[v5,6/6] tools/libxc: add wrapper for PHYSDEVOP_msi_control
diff mbox series

Message ID 5c8fb8141c0f92ccaa78cdc169b8544f7634ce65.1563325215.git-series.marmarek@invisiblethingslab.com
State Superseded
Headers show
Series
  • Fix PCI passthrough for HVM with stubdomain
Related show

Commit Message

Marek Marczykowski-Górecki July 17, 2019, 1 a.m. UTC
Add libxc wrapper for PHYSDEVOP_msi_control introduced in previous
commit.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
Changes in v3:
 - new patch
Changes in v4:
 - adjust for updated previous patch
Changes in v5:
 - rename to PHYSDEVOP_msi_control, adjust arguments
---
 tools/libxc/include/xenctrl.h |  6 ++++++
 tools/libxc/xc_physdev.c      | 19 +++++++++++++++++++
 2 files changed, 25 insertions(+)

Comments

Roger Pau Monné July 17, 2019, 10:21 a.m. UTC | #1
On Wed, Jul 17, 2019 at 03:00:44AM +0200, Marek Marczykowski-Górecki wrote:
> Add libxc wrapper for PHYSDEVOP_msi_control introduced in previous
> commit.
> 
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

LGTM, albeit I find the usage of int instead of unsigned int for the
SBDF kind of weird, but it's inline with the other functions, so I
guess there's a reason for it?

I assume this will be used by an upcoming QEMU patch?

Thanks, Roger.
Marek Marczykowski-Górecki July 18, 2019, 12:12 a.m. UTC | #2
On Wed, Jul 17, 2019 at 12:21:58PM +0200, Roger Pau Monné wrote:
> On Wed, Jul 17, 2019 at 03:00:44AM +0200, Marek Marczykowski-Górecki wrote:
> > Add libxc wrapper for PHYSDEVOP_msi_control introduced in previous
> > commit.
> > 
> > Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> 
> LGTM, albeit I find the usage of int instead of unsigned int for the
> SBDF kind of weird, but it's inline with the other functions, so I
> guess there's a reason for it?

Yes, it was based on looking at other places. But I don't know if there
is any specific reason for it.

> I assume this will be used by an upcoming QEMU patch?

Yes.
Roger Pau Monné July 18, 2019, 1:53 p.m. UTC | #3
On Thu, Jul 18, 2019 at 02:12:20AM +0200, Marek Marczykowski-Górecki wrote:
> On Wed, Jul 17, 2019 at 12:21:58PM +0200, Roger Pau Monné wrote:
> > On Wed, Jul 17, 2019 at 03:00:44AM +0200, Marek Marczykowski-Górecki wrote:
> > > Add libxc wrapper for PHYSDEVOP_msi_control introduced in previous
> > > commit.
> > > 
> > > Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> > 
> > LGTM, albeit I find the usage of int instead of unsigned int for the
> > SBDF kind of weird, but it's inline with the other functions, so I
> > guess there's a reason for it?
> 
> Yes, it was based on looking at other places. But I don't know if there
> is any specific reason for it.

Anyway, since using unsigned or signed is not really that relevant
here, and seeing how other functions are defined:

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

With just a couple of nits: you don't actually need rc, you can just `return
do_physdev_op...`, and you could also initialize physdev_msi_control
at declaration, but I don't have a strong opinion on any of those, so
you can keep the RB regardless.

Thanks!

Patch
diff mbox series

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 538007a..826d10d 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1638,6 +1638,12 @@  int xc_physdev_unmap_pirq(xc_interface *xch,
                           uint32_t domid,
                           int pirq);
 
+int xc_physdev_msi_control(xc_interface *xch,
+                           int seg,
+                           int bus,
+                           int devfn,
+                           int flags);
+
 /*
  *  LOGGING AND ERROR REPORTING
  */
diff --git a/tools/libxc/xc_physdev.c b/tools/libxc/xc_physdev.c
index 460a8e7..a25a117 100644
--- a/tools/libxc/xc_physdev.c
+++ b/tools/libxc/xc_physdev.c
@@ -111,3 +111,22 @@  int xc_physdev_unmap_pirq(xc_interface *xch,
     return rc;
 }
 
+int xc_physdev_msi_control(xc_interface *xch,
+                           int seg,
+                           int bus,
+                           int devfn,
+                           int flags)
+{
+    int rc;
+    struct physdev_msi_control op;
+
+    memset(&op, 0, sizeof(struct physdev_msi_control));
+    op.seg = seg;
+    op.bus = bus;
+    op.devfn = devfn;
+    op.flags = flags;
+
+    rc = do_physdev_op(xch, PHYSDEVOP_msi_control, &op, sizeof(op));
+
+    return rc;
+}