[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZcyQroz_4XZAgbv3@rric.localdomain>
Date: Wed, 14 Feb 2024 11:06:38 +0100
From: Robert Richter <rrichter@....com>
To: Dan Williams <dan.j.williams@...el.com>
Cc: Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>, linux-cxl@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cxl/pci: Fix disabling CXL memory for zero-based
addressing
On 13.02.24 11:45:48, Dan Williams wrote:
> Robert Richter wrote:
> > On 13.02.24 10:40:07, Dan Williams wrote:
> > > Robert Richter wrote:
> > It would be sane to just not use CXL if assumptions on it are not
> > valid and not to break system to boot.
>
> I can get on board with that.
>
> >
> > >
> > > > This may take system memory offline and could lead to a kernel hang.
> > >
> > > Yes, that is not an unreasonable result when Linux fundamental
> > > assumptions are violated.
> >
> > BUG_ON(fw_table_broken)? If at all, it is not mandatory to have a
> > CFMWS. Btw, the check is more strict and also checks memory
> > attributes. It is very likely something can break.
>
> Sure, I'll take a patch like this:
>
> diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
> index 6c9c8d92f8f7..e4e5a917f1f4 100644
> --- a/drivers/cxl/core/pci.c
> +++ b/drivers/cxl/core/pci.c
> @@ -477,10 +477,11 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, struct cxl_hdm *cxlhdm,
> allowed++;
> }
>
> - if (!allowed) {
> - cxl_set_mem_enable(cxlds, 0);
> - info->mem_enabled = 0;
> - }
> + WARN_TAINT(!allowed, TAINT_FIRMWARE_WORKAROUND,
> + FW_BUG "%s: Range register decodes outside platform defined CXL ranges.",
> + dev_name(dev));
> + if (!allowed)
> + return -ENXIO;
Would you be ok with that? This aligns with all other -ENXIO kind of
errors where some unexpected firmware or register behavior is
observed.
if (!allowed) {
- cxl_set_mem_enable(cxlds, 0);
- info->mem_enabled = 0;
+ dev_err(dev, FW_BUG "Range register decodes outside platform defined CXL ranges.\n");
+ return -ENXIO;
}
Thanks,
-Robert
Powered by blists - more mailing lists