From: Venu Busireddy <venu.busireddy@oracle.com> To: venu.busireddy@oracle.com, "Michael S . Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel@redhat.com> Cc: virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v3 1/3] Add "Group Identifier" support to virtio devices. Date: Fri, 29 Jun 2018 17:19:04 -0500 [thread overview] Message-ID: <20180629221907.3662-2-venu.busireddy@oracle.com> (raw) In-Reply-To: <20180629221907.3662-1-venu.busireddy@oracle.com> Use the virtio PCI capability "VIRTIO_PCI_CAP_GROUP_ID_CFG" to store the "Group Identifier" specified via the command line option "failover-group-id" for the virtio device. The capability will be present in the virtio device's configuration space iff the "failover-group-id" option is specified. Group Identifier is used to pair a virtio device with a passthrough device. Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com> --- hw/virtio/virtio-pci.c | 15 +++++++++++++++ hw/virtio/virtio-pci.h | 3 ++- include/hw/pci/pci.h | 1 + include/hw/pci/pcie.h | 1 + include/standard-headers/linux/virtio_pci.h | 8 ++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 3a01fe90f0..cdf907e9c5 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1638,6 +1638,10 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) .cap.cap_len = sizeof cfg, .cap.cfg_type = VIRTIO_PCI_CAP_PCI_CFG, }; + struct virtio_pci_group_id_cap group = { + .cap.cap_len = sizeof group, + .cap.cfg_type = VIRTIO_PCI_CAP_GROUP_ID_CFG, + }; struct virtio_pci_notify_cap notify_pio = { .cap.cap_len = sizeof notify, .notify_off_multiplier = cpu_to_le32(0x0), @@ -1647,6 +1651,11 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) virtio_pci_modern_regions_init(proxy); + if (proxy->pci_dev.failover_group_id != ULLONG_MAX) { + group.failover_group_id = proxy->pci_dev.failover_group_id; + virtio_pci_modern_mem_region_map(proxy, &proxy->group, &group.cap); + } + virtio_pci_modern_mem_region_map(proxy, &proxy->common, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->isr, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->device, &cap); @@ -1763,6 +1772,10 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) proxy->device.size = 0x1000; proxy->device.type = VIRTIO_PCI_CAP_DEVICE_CFG; + proxy->group.offset = 0; + proxy->group.size = 0; + proxy->group.type = VIRTIO_PCI_CAP_GROUP_ID_CFG; + proxy->notify.offset = 0x3000; proxy->notify.size = virtio_pci_queue_mem_mult(proxy) * VIRTIO_QUEUE_MAX; proxy->notify.type = VIRTIO_PCI_CAP_NOTIFY_CFG; @@ -1898,6 +1911,8 @@ static Property virtio_pci_properties[] = { VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true), DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_INIT_PM_BIT, true), + DEFINE_PROP_UINT64(COMPAT_PROP_FAILOVER_GROUP_ID, + PCIDevice, failover_group_id, ULLONG_MAX), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 813082b0d7..e4592e90bf 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -164,10 +164,11 @@ struct VirtIOPCIProxy { VirtIOPCIRegion common; VirtIOPCIRegion isr; VirtIOPCIRegion device; + VirtIOPCIRegion group; VirtIOPCIRegion notify; VirtIOPCIRegion notify_pio; }; - VirtIOPCIRegion regs[5]; + VirtIOPCIRegion regs[6]; }; MemoryRegion modern_bar; MemoryRegion io_bar; diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 990d6fcbde..b59c3e7e38 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -343,6 +343,7 @@ struct PCIDevice { bool has_rom; MemoryRegion rom; uint32_t rom_bar; + uint64_t failover_group_id; /* INTx routing notifier */ PCIINTxRoutingNotifier intx_routing_notifier; diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index b71e369703..71cd143ee4 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -82,6 +82,7 @@ struct PCIExpressDevice { }; #define COMPAT_PROP_PCP "power_controller_present" +#define COMPAT_PROP_FAILOVER_GROUP_ID "failover-group-id" /* PCI express capability helper functions */ int pcie_cap_init(PCIDevice *dev, uint8_t offset, uint8_t type, diff --git a/include/standard-headers/linux/virtio_pci.h b/include/standard-headers/linux/virtio_pci.h index 9262acd130..e46df63e52 100644 --- a/include/standard-headers/linux/virtio_pci.h +++ b/include/standard-headers/linux/virtio_pci.h @@ -113,6 +113,8 @@ #define VIRTIO_PCI_CAP_DEVICE_CFG 4 /* PCI configuration access */ #define VIRTIO_PCI_CAP_PCI_CFG 5 +/* Group Identifier */ +#define VIRTIO_PCI_CAP_GROUP_ID_CFG 6 /* This is the PCI capability header: */ struct virtio_pci_cap { @@ -163,6 +165,12 @@ struct virtio_pci_cfg_cap { uint8_t pci_cfg_data[4]; /* Data for BAR access. */ }; +/* Fields in VIRTIO_PCI_CAP_GROUP_ID_CFG: */ +struct virtio_pci_group_id_cap { + struct virtio_pci_cap cap; + uint64_t failover_group_id; +}; + /* Macro versions of offsets for the Old Timers! */ #define VIRTIO_PCI_CAP_VNDR 0 #define VIRTIO_PCI_CAP_NEXT 1
WARNING: multiple messages have this Message-ID (diff)
From: Venu Busireddy <venu.busireddy@oracle.com> To: venu.busireddy@oracle.com, "Michael S . Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel@redhat.com> Cc: virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org Subject: [virtio-dev] [PATCH v3 1/3] Add "Group Identifier" support to virtio devices. Date: Fri, 29 Jun 2018 17:19:04 -0500 [thread overview] Message-ID: <20180629221907.3662-2-venu.busireddy@oracle.com> (raw) In-Reply-To: <20180629221907.3662-1-venu.busireddy@oracle.com> Use the virtio PCI capability "VIRTIO_PCI_CAP_GROUP_ID_CFG" to store the "Group Identifier" specified via the command line option "failover-group-id" for the virtio device. The capability will be present in the virtio device's configuration space iff the "failover-group-id" option is specified. Group Identifier is used to pair a virtio device with a passthrough device. Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com> --- hw/virtio/virtio-pci.c | 15 +++++++++++++++ hw/virtio/virtio-pci.h | 3 ++- include/hw/pci/pci.h | 1 + include/hw/pci/pcie.h | 1 + include/standard-headers/linux/virtio_pci.h | 8 ++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 3a01fe90f0..cdf907e9c5 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1638,6 +1638,10 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) .cap.cap_len = sizeof cfg, .cap.cfg_type = VIRTIO_PCI_CAP_PCI_CFG, }; + struct virtio_pci_group_id_cap group = { + .cap.cap_len = sizeof group, + .cap.cfg_type = VIRTIO_PCI_CAP_GROUP_ID_CFG, + }; struct virtio_pci_notify_cap notify_pio = { .cap.cap_len = sizeof notify, .notify_off_multiplier = cpu_to_le32(0x0), @@ -1647,6 +1651,11 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) virtio_pci_modern_regions_init(proxy); + if (proxy->pci_dev.failover_group_id != ULLONG_MAX) { + group.failover_group_id = proxy->pci_dev.failover_group_id; + virtio_pci_modern_mem_region_map(proxy, &proxy->group, &group.cap); + } + virtio_pci_modern_mem_region_map(proxy, &proxy->common, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->isr, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->device, &cap); @@ -1763,6 +1772,10 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) proxy->device.size = 0x1000; proxy->device.type = VIRTIO_PCI_CAP_DEVICE_CFG; + proxy->group.offset = 0; + proxy->group.size = 0; + proxy->group.type = VIRTIO_PCI_CAP_GROUP_ID_CFG; + proxy->notify.offset = 0x3000; proxy->notify.size = virtio_pci_queue_mem_mult(proxy) * VIRTIO_QUEUE_MAX; proxy->notify.type = VIRTIO_PCI_CAP_NOTIFY_CFG; @@ -1898,6 +1911,8 @@ static Property virtio_pci_properties[] = { VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true), DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_INIT_PM_BIT, true), + DEFINE_PROP_UINT64(COMPAT_PROP_FAILOVER_GROUP_ID, + PCIDevice, failover_group_id, ULLONG_MAX), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 813082b0d7..e4592e90bf 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -164,10 +164,11 @@ struct VirtIOPCIProxy { VirtIOPCIRegion common; VirtIOPCIRegion isr; VirtIOPCIRegion device; + VirtIOPCIRegion group; VirtIOPCIRegion notify; VirtIOPCIRegion notify_pio; }; - VirtIOPCIRegion regs[5]; + VirtIOPCIRegion regs[6]; }; MemoryRegion modern_bar; MemoryRegion io_bar; diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 990d6fcbde..b59c3e7e38 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -343,6 +343,7 @@ struct PCIDevice { bool has_rom; MemoryRegion rom; uint32_t rom_bar; + uint64_t failover_group_id; /* INTx routing notifier */ PCIINTxRoutingNotifier intx_routing_notifier; diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index b71e369703..71cd143ee4 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -82,6 +82,7 @@ struct PCIExpressDevice { }; #define COMPAT_PROP_PCP "power_controller_present" +#define COMPAT_PROP_FAILOVER_GROUP_ID "failover-group-id" /* PCI express capability helper functions */ int pcie_cap_init(PCIDevice *dev, uint8_t offset, uint8_t type, diff --git a/include/standard-headers/linux/virtio_pci.h b/include/standard-headers/linux/virtio_pci.h index 9262acd130..e46df63e52 100644 --- a/include/standard-headers/linux/virtio_pci.h +++ b/include/standard-headers/linux/virtio_pci.h @@ -113,6 +113,8 @@ #define VIRTIO_PCI_CAP_DEVICE_CFG 4 /* PCI configuration access */ #define VIRTIO_PCI_CAP_PCI_CFG 5 +/* Group Identifier */ +#define VIRTIO_PCI_CAP_GROUP_ID_CFG 6 /* This is the PCI capability header: */ struct virtio_pci_cap { @@ -163,6 +165,12 @@ struct virtio_pci_cfg_cap { uint8_t pci_cfg_data[4]; /* Data for BAR access. */ }; +/* Fields in VIRTIO_PCI_CAP_GROUP_ID_CFG: */ +struct virtio_pci_group_id_cap { + struct virtio_pci_cap cap; + uint64_t failover_group_id; +}; + /* Macro versions of offsets for the Old Timers! */ #define VIRTIO_PCI_CAP_VNDR 0 #define VIRTIO_PCI_CAP_NEXT 1 --------------------------------------------------------------------- To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
next prev parent reply other threads:[~2018-06-29 22:19 UTC|newest] Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-06-29 22:19 [Qemu-devel] [PATCH v3 0/3] Use of unique identifier for pairing virtio and passthrough devices Venu Busireddy 2018-06-29 22:19 ` [virtio-dev] " Venu Busireddy 2018-06-29 22:19 ` Venu Busireddy [this message] 2018-06-29 22:19 ` [virtio-dev] [PATCH v3 1/3] Add "Group Identifier" support to virtio devices Venu Busireddy 2018-06-29 22:19 ` [Qemu-devel] [PATCH v3 2/3] Add "Group Identifier" support to Red Hat PCI bridge Venu Busireddy 2018-06-29 22:19 ` [virtio-dev] " Venu Busireddy 2018-07-03 3:13 ` [Qemu-devel] " Siwei Liu 2018-07-03 3:13 ` Siwei Liu 2018-06-29 22:19 ` [Qemu-devel] [PATCH v3 3/3] Add "Group Identifier" support to Red Hat PCI Express bridge Venu Busireddy 2018-06-29 22:19 ` [virtio-dev] " Venu Busireddy 2018-07-07 12:14 ` [Qemu-devel] " Marcel Apfelbaum 2018-07-07 12:14 ` Marcel Apfelbaum 2018-07-31 15:58 ` [Qemu-devel] " Venu Busireddy 2018-07-31 15:58 ` Venu Busireddy 2018-07-31 16:03 ` [Qemu-devel] " Michael S. Tsirkin 2018-07-31 16:03 ` Michael S. Tsirkin 2018-07-31 19:11 ` [Qemu-devel] " Marcel Apfelbaum 2018-07-31 19:11 ` Marcel Apfelbaum 2018-06-29 22:19 ` [Qemu-devel] [PATCH v3 virtio 1/1] Add "Group Identifier" to virtio PCI capabilities Venu Busireddy 2018-06-29 22:19 ` [virtio-dev] " Venu Busireddy 2018-07-02 16:14 ` [Qemu-devel] [PATCH v3 0/3] Use of unique identifier for pairing virtio and passthrough devices Roman Kagan 2018-07-02 21:14 ` si-wei liu 2018-07-02 21:14 ` [virtio-dev] " si-wei liu 2018-07-03 9:58 ` Roman Kagan 2018-07-03 14:28 ` Venu Busireddy 2018-07-03 14:28 ` [virtio-dev] " Venu Busireddy 2018-07-03 14:52 ` [Qemu-devel] [virtio-dev] " Cornelia Huck 2018-07-03 14:52 ` [virtio-dev] Re: [Qemu-devel] " Cornelia Huck 2018-07-03 23:31 ` [Qemu-devel] [virtio-dev] " Siwei Liu 2018-07-03 23:31 ` [virtio-dev] Re: [Qemu-devel] " Siwei Liu 2018-07-04 12:15 ` [Qemu-devel] [virtio-dev] " Cornelia Huck 2018-07-04 12:15 ` [virtio-dev] Re: [Qemu-devel] " Cornelia Huck 2018-07-06 0:49 ` [Qemu-devel] [virtio-dev] " Siwei Liu 2018-07-06 0:49 ` [virtio-dev] Re: [Qemu-devel] " Siwei Liu 2018-07-06 13:54 ` [Qemu-devel] [virtio-dev] " Cornelia Huck 2018-07-06 13:54 ` [virtio-dev] Re: [Qemu-devel] " Cornelia Huck 2018-07-06 15:07 ` [Qemu-devel] [virtio-dev] " Michael S. Tsirkin 2018-07-06 15:07 ` [virtio-dev] Re: [Qemu-devel] " Michael S. Tsirkin 2018-07-09 16:20 ` [Qemu-devel] [virtio-dev] " Cornelia Huck 2018-07-09 16:20 ` [virtio-dev] Re: [Qemu-devel] " Cornelia Huck 2018-07-06 23:37 ` [Qemu-devel] [virtio-dev] " Siwei Liu 2018-07-06 23:37 ` [virtio-dev] Re: [Qemu-devel] " Siwei Liu 2018-07-09 16:27 ` [Qemu-devel] [virtio-dev] " Cornelia Huck 2018-07-09 16:27 ` [virtio-dev] Re: [Qemu-devel] " Cornelia Huck 2018-07-09 13:14 ` [Qemu-devel] [virtio-dev] " Roman Kagan 2018-07-09 13:14 ` [virtio-dev] Re: [Qemu-devel] " Roman Kagan 2018-07-09 16:10 ` [Qemu-devel] [virtio-dev] " Cornelia Huck 2018-07-09 16:10 ` [virtio-dev] Re: [Qemu-devel] " Cornelia Huck 2018-07-03 15:34 ` Roman Kagan 2018-07-03 22:27 ` si-wei liu 2018-07-03 22:27 ` [virtio-dev] " si-wei liu 2018-07-09 13:00 ` Roman Kagan 2018-07-09 18:35 ` Michael S. Tsirkin 2018-07-09 18:35 ` [virtio-dev] " Michael S. Tsirkin 2018-07-10 1:11 ` si-wei liu 2018-07-10 1:11 ` [virtio-dev] " si-wei liu 2018-07-10 1:54 ` Michael S. Tsirkin 2018-07-10 1:54 ` [virtio-dev] " Michael S. Tsirkin 2018-07-11 0:07 ` Siwei Liu 2018-07-11 0:07 ` [virtio-dev] " Siwei Liu 2018-07-11 0:07 ` [Qemu-devel] [virtio-dev] " Siwei Liu 2018-07-11 9:53 ` Re: [Qemu-devel] " Cornelia Huck 2018-07-11 9:53 ` [virtio-dev] " Cornelia Huck 2018-07-11 9:53 ` [Qemu-devel] [virtio-dev] " Cornelia Huck 2018-07-12 9:37 ` Re: [Qemu-devel] " Siwei Liu 2018-07-12 9:37 ` [virtio-dev] " Siwei Liu 2018-07-12 9:37 ` [Qemu-devel] [virtio-dev] " Siwei Liu 2018-07-12 11:31 ` Re: [Qemu-devel] " Cornelia Huck 2018-07-12 11:31 ` [virtio-dev] " Cornelia Huck 2018-07-12 11:31 ` [Qemu-devel] [virtio-dev] " Cornelia Huck 2018-07-12 20:52 ` Re: [Qemu-devel] " Siwei Liu 2018-07-12 20:52 ` [virtio-dev] " Siwei Liu 2018-07-12 20:52 ` [Qemu-devel] [virtio-dev] " Siwei Liu 2018-07-12 21:00 ` Re: [Qemu-devel] " Michael S. Tsirkin 2018-07-12 21:00 ` [virtio-dev] " Michael S. Tsirkin 2018-07-12 21:00 ` [Qemu-devel] [virtio-dev] " Michael S. Tsirkin 2018-07-12 22:19 ` Re: [Qemu-devel] " Siwei Liu 2018-07-12 22:19 ` [virtio-dev] " Siwei Liu 2018-07-12 22:19 ` [Qemu-devel] [virtio-dev] " Siwei Liu 2018-07-13 1:20 ` Re: [Qemu-devel] " Samudrala, Sridhar 2018-07-13 1:20 ` [virtio-dev] " Samudrala, Sridhar 2018-07-13 1:20 ` [Qemu-devel] [virtio-dev] " Samudrala, Sridhar 2018-07-13 3:28 ` Re: [Qemu-devel] " Michael S. Tsirkin 2018-07-13 3:28 ` [virtio-dev] " Michael S. Tsirkin 2018-07-13 3:28 ` [Qemu-devel] [virtio-dev] " Michael S. Tsirkin 2018-07-13 9:15 ` Re: [Qemu-devel] " Cornelia Huck 2018-07-13 9:15 ` [virtio-dev] " Cornelia Huck 2018-07-13 9:15 ` [Qemu-devel] [virtio-dev] " Cornelia Huck 2018-07-12 19:18 ` Re: [Qemu-devel] " Michael S. Tsirkin 2018-07-12 19:18 ` [virtio-dev] " Michael S. Tsirkin 2018-07-12 19:18 ` [Qemu-devel] [virtio-dev] " Michael S. Tsirkin 2018-07-10 1:58 ` [Qemu-devel] " Michael S. Tsirkin 2018-07-10 1:58 ` [virtio-dev] " Michael S. Tsirkin 2018-07-10 18:56 ` Siwei Liu 2018-07-10 18:56 ` [virtio-dev] " Siwei Liu 2018-07-10 18:56 ` [Qemu-devel] [virtio-dev] " Siwei Liu 2018-07-10 2:05 ` [Qemu-devel] " Michael S. Tsirkin 2018-07-10 2:05 ` [virtio-dev] " Michael S. Tsirkin 2018-07-04 5:43 ` Michael S. Tsirkin 2018-07-04 5:43 ` [virtio-dev] " Michael S. Tsirkin 2018-07-10 2:11 ` Michael S. Tsirkin 2018-07-10 2:11 ` [virtio-dev] " Michael S. Tsirkin 2018-07-10 14:28 ` [Qemu-devel] " Venu Busireddy 2018-07-10 14:28 ` [virtio-dev] " Venu Busireddy 2018-07-12 21:01 ` [Qemu-devel] " Michael S. Tsirkin 2018-07-12 21:01 ` [virtio-dev] " Michael S. Tsirkin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180629221907.3662-2-venu.busireddy@oracle.com \ --to=venu.busireddy@oracle.com \ --cc=marcel@redhat.com \ --cc=mst@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=virtio-dev@lists.oasis-open.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.