在 2024/2/10 14:34, Dan Williams 写道:
Shiyang Ruan wrote:
The length of Physical Address in General Media Event Record/DRAM Event
Record is 64-bit, so the field mask should be defined as such length.
Can you include this user visible side-effect of this change. Looks like
this could cause usages of CXL_DPA_FLAGS_MASK to return an incorrect
result?
Ok. Will change it to this:
The length of Physical Address in General Media Event Record/DRAM Event
Record is 64bit, per CXL Spec r3.0 - 8.2.9.2.1.1, Table 8-43. Currently
CXL_DPA_FLAGS_MASK is defined as int (32bit), then CXL_DPA_MASK is a int
too, it will be 0x00000000FFFFFFC0 while using "->dpa & CXL_DPA_MASK" to
obtain real physical address (to drop flags in lower bits), in this case
the higher 32bit of ->dpa will be lost.
To avoid this, define CXL_DPA_FLAGS_MASK as 64bit: 0x3FULL.
--
Thanks,
Ruan.
Signed-off-by: Shiyang Ruan <ruansy.f...@fujitsu.com>
---
drivers/cxl/core/trace.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
index 89445435303a..388a87d972c2 100644
--- a/drivers/cxl/core/trace.h
+++ b/drivers/cxl/core/trace.h
@@ -253,11 +253,11 @@ TRACE_EVENT(cxl_generic_event,
* DRAM Event Record
* CXL rev 3.0 section 8.2.9.2.1.2; Table 8-44
*/
-#define CXL_DPA_FLAGS_MASK 0x3F
+#define CXL_DPA_FLAGS_MASK 0x3FULL
#define CXL_DPA_MASK (~CXL_DPA_FLAGS_MASK)
-#define CXL_DPA_VOLATILE BIT(0)
-#define CXL_DPA_NOT_REPAIRABLE BIT(1)
+#define CXL_DPA_VOLATILE BIT_ULL(0)
+#define CXL_DPA_NOT_REPAIRABLE BIT_ULL(1)
#define show_dpa_flags(flags) __print_flags(flags, "|", \
{ CXL_DPA_VOLATILE, "VOLATILE" }, \
{ CXL_DPA_NOT_REPAIRABLE, "NOT_REPAIRABLE" } \
--
2.34.1