From bc9ca5958d084222cdb233619dfc5046c81fb76d Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Fri, 10 Jun 2016 19:26:37 +0100 Subject: macio: call dma_memory_unmap() at the end of each DMA transfer This ensures that the underlying memory is marked dirty once the transfer is complete and resolves cache coherency problems under MacOS 9. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- include/hw/ppc/mac_dbdma.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/hw') diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index 0cce4e8..d15a6cc 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -24,6 +24,7 @@ #include "exec/memory.h" #include "qemu/iov.h" +#include "sysemu/dma.h" typedef struct DBDMA_io DBDMA_io; @@ -44,6 +45,10 @@ struct DBDMA_io { uint8_t head_remainder[0x200]; uint8_t tail_remainder[0x200]; QEMUIOVector iov; + /* DMA request */ + void *dma_mem; + dma_addr_t dma_len; + DMADirection dir; }; /* -- cgit v1.1 From d0e5a8f2937de66778d94c20a8fc5cf43501fa04 Mon Sep 17 00:00:00 2001 From: Bharata B Rao Date: Fri, 10 Jun 2016 10:44:48 +0530 Subject: spapr: Ensure all LMBs are represented in ibm,dynamic-memory Memory hotplug can fail for some combinations of RAM and maxmem when DDW is enabled in the presence of devices like nec-usb-xhci. DDW depends on maximum addressable memory returned by guest and this value is currently being calculated wrongly by the guest kernel routine memory_hotplug_max(). While there is an attempt to fix the guest kernel, this patch works around the problem within QEMU itself. memory_hotplug_max() routine in the guest kernel arrives at max addressable memory by multiplying lmb-size with the lmb-count obtained from ibm,dynamic-memory property. There are two assumptions here: - All LMBs are part of ibm,dynamic memory: This is not true for PowerKVM where only hot-pluggable LMBs are present in this property. - The memory area comprising of RAM and hotplug region is contiguous: This needn't be true always for PowerKVM as there can be gap between boot time RAM and hotplug region. To work around this guest kernel bug, ensure that ibm,dynamic-memory has information about all the LMBs (RMA, boot-time LMBs, future hotpluggable LMBs, and dummy LMBs to cover the gap between RAM and hotpluggable region). RMA is represented separately by memory@0 node. Hence mark RMA LMBs and also the LMBs for the gap b/n RAM and hotpluggable region as reserved and as having no valid DRC so that these LMBs are not considered by the guest. Signed-off-by: Bharata B Rao Reviewed-by: Michael Roth Reviewed-by: Nathan Fontenot Signed-off-by: David Gibson --- include/hw/ppc/spapr.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/hw') diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 971df3d..3ac85c0 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -620,9 +620,11 @@ int spapr_rng_populate_dt(void *fdt); #define SPAPR_DR_LMB_LIST_ENTRY_SIZE 6 /* - * This flag value defines the LMB as assigned in ibm,dynamic-memory - * property under ibm,dynamic-reconfiguration-memory node. + * Defines for flag value in ibm,dynamic-memory property under + * ibm,dynamic-reconfiguration-memory node. */ #define SPAPR_LMB_FLAGS_ASSIGNED 0x00000008 +#define SPAPR_LMB_FLAGS_DRC_INVALID 0x00000020 +#define SPAPR_LMB_FLAGS_RESERVED 0x00000080 #endif /* !defined (__HW_SPAPR_H__) */ -- cgit v1.1