[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 26/39] pseries: Allow TCG h_enter to work with hotplugg
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 26/39] pseries: Allow TCG h_enter to work with hotplugged memory |
Date: |
Fri, 29 Jan 2016 16:06:58 +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 03/39] macio: use the existing IDEDMA aiocb to hold the active DMA aiocb, (continued)
- [Qemu-ppc] [PULL 03/39] macio: use the existing IDEDMA aiocb to hold the active DMA aiocb, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 06/39] cuda: add missing fields to VMStateDescription, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 01/39] target-ppc: Use sensible POWER8/POWER8E versions, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 15/39] pseries: Clean up error handling in spapr_rtas_register(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 09/39] spapr: Remove abuse of rtas_ld() in h_client_architecture_support, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 11/39] ppc: Clean up error handling in ppc_set_compat(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 14/39] pseries: Clean up error handling in spapr_vga_init(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 27/39] cuda.c: return error for unknown commands, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 22/39] target-ppc: gdbstub: introduce avr_need_swap(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 13/39] pseries: Clean up error handling in spapr_validate_node_memory(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 26/39] pseries: Allow TCG h_enter to work with hotplugged memory,
David Gibson <=
- [Qemu-ppc] [PULL 23/39] target-ppc: gdbstub: fix altivec registers for little-endian guests, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 37/39] target-ppc: Helper to determine page size information from hpte alone, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 33/39] target-ppc: Use actual page size encodings from HPTE, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 25/39] target-ppc: gdbstub: Add VSX support, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 21/39] target-ppc: gdbstub: fix float registers for little-endian guests, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 28/39] uninorth.c: add support for UniNorth kMacRISCPCIAddressSelect (0x48) register, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 20/39] target-ppc: rename and export maybe_bswap_register(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 34/39] target-ppc: Remove unused mmu models from ppc_tlb_invalidate_one, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 32/39] target-ppc: Rework SLB page size lookup, David Gibson, 2016/01/29