[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 26/28] pseries: Allow TCG h_enter to work with hotplugg
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 26/28] pseries: Allow TCG h_enter to work with hotplugged memory |
Date: |
Mon, 25 Jan 2016 12:15:25 +1100 |
The implementation of the H_ENTER hypercall for PAPR guests needs to
enforce correct access attributes on the inserted HPTE. This means
determining if the HPTE's real address is a regular RAM address (which
requires attributes for coherent access) or an IO address (which requires
attributes for cache-inhibited access).
At the moment this check is implemented with (raddr < machine->ram_size),
but that only handles addresses in the base RAM area, not any hotplugged
RAM.
This patch corrects the problem with a new helper.
Signed-off-by: David Gibson <address@hidden>
Reviewed-by: Alexey Kardashevskiy <address@hidden>
---
hw/ppc/spapr_hcall.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index e9c057d..c4ae255 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -84,10 +84,25 @@ static inline bool valid_pte_index(CPUPPCState *env,
target_ulong pte_index)
return true;
}
+static bool is_ram_address(sPAPRMachineState *spapr, hwaddr addr)
+{
+ MachineState *machine = MACHINE(spapr);
+ MemoryHotplugState *hpms = &spapr->hotplug_memory;
+
+ if (addr < machine->ram_size) {
+ return true;
+ }
+ if ((addr >= hpms->base)
+ && ((addr - hpms->base) < memory_region_size(&hpms->mr))) {
+ return true;
+ }
+
+ return false;
+}
+
static target_ulong h_enter(PowerPCCPU *cpu, sPAPRMachineState *spapr,
target_ulong opcode, target_ulong *args)
{
- MachineState *machine = MACHINE(spapr);
CPUPPCState *env = &cpu->env;
target_ulong flags = args[0];
target_ulong pte_index = args[1];
@@ -119,7 +134,7 @@ static target_ulong h_enter(PowerPCCPU *cpu,
sPAPRMachineState *spapr,
raddr = (ptel & HPTE64_R_RPN) & ~((1ULL << page_shift) - 1);
- if (raddr < machine->ram_size) {
+ if (is_ram_address(spapr, raddr)) {
/* Regular RAM - should have WIMG=0010 */
if ((ptel & HPTE64_R_WIMG) != HPTE64_R_M) {
return H_PARAMETER;
--
2.5.0
- [Qemu-ppc] [PULL 00/28] ppc-for-2.6 queue 20160125, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 04/28] macio: add dma_active to VMStateDescription, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 05/28] mac_dbdma: add DBDMA controller state to VMStateDescription, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 15/28] pseries: Clean up error handling in spapr_rtas_register(), David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 21/28] target-ppc: gdbstub: fix float registers for little-endian guests, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 17/28] pseries: Clean up error reporting in ppc_spapr_init(), David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 26/28] pseries: Allow TCG h_enter to work with hotplugged memory,
David Gibson <=
- [Qemu-ppc] [PULL 03/28] macio: use the existing IDEDMA aiocb to hold the active DMA aiocb, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 01/28] target-ppc: Use sensible POWER8/POWER8E versions, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 09/28] spapr: Remove abuse of rtas_ld() in h_client_architecture_support, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 02/28] target-ppc: use cpu_write_xer() helper in cpu_post_load, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 10/28] spapr: Don't create ibm, dynamic-reconfiguration-memory w/o DR LMBs, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 16/28] pseries: Clean up error handling in xics_system_init(), David Gibson, 2016/01/24