diff mbox

PPC: spapr: Expose /hypervisor node in device tree

Message ID 1398344659-4545-1-git-send-email-agraf@suse.de
State New
Headers show

Commit Message

Alexander Graf April 24, 2014, 1:04 p.m. UTC
PR KVM supports an ePAPR compliant hypercall interface in parallel to the
normal sPAPR one. Expose the ePAPR /hypervisor node and properties to the
guest so it can use it.

This enables magic page sharing on PR KVM with -M pseries.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/ppc/spapr.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff mbox

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index a11e121..93d1fac 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -521,6 +521,19 @@  static void *spapr_create_fdt_skel(hwaddr initrd_base,
     /* event-sources */
     spapr_events_fdt_skel(fdt, epow_irq);
 
+    /* /hypervisor node */
+    if (kvm_enabled()) {
+        uint8_t hypercall[16];
+
+        /* indicate KVM hypercall interface */
+        _FDT((fdt_begin_node(fdt, "hypervisor")));
+        _FDT((fdt_property_string(fdt, "compatible", "linux,kvm")));
+        kvmppc_get_hypercall(first_cpu->env_ptr, hypercall, sizeof(hypercall));
+        _FDT((fdt_property(fdt, "hcall-instructions", hypercall,
+                          sizeof(hypercall))));
+        _FDT((fdt_end_node(fdt)));
+    }
+
     _FDT((fdt_end_node(fdt))); /* close root node */
     _FDT((fdt_finish(fdt)));