aboutsummaryrefslogtreecommitdiff
path: root/samples/client.c
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-11-20 06:43:42 -0500
committerThanos <tmakatos@gmail.com>2020-11-20 12:41:06 +0000
commitc57301efe8460aadedabf05d24cbce336c984b59 (patch)
tree469343548d84e18e9a292107f34283c15a017f08 /samples/client.c
parentdfb0a9b4e2e86f840daf843b5f68f4fdf94ca536 (diff)
downloadlibvfio-user-c57301efe8460aadedabf05d24cbce336c984b59.zip
libvfio-user-c57301efe8460aadedabf05d24cbce336c984b59.tar.gz
libvfio-user-c57301efe8460aadedabf05d24cbce336c984b59.tar.bz2
drop pci_info from lm_ctx
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples/client.c')
-rw-r--r--samples/client.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/samples/client.c b/samples/client.c
index a887647..1c3a491 100644
--- a/samples/client.c
+++ b/samples/client.c
@@ -884,6 +884,7 @@ int main(int argc, char *argv[])
void *migr_data;
__u64 migr_data_len;
char *path_to_server = NULL;
+ lm_pci_hdr_t config_space;
while ((opt = getopt(argc, argv, "h")) != -1) {
switch (opt) {
@@ -923,6 +924,17 @@ int main(int argc, char *argv[])
/* XXX VFIO_USER_DEVICE_GET_REGION_INFO */
get_device_region_info(sock, &client_dev_info);
+
+ ret = access_region(sock, LM_DEV_CFG_REG_IDX, false, 0, &config_space,
+ sizeof config_space);
+ if (ret < 0) {
+ errx(EXIT_FAILURE, "failed to read PCI configuration space: %s\n",
+ strerror(-ret));
+ }
+ assert(config_space.id.raw == 0xdeadbeef);
+ assert(config_space.ss.raw == 0xcafebabe);
+ assert(config_space.cc.pi == 0xab && config_space.cc.scc == 0xcd
+ && config_space.cc.bcc == 0xef);
/* XXX VFIO_USER_DEVICE_RESET */
send_device_reset(sock);