xen/privcmd: Add new syscall to get gsi from dev
On PVH dom0, when passthrough a device to domU, QEMU and xl tools want to use gsi number to do pirq mapping, see QEMU code xen_pt_realize->xc_physdev_map_pirq, and xl code pci_add_dm_done->xc_physdev_map_pirq, but in current codes, the gsi number is got from file /sys/bus/pci/devices/<sbdf>/irq, that is wrong, because irq is not equal with gsi, they are in different spaces, so pirq mapping fails. And in current linux codes, there is no method to get gsi for userspace. For above purpose, record gsi of pcistub devices when init pcistub and add a new syscall into privcmd to let userspace can get gsi when they have a need. Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com> Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Message-ID: <20240924061437.2636766-4-Jiqian.Chen@amd.com> Signed-off-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
committed by
Juergen Gross
parent
b166b8ab41
commit
2fae6bb7be
@@ -126,6 +126,11 @@ struct privcmd_ioeventfd {
|
||||
__u8 pad[2];
|
||||
};
|
||||
|
||||
struct privcmd_pcidev_get_gsi {
|
||||
__u32 sbdf;
|
||||
__u32 gsi;
|
||||
};
|
||||
|
||||
/*
|
||||
* @cmd: IOCTL_PRIVCMD_HYPERCALL
|
||||
* @arg: &privcmd_hypercall_t
|
||||
@@ -157,5 +162,7 @@ struct privcmd_ioeventfd {
|
||||
_IOW('P', 8, struct privcmd_irqfd)
|
||||
#define IOCTL_PRIVCMD_IOEVENTFD \
|
||||
_IOW('P', 9, struct privcmd_ioeventfd)
|
||||
#define IOCTL_PRIVCMD_PCIDEV_GET_GSI \
|
||||
_IOC(_IOC_NONE, 'P', 10, sizeof(struct privcmd_pcidev_get_gsi))
|
||||
|
||||
#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
|
||||
|
||||
Reference in New Issue
Block a user