From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGZlv-0002jH-6A for qemu-devel@nongnu.org; Thu, 20 Feb 2014 14:59:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGZlp-0007gz-5Q for qemu-devel@nongnu.org; Thu, 20 Feb 2014 14:59:03 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:33378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGZlo-0007gh-V1 for qemu-devel@nongnu.org; Thu, 20 Feb 2014 14:58:57 -0500 Received: by mail-lb0-f180.google.com with SMTP id n15so1687873lbi.11 for ; Thu, 20 Feb 2014 11:58:55 -0800 (PST) MIME-Version: 1.0 From: Peter Maydell Date: Thu, 20 Feb 2014 19:58:35 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] spapr_pci.c:spapr_pci_msi_init() creates memory region whose size is host-dependent List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers Cc: "qemu-ppc@nongnu.org" , Alexander Graf spapr_pci_msi_init() does this: memory_region_init_io(&spapr->msiwindow, NULL, &spapr_msi_ops, spapr, "msi", getpagesize()); That means this device's memory region size will depend on the host OS CPU and configuration, which seems like a bad idea, especially if this machine is supposed to work with TCG. It also means that on Win32 the compiler complains: CC ppc64-softmmu/hw/ppc/spapr_pci.o cc1: warnings being treated as errors /home/petmay01/linaro/qemu-from-laptop/qemu/hw/ppc/spapr_pci.c: In function =E2=80=98spapr_pci_msi_init=E2=80=99: /home/petmay01/linaro/qemu-from-laptop/qemu/hw/ppc/spapr_pci.c:482: warning: implicit declaration of function =E2=80=98getpagesize=E2=80=99 /home/petmay01/linaro/qemu-from-laptop/qemu/hw/ppc/spapr_pci.c:482: warning: nested extern declaration of =E2=80=98getpagesize=E2=80=99 since getpagesize() doesn't exist there. Not sure which of the following is best: * use a fixed size for the memory region (eg "worst case page size for target CPU") * query the target CPU for its page size rather than the host OS/CPU * guard with suitable ifdefs if this code can't actually be used except with KVM * abstract out the "how do I find my page size on $OS?" check to an os-*.c file * something else Any suggestions? It would be nice to fix this because I think this is the last Win32 compiler warning. thanks -- PMM