[PATCH 3/8] ppc/spapr: Remove copy-paste from pa-features under TCG

Nicholas Piggin posted 8 patches 9 months, 4 weeks ago
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Nicholas Piggin <npiggin@gmail.com>, "Frédéric Barrat" <fbarrat@linux.ibm.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Harsh Prateek Bora <harshpb@linux.ibm.com>
[PATCH 3/8] ppc/spapr: Remove copy-paste from pa-features under TCG
Posted by Nicholas Piggin 9 months, 4 weeks ago
TCG does not support copy/paste instructions. Remove it from
ibm,pa-features when running TCG. Similarly to SAO, there is a
migration issue here, but this doesn't really make things worse,
a cap would be required to fix it.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 hw/ppc/spapr.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 1c79d5670d..ce969be770 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -299,6 +299,18 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,
         pa_features[4 + 2] &= ~0x80;
     }
 
+    if (tcg_enabled()) {
+        /*
+         * TCG does not implement copy/paste instructions. This causes a
+         * migration issue similarly to SAO, but there is no avoiding that
+         * since there is no KVM cap or way to disable the instructions in
+         * hardware. It's also quite an obscure instruction and is not really
+         * used in KVM guests since KVM does not support accelerator pass-
+         * through anyway.
+         */
+        pa_features[38 + 2] &= ~0x80;
+    }
+
     if (ppc_hash64_has(cpu, PPC_HASH64_CI_LARGEPAGE)) {
         /*
          * Note: we keep CI large pages off by default because a 64K capable
-- 
2.42.0