From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N5hxp-0007uN-8q for qemu-devel@nongnu.org; Wed, 04 Nov 2009 10:40:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N5hxj-0007tF-4l for qemu-devel@nongnu.org; Wed, 04 Nov 2009 10:40:00 -0500 Received: from [199.232.76.173] (port=57730 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N5hxj-0007tC-0z for qemu-devel@nongnu.org; Wed, 04 Nov 2009 10:39:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28181) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N5hxi-0003vt-IL for qemu-devel@nongnu.org; Wed, 04 Nov 2009 10:39:54 -0500 Date: Wed, 4 Nov 2009 17:37:13 +0200 From: "Michael S. Tsirkin" Message-ID: <20091104153713.GA32205@redhat.com> References: <1256905286-25435-1-git-send-email-yamahata@valinux.co.jp> <1256905286-25435-14-git-send-email-yamahata@valinux.co.jp> <20091103134512.GF4961@redhat.com> <20091104061426.GG28390%yamahata@valinux.co.jp> <20091104151746.GV26129@hall.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091104151746.GV26129@hall.aurel32.net> Subject: [Qemu-devel] Re: [PATCH V6 13/32] pci_host: consolidate pci config address access. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: Isaku Yamahata , yu.liu@freescale.com, qemu-devel@nongnu.org, alex@csgraf.de On Wed, Nov 04, 2009 at 04:17:46PM +0100, Aurelien Jarno wrote: > On Wed, Nov 04, 2009 at 03:14:26PM +0900, Isaku Yamahata wrote: > > On Tue, Nov 03, 2009 at 03:45:12PM +0200, Michael S. Tsirkin wrote: > > > > --- a/hw/pci_host.c > > > > +++ b/hw/pci_host.c > > > > @@ -32,6 +32,114 @@ do { printf("pci_host_data: " fmt , ## __VA_ARGS__); } while (0) > > > > #define PCI_DPRINTF(fmt, ...) > > > > #endif > > > > > > > > +static void pci_host_config_writel(void *opaque, target_phys_addr_t addr, > > > > + uint32_t val) > > > > +{ > > > > + PCIHostState *s = opaque; > > > > + > > > > +#ifdef TARGET_WORDS_BIGENDIAN > > > > + val = bswap32(val); > > > > +#endif > > > > > > I know you just copied it, but isn't this just > > > val = le32_to_cpu(val); > > > > > > ? > > > > Makes sense. > > The original code is actually wrong, but le32_to_cpu(val), will break on > big endian hosts. > > The fact is that QEMU doesn't emulate byteswap on buses. Hopefully on all > big endian machines we emulate, the PCI bus is always connected backward, > so we can simply do the byteswap depending on TARGET_WORDS_BIGENDIAN. > > -- > Aurelien Jarno GPG: 1024D/F1BCDB73 > aurelien@aurel32.net http://www.aurel32.net Are you speaking about bit endian hosts with little endian guests? Ugh ... my head hurts. bswap32 is evil because there's no way to figure out what is converted to what. big to little? guest to host? -- MST