hw/virtio/virtio-pci.c | 7 +++++++ include/hw/virtio/virtio-pci.h | 1 + 2 files changed, 8 insertions(+)
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)
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)
I don't understand your comment. Also what would you call it instead of
"x-pcie-dsn"? ""pcie-dsn", "dsn" ?
On Wed, Dec 2, 2026 at 2:38 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> 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)
>
>
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)
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)
© 2016 - 2026 Red Hat, Inc.