File 0096-KVM-PPC-Expose-fixup-hcall-capabili.patch of Package qemu.4227

From 3e91a693a2c91a8eef54c67bdff1c98c920e698c Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 4 Jun 2014 12:14:08 +0200
Subject: [PATCH] KVM: PPC: Expose fixup hcall capability

New kvm versions expose a PPC_FIXUP_HCALL capability. Make it visible to
machine code so we can take decisions based on it.

Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit 87a91de61a34a7f3222203556df8a67f187360cd)
---
 target-ppc/kvm.c     | 7 +++++++
 target-ppc/kvm_ppc.h | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index cf2a69811d..f7528bd332 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -68,6 +68,7 @@ static int cap_epr;
 static int cap_ppc_watchdog;
 static int cap_papr;
 static int cap_htab_fd;
+static int cap_fixup_hcalls;
 
 /* XXX We have a race condition where we actually have a level triggered
  *     interrupt, but the infrastructure can't expose that yet, so the guest
@@ -105,6 +106,7 @@ int kvm_arch_init(KVMState *s)
     /* Note: we don't set cap_papr here, because this capability is
      * only activated after this by kvmppc_set_papr() */
     cap_htab_fd = kvm_check_extension(s, KVM_CAP_PPC_HTAB_FD);
+    cap_fixup_hcalls = kvm_check_extension(s, KVM_CAP_PPC_FIXUP_HCALL);
 
     if (!cap_interrupt_level) {
         fprintf(stderr, "KVM: Couldn't find level irq capability. Expect the "
@@ -1788,6 +1790,11 @@ bool kvmppc_has_cap_htab_fd(void)
     return cap_htab_fd;
 }
 
+bool kvmppc_has_cap_fixup_hcalls(void)
+{
+    return cap_fixup_hcalls;
+}
+
 static PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc)
 {
     ObjectClass *oc = OBJECT_CLASS(pcc);
diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h
index 716c33dfee..88b577d7c3 100644
--- a/target-ppc/kvm_ppc.h
+++ b/target-ppc/kvm_ppc.h
@@ -49,6 +49,7 @@ void kvmppc_hash64_free_pteg(uint64_t token);
 
 void kvmppc_hash64_write_pte(CPUPPCState *env, target_ulong pte_index,
                              target_ulong pte0, target_ulong pte1);
+bool kvmppc_has_cap_fixup_hcalls(void);
 
 #else
 
@@ -217,6 +218,11 @@ static inline void kvmppc_hash64_write_pte(CPUPPCState *env,
     abort();
 }
 
+static inline bool kvmppc_has_cap_fixup_hcalls(void)
+{
+    abort();
+}
+
 #endif
 
 #ifndef CONFIG_KVM
openSUSE Build Service is sponsored by