mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Yongxin Yang <yangyongxin@kylinos.cn>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jic23@kernel.org>,
	Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <iweiny@kernel.org>, Dan Williams <djbw@kernel.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>,
	Hanjun Guo <guohanjun@huawei.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Shuai Xue <xueshuai@linux.alibaba.com>,
	Len Brown <lenb@kernel.org>, Li Ming <ming.li@zohomail.com>,
	Robert Richter <rrichter@amd.com>,
	Ben Cheatham <benjamin.cheatham@amd.com>,
	linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7] cxl/core: Create EINJ debugfs files regardless of EINJ init order
Date: Mon, 16 Nov 2026 15:27:57 -0700	[thread overview]
Message-ID: <740532e4-86f4-4113-9203-d23331fec246@intel.com> (raw)
In-Reply-To: <20261104061256.1449275-1-yangyongxin@kylinos.cn>



On 11/3/26 11:12 PM, Yongxin Yang wrote:
> The einj_types file under the CXL debugfs directory is never created when
> cxl_core is built in.  cxl_core_init() runs at subsys_initcall level, while
> einj_init() registers EINJ at device_initcall level, so the
> einj_cxl_is_initialized() check in cxl_core_init() always sees EINJ as not
> up yet and the debugfs_create_file() below it is never reached.
> 
> Change the file creation condition from EINJ being initialized to a compile
> time check for ACPI_APEI_EINJ_CXL and return -ENODEV until EINJ is up.
> 
> The same check also guards the inject files under every downstream port
> directory.  Gate that directory creation on CONFIG_ACPI_APEI_EINJ_CXL as
> well, and check einj_cxl_is_initialized() in cxl_einj_inject() to reject
> writes until EINJ is up.
> 
> Fixes: 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")
> Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com>
> Signed-off-by: Yongxin Yang <yangyongxin@kylinos.cn>

Applied to cxl/fixes
cab9eaa46f41
Next time please create a new email thread per revision and not reply to the previous threads. Thanks.


> ---
> Link: https://lore.kernel.org/all/de14c4ef-e3d8-432f-9ce8-87c468d6d2ad@amd.com/
> Link: https://lore.kernel.org/all/7a22cc6a-deba-40e6-8033-97d1234420ba@amd.com/
> Link: https://lore.kernel.org/all/63e782a6-e33a-46ce-a455-5d207a60661f@amd.com/
> Link: https://lore.kernel.org/all/1a5ceda1-f039-4946-b8d7-2bc97ed48c00@amd.com/
> 
> Changes in v7:
> - Drop the RCH mention from the third paragraph, as suggested by Ben.
> 
>  drivers/acpi/apei/einj-cxl.c | 3 +++
>  drivers/cxl/core/port.c      | 7 +++++--
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/apei/einj-cxl.c b/drivers/acpi/apei/einj-cxl.c
> index e70a416ec925..22a7eb4dc75e 100644
> --- a/drivers/acpi/apei/einj-cxl.c
> +++ b/drivers/acpi/apei/einj-cxl.c
> @@ -30,6 +30,9 @@ int einj_cxl_available_error_type_show(struct seq_file *m, void *v)
>  	int cxl_err, rc;
>  	u32 available_error_type = 0;
>  
> +	if (!einj_cxl_is_initialized())
> +		return -ENODEV;
> +
>  	rc = einj_get_available_error_type(&available_error_type, ACPI_EINJ_GET_ERROR_TYPE);
>  	if (rc)
>  		return rc;
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index 625e4aa427db..a949228de936 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -806,6 +806,9 @@ static int cxl_einj_inject(void *data, u64 type)
>  {
>  	struct cxl_dport *dport = data;
>  
> +	if (!einj_cxl_is_initialized())
> +		return -ENODEV;
> +
>  	if (dport->rch)
>  		return einj_cxl_inject_rch_error(dport->rcrb.base, type);
>  
> @@ -819,7 +822,7 @@ static void cxl_debugfs_create_dport_dir(struct cxl_dport *dport)
>  	struct cxl_port *parent = parent_port_of(dport->port);
>  	struct dentry *dir;
>  
> -	if (!einj_cxl_is_initialized())
> +	if (!IS_ENABLED(CONFIG_ACPI_APEI_EINJ_CXL))
>  		return;
>  
>  	/*
> @@ -2515,7 +2518,7 @@ static __init int cxl_core_init(void)
>  
>  	cxl_debugfs = debugfs_create_dir("cxl", NULL);
>  
> -	if (einj_cxl_is_initialized())
> +	if (IS_ENABLED(CONFIG_ACPI_APEI_EINJ_CXL))
>  		debugfs_create_file("einj_types", 0400, cxl_debugfs, NULL,
>  				    &einj_cxl_available_error_type_fops);
>  


      parent reply	other threads:[~2026-11-16 22:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  3:24 [PATCH v5] cxl/core: Create einj_types " Yongxin Yang
2026-11-02 21:32 ` Cheatham, Benjamin
2026-11-03  5:36 ` [PATCH v6] cxl/core: Create EINJ debugfs files " Yongxin Yang
2026-11-03 21:31   ` Cheatham, Benjamin
2026-11-04  6:12     ` [PATCH v7] " Yongxin Yang
2026-11-16  2:33       ` Yongxin Yang
2026-11-16 22:27       ` Dave Jiang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=740532e4-86f4-4113-9203-d23331fec246@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=benjamin.cheatham@amd.com \
    --cc=bp@alien8.de \
    --cc=dave@stgolabs.net \
    --cc=djbw@kernel.org \
    --cc=guohanjun@huawei.com \
    --cc=iweiny@kernel.org \
    --cc=jic23@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ming.li@zohomail.com \
    --cc=rafael@kernel.org \
    --cc=rrichter@amd.com \
    --cc=tony.luck@intel.com \
    --cc=vishal.l.verma@intel.com \
    --cc=xueshuai@linux.alibaba.com \
    --cc=yangyongxin@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®