[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/52] PPC: mac99: Move NVRAM to page boundary when n
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PULL 11/52] PPC: mac99: Move NVRAM to page boundary when necessary |
Date: |
Thu, 4 Sep 2014 19:19:59 +0200 |
When running KVM we have to adhere to host page boundaries for memory slots.
Unfortunately the NVRAM on mac99 is a 4k RAM hole inside of an MMIO flash
area.
So if our host is configured with 64k page size, we can't use the mac99 target
with KVM. This is a real shame, as this limitation is not really an issue - we
can easily map NVRAM somewhere else and at least Linux and Mac OS X use it
at their new location.
So in that emergency case when it's about failing to run at all and moving NVRAM
to a place it shouldn't be at, choose the latter.
This patch enables -M mac99 with KVM on 64k page size hosts.
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/mac_newworld.c | 11 ++++++++++-
include/hw/ppc/ppc.h | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 0693168..26067b4 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -176,6 +176,7 @@ static void ppc_core99_init(MachineState *machine)
SysBusDevice *s;
DeviceState *dev;
int *token = g_new(int, 1);
+ hwaddr nvram_addr = 0xFFF04000;
linux_boot = (kernel_filename != NULL);
@@ -426,11 +427,18 @@ static void ppc_core99_init(MachineState *machine)
}
/* The NewWorld NVRAM is not located in the MacIO device */
+#ifdef CONFIG_KVM
+ if (kvm_enabled() && getpagesize() > 4096) {
+ /* We can't combine read-write and read-only in a single page, so
+ move the NVRAM out of ROM again for KVM */
+ nvram_addr = 0xFFE00000;
+ }
+#endif
dev = qdev_create(NULL, TYPE_MACIO_NVRAM);
qdev_prop_set_uint32(dev, "size", 0x2000);
qdev_prop_set_uint32(dev, "it_shift", 1);
qdev_init_nofail(dev);
- sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xFFF04000);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr);
nvr = MACIO_NVRAM(dev);
pmac_format_nvram_partition(nvr, 0x2000);
/* No PCI init: the BIOS will do it */
@@ -473,6 +481,7 @@ static void ppc_core99_init(MachineState *machine)
/* Mac OS X requires a "known good" clock-frequency value; pass it one. */
fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ);
fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);
+ fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr);
qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
}
diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h
index 7e16e2e..14efd0c 100644
--- a/include/hw/ppc/ppc.h
+++ b/include/hw/ppc/ppc.h
@@ -92,7 +92,7 @@ enum {
#define FW_CFG_PPC_IS_KVM (FW_CFG_ARCH_LOCAL + 0x05)
#define FW_CFG_PPC_KVM_HC (FW_CFG_ARCH_LOCAL + 0x06)
#define FW_CFG_PPC_KVM_PID (FW_CFG_ARCH_LOCAL + 0x07)
-/* OpenBIOS has FW_CFG_PPC_NVRAM_ADDR as +0x08 */
+#define FW_CFG_PPC_NVRAM_ADDR (FW_CFG_ARCH_LOCAL + 0x08)
#define FW_CFG_PPC_BUSFREQ (FW_CFG_ARCH_LOCAL + 0x09)
#define PPC_SERIAL_MM_BAUDBASE 399193
--
1.8.1.4
- [Qemu-devel] [PULL 08/52] linux-user: Handle PPC64 ELFv2 Function Pointers, (continued)
- [Qemu-devel] [PULL 08/52] linux-user: Handle PPC64 ELFv2 Function Pointers, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 15/52] spapr: Refactor spapr_populate_memory() to allow memoryless nodes, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 10/52] spapr: add uuid/host details to device tree, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 01/52] PPC: KVM: Fix g3beige and mac99 when HV is loaded, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 17/52] spapr: Add a helper for node0_size calculation, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 16/52] spapr: Split memory nodes to power-of-two blocks, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 06/52] linux-user: Properly Dereference PPC64 ELFv1 Signal Handler Pointer, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 18/52] spapr: Fix ibm, associativity for memory nodes, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 19/52] loader: Add load_image_size() to replace load_image(), Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 14/52] spapr: Use DT memory node rendering helper for other nodes, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 11/52] PPC: mac99: Move NVRAM to page boundary when necessary,
Alexander Graf <=
- [Qemu-devel] [PULL 21/52] ppc: debug stub: Get trap instruction opcode from KVM, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 23/52] ppc: Add software breakpoint support, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 20/52] spapr: Locate RTAS and device-tree based on real RMA, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 22/52] ppc: synchronize excp_vectors for injecting exception, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 27/52] target-ppc: Bug Fix: rlwnm, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 26/52] target-ppc: Bug Fix: rlwinm, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 24/52] ppc: Add hw breakpoint watchpoint support, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 33/52] target-ppc: Bug Fix: srad, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 25/52] ppc/spapr: Fix MAX_CPUS to 255, Alexander Graf, 2014/09/04
- [Qemu-devel] [PULL 35/52] PPC: KVM: Use vm check_extension for pv hcall, Alexander Graf, 2014/09/04