cxl: Rename ACPI_CEDT_CFMWS_RESTRICT_TYPE2/TYPE3
Subsystems (3)
PATCH 1/1 cxl: Rename ACPI_CEDT_CFMWS_RESTRICT_TYPE2/TYPE3
According to the description of the "Window Restrictions" field of "CFMWS Structure" in the CXL spec v3.1 section 9.18.1.3: CXL Fixed Memory Window Structure (CFMWS), the bit 0 of "Window Restrictions" is formerly known as "CXL Type 2 Memory" and renamed to "Device Coherent", while the bit 1 is formerly known as "CXL Type 3 Memory" and renamed to "Host-only Coherent". Because type 3 memory can only be host-only coherent before, while it can be host-only coherent or device coherent with "Back-Invalidate" now.
To avoid confusion about type 2/3 memory and device/host-only coherent in Linux kernel, the patch renames corresponding bit definition from ACPI_CEDT_CFMWS_RESTRICT_TYPE2/TYPE3 to ACPI_CEDT_CFMWS_RESTRICT_DEVMEM/HOSTONLYMEM. This makes the kernel code consistent with the spec too.
The patch also renames the corresponding cxl_decoder flags CXL_DECODER_F_TYPE2/TYPE3 to CXL_DECODER_F_DEVMEM/HOSTONLYMEM.
No functionality change is expected.
--- drivers/cxl/acpi.c | 8 ++++---- drivers/cxl/core/port.c | 8 ++++---- drivers/cxl/cxl.h | 14 +++++++------- include/acpi/actbl1.h | 10 +++++----- tools/testing/cxl/test/cxl.c | 18 +++++++++--------- 5 files changed, 29 insertions(+), 29 deletions(-)
drivers/cxl/acpi.c +4 -4
@@ -115,10 +115,10 @@ static unsigned long cfmws_to_decoder_flags(int restrictions) {unsigned long flags =CXL_DECODER_F_ENABLE ; -if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_TYPE2 ) - flags |=CXL_DECODER_F_TYPE2 ; -if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_TYPE3 ) - flags |=CXL_DECODER_F_TYPE3 ; +if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_DEVMEM ) + flags |=CXL_DECODER_F_DEVMEM ; +if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM ) + flags |=CXL_DECODER_F_HOSTONLYMEM ;if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_VOLATILE ) flags |=CXL_DECODER_F_RAM ;if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_PMEM )
drivers/cxl/core/port.c +4 -4
@@ -125,8 +125,8 @@ static DEVICE_ATTR_RO(name)CXL_DECODER_FLAG_ATTR (cap_pmem,CXL_DECODER_F_PMEM );CXL_DECODER_FLAG_ATTR (cap_ram,CXL_DECODER_F_RAM ); -CXL_DECODER_FLAG_ATTR (cap_type2,CXL_DECODER_F_TYPE2 ); -CXL_DECODER_FLAG_ATTR (cap_type3,CXL_DECODER_F_TYPE3 ); +CXL_DECODER_FLAG_ATTR (cap_type2,CXL_DECODER_F_DEVMEM ); +CXL_DECODER_FLAG_ATTR (cap_type3,CXL_DECODER_F_HOSTONLYMEM );CXL_DECODER_FLAG_ATTR (locked,CXL_DECODER_F_LOCK ); static ssize_t target_type_show(struct device *dev,
@@ -326,14 +326,14 @@ static struct attribute *cxl_decoder_root_attrs[] = {static bool can_create_pmem (struct cxl_root_decoder *cxlrd) { -unsigned long flags =CXL_DECODER_F_TYPE3 |CXL_DECODER_F_PMEM ; +unsigned long flags =CXL_DECODER_F_HOSTONLYMEM |CXL_DECODER_F_PMEM ;return (cxlrd->cxlsd.cxld.flags & flags) == flags; }static bool can_create_ram (struct cxl_root_decoder *cxlrd) { -unsigned long flags =CXL_DECODER_F_TYPE3 |CXL_DECODER_F_RAM ; +unsigned long flags =CXL_DECODER_F_HOSTONLYMEM |CXL_DECODER_F_RAM ;return (cxlrd->cxlsd.cxld.flags & flags) == flags; }
drivers/cxl/cxl.h +7 -7
@@ -315,13 +315,13 @@ resource_size_t cxl_rcd_component_reg_phys(struct device *dev,* Additionally indicate whether decoder settings were autodetected, * user customized. */ -#define CXL_DECODER_F_RAM BIT(0) -#define CXL_DECODER_F_PMEM BIT(1) -#define CXL_DECODER_F_TYPE2 BIT(2) -#define CXL_DECODER_F_TYPE3 BIT(3) -#define CXL_DECODER_F_LOCK BIT(4) -#define CXL_DECODER_F_ENABLE BIT(5) -#define CXL_DECODER_F_MASK GENMASK(5, 0) +#define CXL_DECODER_F_RAM BIT(0) +#define CXL_DECODER_F_PMEM BIT(1) +#define CXL_DECODER_F_DEVMEM BIT(2) +#define CXL_DECODER_F_HOSTONLYMEM BIT(3) +#define CXL_DECODER_F_LOCK BIT(4) +#define CXL_DECODER_F_ENABLE BIT(5) +#define CXL_DECODER_F_MASK GENMASK(5, 0)enum cxl_decoder_type {CXL_DECODER_DEVMEM =2 ,
include/acpi/actbl1.h +5 -5
@@ -551,11 +551,11 @@ struct acpi_cedt_cfmws_target_element {/* Values for Restrictions field above */ -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE2 (1) -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE3 (1<<1) -#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) -#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) -#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4) +#define ACPI_CEDT_CFMWS_RESTRICT_DEVMEM (1) +#define ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM (1<<1) +#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) +#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) +#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4)/* 2: CXL XOR Interleave Math Structure */
tools/testing/cxl/test/cxl.c +9 -9
@@ -209,7 +209,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,
@@ -224,7 +224,7 @@ static struct { }, .interleave_ways = 1, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,
@@ -239,7 +239,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,
@@ -254,7 +254,7 @@ static struct { }, .interleave_ways = 1, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,
@@ -269,7 +269,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,
@@ -284,7 +284,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M,
@@ -301,7 +301,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,
@@ -317,7 +317,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 1, .granularity = 0, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,
@@ -333,7 +333,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 2, .granularity = 0, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 16UL,
Signature · 1 line
2.39.2
Quoted 20 lines · Huang Ying
According to the description of the "Window Restrictions" field of "CFMWS Structure" in the CXL spec v3.1 section 9.18.1.3: CXL Fixed Memory Window Structure (CFMWS), the bit 0 of "Window Restrictions" is formerly known as "CXL Type 2 Memory" and renamed to "Device Coherent", while the bit 1 is formerly known as "CXL Type 3 Memory" and renamed to "Host-only Coherent". Because type 3 memory can only be host-only coherent before, while it can be host-only coherent or device coherent with "Back-Invalidate" now.
To avoid confusion about type 2/3 memory and device/host-only coherent in Linux kernel, the patch renames corresponding bit definition from ACPI_CEDT_CFMWS_RESTRICT_TYPE2/TYPE3 to ACPI_CEDT_CFMWS_RESTRICT_DEVMEM/HOSTONLYMEM. This makes the kernel code consistent with the spec too.
The patch also renames the corresponding
cxl_decoderflags CXL_DECODER_F_TYPE2/TYPE3 to CXL_DECODER_F_DEVMEM/HOSTONLYMEM.No functionality change is expected.
Quoted 9 lines
Signed-off-by "Huang, Ying" <[email protected]>Suggested-by Jonathan Cameron <[email protected]>Reviewed-by Davidlohr Bueso <[email protected]>Reviewed-by Gregory Price <[email protected]>Cc Dan Williams <[email protected]>Cc Dave Jiang <[email protected]>Cc Alison Schofield <[email protected]>Cc Vishal Verma <[email protected]>Cc Ira Weiny <[email protected]>
Quoted 31 lines · Huang Ying
According to the description of the "Window Restrictions" field of "CFMWS Structure" in the CXL spec v3.1 section 9.18.1.3: CXL Fixed Memory Window Structure (CFMWS), the bit 0 of "Window Restrictions" is formerly known as "CXL Type 2 Memory" and renamed to "Device Coherent", while the bit 1 is formerly known as "CXL Type 3 Memory" and renamed to "Host-only Coherent". Because type 3 memory can only be host-only coherent before, while it can be host-only coherent or device coherent with "Back-Invalidate" now.
To avoid confusion about type 2/3 memory and device/host-only coherent in Linux kernel, the patch renames corresponding bit definition from ACPI_CEDT_CFMWS_RESTRICT_TYPE2/TYPE3 to ACPI_CEDT_CFMWS_RESTRICT_DEVMEM/HOSTONLYMEM. This makes the kernel code consistent with the spec too.
The patch also renames the corresponding
cxl_decoderflags CXL_DECODER_F_TYPE2/TYPE3 to CXL_DECODER_F_DEVMEM/HOSTONLYMEM.No functionality change is expected.
Signed-off-by "Huang, Ying" <[email protected]>Suggested-by Jonathan Cameron <[email protected]>Reviewed-by Davidlohr Bueso <[email protected]>Reviewed-by Gregory Price <[email protected]>Cc Dan Williams <[email protected]>Cc Dave Jiang <[email protected]>Cc Alison Schofield <[email protected]>Cc Vishal Verma <[email protected]>Cc Ira Weiny <[email protected]>Cc Alejandro Lucero <[email protected]>Cc Ben Cheatham <[email protected]>
Quoted 1 line
---
Quoted 192 lines
drivers/cxl/acpi.c | 8 ++++---- drivers/cxl/core/port.c | 8 ++++---- drivers/cxl/cxl.h | 14 +++++++------- include/acpi/actbl1.h | 10 +++++----- tools/testing/cxl/test/cxl.c | 18 +++++++++--------- 5 files changed, 29 insertions(+), 29 deletions(-)drivers/cxl/acpi.c +4
-4@@ -115,10 +115,10 @@ static unsigned long cfmws_to_decoder_flags(int restrictions) {unsigned long flags =CXL_DECODER_F_ENABLE ; -if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_TYPE2 ) - flags |=CXL_DECODER_F_TYPE2 ; -if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_TYPE3 ) - flags |=CXL_DECODER_F_TYPE3 ; +if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_DEVMEM ) + flags |=CXL_DECODER_F_DEVMEM ; +if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM ) + flags |=CXL_DECODER_F_HOSTONLYMEM ;if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_VOLATILE ) flags |=CXL_DECODER_F_RAM ;if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_PMEM )drivers/cxl/core/port.c +4
-4@@ -125,8 +125,8 @@ static DEVICE_ATTR_RO(name)CXL_DECODER_FLAG_ATTR (cap_pmem,CXL_DECODER_F_PMEM );CXL_DECODER_FLAG_ATTR (cap_ram,CXL_DECODER_F_RAM ); -CXL_DECODER_FLAG_ATTR (cap_type2,CXL_DECODER_F_TYPE2 ); -CXL_DECODER_FLAG_ATTR (cap_type3,CXL_DECODER_F_TYPE3 ); +CXL_DECODER_FLAG_ATTR (cap_type2,CXL_DECODER_F_DEVMEM ); +CXL_DECODER_FLAG_ATTR (cap_type3,CXL_DECODER_F_HOSTONLYMEM );CXL_DECODER_FLAG_ATTR (locked,CXL_DECODER_F_LOCK ); static ssize_t target_type_show(struct device *dev,@@ -326,14 +326,14 @@ static struct attribute *cxl_decoder_root_attrs[] = {static bool can_create_pmem (struct cxl_root_decoder *cxlrd) { -unsigned long flags =CXL_DECODER_F_TYPE3 |CXL_DECODER_F_PMEM ; +unsigned long flags =CXL_DECODER_F_HOSTONLYMEM |CXL_DECODER_F_PMEM ;return (cxlrd->cxlsd.cxld.flags & flags) == flags; }static bool can_create_ram (struct cxl_root_decoder *cxlrd) { -unsigned long flags =CXL_DECODER_F_TYPE3 |CXL_DECODER_F_RAM ; +unsigned long flags =CXL_DECODER_F_HOSTONLYMEM |CXL_DECODER_F_RAM ;return (cxlrd->cxlsd.cxld.flags & flags) == flags; }drivers/cxl/cxl.h +7
-7@@ -315,13 +315,13 @@ resource_size_t cxl_rcd_component_reg_phys(struct device *dev,* Additionally indicate whether decoder settings were autodetected, * user customized. */ -#define CXL_DECODER_F_RAM BIT(0) -#define CXL_DECODER_F_PMEM BIT(1) -#define CXL_DECODER_F_TYPE2 BIT(2) -#define CXL_DECODER_F_TYPE3 BIT(3) -#define CXL_DECODER_F_LOCK BIT(4) -#define CXL_DECODER_F_ENABLE BIT(5) -#define CXL_DECODER_F_MASK GENMASK(5, 0) +#define CXL_DECODER_F_RAM BIT(0) +#define CXL_DECODER_F_PMEM BIT(1) +#define CXL_DECODER_F_DEVMEM BIT(2) +#define CXL_DECODER_F_HOSTONLYMEM BIT(3) +#define CXL_DECODER_F_LOCK BIT(4) +#define CXL_DECODER_F_ENABLE BIT(5) +#define CXL_DECODER_F_MASK GENMASK(5, 0)enum cxl_decoder_type {CXL_DECODER_DEVMEM =2 ,include/acpi/actbl1.h +5
-5@@ -551,11 +551,11 @@ struct acpi_cedt_cfmws_target_element {/* Values for Restrictions field above */ -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE2 (1) -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE3 (1<<1) -#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) -#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) -#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4) +#define ACPI_CEDT_CFMWS_RESTRICT_DEVMEM (1) +#define ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM (1<<1) +#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) +#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) +#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4)/* 2: CXL XOR Interleave Math Structure */ tools/testing/cxl/test/cxl.c +9
-9@@ -209,7 +209,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -224,7 +224,7 @@ static struct { }, .interleave_ways = 1, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -239,7 +239,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -254,7 +254,7 @@ static struct { }, .interleave_ways = 1, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -269,7 +269,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -284,7 +284,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M,@@ -301,7 +301,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -317,7 +317,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 1, .granularity = 0, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -333,7 +333,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 2, .granularity = 0, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 16UL,Signature · 1 line
2.39.2
Signature · 1 line
Fan Ni
Alison Schofield
maintainerQuoted 63 lines · Ying Huang
According to the description of the "Window Restrictions" field of "CFMWS Structure" in the CXL spec v3.1 section 9.18.1.3: CXL Fixed Memory Window Structure (CFMWS), the bit 0 of "Window Restrictions" is formerly known as "CXL Type 2 Memory" and renamed to "Device Coherent", while the bit 1 is formerly known as "CXL Type 3 Memory" and renamed to "Host-only Coherent". Because type 3 memory can only be host-only coherent before, while it can be host-only coherent or device coherent with "Back-Invalidate" now.
To avoid confusion about type 2/3 memory and device/host-only coherent in Linux kernel, the patch renames corresponding bit definition from ACPI_CEDT_CFMWS_RESTRICT_TYPE2/TYPE3 to ACPI_CEDT_CFMWS_RESTRICT_DEVMEM/HOSTONLYMEM. This makes the kernel code consistent with the spec too.
The patch also renames the corresponding
cxl_decoderflags CXL_DECODER_F_TYPE2/TYPE3 to CXL_DECODER_F_DEVMEM/HOSTONLYMEM.No functionality change is expected.
Signed-off-by "Huang, Ying" <[email protected]>Suggested-by Jonathan Cameron <[email protected]>Reviewed-by Davidlohr Bueso <[email protected]>Reviewed-by Gregory Price <[email protected]>Cc Dan Williams <[email protected]>Cc Dave Jiang <[email protected]>Cc Alison Schofield <[email protected]>Cc Vishal Verma <[email protected]>Cc Ira Weiny <[email protected]>Cc Alejandro Lucero <[email protected]>Cc Ben Cheatham <[email protected]>--- drivers/cxl/acpi.c | 8 ++++---- drivers/cxl/core/port.c | 8 ++++---- drivers/cxl/cxl.h | 14 +++++++------- include/acpi/actbl1.h | 10 +++++----- tools/testing/cxl/test/cxl.c | 18 +++++++++--------- 5 files changed, 29 insertions(+), 29 deletions(-)drivers/cxl/acpi.c +4
-4@@ -115,10 +115,10 @@ static unsigned long cfmws_to_decoder_flags(int restrictions) {unsigned long flags =CXL_DECODER_F_ENABLE ; -if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_TYPE2 ) - flags |=CXL_DECODER_F_TYPE2 ; -if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_TYPE3 ) - flags |=CXL_DECODER_F_TYPE3 ; +if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_DEVMEM ) + flags |=CXL_DECODER_F_DEVMEM ; +if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM ) + flags |=CXL_DECODER_F_HOSTONLYMEM ;if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_VOLATILE ) flags |=CXL_DECODER_F_RAM ;if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_PMEM )drivers/cxl/core/port.c +0
-0
drivers/cxl/core/port.c static DEVICE_ATTR_RO(name) · line 131
Quoted 9 lines
drivers/cxl/core/port.c +2
-2@@ -125,8 +125,8 @@ static DEVICE_ATTR_RO(name)CXL_DECODER_FLAG_ATTR (cap_pmem,CXL_DECODER_F_PMEM );CXL_DECODER_FLAG_ATTR (cap_ram,CXL_DECODER_F_RAM ); -CXL_DECODER_FLAG_ATTR (cap_type2,CXL_DECODER_F_TYPE2 ); -CXL_DECODER_FLAG_ATTR (cap_type3,CXL_DECODER_F_TYPE3 ); +CXL_DECODER_FLAG_ATTR (cap_type2,CXL_DECODER_F_DEVMEM ); +CXL_DECODER_FLAG_ATTR (cap_type3,CXL_DECODER_F_HOSTONLYMEM );CXL_DECODER_FLAG_ATTR (locked,CXL_DECODER_F_LOCK );
Hi Ying,
The commit log explains that type3 can now be 'either/or', so does cap_type3_show() need to emit true for either:
(flags & CXL_DECODER_F_HOSTONLYMEM)
or
(flags & CXL_DECODER_F_DEVMEM) & 'back invalidate')
Does this explanation in the ABI need updating:
What: /sys/bus/cxl/devices/decoderX.Y/cap_{pmem,ram,type2,type3}
Date: June, 2021
KernelVersion: v5.14
Contact: [email protected]Description:
(RO) When a CXL decoder is of devtype "cxl_decoder_root", it represents a fixed memory window identified by platform firmware. A fixed window may only support a subset of memory types. The 'cap_*' attributes indicate whether persistent memory, volatile memory, accelerator memory, and / or expander memory may be mapped behind this decoder's memory window.
--Alison
Quoted 152 lines
drivers/cxl/core/port.c +2
-2static ssize_t target_type_show(struct device *dev,@@ -326,14 +326,14 @@ static struct attribute *cxl_decoder_root_attrs[] = {static bool can_create_pmem (struct cxl_root_decoder *cxlrd) { -unsigned long flags =CXL_DECODER_F_TYPE3 |CXL_DECODER_F_PMEM ; +unsigned long flags =CXL_DECODER_F_HOSTONLYMEM |CXL_DECODER_F_PMEM ;return (cxlrd->cxlsd.cxld.flags & flags) == flags; }static bool can_create_ram (struct cxl_root_decoder *cxlrd) { -unsigned long flags =CXL_DECODER_F_TYPE3 |CXL_DECODER_F_RAM ; +unsigned long flags =CXL_DECODER_F_HOSTONLYMEM |CXL_DECODER_F_RAM ;return (cxlrd->cxlsd.cxld.flags & flags) == flags; }drivers/cxl/cxl.h +7
-7@@ -315,13 +315,13 @@ resource_size_t cxl_rcd_component_reg_phys(struct device *dev,* Additionally indicate whether decoder settings were autodetected, * user customized. */ -#define CXL_DECODER_F_RAM BIT(0) -#define CXL_DECODER_F_PMEM BIT(1) -#define CXL_DECODER_F_TYPE2 BIT(2) -#define CXL_DECODER_F_TYPE3 BIT(3) -#define CXL_DECODER_F_LOCK BIT(4) -#define CXL_DECODER_F_ENABLE BIT(5) -#define CXL_DECODER_F_MASK GENMASK(5, 0) +#define CXL_DECODER_F_RAM BIT(0) +#define CXL_DECODER_F_PMEM BIT(1) +#define CXL_DECODER_F_DEVMEM BIT(2) +#define CXL_DECODER_F_HOSTONLYMEM BIT(3) +#define CXL_DECODER_F_LOCK BIT(4) +#define CXL_DECODER_F_ENABLE BIT(5) +#define CXL_DECODER_F_MASK GENMASK(5, 0)enum cxl_decoder_type {CXL_DECODER_DEVMEM =2 ,include/acpi/actbl1.h +5
-5@@ -551,11 +551,11 @@ struct acpi_cedt_cfmws_target_element {/* Values for Restrictions field above */ -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE2 (1) -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE3 (1<<1) -#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) -#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) -#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4) +#define ACPI_CEDT_CFMWS_RESTRICT_DEVMEM (1) +#define ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM (1<<1) +#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) +#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) +#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4)/* 2: CXL XOR Interleave Math Structure */ tools/testing/cxl/test/cxl.c +9
-9@@ -209,7 +209,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -224,7 +224,7 @@ static struct { }, .interleave_ways = 1, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -239,7 +239,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -254,7 +254,7 @@ static struct { }, .interleave_ways = 1, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -269,7 +269,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -284,7 +284,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M,@@ -301,7 +301,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -317,7 +317,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 1, .granularity = 0, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -333,7 +333,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 2, .granularity = 0, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 16UL,Signature · 1 line
2.39.2
Quoted 65 lines · Alison Schofield
Quoted 64 lines · Ying Huang
According to the description of the "Window Restrictions" field of "CFMWS Structure" in the CXL spec v3.1 section 9.18.1.3: CXL Fixed Memory Window Structure (CFMWS), the bit 0 of "Window Restrictions" is formerly known as "CXL Type 2 Memory" and renamed to "Device Coherent", while the bit 1 is formerly known as "CXL Type 3 Memory" and renamed to "Host-only Coherent". Because type 3 memory can only be host-only coherent before, while it can be host-only coherent or device coherent with "Back-Invalidate" now.
To avoid confusion about type 2/3 memory and device/host-only coherent in Linux kernel, the patch renames corresponding bit definition from ACPI_CEDT_CFMWS_RESTRICT_TYPE2/TYPE3 to ACPI_CEDT_CFMWS_RESTRICT_DEVMEM/HOSTONLYMEM. This makes the kernel code consistent with the spec too.
The patch also renames the corresponding
cxl_decoderflags CXL_DECODER_F_TYPE2/TYPE3 to CXL_DECODER_F_DEVMEM/HOSTONLYMEM.No functionality change is expected.
Signed-off-by "Huang, Ying" <[email protected]>Suggested-by Jonathan Cameron <[email protected]>Reviewed-by Davidlohr Bueso <[email protected]>Reviewed-by Gregory Price <[email protected]>Cc Dan Williams <[email protected]>Cc Dave Jiang <[email protected]>Cc Alison Schofield <[email protected]>Cc Vishal Verma <[email protected]>Cc Ira Weiny <[email protected]>Cc Alejandro Lucero <[email protected]>Cc Ben Cheatham <[email protected]>--- drivers/cxl/acpi.c | 8 ++++---- drivers/cxl/core/port.c | 8 ++++---- drivers/cxl/cxl.h | 14 +++++++------- include/acpi/actbl1.h | 10 +++++----- tools/testing/cxl/test/cxl.c | 18 +++++++++--------- 5 files changed, 29 insertions(+), 29 deletions(-)drivers/cxl/acpi.c +4
-4@@ -115,10 +115,10 @@ static unsigned long cfmws_to_decoder_flags(int restrictions) {unsigned long flags =CXL_DECODER_F_ENABLE ; -if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_TYPE2 ) - flags |=CXL_DECODER_F_TYPE2 ; -if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_TYPE3 ) - flags |=CXL_DECODER_F_TYPE3 ; +if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_DEVMEM ) + flags |=CXL_DECODER_F_DEVMEM ; +if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM ) + flags |=CXL_DECODER_F_HOSTONLYMEM ;if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_VOLATILE ) flags |=CXL_DECODER_F_RAM ;if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_PMEM )drivers/cxl/core/port.c +0
-0@@ -125,8 +125,8 @@ static DEVICE_ATTR_RO(name)
Quoted 9 lines
drivers/cxl/core/port.c static DEVICE_ATTR_RO(name) · line 131
Quoted 8 lines
drivers/cxl/core/port.c +2
-2CXL_DECODER_FLAG_ATTR (cap_pmem,CXL_DECODER_F_PMEM );CXL_DECODER_FLAG_ATTR (cap_ram,CXL_DECODER_F_RAM ); -CXL_DECODER_FLAG_ATTR (cap_type2,CXL_DECODER_F_TYPE2 ); -CXL_DECODER_FLAG_ATTR (cap_type3,CXL_DECODER_F_TYPE3 ); +CXL_DECODER_FLAG_ATTR (cap_type2,CXL_DECODER_F_DEVMEM ); +CXL_DECODER_FLAG_ATTR (cap_type3,CXL_DECODER_F_HOSTONLYMEM );CXL_DECODER_FLAG_ATTR (locked,CXL_DECODER_F_LOCK );Hi Ying,
Hi, Alison,
Quoted 12 lines
The commit log explains that type3 can now be 'either/or', so does
cap_type3_show()need to emit true for either:
(flags &CXL_DECODER_F_HOSTONLYMEM)
or
(flags &CXL_DECODER_F_DEVMEM) & 'back invalidate')Does this explanation in the ABI need updating:
What: /sys/bus/cxl/devices/decoderX.Y/cap_{pmem,ram,type2,type3} Date: June, 2021 KernelVersion: v5.14 Contact: [email protected]
Quoted 7 lines
Description:
(RO) When a CXL decoder is of devtype "cxl_decoder_root", it represents a fixed memory window identified by platform firmware. A fixed window may only support a subset of memory types. The 'cap_*' attributes indicate whether persistent memory, volatile memory, accelerator memory, and / or expander memory may be mapped behind this decoder's memory window.
I think so too. However, I prefer to keep this patch just mechanic renaming and do these changes in another patch. Do you agree?
--
Best Regards,
Huang, Ying
Quoted 153 lines
Quoted 153 lines
drivers/cxl/core/port.c +2
-2static ssize_t target_type_show(struct device *dev,@@ -326,14 +326,14 @@ static struct attribute *cxl_decoder_root_attrs[] = {static bool can_create_pmem (struct cxl_root_decoder *cxlrd) { -unsigned long flags =CXL_DECODER_F_TYPE3 |CXL_DECODER_F_PMEM ; +unsigned long flags =CXL_DECODER_F_HOSTONLYMEM |CXL_DECODER_F_PMEM ;return (cxlrd->cxlsd.cxld.flags & flags) == flags; }static bool can_create_ram (struct cxl_root_decoder *cxlrd) { -unsigned long flags =CXL_DECODER_F_TYPE3 |CXL_DECODER_F_RAM ; +unsigned long flags =CXL_DECODER_F_HOSTONLYMEM |CXL_DECODER_F_RAM ;return (cxlrd->cxlsd.cxld.flags & flags) == flags; }drivers/cxl/cxl.h +7
-7@@ -315,13 +315,13 @@ resource_size_t cxl_rcd_component_reg_phys(struct device *dev,* Additionally indicate whether decoder settings were autodetected, * user customized. */ -#define CXL_DECODER_F_RAM BIT(0) -#define CXL_DECODER_F_PMEM BIT(1) -#define CXL_DECODER_F_TYPE2 BIT(2) -#define CXL_DECODER_F_TYPE3 BIT(3) -#define CXL_DECODER_F_LOCK BIT(4) -#define CXL_DECODER_F_ENABLE BIT(5) -#define CXL_DECODER_F_MASK GENMASK(5, 0) +#define CXL_DECODER_F_RAM BIT(0) +#define CXL_DECODER_F_PMEM BIT(1) +#define CXL_DECODER_F_DEVMEM BIT(2) +#define CXL_DECODER_F_HOSTONLYMEM BIT(3) +#define CXL_DECODER_F_LOCK BIT(4) +#define CXL_DECODER_F_ENABLE BIT(5) +#define CXL_DECODER_F_MASK GENMASK(5, 0)enum cxl_decoder_type {CXL_DECODER_DEVMEM =2 ,include/acpi/actbl1.h +5
-5@@ -551,11 +551,11 @@ struct acpi_cedt_cfmws_target_element {/* Values for Restrictions field above */ -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE2 (1) -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE3 (1<<1) -#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) -#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) -#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4) +#define ACPI_CEDT_CFMWS_RESTRICT_DEVMEM (1) +#define ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM (1<<1) +#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) +#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) +#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4)/* 2: CXL XOR Interleave Math Structure */ tools/testing/cxl/test/cxl.c +9
-9@@ -209,7 +209,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -224,7 +224,7 @@ static struct { }, .interleave_ways = 1, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -239,7 +239,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -254,7 +254,7 @@ static struct { }, .interleave_ways = 1, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -269,7 +269,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -284,7 +284,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M,@@ -301,7 +301,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -317,7 +317,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 1, .granularity = 0, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -333,7 +333,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 2, .granularity = 0, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 16UL,Signature · 1 line
2.39.2
Alison Schofield
maintainerQuoted 99 lines · Ying Huang
Quoted 65 lines · Alison Schofield
Quoted 64 lines · Ying Huang
According to the description of the "Window Restrictions" field of "CFMWS Structure" in the CXL spec v3.1 section 9.18.1.3: CXL Fixed Memory Window Structure (CFMWS), the bit 0 of "Window Restrictions" is formerly known as "CXL Type 2 Memory" and renamed to "Device Coherent", while the bit 1 is formerly known as "CXL Type 3 Memory" and renamed to "Host-only Coherent". Because type 3 memory can only be host-only coherent before, while it can be host-only coherent or device coherent with "Back-Invalidate" now.
To avoid confusion about type 2/3 memory and device/host-only coherent in Linux kernel, the patch renames corresponding bit definition from ACPI_CEDT_CFMWS_RESTRICT_TYPE2/TYPE3 to ACPI_CEDT_CFMWS_RESTRICT_DEVMEM/HOSTONLYMEM. This makes the kernel code consistent with the spec too.
The patch also renames the corresponding
cxl_decoderflags CXL_DECODER_F_TYPE2/TYPE3 to CXL_DECODER_F_DEVMEM/HOSTONLYMEM.No functionality change is expected.
Signed-off-by "Huang, Ying" <[email protected]>Suggested-by Jonathan Cameron <[email protected]>Reviewed-by Davidlohr Bueso <[email protected]>Reviewed-by Gregory Price <[email protected]>Cc Dan Williams <[email protected]>Cc Dave Jiang <[email protected]>Cc Alison Schofield <[email protected]>Cc Vishal Verma <[email protected]>Cc Ira Weiny <[email protected]>Cc Alejandro Lucero <[email protected]>Cc Ben Cheatham <[email protected]>--- drivers/cxl/acpi.c | 8 ++++---- drivers/cxl/core/port.c | 8 ++++---- drivers/cxl/cxl.h | 14 +++++++------- include/acpi/actbl1.h | 10 +++++----- tools/testing/cxl/test/cxl.c | 18 +++++++++--------- 5 files changed, 29 insertions(+), 29 deletions(-)drivers/cxl/acpi.c +4
-4@@ -115,10 +115,10 @@ static unsigned long cfmws_to_decoder_flags(int restrictions) {unsigned long flags =CXL_DECODER_F_ENABLE ; -if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_TYPE2 ) - flags |=CXL_DECODER_F_TYPE2 ; -if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_TYPE3 ) - flags |=CXL_DECODER_F_TYPE3 ; +if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_DEVMEM ) + flags |=CXL_DECODER_F_DEVMEM ; +if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM ) + flags |=CXL_DECODER_F_HOSTONLYMEM ;if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_VOLATILE ) flags |=CXL_DECODER_F_RAM ;if (restrictions &ACPI_CEDT_CFMWS_RESTRICT_PMEM )drivers/cxl/core/port.c +0
-0@@ -125,8 +125,8 @@ static DEVICE_ATTR_RO(name)Quoted 9 lines
drivers/cxl/core/port.c static DEVICE_ATTR_RO(name) · line 131
Quoted 8 lines
drivers/cxl/core/port.c +2
-2CXL_DECODER_FLAG_ATTR (cap_pmem,CXL_DECODER_F_PMEM );CXL_DECODER_FLAG_ATTR (cap_ram,CXL_DECODER_F_RAM ); -CXL_DECODER_FLAG_ATTR (cap_type2,CXL_DECODER_F_TYPE2 ); -CXL_DECODER_FLAG_ATTR (cap_type3,CXL_DECODER_F_TYPE3 ); +CXL_DECODER_FLAG_ATTR (cap_type2,CXL_DECODER_F_DEVMEM ); +CXL_DECODER_FLAG_ATTR (cap_type3,CXL_DECODER_F_HOSTONLYMEM );CXL_DECODER_FLAG_ATTR (locked,CXL_DECODER_F_LOCK );Hi Ying,
Hi, Alison,
Quoted 12 lines
The commit log explains that type3 can now be 'either/or', so does
cap_type3_show()need to emit true for either:
(flags &CXL_DECODER_F_HOSTONLYMEM)
or
(flags &CXL_DECODER_F_DEVMEM) & 'back invalidate')Does this explanation in the ABI need updating:
What: /sys/bus/cxl/devices/decoderX.Y/cap_{pmem,ram,type2,type3} Date: June, 2021 KernelVersion: v5.14 Contact: [email protected]Quoted 7 lines
Description:
(RO) When a CXL decoder is of devtype "cxl_decoder_root", it represents a fixed memory window identified by platform firmware. A fixed window may only support a subset of memory types. The 'cap_*' attributes indicate whether persistent memory, volatile memory, accelerator memory, and / or expander memory may be mapped behind this decoder's memory window.
Quoted 3 lines
I think so too. However, I prefer to keep this patch just mechanic renaming and do these changes in another patch. Do you agree?
I don't know. I was just questioning where and how far the naming scheme needs to change.
Maybe Jonathan, as the Suggested-by, can chime in and move this ahead.
Quoted 157 lines
--
Best Regards,
Huang, YingQuoted 153 lines
Quoted 153 lines
drivers/cxl/core/port.c +2
-2static ssize_t target_type_show(struct device *dev,@@ -326,14 +326,14 @@ static struct attribute *cxl_decoder_root_attrs[] = {static bool can_create_pmem (struct cxl_root_decoder *cxlrd) { -unsigned long flags =CXL_DECODER_F_TYPE3 |CXL_DECODER_F_PMEM ; +unsigned long flags =CXL_DECODER_F_HOSTONLYMEM |CXL_DECODER_F_PMEM ;return (cxlrd->cxlsd.cxld.flags & flags) == flags; }static bool can_create_ram (struct cxl_root_decoder *cxlrd) { -unsigned long flags =CXL_DECODER_F_TYPE3 |CXL_DECODER_F_RAM ; +unsigned long flags =CXL_DECODER_F_HOSTONLYMEM |CXL_DECODER_F_RAM ;return (cxlrd->cxlsd.cxld.flags & flags) == flags; }drivers/cxl/cxl.h +7
-7@@ -315,13 +315,13 @@ resource_size_t cxl_rcd_component_reg_phys(struct device *dev,* Additionally indicate whether decoder settings were autodetected, * user customized. */ -#define CXL_DECODER_F_RAM BIT(0) -#define CXL_DECODER_F_PMEM BIT(1) -#define CXL_DECODER_F_TYPE2 BIT(2) -#define CXL_DECODER_F_TYPE3 BIT(3) -#define CXL_DECODER_F_LOCK BIT(4) -#define CXL_DECODER_F_ENABLE BIT(5) -#define CXL_DECODER_F_MASK GENMASK(5, 0) +#define CXL_DECODER_F_RAM BIT(0) +#define CXL_DECODER_F_PMEM BIT(1) +#define CXL_DECODER_F_DEVMEM BIT(2) +#define CXL_DECODER_F_HOSTONLYMEM BIT(3) +#define CXL_DECODER_F_LOCK BIT(4) +#define CXL_DECODER_F_ENABLE BIT(5) +#define CXL_DECODER_F_MASK GENMASK(5, 0)enum cxl_decoder_type {CXL_DECODER_DEVMEM =2 ,include/acpi/actbl1.h +5
-5@@ -551,11 +551,11 @@ struct acpi_cedt_cfmws_target_element {/* Values for Restrictions field above */ -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE2 (1) -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE3 (1<<1) -#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) -#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) -#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4) +#define ACPI_CEDT_CFMWS_RESTRICT_DEVMEM (1) +#define ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM (1<<1) +#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) +#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) +#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4)/* 2: CXL XOR Interleave Math Structure */ tools/testing/cxl/test/cxl.c +9
-9@@ -209,7 +209,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -224,7 +224,7 @@ static struct { }, .interleave_ways = 1, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -239,7 +239,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -254,7 +254,7 @@ static struct { }, .interleave_ways = 1, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -269,7 +269,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 4UL,@@ -284,7 +284,7 @@ static struct { }, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_VOLATILE, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M,@@ -301,7 +301,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 0, .granularity = 4, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -317,7 +317,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 1, .granularity = 0, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 8UL,@@ -333,7 +333,7 @@ static struct { .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR, .interleave_ways = 2, .granularity = 0, - .restrictions =ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | + .restrictions =ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM | ACPI_CEDT_CFMWS_RESTRICT_PMEM, .qtg_id = FAKE_QTG_ID, .window_size = SZ_256M * 16UL,Signature · 1 line
2.39.2
Alison Schofield wrote:
[..]
Quoted 8 lines
Quoted 3 lines
I think so too. However, I prefer to keep this patch just mechanic renaming and do these changes in another patch. Do you agree?
I don't know. I was just questioning where and how far the naming scheme needs to change.
Maybe Jonathan, as the Suggested-by, can chime in and move this ahead.
I feel like we are going to be living with the ghosts of the original "Type2 / Type3" naming problem for the rest of the subsystem's lifespan especially since they were encoded in the ABI and ABI is forever.
I am not opposed to this localized rename in drivers/cxl/acpi.c on principal, but in terms of incremental value relative to the thrash, it's questionable.
For example changes to include/acpi/actbl1.h need to be chased through ACPICA, at which point is this rename really worth it?
Quoted 15 lines · Dan Williams
Alison Schofield wrote:
[..]Quoted 8 lines
Quoted 3 lines
I think so too. However, I prefer to keep this patch just mechanic renaming and do these changes in another patch. Do you agree?
I don't know. I was just questioning where and how far the naming scheme needs to change.
Maybe Jonathan, as the Suggested-by, can chime in and move this ahead.
I feel like we are going to be living with the ghosts of the original "Type2 / Type3" naming problem for the rest of the subsystem's lifespan especially since they were encoded in the ABI and ABI is forever.
Quoted 6 lines
I am not opposed to this localized rename in
drivers/cxl/acpi.con principal, but in terms of incremental value relative to the thrash, it's questionable.For example changes to
include/acpi/actbl1.hneed to be chased through ACPICA, at which point is this rename really worth it?
I think that it's not too hard to change ACPI tables definition. Added Bob and Rui for ACPICA related change.
--
Best Regards,
Huang, Ying
CC Rafael,
Quoted 27 lines · Ying
Quoted 25 lines · Dan Williams
Alison Schofield wrote:
[..]Quoted 11 lines
Quoted 4 lines
I think so too. However, I prefer to keep this patch just mechanic
renaming and do these changes in another patch. Do you agree?I don't know. I was just questioning where and how far the naming scheme
needs to change.Maybe Jonathan, as the Suggested-by, can chime in and move this ahead.
I feel like we are going to be living with the ghosts of the original
"Type2 / Type3" naming problem for the rest of the subsystem's lifespan
especially since they were encoded in the ABI and ABI is forever.I am not opposed to this localized rename in
drivers/cxl/acpi.con principal, but in terms of incremental value relative to the thrash, it's
questionable.
Quoted 7 lines
Quoted 3 lines
For example changes to
include/acpi/actbl1.hneed to be chased through
ACPICA, at which point is this rename really worth it?I think that it's not too hard to change ACPI tables definition. Added
Bob and Rui for ACPICA related change.
For the change below,
include/acpi/actbl1.h +5 -5
@@ -551,11 +551,11 @@ struct acpi_cedt_cfmws_target_element {/* Values for Restrictions field above */ -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE2 (1) -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE3 (1<<1) -#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) -#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) -#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4) +#define ACPI_CEDT_CFMWS_RESTRICT_DEVMEM (1) +#define ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM (1<<1) +#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) +#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) +#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4)
This change is made based on the spec update, right?
Do we have any user(other than Linux) for the old version of spec? If yes, we probably need to keep the old ones. And IMO, if spec changes and the bit definition changes, we should introduce new Macros for the new definitions, together with spec revision info, say something like
#define ACPI_CEDT_CFMWS_V2_RESTRICT_DEVMEM (1) #define ACPI_CEDT_CFMWS_V2_RESTRICT_HOSTONLYMEM (1<<1) #define ACPI_CEDT_CFMWS_V2_RESTRICT_VOLATILE (1<<2) #define ACPI_CEDT_CFMWS_V2_RESTRICT_PMEM (1<<3) #define ACPI_CEDT_CFMWS_V2_RESTRICT_FIXED (1<<4)
and make Linux stick with the new Macros?
thanks,
rui
Quoted 61 lines · Rui
CC Rafael,
Quoted 27 lines · Ying
Quoted 25 lines · Dan Williams
Alison Schofield wrote:
[..]Quoted 11 lines
Quoted 4 lines
I think so too. However, I prefer to keep this patch just mechanic
renaming and do these changes in another patch. Do you agree?I don't know. I was just questioning where and how far the naming scheme
needs to change.Maybe Jonathan, as the Suggested-by, can chime in and move this ahead.
I feel like we are going to be living with the ghosts of the original
"Type2 / Type3" naming problem for the rest of the subsystem's lifespan
especially since they were encoded in the ABI and ABI is forever.I am not opposed to this localized rename in
drivers/cxl/acpi.con principal, but in terms of incremental value relative to the thrash, it's
questionable.Quoted 7 lines
Quoted 3 lines
For example changes to
include/acpi/actbl1.hneed to be chased through
ACPICA, at which point is this rename really worth it?I think that it's not too hard to change ACPI tables definition. Added
Bob and Rui for ACPICA related change.For the change below,
include/acpi/actbl1.h +5
-5@@ -551,11 +551,11 @@ struct acpi_cedt_cfmws_target_element {/* Values for Restrictions field above */ -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE2 (1) -#define ACPI_CEDT_CFMWS_RESTRICT_TYPE3 (1<<1) -#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) -#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) -#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4) +#define ACPI_CEDT_CFMWS_RESTRICT_DEVMEM (1) +#define ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM (1<<1) +#define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE (1<<2) +#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3) +#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4)This change is made based on the spec update, right?
Quoted 4 lines
Do we have any user(other than Linux) for the old version of spec? If yes, we probably need to keep the old ones. And IMO, if spec changes and the bit definition changes, we should introduce new Macros for the new definitions, together with spec revision info, say something like
At least for me the thrash does not have a signficant upside. The more important terminology concepts are within the CXL core.
So I would just merge this rename below and call it a day, i.e. leave the cxl_acpi rename alone.
drivers/cxl/cxl.h +7 -7
@@ -315,13 +315,13 @@ resource_size_t cxl_rcd_component_reg_phys(struct device *dev,* Additionally indicate whether decoder settings were autodetected, * user customized. */ -#define CXL_DECODER_F_RAM BIT(0) -#define CXL_DECODER_F_PMEM BIT(1) -#define CXL_DECODER_F_TYPE2 BIT(2) -#define CXL_DECODER_F_TYPE3 BIT(3) -#define CXL_DECODER_F_LOCK BIT(4) -#define CXL_DECODER_F_ENABLE BIT(5) -#define CXL_DECODER_F_MASK GENMASK(5, 0) +#define CXL_DECODER_F_RAM BIT(0) +#define CXL_DECODER_F_PMEM BIT(1) +#define CXL_DECODER_F_DEVMEM BIT(2) +#define CXL_DECODER_F_HOSTONLYMEM BIT(3) +#define CXL_DECODER_F_LOCK BIT(4) +#define CXL_DECODER_F_ENABLE BIT(5) +#define CXL_DECODER_F_MASK GENMASK(5, 0)enum cxl_decoder_type {CXL_DECODER_DEVMEM =2 ,