[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/55] mem/cxl-type3: Add sn option to provide serial number for P
From: |
Michael S. Tsirkin |
Subject: |
[PULL 28/55] mem/cxl-type3: Add sn option to provide serial number for PCI ecap |
Date: |
Mon, 10 Oct 2022 13:30:41 -0400 |
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The Device Serial Number Extended Capability PCI r6.0 sec 7.9.3
provides a standard way to provide a device serial number as
an IEEE defined 64-bit extended unique identifier EUI-64.
CXL 2.0 section 8.1.12.2 Memory Device PCIe Capabilities and
Extended Capabilities requires this to be used to uniquely
identify CXL memory devices.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20220923161835.9805-1-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Ben Widawsky <bwidawsk@kernel.org>
---
include/hw/cxl/cxl_device.h | 1 +
hw/mem/cxl_type3.c | 14 +++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h
index 1e141b6621..e4d221cdb3 100644
--- a/include/hw/cxl/cxl_device.h
+++ b/include/hw/cxl/cxl_device.h
@@ -237,6 +237,7 @@ struct CXLType3Dev {
/* Properties */
HostMemoryBackend *hostmem;
HostMemoryBackend *lsa;
+ uint64_t sn;
/* State */
AddressSpace hostmem_as;
diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
index ada2108fac..a71bf1afeb 100644
--- a/hw/mem/cxl_type3.c
+++ b/hw/mem/cxl_type3.c
@@ -14,6 +14,12 @@
#include "sysemu/hostmem.h"
#include "hw/cxl/cxl.h"
+/*
+ * Null value of all Fs suggested by IEEE RA guidelines for use of
+ * EU, OUI and CID
+ */
+#define UI64_NULL ~(0ULL)
+
static void build_dvsecs(CXLType3Dev *ct3d)
{
CXLComponentState *cxl_cstate = &ct3d->cxl_cstate;
@@ -149,7 +155,12 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
pci_config_set_class(pci_conf, PCI_CLASS_MEMORY_CXL);
pcie_endpoint_cap_init(pci_dev, 0x80);
- cxl_cstate->dvsec_offset = 0x100;
+ if (ct3d->sn != UI64_NULL) {
+ pcie_dev_ser_num_init(pci_dev, 0x100, ct3d->sn);
+ cxl_cstate->dvsec_offset = 0x100 + 0x0c;
+ } else {
+ cxl_cstate->dvsec_offset = 0x100;
+ }
ct3d->cxl_cstate.pdev = pci_dev;
build_dvsecs(ct3d);
@@ -275,6 +286,7 @@ static Property ct3_props[] = {
HostMemoryBackend *),
DEFINE_PROP_LINK("lsa", CXLType3Dev, lsa, TYPE_MEMORY_BACKEND,
HostMemoryBackend *),
+ DEFINE_PROP_UINT64("sn", CXLType3Dev, sn, UI64_NULL),
DEFINE_PROP_END_OF_LIST(),
};
--
MST
- [PULL 18/55] tests/qtest: add a get_features op to vhost-user-test, (continued)
- [PULL 18/55] tests/qtest: add a get_features op to vhost-user-test, Michael S. Tsirkin, 2022/10/10
- [PULL 19/55] tests/qtest: enable tests for virtio-gpio, Michael S. Tsirkin, 2022/10/10
- [PULL 20/55] virtio: introduce VirtIOConfigSizeParams & virtio_get_config_size, Michael S. Tsirkin, 2022/10/10
- [PULL 21/55] virtio-blk: move config size params to virtio-blk-common, Michael S. Tsirkin, 2022/10/10
- [PULL 22/55] vhost-user-blk: make it possible to disable write-zeroes/discard, Michael S. Tsirkin, 2022/10/10
- [PULL 23/55] vhost-user-blk: make 'config_wce' part of 'host_features', Michael S. Tsirkin, 2022/10/10
- [PULL 24/55] vhost-user-blk: dynamically resize config space based on features, Michael S. Tsirkin, 2022/10/10
- [PULL 25/55] tests/acpi: virt: allow acpi GTDT changes, Michael S. Tsirkin, 2022/10/10
- [PULL 26/55] acpi: arm/virt: build_gtdt: fix invalid 64-bit physical addresses, Michael S. Tsirkin, 2022/10/10
- [PULL 27/55] tests/acpi: virt: update ACPI GTDT binaries, Michael S. Tsirkin, 2022/10/10
- [PULL 28/55] mem/cxl-type3: Add sn option to provide serial number for PCI ecap,
Michael S. Tsirkin <=
- [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks", Michael S. Tsirkin, 2022/10/10
[PULL 31/55] qmp: add QMP command x-query-virtio-status, Michael S. Tsirkin, 2022/10/10
[PULL 30/55] qmp: add QMP command x-query-virtio, Michael S. Tsirkin, 2022/10/10
[PULL 33/55] qmp: add QMP commands for virtio/vhost queue-status, Michael S. Tsirkin, 2022/10/10
[PULL 32/55] qmp: decode feature & status bits in virtio-status, Michael S. Tsirkin, 2022/10/10
[PULL 34/55] qmp: add QMP command x-query-virtio-queue-element, Michael S. Tsirkin, 2022/10/10