aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2021-06-18 12:01:07 +0100
committerGitHub <noreply@github.com>2021-06-18 12:01:07 +0100
commit3dea51565391dc81ae834b3ecc4f8521c3f03786 (patch)
treec8d6f2ef8981d4358fe777520fb74ec2e566dd13 /lib
parent6b8d93075499f0db5d0bfb9386e9024a0bdf68cf (diff)
downloadlibvfio-user-3dea51565391dc81ae834b3ecc4f8521c3f03786.zip
libvfio-user-3dea51565391dc81ae834b3ecc4f8521c3f03786.tar.gz
libvfio-user-3dea51565391dc81ae834b3ecc4f8521c3f03786.tar.bz2
superficially handle Device Control 2 and Link Control 2 (#568)
* superficially handle Device Control 2 and Link Control 2 Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/pci_caps.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/pci_caps.c b/lib/pci_caps.c
index f6a3abc..d7d312f 100644
--- a/lib/pci_caps.c
+++ b/lib/pci_caps.c
@@ -293,12 +293,44 @@ handle_px_pxdc_write(vfu_ctx_t *vfu_ctx, struct pxcap *px,
}
static int
+handle_px_pxdc2_write(vfu_ctx_t *vfu_ctx, struct pxcap *px,
+ const union pxdc2 *const p)
+{
+ assert(px != NULL);
+ assert(p != NULL);
+
+ if (p->raw != px->pxdc2.raw) {
+ vfu_log(vfu_ctx, LOG_DEBUG, "Device Control 2 set to %#x", p->raw);
+ }
+ px->pxdc2 = *p;
+ return 0;
+}
+
+static int
+handle_px_pxlc2_write(vfu_ctx_t *vfu_ctx, struct pxcap *px,
+ const struct pxlc2 *const p)
+{
+ assert(px != NULL);
+ assert(p != NULL);
+
+ if (p->stuff != px->pxlc2.stuff) {
+ vfu_log(vfu_ctx, LOG_DEBUG, "Link Control 2 set to %#x", p->stuff);
+ }
+ px->pxlc2 = *p;
+ return 0;
+}
+
+static int
handle_px_write_2_bytes(vfu_ctx_t *vfu_ctx, struct pxcap *px, char *buf,
loff_t off)
{
switch (off) {
case offsetof(struct pxcap, pxdc):
return handle_px_pxdc_write(vfu_ctx, px, (union pxdc *)buf);
+ case offsetof(struct pxcap, pxdc2):
+ return handle_px_pxdc2_write(vfu_ctx, px, (union pxdc2 *)buf);
+ case offsetof(struct pxcap, pxlc2):
+ return handle_px_pxlc2_write(vfu_ctx, px, (struct pxlc2 *)buf);
}
return ERROR_INT(EINVAL);
}