From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E39E1606A335 for ; Wed, 2 Dec 2026 10:51:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QImPmwBi Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xYhvZ-00019f-5W; Wed, 02 Dec 2026 05:51:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYhvX-00019R-Gi for qemu-devel@nongnu.org; Wed, 02 Dec 2026 05:51:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYhvV-00071t-KQ for qemu-devel@nongnu.org; Wed, 02 Dec 2026 05:51:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796208665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ipBKcilfqSgUHi84eLhjUwttbn9EOiE3pGQLOpvmzao=; b=QImPmwBicfgr3wqPg5q6ZUfiYNbsBd43CpiVW+lSl1XISK9qQLyrv4AR2Cw1QKo52qssVq QR5HxfeeH9sUFFjyg2Vjm00OQUta6bI8+IyPDBOmH98/7u3oc77KRKmdlWzWBQElcmJFHd dHViyCiLkDS/jVR+ThVDAtDdHuB87KY= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-241-3l0J-gt-NHGN8FejmCe0Ww-1; Wed, 2 Dec 2026 10:49:54 +0000 X-MC-Unique: 3l0J-gt-NHGN8FejmCe0Ww-1 X-Mimecast-MFC-AGG-ID: 3l0J-gt-NHGN8FejmCe0Ww_1796208593 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3721F1933E10 for ; Wed, 2 Dec 2026 10:49:53 +0000 (UTC) Received: from Alexs-MacBook-Air.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EE88018088B6; Wed, 2 Dec 2026 10:49:51 +0000 (UTC) From: Alex Fishman To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" Subject: [PATCH] virtio-pci: add a PCIe Device Serial Number (DSN) Date: Wed, 2 Dec 2026 12:49:35 +0200 Message-ID: <20261202104935.29518-1-afishman@redhat.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass client-ip=170.10.133.124; envelope-from=afishman@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 --- 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)