* [PATCH] virtio-pci: add a PCIe Device Serial Number (DSN)
@ 2026-12-02 10:49 Alex Fishman
2026-12-02 12:26 ` Michael S. Tsirkin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Alex Fishman @ 2026-12-02 10:49 UTC (permalink / raw)
To: qemu-devel; +Cc: Michael S. Tsirkin
Add a 64-bit x-pcie-dsn property to the shared virtio-pci transport.
This lets a user supply a stable PCIe identity for endpoints such
as virtio-blk devices and virtio-scsi controllers.
When Windows processes the PCIe DSN capability, it can use the DSN
to construct a PnP instance ID that remains stable across PCI
topology changes.
Signed-off-by: Alex Fishman <afishman@redhat.com>
---
hw/virtio/virtio-pci.c | 7 +++++++
include/hw/virtio/virtio-pci.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 9ff8b63..f2f6cb6 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -2306,6 +2306,12 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
proxy->last_pcie_cap_offset += PCI_EXT_CAP_ATS_SIZEOF;
}
+ if (proxy->dsn) {
+ pcie_dev_ser_num_init(pci_dev, proxy->last_pcie_cap_offset,
+ proxy->dsn);
+ proxy->last_pcie_cap_offset += PCI_EXT_CAP_DSN_SIZEOF;
+ }
+
/* Set Function Level Reset capability bit */
pcie_cap_flr_init(pci_dev);
} else {
@@ -2415,6 +2421,7 @@ static const Property virtio_pci_properties[] = {
VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT, false),
DEFINE_PROP_BIT("aer", VirtIOPCIProxy, flags,
VIRTIO_PCI_FLAG_AER_BIT, false),
+ DEFINE_PROP_UINT64("x-pcie-dsn", VirtIOPCIProxy, dsn, 0),
};
static void virtio_pci_dc_realize(DeviceState *qdev, Error **errp)
diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h
index b2738ce..d4f3ba7 100644
--- a/include/hw/virtio/virtio-pci.h
+++ b/include/hw/virtio/virtio-pci.h
@@ -141,6 +141,7 @@ struct VirtIOPCIProxy {
uint32_t nvectors;
uint32_t dfselect;
uint32_t gfselect;
+ uint64_t dsn;
uint32_t guest_features[VIRTIO_FEATURES_NU32S];
VirtIOPCIQueue vqs[VIRTIO_QUEUE_MAX];
--
2.54.0 (Apple Git-157)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio-pci: add a PCIe Device Serial Number (DSN)
2026-12-02 10:49 [PATCH] virtio-pci: add a PCIe Device Serial Number (DSN) Alex Fishman
@ 2026-12-02 12:26 ` Michael S. Tsirkin
2026-12-02 12:29 ` Michael S. Tsirkin
2026-12-02 12:37 ` Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2026-12-02 12:26 UTC (permalink / raw)
To: Alex Fishman; +Cc: qemu-devel
On Wed, Dec 02, 2026 at 12:49:35PM +0200, Alex Fishman wrote:
> Add a 64-bit x-pcie-dsn property to the shared virtio-pci transport.
> This lets a user supply a stable PCIe identity for endpoints such
> as virtio-blk devices and virtio-scsi controllers.
>
> When Windows processes the PCIe DSN capability, it can use the DSN
> to construct a PnP instance ID that remains stable across PCI
> topology changes.
>
> Signed-off-by: Alex Fishman <afishman@redhat.com>
If it's designed for actual users, it can not start with x- -
these are not guaranteed to be stable across releases.
> ---
> hw/virtio/virtio-pci.c | 7 +++++++
> include/hw/virtio/virtio-pci.h | 1 +
> 2 files changed, 8 insertions(+)
>
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 9ff8b63..f2f6cb6 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -2306,6 +2306,12 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
> proxy->last_pcie_cap_offset += PCI_EXT_CAP_ATS_SIZEOF;
> }
>
> + if (proxy->dsn) {
> + pcie_dev_ser_num_init(pci_dev, proxy->last_pcie_cap_offset,
> + proxy->dsn);
> + proxy->last_pcie_cap_offset += PCI_EXT_CAP_DSN_SIZEOF;
> + }
> +
Need to make sure users do not set this with non pcie devices.
> /* Set Function Level Reset capability bit */
> pcie_cap_flr_init(pci_dev);
> } else {
> @@ -2415,6 +2421,7 @@ static const Property virtio_pci_properties[] = {
> VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT, false),
> DEFINE_PROP_BIT("aer", VirtIOPCIProxy, flags,
> VIRTIO_PCI_FLAG_AER_BIT, false),
> + DEFINE_PROP_UINT64("x-pcie-dsn", VirtIOPCIProxy, dsn, 0),
> };
>
> static void virtio_pci_dc_realize(DeviceState *qdev, Error **errp)
> diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h
> index b2738ce..d4f3ba7 100644
> --- a/include/hw/virtio/virtio-pci.h
> +++ b/include/hw/virtio/virtio-pci.h
> @@ -141,6 +141,7 @@ struct VirtIOPCIProxy {
> uint32_t nvectors;
> uint32_t dfselect;
> uint32_t gfselect;
> + uint64_t dsn;
> uint32_t guest_features[VIRTIO_FEATURES_NU32S];
> VirtIOPCIQueue vqs[VIRTIO_QUEUE_MAX];
>
> --
> 2.54.0 (Apple Git-157)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio-pci: add a PCIe Device Serial Number (DSN)
2026-12-02 10:49 [PATCH] virtio-pci: add a PCIe Device Serial Number (DSN) Alex Fishman
2026-12-02 12:26 ` Michael S. Tsirkin
@ 2026-12-02 12:29 ` Michael S. Tsirkin
2026-12-02 12:37 ` Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2026-12-02 12:29 UTC (permalink / raw)
To: Alex Fishman; +Cc: qemu-devel
On Wed, Dec 02, 2026 at 12:49:35PM +0200, Alex Fishman wrote:
> Add a 64-bit x-pcie-dsn property to the shared virtio-pci transport.
> This lets a user supply a stable PCIe identity for endpoints such
> as virtio-blk devices and virtio-scsi controllers.
>
> When Windows processes the PCIe DSN capability, it can use the DSN
> to construct a PnP instance ID that remains stable across PCI
> topology changes.
>
> Signed-off-by: Alex Fishman <afishman@redhat.com>
> ---
> hw/virtio/virtio-pci.c | 7 +++++++
> include/hw/virtio/virtio-pci.h | 1 +
> 2 files changed, 8 insertions(+)
>
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 9ff8b63..f2f6cb6 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -2306,6 +2306,12 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
> proxy->last_pcie_cap_offset += PCI_EXT_CAP_ATS_SIZEOF;
> }
>
> + if (proxy->dsn) {
> + pcie_dev_ser_num_init(pci_dev, proxy->last_pcie_cap_offset,
> + proxy->dsn);
> + proxy->last_pcie_cap_offset += PCI_EXT_CAP_DSN_SIZEOF;
> + }
> +
> /* Set Function Level Reset capability bit */
> pcie_cap_flr_init(pci_dev);
> } else {
> @@ -2415,6 +2421,7 @@ static const Property virtio_pci_properties[] = {
> VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT, false),
> DEFINE_PROP_BIT("aer", VirtIOPCIProxy, flags,
> VIRTIO_PCI_FLAG_AER_BIT, false),
> + DEFINE_PROP_UINT64("x-pcie-dsn", VirtIOPCIProxy, dsn, 0),
> };
this dsn is "pcie" as opposed to what? is there another dsn
we are disambiguiating against?
> static void virtio_pci_dc_realize(DeviceState *qdev, Error **errp)
> diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h
> index b2738ce..d4f3ba7 100644
> --- a/include/hw/virtio/virtio-pci.h
> +++ b/include/hw/virtio/virtio-pci.h
> @@ -141,6 +141,7 @@ struct VirtIOPCIProxy {
> uint32_t nvectors;
> uint32_t dfselect;
> uint32_t gfselect;
> + uint64_t dsn;
> uint32_t guest_features[VIRTIO_FEATURES_NU32S];
> VirtIOPCIQueue vqs[VIRTIO_QUEUE_MAX];
>
> --
> 2.54.0 (Apple Git-157)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio-pci: add a PCIe Device Serial Number (DSN)
2026-12-02 10:49 [PATCH] virtio-pci: add a PCIe Device Serial Number (DSN) Alex Fishman
2026-12-02 12:26 ` Michael S. Tsirkin
2026-12-02 12:29 ` Michael S. Tsirkin
@ 2026-12-02 12:37 ` Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2026-12-02 12:37 UTC (permalink / raw)
To: Alex Fishman; +Cc: qemu-devel
On Wed, Dec 02, 2026 at 12:49:35PM +0200, Alex Fishman wrote:
> Add a 64-bit x-pcie-dsn property to the shared virtio-pci transport.
> This lets a user supply a stable PCIe identity for endpoints such
> as virtio-blk devices and virtio-scsi controllers.
>
> When Windows processes the PCIe DSN capability, it can use the DSN
> to construct a PnP instance ID that remains stable across PCI
> topology changes.
>
> Signed-off-by: Alex Fishman <afishman@redhat.com>
> ---
> hw/virtio/virtio-pci.c | 7 +++++++
> include/hw/virtio/virtio-pci.h | 1 +
> 2 files changed, 8 insertions(+)
>
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 9ff8b63..f2f6cb6 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -2306,6 +2306,12 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
> proxy->last_pcie_cap_offset += PCI_EXT_CAP_ATS_SIZEOF;
> }
>
> + if (proxy->dsn) {
> + pcie_dev_ser_num_init(pci_dev, proxy->last_pcie_cap_offset,
> + proxy->dsn);
> + proxy->last_pcie_cap_offset += PCI_EXT_CAP_DSN_SIZEOF;
> + }
> +
> /* Set Function Level Reset capability bit */
> pcie_cap_flr_init(pci_dev);
> } else {
> @@ -2415,6 +2421,7 @@ static const Property virtio_pci_properties[] = {
> VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT, false),
> DEFINE_PROP_BIT("aer", VirtIOPCIProxy, flags,
> VIRTIO_PCI_FLAG_AER_BIT, false),
> + DEFINE_PROP_UINT64("x-pcie-dsn", VirtIOPCIProxy, dsn, 0),
maybe "dns"?
And maybe, UI64_NULL?
> };
>
> static void virtio_pci_dc_realize(DeviceState *qdev, Error **errp)
> diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h
> index b2738ce..d4f3ba7 100644
> --- a/include/hw/virtio/virtio-pci.h
> +++ b/include/hw/virtio/virtio-pci.h
> @@ -141,6 +141,7 @@ struct VirtIOPCIProxy {
> uint32_t nvectors;
> uint32_t dfselect;
> uint32_t gfselect;
> + uint64_t dsn;
why here, in the middle of the virtio transport implementation?
> uint32_t guest_features[VIRTIO_FEATURES_NU32S];
> VirtIOPCIQueue vqs[VIRTIO_QUEUE_MAX];
>
> --
> 2.54.0 (Apple Git-157)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-02 12:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 10:49 [PATCH] virtio-pci: add a PCIe Device Serial Number (DSN) Alex Fishman
2026-12-02 12:26 ` Michael S. Tsirkin
2026-12-02 12:29 ` Michael S. Tsirkin
2026-12-02 12:37 ` Michael S. Tsirkin
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.