From dd53579ae82bed0654dd3e4b3052ef2cac58b5f4 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 16 Dec 2013 14:10:20 +0100 Subject: Work around missing sc 1 traps on pHyp When running a pseries guest in PR KVM on top of pHyp, sc 1 instructions are handled directly by pHyp, so we don't get to see them. That means we need to get inventive. Invent a new instruction that behaves like sc 1, but really is a reserved instruction that traps. This instruction can be used by KVM to emulate sc 1 behavior. This patch adds the SLOF support for it. With this, SLOF detects whether it's running on such a broken setup and if so patches itself to execute the fake sc 1 instruction instead of the real one. Furthermore, we also hook into "quiesce" which Linux calls when it boots. This gives us the chance to also patch Linux when it boots up, so it uses the fake sc 1 too. Signed-off-by: Alexander Graf Signed-off-by: Nikunj A Dadhania --- slof/ofw.S | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'slof') diff --git a/slof/ofw.S b/slof/ofw.S index b9f78e4..14e1e9d 100644 --- a/slof/ofw.S +++ b/slof/ofw.S @@ -45,5 +45,15 @@ ld r3, 0(r3) std r3, XVECT_M_HANDLER(0) +#ifdef BROKEN_SC1 + /* Patch potentially broken sc 1 instructions */ + lis r3, _slof_text@h + ori r3, r3, _slof_text@l + lis r4, _slof_text_end@h + ori r4, r4, _slof_text_end@l + li r5, 0 + bl .patch_broken_sc1 +#endif + /* GO! */ ba 0x100 -- cgit v1.1