[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-12 Thread Blue Swirl
On Mon, Jan 11, 2010 at 10:33 PM, Igor Kovalenko igor.v.kovale...@gmail.com wrote: On Tue, Jan 12, 2010 at 12:29 AM, Blue Swirl blauwir...@gmail.com wrote: On Sun, Jan 10, 2010 at 6:41 PM, Blue Swirl blauwir...@gmail.com wrote: On Sun, Jan 3, 2010 at 7:18 PM, Blue Swirl blauwir...@gmail.com

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-11 Thread Blue Swirl
On Sun, Jan 10, 2010 at 6:41 PM, Blue Swirl blauwir...@gmail.com wrote: On Sun, Jan 3, 2010 at 7:18 PM, Blue Swirl blauwir...@gmail.com wrote: On Sun, Jan 3, 2010 at 6:06 PM, Michael S. Tsirkin m...@redhat.com wrote: On Sun, Jan 03, 2010 at 06:50:15PM +0100, Alexander Graf wrote: On

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-11 Thread Igor Kovalenko
On Tue, Jan 12, 2010 at 12:29 AM, Blue Swirl blauwir...@gmail.com wrote: On Sun, Jan 10, 2010 at 6:41 PM, Blue Swirl blauwir...@gmail.com wrote: On Sun, Jan 3, 2010 at 7:18 PM, Blue Swirl blauwir...@gmail.com wrote: On Sun, Jan 3, 2010 at 6:06 PM, Michael S. Tsirkin m...@redhat.com wrote: On

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-10 Thread Blue Swirl
On Sun, Jan 3, 2010 at 7:18 PM, Blue Swirl blauwir...@gmail.com wrote: On Sun, Jan 3, 2010 at 6:06 PM, Michael S. Tsirkin m...@redhat.com wrote: On Sun, Jan 03, 2010 at 06:50:15PM +0100, Alexander Graf wrote: On 03.01.2010, at 18:44, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Michael S. Tsirkin
On Tue, Jan 05, 2010 at 09:51:48AM +1100, Benjamin Herrenschmidt wrote: On Tue, 2010-01-05 at 00:25 +0200, Michael S. Tsirkin wrote: On Tue, Jan 05, 2010 at 08:53:52AM +1100, Benjamin Herrenschmidt wrote: Yes, but I think how you program your host to pci bridge is platform

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Benjamin Herrenschmidt
On Mon, 2010-01-04 at 13:07 +0200, Michael S. Tsirkin wrote: BTW, I think we really should think about the right way to address the swap/noswap issue without using a preprocessor. Maybe make pci host bridge explicitly specify whether to swap bytes? How about adding a field in PCIHostState to

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Michael S. Tsirkin
On Tue, Jan 05, 2010 at 08:53:52AM +1100, Benjamin Herrenschmidt wrote: Yes, but I think how you program your host to pci bridge is platform specific, the standard (mostly) applies to what happens below the bridge. There's no real standard for how PCI host bridge is connected to

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Benjamin Herrenschmidt
So, it appears that this is not the case for many platforms: bridge itself does a byteswap to make devices behind it work according to spec, but this does not apply to programming bridge itself. This seems common on BE platforms, this is why qemu has ifdef TARGET_WORDS_BIGENDIAN there

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Michael S. Tsirkin
On Tue, Jan 05, 2010 at 08:25:30AM +1100, Benjamin Herrenschmidt wrote: On Mon, 2010-01-04 at 23:12 +0200, Michael S. Tsirkin wrote: Well, the main issue if I understand correcttly is that basically the same hardware bridge can be connected to host in different ways. Yes, we can say if it's

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Alexander Graf
On 04.01.2010, at 23:59, Michael S. Tsirkin wrote: On Tue, Jan 05, 2010 at 09:51:48AM +1100, Benjamin Herrenschmidt wrote: On Tue, 2010-01-05 at 00:25 +0200, Michael S. Tsirkin wrote: On Tue, Jan 05, 2010 at 08:53:52AM +1100, Benjamin Herrenschmidt wrote: Yes, but I think how you program

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Benjamin Herrenschmidt
On Mon, 2010-01-04 at 23:12 +0200, Michael S. Tsirkin wrote: Well, the main issue if I understand correcttly is that basically the same hardware bridge can be connected to host in different ways. Yes, we can say if it's connected differently it's a different device but this is slightly ugly,

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Benjamin Herrenschmidt
On Tue, 2010-01-05 at 00:08 +0100, Alexander Graf wrote: IIRC qemu's mmio functions just pass the register value the guest had at that moment to the mmio function. That means that qemu HW emulation needs, for each device, to add a layer of byteswap depending on whether the CPU is LE or BE

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Benjamin Herrenschmidt
Yes, but I think how you program your host to pci bridge is platform specific, the standard (mostly) applies to what happens below the bridge. There's no real standard for how PCI host bridge is connected to processor AFAIK, it's by luck we can share code there at all. Well, yes and no ...

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Benjamin Herrenschmidt
On Tue, 2010-01-05 at 00:25 +0200, Michael S. Tsirkin wrote: On Tue, Jan 05, 2010 at 08:53:52AM +1100, Benjamin Herrenschmidt wrote: Yes, but I think how you program your host to pci bridge is platform specific, the standard (mostly) applies to what happens below the bridge. There's

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-05 Thread Michael S. Tsirkin
On Tue, Jan 05, 2010 at 07:10:58AM +1100, Benjamin Herrenschmidt wrote: On Mon, 2010-01-04 at 13:07 +0200, Michael S. Tsirkin wrote: BTW, I think we really should think about the right way to address the swap/noswap issue without using a preprocessor. Maybe make pci host bridge explicitly

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-04 Thread Isaku Yamahata
On Mon, Jan 04, 2010 at 04:26:46AM +0100, Alexander Graf wrote: On 03.01.2010, at 21:50, Benjamin Herrenschmidt wrote: On Sun, 2010-01-03 at 21:27 +0100, Alexander Graf wrote: I think if unin_pci is the only user, it'd be better to do it hacky inside unin_pci.c. But if there's a

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-04 Thread Alexander Graf
On 04.01.2010, at 11:45, Isaku Yamahata wrote: On Mon, Jan 04, 2010 at 04:26:46AM +0100, Alexander Graf wrote: On 03.01.2010, at 21:50, Benjamin Herrenschmidt wrote: On Sun, 2010-01-03 at 21:27 +0100, Alexander Graf wrote: I think if unin_pci is the only user, it'd be better to do it

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-04 Thread Isaku Yamahata
On Mon, Jan 04, 2010 at 11:55:10AM +0100, Alexander Graf wrote: On 04.01.2010, at 11:45, Isaku Yamahata wrote: On Mon, Jan 04, 2010 at 04:26:46AM +0100, Alexander Graf wrote: On 03.01.2010, at 21:50, Benjamin Herrenschmidt wrote: On Sun, 2010-01-03 at 21:27 +0100, Alexander Graf

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-04 Thread Michael S. Tsirkin
On Mon, Jan 04, 2010 at 07:45:16PM +0900, Isaku Yamahata wrote: +static PCIDevice *pci_host_dev_find_fn_noswap(PCIHostState *s, uint32_t addr) +{ +return pci_host_find_dev_active(s-bus, pci_host_pci_addr(s, addr)); +} + +static PCIDevice *pci_host_dev_find_fn(PCIHostState *s, uint32_t

Re: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-04 Thread Alexander Graf
On 04.01.2010, at 12:07, Michael S. Tsirkin wrote: On Mon, Jan 04, 2010 at 07:45:16PM +0900, Isaku Yamahata wrote: +static PCIDevice *pci_host_dev_find_fn_noswap(PCIHostState *s, uint32_t addr) +{ +return pci_host_find_dev_active(s-bus, pci_host_pci_addr(s, addr)); +} + +static

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-03 Thread Michael S. Tsirkin
On Sun, Jan 03, 2010 at 02:50:45AM +0100, Alexander Graf wrote: Different host buses may have different layouts for config space accessors. The Mac U3 for example uses the following define to access Type 0 (directly attached) devices: #define MACRISC_CFA0(devfn, off)\

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-03 Thread Alexander Graf
On 03.01.2010, at 16:45, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 02:50:45AM +0100, Alexander Graf wrote: Different host buses may have different layouts for config space accessors. The Mac U3 for example uses the following define to access Type 0 (directly attached) devices:

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-03 Thread Michael S. Tsirkin
On Sun, Jan 03, 2010 at 05:09:32PM +0100, Alexander Graf wrote: On 03.01.2010, at 16:45, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 02:50:45AM +0100, Alexander Graf wrote: Different host buses may have different layouts for config space accessors. The Mac U3 for example uses

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-03 Thread Alexander Graf
On 03.01.2010, at 18:29, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 05:09:32PM +0100, Alexander Graf wrote: On 03.01.2010, at 16:45, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 02:50:45AM +0100, Alexander Graf wrote: Different host buses may have different layouts for config

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-03 Thread Michael S. Tsirkin
On Sun, Jan 03, 2010 at 06:40:52PM +0100, Alexander Graf wrote: On 03.01.2010, at 18:29, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 05:09:32PM +0100, Alexander Graf wrote: On 03.01.2010, at 16:45, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 02:50:45AM +0100, Alexander

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-03 Thread Alexander Graf
On 03.01.2010, at 18:44, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 06:40:52PM +0100, Alexander Graf wrote: On 03.01.2010, at 18:29, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 05:09:32PM +0100, Alexander Graf wrote: On 03.01.2010, at 16:45, Michael S. Tsirkin wrote: On

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-03 Thread Blue Swirl
On Sun, Jan 3, 2010 at 6:06 PM, Michael S. Tsirkin m...@redhat.com wrote: On Sun, Jan 03, 2010 at 06:50:15PM +0100, Alexander Graf wrote: On 03.01.2010, at 18:44, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 06:40:52PM +0100, Alexander Graf wrote: On 03.01.2010, at 18:29, Michael S.

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-03 Thread Alexander Graf
On 03.01.2010, at 19:06, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 06:50:15PM +0100, Alexander Graf wrote: On 03.01.2010, at 18:44, Michael S. Tsirkin wrote: On Sun, Jan 03, 2010 at 06:40:52PM +0100, Alexander Graf wrote: On 03.01.2010, at 18:29, Michael S. Tsirkin wrote: On

[Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable

2010-01-03 Thread Alexander Graf
On 03.01.2010, at 21:50, Benjamin Herrenschmidt wrote: On Sun, 2010-01-03 at 21:27 +0100, Alexander Graf wrote: I think if unin_pci is the only user, it'd be better to do it hacky inside unin_pci.c. But if there's a chance there's another user, it'd be better to make it generic. Since