Re: [PATCH v4] cxl/core: Create einj_types when EINJ becomes available

From: Cheatham, Benjamin

Date: Fri Oct 30 2026 - 16:37:08 EST


On 10/30/2026 2:24 PM, Cheatham, Benjamin wrote:
>
>>> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
>>> index cab8ce39f465..b9245261ee39 100644
>>> --- a/drivers/cxl/cxl.h
>>> +++ b/drivers/cxl/cxl.h
>>> @@ -926,4 +926,6 @@ struct cxl_dport *devm_cxl_add_dport_by_dev(struct cxl_port *port,
>>>
>>> u16 cxl_gpf_get_dvsec(struct device *dev);
>>>
>>> +void cxl_debugfs_einj_add_types(void);
>>> +
>>> #endif /* __CXL_H__ */
>>
>> Maybe drop the cxl_acpi_probe() hook? Host bridge dports, RCH included, already go through __devm_cxl_add_dport() -> cxl_debugfs_create_dport_dir() -> cxl_debugfs_einj_add_types() inside the same probe, so the hook runs at the same time and adds nothing. That also removes the export.
>>
>> Also, the RCH all built-in case still never gets einj_types since the only RCH dport is added at subsys_initcall_sync. Should the commit log say so?
>>
>> I do wonder if it's simpler to always create einj_types in cxl_core_init() and have einj_cxl_available_error_type_show() return -ENODEV when EINJ isn't initialized. That covers every config without the lock and the extra hooks. Any thoughts Ben?
>
> Yeah, that sounds good to me. Wish I had thought of it :)

I thought about it a bit more and there should also be a check for CONFIG_ACPI_APEI_EINJ_CXL as well. It doesn't make sense to
add the file if the support won't ever be turned on. So change the check for creating the file from "if (einj_cxl_is_initialized())"
to "if (IS_ENABLED(CONFIG_ACPI_APEI_EINJ_CXL))".

Thanks,
Ben