Sander Eikelenboom
2012-Dec-06 21:32 UTC
[xen-unstable] [qemu-xen] pci passthrough msi-x returns same pirq
Hi Stefano / Anthony, With the debug output turned on i see some difference between qemu-traditional and qemu-upstream: With the pci passthroughed device that fails with msi-x, in qemu-xen it seems to get the same pirq back for every entry in qemu-traditional: pt_msix_update_one: pt_msix_update_one requested pirq = 87 pt_msix_update_one: Update msix entry 0 with pirq 57 gvec 0 pt_msix_update_one: pt_msix_update_one requested pirq = 86 pt_msix_update_one: Update msix entry 1 with pirq 56 gvec 0 pt_msix_update_one: pt_msix_update_one requested pirq = 85 pt_msix_update_one: Update msix entry 2 with pirq 55 gvec 0 pt_msix_update_one: pt_msix_update_one requested pirq = 84 pt_msix_update_one: Update msix entry 3 with pirq 54 gvec 0 in qemu-xen (upstream): [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0) [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3057 (entry: 0) [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x1) [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3056 (entry: 0x1) [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x2) [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3055 (entry: 0x2) [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x3) [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3054 (entry: 0x3) -- Sander
Stefano Stabellini
2012-Dec-07 17:24 UTC
Re: [xen-unstable] [qemu-xen] pci passthrough msi-x returns same pirq
On Thu, 6 Dec 2012, Sander Eikelenboom wrote:> Hi Stefano / Anthony, > > With the debug output turned on i see some difference between qemu-traditional and qemu-upstream: > > With the pci passthroughed device that fails with msi-x, in qemu-xen it seems to get the same pirq back for every entry > > in qemu-traditional: > > pt_msix_update_one: pt_msix_update_one requested pirq = 87 > pt_msix_update_one: Update msix entry 0 with pirq 57 gvec 0 > pt_msix_update_one: pt_msix_update_one requested pirq = 86 > pt_msix_update_one: Update msix entry 1 with pirq 56 gvec 0 > pt_msix_update_one: pt_msix_update_one requested pirq = 85 > pt_msix_update_one: Update msix entry 2 with pirq 55 gvec 0 > pt_msix_update_one: pt_msix_update_one requested pirq = 84 > pt_msix_update_one: Update msix entry 3 with pirq 54 gvec 0 > > > in qemu-xen (upstream): > > [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0) > [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3057 (entry: 0) > [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x1) > [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3056 (entry: 0x1) > [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x2) > [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3055 (entry: 0x2) > [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x3) > [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3054 (entry: 0x3)That is a good pointer, but unfortunately the code that parses those entries look exactly alike in both QEMU trees: qemu-xen-traditional/hw/pt-msi.c:pt_msix_update_one if (!gvec) { /* if gvec is 0, the guest is asking for a particular pirq that * is passed as dest_id */ pirq = ((gaddr >> 32) & 0xffffff00) | (((gaddr & 0xffffffff) >> MSI_TARGET_CPU_SHIFT) & 0xff); qemu-xen/hw/xen_pt_msi.c:msi_msix_setup if (gvec == 0) { /* if gvec is 0, the guest is asking for a particular pirq that * is passed as dest_id */ *ppirq = msi_ext_dest_id(addr >> 32) | msi_dest_id(addr); given how msi_ext_dest_id and msi_dest_id are defined, they should behave the same way. Maybe adding a printk in msi_msix_setup to show addr would help nonetheless...
Sander Eikelenboom
2012-Dec-07 20:51 UTC
Re: [xen-unstable] [qemu-xen] pci passthrough msi-x returns same pirq
Friday, December 7, 2012, 6:24:10 PM, you wrote:> On Thu, 6 Dec 2012, Sander Eikelenboom wrote: >> Hi Stefano / Anthony, >> >> With the debug output turned on i see some difference between qemu-traditional and qemu-upstream: >> >> With the pci passthroughed device that fails with msi-x, in qemu-xen it seems to get the same pirq back for every entry >> >> in qemu-traditional: >> >> pt_msix_update_one: pt_msix_update_one requested pirq = 87 >> pt_msix_update_one: Update msix entry 0 with pirq 57 gvec 0 >> pt_msix_update_one: pt_msix_update_one requested pirq = 86 >> pt_msix_update_one: Update msix entry 1 with pirq 56 gvec 0 >> pt_msix_update_one: pt_msix_update_one requested pirq = 85 >> pt_msix_update_one: Update msix entry 2 with pirq 55 gvec 0 >> pt_msix_update_one: pt_msix_update_one requested pirq = 84 >> pt_msix_update_one: Update msix entry 3 with pirq 54 gvec 0 >> >> >> in qemu-xen (upstream): >> >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0) >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3057 (entry: 0) >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x1) >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3056 (entry: 0x1) >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x2) >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3055 (entry: 0x2) >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x3) >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3054 (entry: 0x3)> That is a good pointer, but unfortunately the code that parses those > entries look exactly alike in both QEMU trees:> qemu-xen-traditional/hw/pt-msi.c:pt_msix_update_one> if (!gvec) { > /* if gvec is 0, the guest is asking for a particular pirq that > * is passed as dest_id */ > pirq = ((gaddr >> 32) & 0xffffff00) | > (((gaddr & 0xffffffff) >> MSI_TARGET_CPU_SHIFT) & 0xff);> qemu-xen/hw/xen_pt_msi.c:msi_msix_setup> if (gvec == 0) { > /* if gvec is 0, the guest is asking for a particular pirq that > * is passed as dest_id */ > *ppirq = msi_ext_dest_id(addr >> 32) | msi_dest_id(addr);> given how msi_ext_dest_id and msi_dest_id are defined, they should > behave the same way.> Maybe adding a printk in msi_msix_setup to show addr would help > nonetheless...Hi Stefano, I have added some printk''s attached i have: - qemu-upstream.log boot of the guest with qemu upstream, device not working - qemu-traditional.log boot of the same guest with qemu traditional, device is working - xl-dmesg-upstream.txt part of xl-dmesg related to boot of guest with qemu-upstream - xl-dmesg-traditional.txt part of xl-dmesg related to boot of sameguest with qemu-traditional - xl-dmesg.txt complete xl-dmesg - interrupts-dom0.txt /proc/interrupts of dom0 - interrupts-upstream.txt /proc/interrupts of guest with qemu-upstream -- Sander _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Stefano Stabellini
2012-Dec-10 15:48 UTC
Re: [xen-unstable] [qemu-xen] pci passthrough msi-x returns same pirq
On Fri, 7 Dec 2012, Sander Eikelenboom wrote:> Friday, December 7, 2012, 6:24:10 PM, you wrote: > > > On Thu, 6 Dec 2012, Sander Eikelenboom wrote: > >> Hi Stefano / Anthony, > >> > >> With the debug output turned on i see some difference between qemu-traditional and qemu-upstream: > >> > >> With the pci passthroughed device that fails with msi-x, in qemu-xen it seems to get the same pirq back for every entry > >> > >> in qemu-traditional: > >> > >> pt_msix_update_one: pt_msix_update_one requested pirq = 87 > >> pt_msix_update_one: Update msix entry 0 with pirq 57 gvec 0 > >> pt_msix_update_one: pt_msix_update_one requested pirq = 86 > >> pt_msix_update_one: Update msix entry 1 with pirq 56 gvec 0 > >> pt_msix_update_one: pt_msix_update_one requested pirq = 85 > >> pt_msix_update_one: Update msix entry 2 with pirq 55 gvec 0 > >> pt_msix_update_one: pt_msix_update_one requested pirq = 84 > >> pt_msix_update_one: Update msix entry 3 with pirq 54 gvec 0 > >> > >> > >> in qemu-xen (upstream): > >> > >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0) > >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3057 (entry: 0) > >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x1) > >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3056 (entry: 0x1) > >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x2) > >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3055 (entry: 0x2) > >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x3) > >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3054 (entry: 0x3) > > > That is a good pointer, but unfortunately the code that parses those > > entries look exactly alike in both QEMU trees: > > > qemu-xen-traditional/hw/pt-msi.c:pt_msix_update_one > > > if (!gvec) { > > /* if gvec is 0, the guest is asking for a particular pirq that > > * is passed as dest_id */ > > pirq = ((gaddr >> 32) & 0xffffff00) | > > (((gaddr & 0xffffffff) >> MSI_TARGET_CPU_SHIFT) & 0xff); > > > > > qemu-xen/hw/xen_pt_msi.c:msi_msix_setup > > > if (gvec == 0) { > > /* if gvec is 0, the guest is asking for a particular pirq that > > * is passed as dest_id */ > > *ppirq = msi_ext_dest_id(addr >> 32) | msi_dest_id(addr); > > > given how msi_ext_dest_id and msi_dest_id are defined, they should > > behave the same way. > > > Maybe adding a printk in msi_msix_setup to show addr would help > > nonetheless... > > Hi Stefano, > > I have added some printk''s attached i have: > > - qemu-upstream.log boot of the guest with qemu upstream, device not working > - qemu-traditional.log boot of the same guest with qemu traditional, device is working > > - xl-dmesg-upstream.txt part of xl-dmesg related to boot of guest with qemu-upstream > - xl-dmesg-traditional.txt part of xl-dmesg related to boot of sameguest with qemu-traditional > - xl-dmesg.txt complete xl-dmesg > > - interrupts-dom0.txt /proc/interrupts of dom0 > - interrupts-upstream.txt /proc/interrupts of guest with qemu-upstreamThank you very much! Could it be that the error is just due to a typo? --- diff --git a/hw/xen_pt_msi.c b/hw/xen_pt_msi.c index 6807672..db757cd 100644 --- a/hw/xen_pt_msi.c +++ b/hw/xen_pt_msi.c @@ -321,7 +321,7 @@ static int xen_pt_msix_update_one(XenPCIPassthroughState *s, int entry_nr) pirq = entry->pirq; - rc = msi_msix_setup(s, entry->data, entry->data, &pirq, true, entry_nr, + rc = msi_msix_setup(s, entry->addr, entry->data, &pirq, true, entry_nr, entry->pirq == XEN_PT_UNASSIGNED_PIRQ); if (rc) { return rc;
Sander Eikelenboom
2012-Dec-10 15:53 UTC
Re: [xen-unstable] [qemu-xen] pci passthrough msi-x returns same pirq
Monday, December 10, 2012, 4:48:32 PM, you wrote:> On Fri, 7 Dec 2012, Sander Eikelenboom wrote: >> Friday, December 7, 2012, 6:24:10 PM, you wrote: >> >> > On Thu, 6 Dec 2012, Sander Eikelenboom wrote: >> >> Hi Stefano / Anthony, >> >> >> >> With the debug output turned on i see some difference between qemu-traditional and qemu-upstream: >> >> >> >> With the pci passthroughed device that fails with msi-x, in qemu-xen it seems to get the same pirq back for every entry >> >> >> >> in qemu-traditional: >> >> >> >> pt_msix_update_one: pt_msix_update_one requested pirq = 87 >> >> pt_msix_update_one: Update msix entry 0 with pirq 57 gvec 0 >> >> pt_msix_update_one: pt_msix_update_one requested pirq = 86 >> >> pt_msix_update_one: Update msix entry 1 with pirq 56 gvec 0 >> >> pt_msix_update_one: pt_msix_update_one requested pirq = 85 >> >> pt_msix_update_one: Update msix entry 2 with pirq 55 gvec 0 >> >> pt_msix_update_one: pt_msix_update_one requested pirq = 84 >> >> pt_msix_update_one: Update msix entry 3 with pirq 54 gvec 0 >> >> >> >> >> >> in qemu-xen (upstream): >> >> >> >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0) >> >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3057 (entry: 0) >> >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x1) >> >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3056 (entry: 0x1) >> >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x2) >> >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3055 (entry: 0x2) >> >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x3) >> >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3054 (entry: 0x3) >> >> > That is a good pointer, but unfortunately the code that parses those >> > entries look exactly alike in both QEMU trees: >> >> > qemu-xen-traditional/hw/pt-msi.c:pt_msix_update_one >> >> > if (!gvec) { >> > /* if gvec is 0, the guest is asking for a particular pirq that >> > * is passed as dest_id */ >> > pirq = ((gaddr >> 32) & 0xffffff00) | >> > (((gaddr & 0xffffffff) >> MSI_TARGET_CPU_SHIFT) & 0xff); >> >> >> >> > qemu-xen/hw/xen_pt_msi.c:msi_msix_setup >> >> > if (gvec == 0) { >> > /* if gvec is 0, the guest is asking for a particular pirq that >> > * is passed as dest_id */ >> > *ppirq = msi_ext_dest_id(addr >> 32) | msi_dest_id(addr); >> >> > given how msi_ext_dest_id and msi_dest_id are defined, they should >> > behave the same way. >> >> > Maybe adding a printk in msi_msix_setup to show addr would help >> > nonetheless... >> >> Hi Stefano, >> >> I have added some printk''s attached i have: >> >> - qemu-upstream.log boot of the guest with qemu upstream, device not working >> - qemu-traditional.log boot of the same guest with qemu traditional, device is working >> >> - xl-dmesg-upstream.txt part of xl-dmesg related to boot of guest with qemu-upstream >> - xl-dmesg-traditional.txt part of xl-dmesg related to boot of sameguest with qemu-traditional >> - xl-dmesg.txt complete xl-dmesg >> >> - interrupts-dom0.txt /proc/interrupts of dom0 >> - interrupts-upstream.txt /proc/interrupts of guest with qemu-upstream> Thank you very much! > Could it be that the error is just due to a typo?Hmmm that i didn''t notice that :-) Must be it .. will give it a go ! Thx !> ---> diff --git a/hw/xen_pt_msi.c b/hw/xen_pt_msi.c > index 6807672..db757cd 100644 > --- a/hw/xen_pt_msi.c > +++ b/hw/xen_pt_msi.c > @@ -321,7 +321,7 @@ static int xen_pt_msix_update_one(XenPCIPassthroughState *s, int entry_nr) > > pirq = entry->pirq; > > - rc = msi_msix_setup(s, entry->data, entry->data, &pirq, true, entry_nr, > + rc = msi_msix_setup(s, entry->addr, entry->data, &pirq, true, entry_nr, > entry->pirq == XEN_PT_UNASSIGNED_PIRQ); > if (rc) { > return rc;
Sander Eikelenboom
2012-Dec-10 16:32 UTC
Re: [xen-unstable] [qemu-xen] pci passthrough msi-x returns same pirq
Monday, December 10, 2012, 4:48:32 PM, you wrote:> On Fri, 7 Dec 2012, Sander Eikelenboom wrote: >> Friday, December 7, 2012, 6:24:10 PM, you wrote: >> >> > On Thu, 6 Dec 2012, Sander Eikelenboom wrote: >> >> Hi Stefano / Anthony, >> >> >> >> With the debug output turned on i see some difference between qemu-traditional and qemu-upstream: >> >> >> >> With the pci passthroughed device that fails with msi-x, in qemu-xen it seems to get the same pirq back for every entry >> >> >> >> in qemu-traditional: >> >> >> >> pt_msix_update_one: pt_msix_update_one requested pirq = 87 >> >> pt_msix_update_one: Update msix entry 0 with pirq 57 gvec 0 >> >> pt_msix_update_one: pt_msix_update_one requested pirq = 86 >> >> pt_msix_update_one: Update msix entry 1 with pirq 56 gvec 0 >> >> pt_msix_update_one: pt_msix_update_one requested pirq = 85 >> >> pt_msix_update_one: Update msix entry 2 with pirq 55 gvec 0 >> >> pt_msix_update_one: pt_msix_update_one requested pirq = 84 >> >> pt_msix_update_one: Update msix entry 3 with pirq 54 gvec 0 >> >> >> >> >> >> in qemu-xen (upstream): >> >> >> >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0) >> >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3057 (entry: 0) >> >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x1) >> >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3056 (entry: 0x1) >> >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x2) >> >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3055 (entry: 0x2) >> >> [00:05.0] msi_msix_setup: requested pirq 4 for MSI-X (vec: 0, entry: 0x3) >> >> [00:05.0] msi_msix_update: Updating MSI-X with pirq 4 gvec 0 gflags 0x3054 (entry: 0x3) >> >> > That is a good pointer, but unfortunately the code that parses those >> > entries look exactly alike in both QEMU trees: >> >> > qemu-xen-traditional/hw/pt-msi.c:pt_msix_update_one >> >> > if (!gvec) { >> > /* if gvec is 0, the guest is asking for a particular pirq that >> > * is passed as dest_id */ >> > pirq = ((gaddr >> 32) & 0xffffff00) | >> > (((gaddr & 0xffffffff) >> MSI_TARGET_CPU_SHIFT) & 0xff); >> >> >> >> > qemu-xen/hw/xen_pt_msi.c:msi_msix_setup >> >> > if (gvec == 0) { >> > /* if gvec is 0, the guest is asking for a particular pirq that >> > * is passed as dest_id */ >> > *ppirq = msi_ext_dest_id(addr >> 32) | msi_dest_id(addr); >> >> > given how msi_ext_dest_id and msi_dest_id are defined, they should >> > behave the same way. >> >> > Maybe adding a printk in msi_msix_setup to show addr would help >> > nonetheless... >> >> Hi Stefano, >> >> I have added some printk''s attached i have: >> >> - qemu-upstream.log boot of the guest with qemu upstream, device not working >> - qemu-traditional.log boot of the same guest with qemu traditional, device is working >> >> - xl-dmesg-upstream.txt part of xl-dmesg related to boot of guest with qemu-upstream >> - xl-dmesg-traditional.txt part of xl-dmesg related to boot of sameguest with qemu-traditional >> - xl-dmesg.txt complete xl-dmesg >> >> - interrupts-dom0.txt /proc/interrupts of dom0 >> - interrupts-upstream.txt /proc/interrupts of guest with qemu-upstream> Thank you very much! > Could it be that the error is just due to a typo?Tested-By .. yes it was that simple ;-) Thx !> ---> diff --git a/hw/xen_pt_msi.c b/hw/xen_pt_msi.c > index 6807672..db757cd 100644 > --- a/hw/xen_pt_msi.c > +++ b/hw/xen_pt_msi.c > @@ -321,7 +321,7 @@ static int xen_pt_msix_update_one(XenPCIPassthroughState *s, int entry_nr) > > pirq = entry->pirq; > > - rc = msi_msix_setup(s, entry->data, entry->data, &pirq, true, entry_nr, > + rc = msi_msix_setup(s, entry->addr, entry->data, &pirq, true, entry_nr, > entry->pirq == XEN_PT_UNASSIGNED_PIRQ); > if (rc) { > return rc;
Stefano Stabellini
2012-Dec-10 16:47 UTC
[PATCH] xen: fix trivial PCI passthrough MSI-X bug
We are currently passing entry->data as address parameter. Pass entry->addr instead. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Tested-by: Sander Eikelenboom <linux@eikelenboom.it> Xen-devel: http://marc.info/?l=xen-devel&m=135515462613715 diff --git a/hw/xen_pt_msi.c b/hw/xen_pt_msi.c index 6807672..db757cd 100644 --- a/hw/xen_pt_msi.c +++ b/hw/xen_pt_msi.c @@ -321,7 +321,7 @@ static int xen_pt_msix_update_one(XenPCIPassthroughState *s, int entry_nr) pirq = entry->pirq; - rc = msi_msix_setup(s, entry->data, entry->data, &pirq, true, entry_nr, + rc = msi_msix_setup(s, entry->addr, entry->data, &pirq, true, entry_nr, entry->pirq == XEN_PT_UNASSIGNED_PIRQ); if (rc) { return rc;