[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 43/73] pseries: Move /hypervisor node construction to f
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 43/73] pseries: Move /hypervisor node construction to fdt_build_fdt() |
Date: |
Fri, 28 Oct 2016 12:37:44 +1100 |
Currently the /hypervisor device tree node is constructed in
spapr_create_fdt_skel(). As part of consolidating device tree construction
to reset time, move it to a function called from spapr_build_fdt().
Signed-off-by: David Gibson <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Reviewed-by: Michael Roth <address@hidden>
---
hw/ppc/spapr.c | 49 ++++++++++++++++++++++++++++---------------------
1 file changed, 28 insertions(+), 21 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 048fb3d..261be68 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -328,27 +328,6 @@ static void *spapr_create_fdt_skel(sPAPRMachineState
*spapr)
_FDT((fdt_end_node(fdt)));
- /* /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")));
- if (kvmppc_has_cap_fixup_hcalls()) {
- /*
- * Older KVM versions with older guest kernels were broken with the
- * magic page, don't allow the guest to map it.
- */
- if (!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)));
@@ -916,6 +895,29 @@ static void spapr_dt_chosen(sPAPRMachineState *spapr, void
*fdt)
g_free(bootlist);
}
+static void spapr_dt_hypervisor(sPAPRMachineState *spapr, void *fdt)
+{
+ /* The /hypervisor node isn't in PAPR - this is a hack to allow PR
+ * KVM to work under pHyp with some guest co-operation */
+ int hypervisor;
+ uint8_t hypercall[16];
+
+ _FDT(hypervisor = fdt_add_subnode(fdt, 0, "hypervisor"));
+ /* indicate KVM hypercall interface */
+ _FDT(fdt_setprop_string(fdt, hypervisor, "compatible", "linux,kvm"));
+ if (kvmppc_has_cap_fixup_hcalls()) {
+ /*
+ * Older KVM versions with older guest kernels were broken
+ * with the magic page, don't allow the guest to map it.
+ */
+ if (!kvmppc_get_hypercall(first_cpu->env_ptr, hypercall,
+ sizeof(hypercall))) {
+ _FDT(fdt_setprop(fdt, hypervisor, "hcall-instructions",
+ hypercall, sizeof(hypercall)));
+ }
+ }
+}
+
static void *spapr_build_fdt(sPAPRMachineState *spapr,
hwaddr rtas_addr,
hwaddr rtas_size)
@@ -989,6 +991,11 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
/* /chosen */
spapr_dt_chosen(spapr, fdt);
+ /* /hypervisor */
+ if (kvm_enabled()) {
+ spapr_dt_hypervisor(spapr, fdt);
+ }
+
/* Build memory reserve map */
if (spapr->kernel_size) {
_FDT((fdt_add_mem_rsv(fdt, KERNEL_LOAD_ADDR, spapr->kernel_size)));
--
2.7.4
- [Qemu-ppc] [PULL 35/73] pseries: Remove rtas_addr and fdt_addr fields from machinestate, (continued)
- [Qemu-ppc] [PULL 35/73] pseries: Remove rtas_addr and fdt_addr fields from machinestate, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 42/73] pseries: Move /event-sources construction to spapr_build_fdt(), David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 36/73] pseries: Make spapr_create_fdt_skel() get information from machine state, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 45/73] pseries: Remove spapr_create_fdt_skel(), David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 29/73] ppc/pnv: add XSCOM infrastructure, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 32/73] ppc/pnv: add a ISA bus, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 30/73] ppc/pnv: add XSCOM handlers to PnvCore, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 31/73] ppc/pnv: add a LPC controller, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 39/73] pseries: Move construction of /interrupt-controller fdt node, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 37/73] pseries: Move adding of fdt reserve map entries, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 43/73] pseries: Move /hypervisor node construction to fdt_build_fdt(),
David Gibson <=
- [Qemu-ppc] [PULL 33/73] target-ppc: add vmul10[u, eu, cu, ecu]q instructions, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 65/73] target-ppc: add xscmp[eq, gt, ge, ne]dp instructions, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 55/73] tests: Adjust tco-test to use qpci_legacy_iomap(), David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 71/73] spapr: use count+index for memory hotplug, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 58/73] tests: Clean up IO handling in ide-test, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 64/73] tests: Add pseries machine to the prom-env-test, too, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 66/73] target-ppc: Add xvcmpnesp, xvcmpnedp instructions, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 52/73] libqos: Handle PCI IO de-multiplexing in common code, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 56/73] libqos: Add streaming accessors for PCI MMIO, David Gibson, 2016/10/27
- [Qemu-ppc] [PULL 69/73] spapr: add hotplug interrupt machine options, David Gibson, 2016/10/27