Received: from eggs.gnu.org ([2001:4830:134:3::10]:34938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGmcL-0007dQ-1k for qemu-devel@nongnu.org; Fri, 21 Feb 2014 04:42:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGmcF-000276-2H for qemu-devel@nongnu.org; Fri, 21 Feb 2014 04:42:00 -0500 From: Alexander Graf Date: Fri, 21 Feb 2014 10:41:51 +0100 Message-Id: <1392975711-28286-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH] PPC: sPAPR: Only use getpagesize() when we run with kvm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , Peter Maydell , qemu-ppc@nongnu.org We currently size the msi window trap page according to the host's page size so that we poke a working hole into a memory slot in case we overlap. However, this is only ever necessary with KVM active. Without KVM, we should rather try to be host platform agnostic and use a constant size: 4k. This fixes a build breakage on win32 hosts. Signed-off-by: Alexander Graf --- hw/ppc/spapr_pci.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 66ddf10..a3af75c 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -469,6 +469,8 @@ static const MemoryRegionOps spapr_msi_ops = { void spapr_pci_msi_init(sPAPREnvironment *spapr, hwaddr addr) { + uint64_t window_size = 4096; + /* * As MSI/MSIX interrupts trigger by writing at MSI/MSIX vectors, * we need to allocate some memory to catch those writes coming @@ -476,10 +478,17 @@ void spapr_pci_msi_init(sPAPREnvironment *spapr, hwaddr addr) * As MSIMessage:addr is going to be the same and MSIMessage:data * is going to be a VIRQ number, 4 bytes of the MSI MR will only * be used. + * + * For KVM we want to ensure that this memory is a full page so that + * our memory slot is of page size granularity. */ + if (kvm_enabled()) { + window_size = getpagesize(); + } + spapr->msi_win_addr = addr; memory_region_init_io(&spapr->msiwindow, NULL, &spapr_msi_ops, spapr, - "msi", getpagesize()); + "msi", window_size); memory_region_add_subregion(get_system_memory(), spapr->msi_win_addr, &spapr->msiwindow); } -- 1.8.1.4