tools/libxc: fix xc_physdev_map_pirq_msi() with PCI segments != 0
PATCH 1/1 tools/libxc: fix xc_physdev_map_pirq_msi() with PCI segments != 0
Otherwise it's not possible for device models to map IRQs of devices on segments different than 0. Keep the same function prototype and pass the segment in the high 16bits of the bus parameter, like it's done for the hypercall itself.
---
I think it's 4.21 material, as otherwise it's not possible to passthrough PCI devices on segments != 0.
--- tools/libs/ctrl/xc_physdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/ctrl/xc_physdev.c +1 -1
@@ -79,7 +79,7 @@ int xc_physdev_map_pirq_msi(xc_interface *xch, }memset (&map,0 ,sizeof (struct physdev_map_pirq )); map.domid = domid; - map.type =MAP_PIRQ_TYPE_MSI ; + map.type =MAP_PIRQ_TYPE_MSI_SEG ; map.index = index; map.pirq = *pirq; map.bus = bus;
Signature · 1 line
2.51.0
Quoted 10 lines · Roger Pau Monne
Otherwise it's not possible for device models to map IRQs of devices on segments different than 0. Keep the same function prototype and pass the segment in the high 16bits of the bus parameter, like it's done for the hypercall itself.
Fixes 7620c0cf9a4d ("PCI multi-seg: add new physdevop-s")Signed-off-by Roger Pau Monné<[email protected]>---
I think it's 4.21 material, as otherwise it's not possible to passthrough PCI devices on segments != 0.
Make sense to me:
Thanks.
~ Oleksii
Quoted 17 lines
--- tools/libs/ctrl/xc_physdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libs/ctrl/xc_physdev.c +1
-1@@ -79,7 +79,7 @@ int xc_physdev_map_pirq_msi(xc_interface *xch, }memset (&map,0 ,sizeof (struct physdev_map_pirq )); map.domid = domid; - map.type =MAP_PIRQ_TYPE_MSI ; + map.type =MAP_PIRQ_TYPE_MSI_SEG ; map.index = index; map.pirq = *pirq; map.bus = bus;
Quoted 20 lines · Roger Pau Monne
Otherwise it's not possible for device models to map IRQs of devices on segments different than 0. Keep the same function prototype and pass the segment in the high 16bits of the bus parameter, like it's done for the hypercall itself.
Fixes 7620c0cf9a4d ("PCI multi-seg: add new physdevop-s")Signed-off-by Roger Pau Monné <[email protected]>---
I think it's 4.21 material, as otherwise it's not possible to passthrough PCI devices on segments != 0.--- tools/libs/ctrl/xc_physdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libs/ctrl/xc_physdev.c +0
-0
tools/libs/ctrl/xc_physdev.c int xc_physdev_map_pirq_msi(xc_interface *xch, · line 85
Quoted 8 lines
tools/libs/ctrl/xc_physdev.c +1
-1@@ -79,7 +79,7 @@ int xc_physdev_map_pirq_msi(xc_interface *xch, }memset (&map,0 ,sizeof (struct physdev_map_pirq )); map.domid = domid; - map.type =MAP_PIRQ_TYPE_MSI ; + map.type =MAP_PIRQ_TYPE_MSI_SEG ; map.index = index; map.pirq = *pirq; map.bus = bus;
This was tested on a real machine.
About MAP_PIRQ_TYPE_MSI and MAP_PIRQ_TYPE_MSI_SEG, do we need to keep ABI compatibility or we should just remove MAP_PIRQ_TYPE_MSI_SEG and make MAP_PIRQ_TYPE_MSI consider the segment ?
Frediano
Quoted 32 lines · Frediano Ziglio
Quoted 20 lines · Roger Pau Monne
Otherwise it's not possible for device models to map IRQs of devices on segments different than 0. Keep the same function prototype and pass the segment in the high 16bits of the bus parameter, like it's done for the hypercall itself.
Fixes 7620c0cf9a4d ("PCI multi-seg: add new physdevop-s")Signed-off-by Roger Pau Monné <[email protected]>---
I think it's 4.21 material, as otherwise it's not possible to passthrough PCI devices on segments != 0.--- tools/libs/ctrl/xc_physdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libs/ctrl/xc_physdev.c +0
-0tools/libs/ctrl/xc_physdev.c int xc_physdev_map_pirq_msi(xc_interface *xch, · line 85
Quoted 8 lines
tools/libs/ctrl/xc_physdev.c +1
-1@@ -79,7 +79,7 @@ int xc_physdev_map_pirq_msi(xc_interface *xch, }memset (&map,0 ,sizeof (struct physdev_map_pirq )); map.domid = domid; - map.type =MAP_PIRQ_TYPE_MSI ; + map.type =MAP_PIRQ_TYPE_MSI_SEG ; map.index = index; map.pirq = *pirq; map.bus = bus;Reviewed-by Frediano Ziglio <[email protected]>
Quoted 5 lines
This was tested on a real machine.
About
MAP_PIRQ_TYPE_MSIandMAP_PIRQ_TYPE_MSI_SEG, do we need to keep ABI compatibility or we should just removeMAP_PIRQ_TYPE_MSI_SEGand makeMAP_PIRQ_TYPE_MSIconsider the segment ?
Assuming you talk about the hypervisor interface, could you explain how you see breaking ABI compatibility to not break anything? These aren't tools-only interfaces, after all.
Jan
Quoted 4 lines · Roger Pau Monne
Otherwise it's not possible for device models to map IRQs of devices on segments different than 0. Keep the same function prototype and pass the segment in the high 16bits of the bus parameter, like it's done for the hypercall itself.
While easiest, that's an odd interface, though. Should, at the very least the function parameter then be named e.g. "segbus", along the lines of "devfn"?
Quoted 1 line
Fixes 7620c0cf9a4d ("PCI multi-seg: add new physdevop-s")
This commit wasn't about tool stack uses of the interfaces at all.
Jan
Quoted 8 lines · Jan Beulich
Quoted 4 lines · Roger Pau Monne
Otherwise it's not possible for device models to map IRQs of devices on segments different than 0. Keep the same function prototype and pass the segment in the high 16bits of the bus parameter, like it's done for the hypercall itself.
While easiest, that's an odd interface, though. Should, at the very least the function parameter then be named e.g. "segbus", along the lines of "devfn"?
I certainly don't mind using segbus instead of plain bus, will adjust now.
Quoted 3 lines
Quoted 1 line
Fixes 7620c0cf9a4d ("PCI multi-seg: add new physdevop-s")This commit wasn't about tool stack uses of the interfaces at all.
But there should have been a tools side change somewhere to make use of that interface, at the point that support for multi-segment was added to Xen? Otherwise the support feels like half done.
Would you prefer me to use the "Amends:" tag? Or no tag at all.
Thanks, Roger.
Quoted 13 lines · Roger Pau Monné
Quoted 8 lines · Jan Beulich
Quoted 4 lines · Roger Pau Monne
Otherwise it's not possible for device models to map IRQs of devices on segments different than 0. Keep the same function prototype and pass the segment in the high 16bits of the bus parameter, like it's done for the hypercall itself.
While easiest, that's an odd interface, though. Should, at the very least the function parameter then be named e.g. "segbus", along the lines of "devfn"?
I certainly don't mind using segbus instead of plain bus, will adjust now.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Fixes 7620c0cf9a4d ("PCI multi-seg: add new physdevop-s")This commit wasn't about tool stack uses of the interfaces at all.
But there should have been a tools side change somewhere to make use of that interface, at the point that support for multi-segment was added to Xen? Otherwise the support feels like half done.
Perhaps. I was after kernel functionality only at that point, and I would really have liked toolstack folks to have picked up any work needed there.
Quoted 1 line
Would you prefer me to use the "Amends:" tag? Or no tag at all.
Both would be fine with me.
Jan