aboutsummaryrefslogtreecommitdiff
path: root/samples/client.c
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-10-22 11:05:55 -0400
committerThanos Makatos <thanos.makatos@nutanix.com>2020-10-22 11:11:37 -0400
commit806c427db17a57f1d3030c4fc21a357cfcdb4a84 (patch)
tree3460ca537e395340875869a8a3cf516ce957802f /samples/client.c
parent11daed97e8751b123897030e331ee49aad6c34ba (diff)
downloadlibvfio-user-806c427db17a57f1d3030c4fc21a357cfcdb4a84.zip
libvfio-user-806c427db17a57f1d3030c4fc21a357cfcdb4a84.tar.gz
libvfio-user-806c427db17a57f1d3030c4fc21a357cfcdb4a84.tar.bz2
samples/client: move VFIO_USER_REGION_READ/VFIO_USER_REGION_WRITE earlier
It's better to have this test earlier in the code, before we have to manually trigger an IRQ, so that we can catch developement errors more easily. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples/client.c')
-rw-r--r--samples/client.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/samples/client.c b/samples/client.c
index 9a793dd..925335d 100644
--- a/samples/client.c
+++ b/samples/client.c
@@ -542,6 +542,18 @@ int main(int argc, char *argv[])
}
/*
+ * XXX VFIO_USER_REGION_READ and VFIO_USER_REGION_WRITE
+ *
+ * BAR0 in the server does not support memory mapping so it must be accessed
+ * via explicit messages.
+ */
+ ret = access_bar0(sock);
+ if (ret < 0) {
+ fprintf(stderr, "failed to access BAR0: %s\n", strerror(-ret));
+ exit(EXIT_FAILURE);
+ }
+
+ /*
* XXX VFIO_USER_DEVICE_GET_IRQ_INFO and VFIO_IRQ_SET_ACTION_TRIGGER
* Query interrupts, configure an eventfd to be associated with INTx, and
* finally wait for the server to fire the interrupt.
@@ -559,18 +571,6 @@ int main(int argc, char *argv[])
}
/*
- * XXX VFIO_USER_REGION_READ and VFIO_USER_REGION_WRITE
- *
- * BAR0 in the server does not support memory mapping so it must be accessed
- * via explicit messages.
- */
- ret = access_bar0(sock);
- if (ret < 0) {
- fprintf(stderr, "failed to access BAR0: %s\n", strerror(-ret));
- exit(EXIT_FAILURE);
- }
-
- /*
* FIXME now that region read/write works, change the server implementation
* to trigger an interrupt after N seconds, where N is the value written to
* BAR0 by the client.