[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [RFC XEN PATCH v14 4/5] tools: Add new function to get gsi from dev
On Tue, Sep 03, 2024 at 03:04:23PM +0800, Jiqian Chen wrote: > diff --git a/tools/include/xen-sys/Linux/privcmd.h > b/tools/include/xen-sys/Linux/privcmd.h > index bc60e8fd55eb..607dfa2287bc 100644 > --- a/tools/include/xen-sys/Linux/privcmd.h > +++ b/tools/include/xen-sys/Linux/privcmd.h > @@ -95,6 +95,11 @@ typedef struct privcmd_mmap_resource { > __u64 addr; > } privcmd_mmap_resource_t; > > +typedef struct privcmd_pcidev_get_gsi { > + __u32 sbdf; > + __u32 gsi; > +} privcmd_pcidev_get_gsi_t; > diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c > index c67c71c08be3..92591e49a1c8 100644 > --- a/tools/libs/ctrl/xc_linux.c > +++ b/tools/libs/ctrl/xc_linux.c > @@ -66,6 +66,26 @@ void *xc_memalign(xc_interface *xch, size_t alignment, > size_t size) > return ptr; > } > > +int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf) > +{ > + int ret; > + privcmd_pcidev_get_gsi_t dev_gsi = { > + .sbdf = sbdf, > + .gsi = 0, > + }; > + > + ret = ioctl(xencall_fd(xch->xcall), > + IOCTL_PRIVCMD_PCIDEV_GET_GSI, &dev_gsi); > + > + if (ret < 0) { > + PERROR("Failed to get gsi from dev"); > + } else { > + ret = dev_gsi.gsi; I've just notice that this is mixing signed and unsigned int. We are storing a "__u32" into an "int" here. This isn't great as we are throwing way lots of potentially good value. (Even if I have no idea if they are possible.) Cheers, -- Anthony Perard | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |