* [PATCH v2 0/3] CXL CCI Log Commands implementation [not found] <CGME20250218085809epcas5p3ee3d79ffec77b13bb097c6d15bb24710@epcas5p3.samsung.com> @ 2025-02-18 8:57 ` Arpit Kumar [not found] ` <CGME20250218085810epcas5p42b0e96fff3fff297a1e7334cc7feae9f@epcas5p4.samsung.com> ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread From: Arpit Kumar @ 2025-02-18 8:57 UTC (permalink / raw) To: qemu-devel Cc: gost.dev, linux-cxl, nifan.cxl, dave, vishak.g, krish.reddy, a.manzanares, alok.rathore, Arpit Kumar CXL CCI log commands implmented as per CXL Specification 3.2 8.2.10.5 1) get_log_capabilities (Opcode 0402h) 2) clear_log (Opcode 0403h) 3) populate_log (Opcode 0404h) This v2 patch addresses the feedback from the v1 patch and include some new changes. Changes in from v1 to v2: - Added descriptive text for each patches - Added reference from CXL spec 3.2 - Updated naming for better comprehension - Modified find_log_index() to return supported log - Handled array of log capabilities as static const pointers - Replaced bit fields for param_flags with defines for individual bits - Disabled support of clear & populate log command for command effect log The patches are generated against the Johnathan's tree https://gitlab.com/jic23/qemu.git and branch cxl-2024-11-27. Arpit Kumar (3): hw/cxl/cxl-mailbox-utils.c: Added support for Get Log Capabilities (Opcode 0402h) hw/cxl/cxl-mailbox-utils.c: Added support for Clear Log (Opcode 0403h) hw/cxl/cxl-mailbox-utils.c: Added support for Populate Log (Opcode 0404h) hw/cxl/cxl-mailbox-utils.c | 100 +++++++++++++++++++++++++++++++++++ include/hw/cxl/cxl_device.h | 20 +++++++ include/hw/cxl/cxl_mailbox.h | 5 ++ 3 files changed, 125 insertions(+) -- 2.34.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CGME20250218085810epcas5p42b0e96fff3fff297a1e7334cc7feae9f@epcas5p4.samsung.com>]
* [PATCH v2 1/3] hw/cxl/cxl-mailbox-utils.c: Added support for Get Log Capabilities (Opcode 0402h) [not found] ` <CGME20250218085810epcas5p42b0e96fff3fff297a1e7334cc7feae9f@epcas5p4.samsung.com> @ 2025-02-18 8:57 ` Arpit Kumar 0 siblings, 0 replies; 6+ messages in thread From: Arpit Kumar @ 2025-02-18 8:57 UTC (permalink / raw) To: qemu-devel Cc: gost.dev, linux-cxl, nifan.cxl, dave, vishak.g, krish.reddy, a.manzanares, alok.rathore, Arpit Kumar CXL spec 3.2 section 8.2.10.5.3 describes Get Log Capabilities. It provides log capabilities supported by specified log. Signed-off-by: Arpit Kumar <arpit1.kumar@samsung.com> --- hw/cxl/cxl-mailbox-utils.c | 45 ++++++++++++++++++++++++++++++++++++ include/hw/cxl/cxl_device.h | 20 ++++++++++++++++ include/hw/cxl/cxl_mailbox.h | 5 ++++ 3 files changed, 70 insertions(+) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 9c7ea5bc35..5b0f793ac5 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -76,6 +76,7 @@ enum { LOGS = 0x04, #define GET_SUPPORTED 0x0 #define GET_LOG 0x1 + #define GET_LOG_CAPABILITIES 0x2 FEATURES = 0x05, #define GET_SUPPORTED 0x0 #define GET_FEATURE 0x1 @@ -1075,6 +1076,43 @@ static CXLRetCode cmd_logs_get_log(const struct cxl_cmd *cmd, return CXL_MBOX_SUCCESS; } +static const struct CXLLogCapabilities *find_log_index(QemuUUID *uuid, CXLCCI *cci) +{ + for (int i = CXL_LOG_COMMAND_EFFECT; i < MAX_LOG_TYPE; i++) { + if (qemu_uuid_is_equal(uuid, + &cci->supported_log_cap[i].uuid)) { + return &cci->supported_log_cap[i]; + } + } + return NULL; +} + +/* CXL r3.2 Section 8.2.10.5.3: Get Log Capabilities (Opcode 0402h) */ +static CXLRetCode cmd_logs_get_log_capabilities(const struct cxl_cmd *cmd, + uint8_t *payload_in, + size_t len_in, + uint8_t *payload_out, + size_t *len_out, + CXLCCI *cci) +{ + const CXLLogCapabilities *cap; + struct { + QemuUUID uuid; + } QEMU_PACKED QEMU_ALIGNED(8) * get_log_capabilities_in = (void *)payload_in; + + uint32_t *get_log_capabilities_out = (uint32_t *)payload_out; + + cap = find_log_index(&get_log_capabilities_in->uuid, cci); + if (!cap) { + return CXL_MBOX_INVALID_LOG; + } + + memcpy(get_log_capabilities_out, &cap->param_flags, + sizeof(cap->param_flags)); + *len_out = sizeof(*get_log_capabilities_out); + return CXL_MBOX_SUCCESS; +} + /* CXL r3.1 section 8.2.9.6: Features */ /* * Get Supported Features output payload @@ -2840,6 +2878,8 @@ static const struct cxl_cmd cxl_cmd_set[256][256] = { [LOGS][GET_SUPPORTED] = { "LOGS_GET_SUPPORTED", cmd_logs_get_supported, 0, 0 }, [LOGS][GET_LOG] = { "LOGS_GET_LOG", cmd_logs_get_log, 0x18, 0 }, + [LOGS][GET_LOG_CAPABILITIES] = { "LOGS_GET_LOG_CAPABILITIES", + cmd_logs_get_log_capabilities, 0x10, 0 }, [FEATURES][GET_SUPPORTED] = { "FEATURES_GET_SUPPORTED", cmd_features_get_supported, 0x8, 0 }, [FEATURES][GET_FEATURE] = { "FEATURES_GET_FEATURE", @@ -3084,10 +3124,15 @@ static void cxl_rebuild_cel(CXLCCI *cci) } } +static const struct CXLLogCapabilities cxl_get_log_cap[MAX_LOG_TYPE] = { + [CXL_LOG_COMMAND_EFFECT] = {.param_flags = 0, .uuid = cel_uuid}, +}; + void cxl_init_cci(CXLCCI *cci, size_t payload_max) { cci->payload_max = payload_max; cxl_rebuild_cel(cci); + cci->supported_log_cap = cxl_get_log_cap; cci->bg.complete_pct = 0; cci->bg.starttime = 0; diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index a64739be25..23f6f4ed17 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -164,6 +164,18 @@ typedef enum { CXL_MBOX_MAX = 0x20 } CXLRetCode; +/* types of logs */ +typedef enum { + CXL_LOG_COMMAND_EFFECT, + CXL_LOG_VENDOR_DEBUG, + CXL_LOG_COMPONENT_STATE_DUMP, + CXL_LOG_ERROR_CHECK_SCRUB, + CXL_LOG_MEDIA_TEST_CAPABILITY, + CXL_LOG_MEDIA_TEST_RESULTS_SHORT, + CXL_LOG_MEDIA_TEST_RESULTS_LONG, + MAX_LOG_TYPE +} CXLLogType; + typedef struct CXLCCI CXLCCI; typedef struct cxl_device_state CXLDeviceState; struct cxl_cmd; @@ -194,6 +206,11 @@ typedef struct CXLEventLog { QSIMPLEQ_HEAD(, CXLEvent) events; } CXLEventLog; +typedef struct CXLLogCapabilities { + uint32_t param_flags; + QemuUUID uuid; +} CXLLogCapabilities; + typedef struct CXLCCI { struct cxl_cmd cxl_cmd_set[256][256]; struct cel_log { @@ -202,6 +219,9 @@ typedef struct CXLCCI { } cel_log[1 << 16]; size_t cel_size; + /* get log capabilities */ + const CXLLogCapabilities *supported_log_cap; + /* background command handling (times in ms) */ struct { uint16_t opcode; diff --git a/include/hw/cxl/cxl_mailbox.h b/include/hw/cxl/cxl_mailbox.h index 9008402d1c..8e1c7c5f15 100644 --- a/include/hw/cxl/cxl_mailbox.h +++ b/include/hw/cxl/cxl_mailbox.h @@ -16,4 +16,9 @@ #define CXL_MBOX_BACKGROUND_OPERATION (1 << 6) #define CXL_MBOX_BACKGROUND_OPERATION_ABORT (1 << 7) +#define CXL_LOG_CAP_CLEAR_SUPPORTED (1 << 0) +#define CXL_LOG_CAP_POPULATE_SUPPORTED (1 << 1) +#define CXL_LOG_CAP_AUTO_POPULATE_SUPPORTED (1 << 2) +#define CXL_LOG_CAP_PERSISTENT_COLD_RESET_SUPPORTED (1 << 3) + #endif -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <CGME20250218085812epcas5p3981d9649c89f876d59724a24c0ed8d80@epcas5p3.samsung.com>]
* [PATCH v2 2/3] hw/cxl/cxl-mailbox-utils.c: Added support for Clear Log (Opcode 0403h) [not found] ` <CGME20250218085812epcas5p3981d9649c89f876d59724a24c0ed8d80@epcas5p3.samsung.com> @ 2025-02-18 8:57 ` Arpit Kumar 0 siblings, 0 replies; 6+ messages in thread From: Arpit Kumar @ 2025-02-18 8:57 UTC (permalink / raw) To: qemu-devel Cc: gost.dev, linux-cxl, nifan.cxl, dave, vishak.g, krish.reddy, a.manzanares, alok.rathore, Arpit Kumar CXL spec 3.2 section 8.2.10.5.4 describes clear log. It clears the content of the specified log. Signed-off-by: Arpit Kumar <arpit1.kumar@samsung.com> --- hw/cxl/cxl-mailbox-utils.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 5b0f793ac5..1caee3f058 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -77,6 +77,7 @@ enum { #define GET_SUPPORTED 0x0 #define GET_LOG 0x1 #define GET_LOG_CAPABILITIES 0x2 + #define CLEAR_LOG 0x3 FEATURES = 0x05, #define GET_SUPPORTED 0x0 #define GET_FEATURE 0x1 @@ -1113,6 +1114,30 @@ static CXLRetCode cmd_logs_get_log_capabilities(const struct cxl_cmd *cmd, return CXL_MBOX_SUCCESS; } +/* CXL r3.2 Section 8.2.10.5.4: Clear Log (Opcode 0403h) */ +static CXLRetCode cmd_logs_clear_log(const struct cxl_cmd *cmd, + uint8_t *payload_in, + size_t len_in, + uint8_t *payload_out, + size_t *len_out, + CXLCCI *cci) +{ + const CXLLogCapabilities *cap; + struct { + QemuUUID uuid; + } QEMU_PACKED QEMU_ALIGNED(8) * clear_log = (void *)payload_in; + + cap = find_log_index(&clear_log->uuid, cci); + if (!cap) { + return CXL_MBOX_INVALID_LOG; + } + + if (!(cap->param_flags & CXL_LOG_CAP_CLEAR_SUPPORTED)) { + return CXL_MBOX_UNSUPPORTED; + } + return CXL_MBOX_SUCCESS; +} + /* CXL r3.1 section 8.2.9.6: Features */ /* * Get Supported Features output payload @@ -2880,6 +2905,8 @@ static const struct cxl_cmd cxl_cmd_set[256][256] = { [LOGS][GET_LOG] = { "LOGS_GET_LOG", cmd_logs_get_log, 0x18, 0 }, [LOGS][GET_LOG_CAPABILITIES] = { "LOGS_GET_LOG_CAPABILITIES", cmd_logs_get_log_capabilities, 0x10, 0 }, + [LOGS][CLEAR_LOG] = { "LOGS_CLEAR_LOG", cmd_logs_clear_log, 0x10, + CXL_MBOX_IMMEDIATE_LOG_CHANGE}, [FEATURES][GET_SUPPORTED] = { "FEATURES_GET_SUPPORTED", cmd_features_get_supported, 0x8, 0 }, [FEATURES][GET_FEATURE] = { "FEATURES_GET_FEATURE", -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <CGME20250218085814epcas5p384be512f40b0add05588d2242e2f0061@epcas5p3.samsung.com>]
* [PATCH v2 3/3] hw/cxl/cxl-mailbox-utils.c: Added support for Populate Log (Opcode 0404h) [not found] ` <CGME20250218085814epcas5p384be512f40b0add05588d2242e2f0061@epcas5p3.samsung.com> @ 2025-02-18 8:57 ` Arpit Kumar 0 siblings, 0 replies; 6+ messages in thread From: Arpit Kumar @ 2025-02-18 8:57 UTC (permalink / raw) To: qemu-devel Cc: gost.dev, linux-cxl, nifan.cxl, dave, vishak.g, krish.reddy, a.manzanares, alok.rathore, Arpit Kumar CXL spec 3.2 section 8.2.10.5.5 describes populate log. It populates the contents of the specified log and can run as a background operation. Signed-off-by: Arpit Kumar <arpit1.kumar@samsung.com> --- hw/cxl/cxl-mailbox-utils.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 1caee3f058..b41b70a790 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -78,6 +78,7 @@ enum { #define GET_LOG 0x1 #define GET_LOG_CAPABILITIES 0x2 #define CLEAR_LOG 0x3 + #define POPULATE_LOG 0x4 FEATURES = 0x05, #define GET_SUPPORTED 0x0 #define GET_FEATURE 0x1 @@ -1138,6 +1139,30 @@ static CXLRetCode cmd_logs_clear_log(const struct cxl_cmd *cmd, return CXL_MBOX_SUCCESS; } +/* CXL r3.2 Section 8.2.10.5.5: Populate log (Opcode 0404h) */ +static CXLRetCode cmd_logs_populate_log(const struct cxl_cmd *cmd, + uint8_t *payload_in, + size_t len_in, + uint8_t *payload_out, + size_t *len_out, + CXLCCI *cci) +{ + const CXLLogCapabilities *cap; + struct { + QemuUUID uuid; + } QEMU_PACKED QEMU_ALIGNED(8) * populate_log = (void *)payload_in; + + cap = find_log_index(&populate_log->uuid, cci); + if (!cap) { + return CXL_MBOX_INVALID_LOG; + } + + if (!(cap->param_flags & CXL_LOG_CAP_POPULATE_SUPPORTED)) { + return CXL_MBOX_UNSUPPORTED; + } + return CXL_MBOX_UNSUPPORTED; +} + /* CXL r3.1 section 8.2.9.6: Features */ /* * Get Supported Features output payload @@ -2907,6 +2932,9 @@ static const struct cxl_cmd cxl_cmd_set[256][256] = { cmd_logs_get_log_capabilities, 0x10, 0 }, [LOGS][CLEAR_LOG] = { "LOGS_CLEAR_LOG", cmd_logs_clear_log, 0x10, CXL_MBOX_IMMEDIATE_LOG_CHANGE}, + [LOGS][POPULATE_LOG] = { "LOGS_POPULATE_LOG", cmd_logs_populate_log, 0x10, + (CXL_MBOX_IMMEDIATE_LOG_CHANGE | + CXL_MBOX_BACKGROUND_OPERATION)}, [FEATURES][GET_SUPPORTED] = { "FEATURES_GET_SUPPORTED", cmd_features_get_supported, 0x8, 0 }, [FEATURES][GET_FEATURE] = { "FEATURES_GET_FEATURE", -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/3] CXL CCI Log Commands implementation 2025-02-18 8:57 ` [PATCH v2 0/3] CXL CCI Log Commands implementation Arpit Kumar ` (2 preceding siblings ...) [not found] ` <CGME20250218085814epcas5p384be512f40b0add05588d2242e2f0061@epcas5p3.samsung.com> @ 2025-02-20 16:08 ` Jonathan Cameron via 2025-02-24 11:54 ` Arpit Kumar 3 siblings, 1 reply; 6+ messages in thread From: Jonathan Cameron via @ 2025-02-20 16:08 UTC (permalink / raw) To: Arpit Kumar Cc: qemu-devel, gost.dev, linux-cxl, nifan.cxl, dave, vishak.g, krish.reddy, a.manzanares, alok.rathore On Tue, 18 Feb 2025 14:27:28 +0530 Arpit Kumar <arpit1.kumar@samsung.com> wrote: > CXL CCI log commands implmented as per CXL Specification 3.2 8.2.10.5 > 1) get_log_capabilities (Opcode 0402h) > 2) clear_log (Opcode 0403h) > 3) populate_log (Opcode 0404h) > > This v2 patch addresses the feedback from the v1 patch and include some new changes. I'll apply these to my staging tree, but it is a little odd to have the last two commands without any logs that they actually apply to. Maybe we should make up a component state dump? I think that currently the populate only really applies to that one (or the vendor defined one). We can also look at wiring up the ECS logs and some suitable error injection as clear log would apply to those. I like the idea of having media test longer term as well as the use cases for that in kernel are interesting to explore. Jonathan > > Changes in from v1 to v2: > - Added descriptive text for each patches > - Added reference from CXL spec 3.2 > - Updated naming for better comprehension > - Modified find_log_index() to return supported log > - Handled array of log capabilities as static const pointers > - Replaced bit fields for param_flags with defines for individual bits > - Disabled support of clear & populate log command for command effect log > > The patches are generated against the Johnathan's tree > https://gitlab.com/jic23/qemu.git and branch cxl-2024-11-27. > > Arpit Kumar (3): > hw/cxl/cxl-mailbox-utils.c: Added support for Get Log Capabilities > (Opcode 0402h) > hw/cxl/cxl-mailbox-utils.c: Added support for Clear Log (Opcode 0403h) > hw/cxl/cxl-mailbox-utils.c: Added support for Populate Log (Opcode > 0404h) > > hw/cxl/cxl-mailbox-utils.c | 100 +++++++++++++++++++++++++++++++++++ > include/hw/cxl/cxl_device.h | 20 +++++++ > include/hw/cxl/cxl_mailbox.h | 5 ++ > 3 files changed, 125 insertions(+) > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/3] CXL CCI Log Commands implementation 2025-02-20 16:08 ` [PATCH v2 0/3] CXL CCI Log Commands implementation Jonathan Cameron via @ 2025-02-24 11:54 ` Arpit Kumar 0 siblings, 0 replies; 6+ messages in thread From: Arpit Kumar @ 2025-02-24 11:54 UTC (permalink / raw) To: Jonathan Cameron Cc: qemu-devel, gost.dev, linux-cxl, nifan.cxl, dave, vishak.g, krish.reddy, a.manzanares, alok.rathore [-- Attachment #1: Type: text/plain, Size: 2093 bytes --] On 20/02/25 04:08PM, Jonathan Cameron wrote: >On Tue, 18 Feb 2025 14:27:28 +0530 >Arpit Kumar <arpit1.kumar@samsung.com> wrote: > >> CXL CCI log commands implmented as per CXL Specification 3.2 8.2.10.5 >> 1) get_log_capabilities (Opcode 0402h) >> 2) clear_log (Opcode 0403h) >> 3) populate_log (Opcode 0404h) >> >> This v2 patch addresses the feedback from the v1 patch and include some new changes. > >I'll apply these to my staging tree, but it is a little odd >to have the last two commands without any logs that they actually apply to. > >Maybe we should make up a component state dump? >I think that currently the populate only really applies to that >one (or the vendor defined one). > >We can also look at wiring up the ECS logs and some suitable error >injection as clear log would apply to those. I like the idea >of having media test longer term as well as the use cases for that in >kernel are interesting to explore. > >Jonathan Thanks for the suggestion Jonathan. I will go in depth of stated log commands and will plan the same. >> >> Changes in from v1 to v2: >> - Added descriptive text for each patches >> - Added reference from CXL spec 3.2 >> - Updated naming for better comprehension >> - Modified find_log_index() to return supported log >> - Handled array of log capabilities as static const pointers >> - Replaced bit fields for param_flags with defines for individual bits >> - Disabled support of clear & populate log command for command effect log >> >> The patches are generated against the Johnathan's tree >> https://gitlab.com/jic23/qemu.git and branch cxl-2024-11-27. >> >> Arpit Kumar (3): >> hw/cxl/cxl-mailbox-utils.c: Added support for Get Log Capabilities >> (Opcode 0402h) >> hw/cxl/cxl-mailbox-utils.c: Added support for Clear Log (Opcode 0403h) >> hw/cxl/cxl-mailbox-utils.c: Added support for Populate Log (Opcode >> 0404h) >> >> hw/cxl/cxl-mailbox-utils.c | 100 +++++++++++++++++++++++++++++++++++ >> include/hw/cxl/cxl_device.h | 20 +++++++ >> include/hw/cxl/cxl_mailbox.h | 5 ++ >> 3 files changed, 125 insertions(+) >> > [-- Attachment #2: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-24 12:15 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <CGME20250218085809epcas5p3ee3d79ffec77b13bb097c6d15bb24710@epcas5p3.samsung.com> 2025-02-18 8:57 ` [PATCH v2 0/3] CXL CCI Log Commands implementation Arpit Kumar [not found] ` <CGME20250218085810epcas5p42b0e96fff3fff297a1e7334cc7feae9f@epcas5p4.samsung.com> 2025-02-18 8:57 ` [PATCH v2 1/3] hw/cxl/cxl-mailbox-utils.c: Added support for Get Log Capabilities (Opcode 0402h) Arpit Kumar [not found] ` <CGME20250218085812epcas5p3981d9649c89f876d59724a24c0ed8d80@epcas5p3.samsung.com> 2025-02-18 8:57 ` [PATCH v2 2/3] hw/cxl/cxl-mailbox-utils.c: Added support for Clear Log (Opcode 0403h) Arpit Kumar [not found] ` <CGME20250218085814epcas5p384be512f40b0add05588d2242e2f0061@epcas5p3.samsung.com> 2025-02-18 8:57 ` [PATCH v2 3/3] hw/cxl/cxl-mailbox-utils.c: Added support for Populate Log (Opcode 0404h) Arpit Kumar 2025-02-20 16:08 ` [PATCH v2 0/3] CXL CCI Log Commands implementation Jonathan Cameron via 2025-02-24 11:54 ` Arpit Kumar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).