Re: [PATCH v12 07/25] CXL/PCI: Move CXL DVSEC definitions into uapi/linux/pci_regs.h
From: Jonathan Cameron
Date: Wed Oct 01 2025 - 11:59:18 EST
On Thu, 25 Sep 2025 17:34:22 -0500
Terry Bowman <terry.bowman@xxxxxxx> wrote:
> The CXL DVSECs are currently defined in cxl/core/cxlpci.h. These are not
> accessible to other subsystems.
>
> Change DVSEC name formatting to follow the existing PCI format in
> pci_regs.h. The current format uses CXL_DVSEC_XYZ. Change to be PCI_DVSEC_CXL_XYZ.
> Reuse the existing formatting.
>
> Update existing occurrences to match the name change.
>
> Update the inline documentation to refer to latest CXL spec version.
>
> Signed-off-by: Terry Bowman <terry.bowman@xxxxxxx>
Maybe we discussed it in earlier versions and I've forgotten but generally renaming
uapi defines is a non starter.
I was kind of assuming lspci used these, but nope, it uses hard coded
value of 3 and it's own defines for the fields. (A younger me even reviewed
the patch adding those :) )
https://github.com/pciutils/pciutils/blob/master/ls-ecaps.c#L1279
However, that doesn't mean other code isn't already using those defines.
Minimum I think would be to state here why you think we can get away with
this change.
Personally I'd just not bother changing that one.
Jonathan
> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> index f5b17745de60..bd03799612d3 100644
> --- a/include/uapi/linux/pci_regs.h
> +++ b/include/uapi/linux/pci_regs.h
> @@ -1234,9 +1234,64 @@
> /* Deprecated old name, replaced with PCI_DOE_DATA_OBJECT_DISC_RSP_3_TYPE */
> #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL PCI_DOE_DATA_OBJECT_DISC_RSP_3_TYPE
>
> -/* Compute Express Link (CXL r3.1, sec 8.1.5) */
> -#define PCI_DVSEC_CXL_PORT 3
This is a userspace header. We can't rename existing definitions
as we have no idea who is using them. Only option would be to
add a comment making the old ones deprecated and adding new ones alongside.
> -#define PCI_DVSEC_CXL_PORT_CTL 0x0c
> -#define PCI_DVSEC_CXL_PORT_CTL_UNMASK_SBR 0x00000001
....
> +/* CXL 3.2 8.1.5: Extensions DVSEC for Ports */
> +#define PCI_DVSEC_CXL_PORT_EXT 3
> +#define PCI_DVSEC_CXL_PORT_EXT_CTL_OFFSET 0x0c
> +#define PCI_DVSEC_CXL_PORT_EXT_CTL_UNMASK_SBR 0x00000001