[PATCH for-4.21 v2] tools/libxc: fix xc_physdev_map_pirq_msi() with PCI segments != 0

Roger Pau Monne posted 1 patch 1 week, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20251020105613.53636-1-roger.pau@citrix.com
tools/include/xenctrl.h      | 2 +-
tools/libs/ctrl/xc_physdev.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
[PATCH for-4.21 v2] tools/libxc: fix xc_physdev_map_pirq_msi() with PCI segments != 0
Posted by Roger Pau Monne 1 week, 2 days ago
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.

Amends: 7620c0cf9a4d ("PCI multi-seg: add new physdevop-s")
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 tools/include/xenctrl.h      | 2 +-
 tools/libs/ctrl/xc_physdev.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index c14ecd66aa9c..d5dbf69c8968 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1623,7 +1623,7 @@ int xc_physdev_map_pirq_msi(xc_interface *xch,
                             int index,
                             int *pirq,
                             int devfn,
-                            int bus,
+                            int segbus,
                             int entry_nr,
                             uint64_t table_base);
 
diff --git a/tools/libs/ctrl/xc_physdev.c b/tools/libs/ctrl/xc_physdev.c
index 25e686d7b389..9fb78536ea7b 100644
--- a/tools/libs/ctrl/xc_physdev.c
+++ b/tools/libs/ctrl/xc_physdev.c
@@ -65,7 +65,7 @@ int xc_physdev_map_pirq_msi(xc_interface *xch,
                             int index,
                             int *pirq,
                             int devfn,
-                            int bus,
+                            int segbus,
                             int entry_nr,
                             uint64_t table_base)
 {
@@ -79,10 +79,10 @@ 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;
+    map.bus = segbus;
     map.devfn = devfn;
     map.entry_nr = entry_nr;
     map.table_base = table_base;
-- 
2.51.0


Re: [PATCH for-4.21 v2] tools/libxc: fix xc_physdev_map_pirq_msi() with PCI segments != 0
Posted by Anthony PERARD 1 week, 1 day ago
On Mon, Oct 20, 2025 at 11:56:13AM +0100, Roger Pau Monne wrote:
> 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.
> 
> Amends: 7620c0cf9a4d ("PCI multi-seg: add new physdevop-s")
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>

Thanks,

-- 
Anthony PERARD