[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 26/68] pcie: Support PCIe Gen5/Gen6 link speeds
From: |
Michael S. Tsirkin |
Subject: |
[PULL 26/68] pcie: Support PCIe Gen5/Gen6 link speeds |
Date: |
Tue, 12 Mar 2024 18:26:50 -0400 |
From: Lukas Stockner <lstockner@genesiscloud.com>
This patch extends the PCIe link speed option so that slots can be
configured as supporting 32GT/s (Gen5) or 64GT/s (Gen5) speeds.
This is as simple as setting the appropriate bit in LnkCap2 and
the appropriate value in LnkCap and LnkCtl2.
Signed-off-by: Lukas Stockner <lstockner@genesiscloud.com>
Message-Id: <20240215012326.3272366-1-lstockner@genesiscloud.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
qapi/common.json | 6 +++++-
include/hw/pci/pcie_regs.h | 2 ++
hw/core/qdev-properties-system.c | 16 ++++++++++++++--
hw/pci/pcie.c | 8 ++++++++
4 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/qapi/common.json b/qapi/common.json
index f1bb841951..867a9ad9b0 100644
--- a/qapi/common.json
+++ b/qapi/common.json
@@ -107,10 +107,14 @@
#
# @16: 16.0GT/s
#
+# @32: 32.0GT/s
+#
+# @64: 64.0GT/s
+#
# Since: 4.0
##
{ 'enum': 'PCIELinkSpeed',
- 'data': [ '2_5', '5', '8', '16' ] }
+ 'data': [ '2_5', '5', '8', '16', '32', '64' ] }
##
# @PCIELinkWidth:
diff --git a/include/hw/pci/pcie_regs.h b/include/hw/pci/pcie_regs.h
index 4972106c42..9d3b6868dc 100644
--- a/include/hw/pci/pcie_regs.h
+++ b/include/hw/pci/pcie_regs.h
@@ -39,6 +39,8 @@ typedef enum PCIExpLinkSpeed {
QEMU_PCI_EXP_LNK_5GT,
QEMU_PCI_EXP_LNK_8GT,
QEMU_PCI_EXP_LNK_16GT,
+ QEMU_PCI_EXP_LNK_32GT,
+ QEMU_PCI_EXP_LNK_64GT,
} PCIExpLinkSpeed;
#define QEMU_PCI_EXP_LNKCAP_MLS(speed) (speed)
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index b45e90edb2..28ce6162c7 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -955,7 +955,7 @@ const PropertyInfo qdev_prop_off_auto_pcibar = {
.set_default_value = qdev_propinfo_set_default_value_enum,
};
-/* --- PCIELinkSpeed 2_5/5/8/16 -- */
+/* --- PCIELinkSpeed 2_5/5/8/16/32/64 -- */
static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
@@ -977,6 +977,12 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor
*v, const char *name,
case QEMU_PCI_EXP_LNK_16GT:
speed = PCIE_LINK_SPEED_16;
break;
+ case QEMU_PCI_EXP_LNK_32GT:
+ speed = PCIE_LINK_SPEED_32;
+ break;
+ case QEMU_PCI_EXP_LNK_64GT:
+ speed = PCIE_LINK_SPEED_64;
+ break;
default:
/* Unreachable */
abort();
@@ -1010,6 +1016,12 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor
*v, const char *name,
case PCIE_LINK_SPEED_16:
*p = QEMU_PCI_EXP_LNK_16GT;
break;
+ case PCIE_LINK_SPEED_32:
+ *p = QEMU_PCI_EXP_LNK_32GT;
+ break;
+ case PCIE_LINK_SPEED_64:
+ *p = QEMU_PCI_EXP_LNK_64GT;
+ break;
default:
/* Unreachable */
abort();
@@ -1018,7 +1030,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor
*v, const char *name,
const PropertyInfo qdev_prop_pcie_link_speed = {
.name = "PCIELinkSpeed",
- .description = "2_5/5/8/16",
+ .description = "2_5/5/8/16/32/64",
.enum_table = &PCIELinkSpeed_lookup,
.get = get_prop_pcielinkspeed,
.set = set_prop_pcielinkspeed,
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 6db0cf69cd..0b4817e144 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -153,6 +153,14 @@ static void pcie_cap_fill_slot_lnk(PCIDevice *dev)
pci_long_test_and_set_mask(exp_cap + PCI_EXP_LNKCAP2,
PCI_EXP_LNKCAP2_SLS_16_0GB);
}
+ if (s->speed > QEMU_PCI_EXP_LNK_16GT) {
+ pci_long_test_and_set_mask(exp_cap + PCI_EXP_LNKCAP2,
+ PCI_EXP_LNKCAP2_SLS_32_0GB);
+ }
+ if (s->speed > QEMU_PCI_EXP_LNK_32GT) {
+ pci_long_test_and_set_mask(exp_cap + PCI_EXP_LNKCAP2,
+ PCI_EXP_LNKCAP2_SLS_64_0GB);
+ }
}
}
--
MST
- [PULL 01/68] vdpa: add back vhost_vdpa_net_first_nc_vdpa, (continued)
- [PULL 01/68] vdpa: add back vhost_vdpa_net_first_nc_vdpa, Michael S. Tsirkin, 2024/03/12
- [PULL 11/68] vdpa: fix network breakage after cancelling migration, Michael S. Tsirkin, 2024/03/12
- [PULL 13/68] libvhost-user: Bump up VHOST_USER_MAX_RAM_SLOTS to 509, Michael S. Tsirkin, 2024/03/12
- [PULL 14/68] libvhost-user: Factor out removing all mem regions, Michael S. Tsirkin, 2024/03/12
- [PULL 15/68] libvhost-user: Merge vu_set_mem_table_exec_postcopy() into vu_set_mem_table_exec(), Michael S. Tsirkin, 2024/03/12
- [PULL 16/68] libvhost-user: Factor out adding a memory region, Michael S. Tsirkin, 2024/03/12
- [PULL 17/68] libvhost-user: No need to check for NULL when unmapping, Michael S. Tsirkin, 2024/03/12
- [PULL 18/68] libvhost-user: Don't zero out memory for memory regions, Michael S. Tsirkin, 2024/03/12
- [PULL 19/68] libvhost-user: Don't search for duplicates when removing memory regions, Michael S. Tsirkin, 2024/03/12
- [PULL 23/68] libvhost-user: Factor out vq usability check, Michael S. Tsirkin, 2024/03/12
- [PULL 26/68] pcie: Support PCIe Gen5/Gen6 link speeds,
Michael S. Tsirkin <=
- [PULL 21/68] libvhost-user: Speedup gpa_to_mem_region() and vu_gpa_to_va(), Michael S. Tsirkin, 2024/03/12
- [PULL 22/68] libvhost-user: Use most of mmap_offset as fd_offset, Michael S. Tsirkin, 2024/03/12
- [PULL 27/68] vdpa: stash memory region properties in vars, Michael S. Tsirkin, 2024/03/12
- [PULL 20/68] libvhost-user: Factor out search for memory region by GPA and simplify, Michael S. Tsirkin, 2024/03/12
- [PULL 24/68] libvhost-user: Dynamically remap rings after (temporarily?) removing memory regions, Michael S. Tsirkin, 2024/03/12
- [PULL 28/68] vdpa: trace skipped memory sections, Michael S. Tsirkin, 2024/03/12
- [PULL 29/68] hw/pci-bridge/pxb-cxl: Drop RAS capability from host bridge., Michael S. Tsirkin, 2024/03/12
- [PULL 30/68] hw/audio/virtio-sound: return correct command response size, Michael S. Tsirkin, 2024/03/12
- [PULL 31/68] hw/virtio: check owner for removing objects, Michael S. Tsirkin, 2024/03/12
- [PULL 33/68] hw/cxl/cxl-host: Fix missing ERRP_GUARD() in cxl_fixed_memory_window_config(), Michael S. Tsirkin, 2024/03/12