From: Yanfei Xu <yanfei.xu@intel.com>
To: Dan Williams <dan.j.williams@intel.com>, <linux-cxl@vger.kernel.org>
Cc: <dave@stgolabs.net>, <jonathan.cameron@huawei.com>,
<dave.jiang@intel.com>, <alison.schofield@intel.com>,
<vishal.l.verma@intel.com>, <ira.weiny@intel.com>,
<ming4.li@intel.com>
Subject: Re: [v2 2/4] cxl/pci: Don't set up decoders for disallowed DVSEC ranges
Date: Sat, 10 Aug 2024 19:36:08 +0800 [thread overview]
Message-ID: <a2fb9764-a182-4371-aef2-aea2e7e1136f@intel.com> (raw)
In-Reply-To: <66b667ca7ad47_257529424@dwillia2-xfh.jf.intel.com.notmuch>
On 8/10/2024 3:02 AM, Dan Williams wrote:
> Yanfei Xu wrote:
>> Since it shouldn't create and configure decoders for disallowed
>> ranges, move the check of dvsec_range_allowed() earlier into
>> cxl_dvsec_rr_decode() to filter the disallowed DVSEC ranges out
>> at firtst.
>
> "Fixes" explain the user visible side effect of the problem. There is no
> problem being fixed with this. It is maybe a conceptual cleanup, but to
> me the risk and thrash is not worth the reward. Unless I am missing
> something this is just code movement for no value.
You are right, this is much like a cleanup as creating decoders for
disallowed ranges doesn't have side effect for user. Will drop the "Fixes".
I just was aiming to avoid to create decoders for the disallowed ranges,
since this kind of decoders don't take effect in practice. And we
already checked and found that, why continued to create that? :)
How about changing the dev_dbg() in below codes to dev_warn() when find
disallowed ranges to let the user to know what happened.
cxld_dev = device_find_child(&root->dev, &dvsec_range,
dvsec_range_allowed);
if (!cxld_dev) {
dev_dbg(dev, "DVSEC Range%d denied by platform\n", i+1);
continue;
}
dev_dbg(dev, "DVSEC Range%d allowed by platform\n", i+1);
put_device(cxld_dev);
>
> The "risk" is that I think this breaks cases where BIOS has enabled HDM
> decoders. I.e.
>
> /*
> * If the HDM Decoder Capability is already enabled then assume
> * that some other agent like platform firmware set it up.
> */
> if (global_ctrl & CXL_HDM_DECODER_ENABLE || (!hdm && info->mem_enabled))
> return devm_cxl_enable_mem(&port->dev, cxlds);
>
> ...the DVSEC range resgister values do not matter when HDM decoders are
> enabled.
It won't. Even no allowed range, it only keep 0 in info->ranges first.
And the check for whether info->ranges is 0 is performed after the check
you pasted.
if (global_ctrl & CXL_HDM_DECODER_ENABLE || (!hdm &&
info->mem_enabled))
return devm_cxl_enable_mem(&port->dev, cxlds);
else if (!hdm)
return -ENODEV;
......
if (!info->ranges) {
dev_err(dev, "No available DVSEC register ranges.\n");
return -ENXIO;
}
Thanks,
Yanfei
next prev parent reply other threads:[~2024-08-10 11:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 9:34 [v2 0/4] Fixes for hdm docoder initialization from DVSEC ranges Yanfei Xu
2024-08-09 9:34 ` [v2 1/4] cxl/pci: Fix to record only non-zero ranges Yanfei Xu
2024-08-09 18:55 ` Dan Williams
2024-08-10 8:10 ` Yanfei Xu
2024-08-09 9:34 ` [v2 2/4] cxl/pci: Don't set up decoders for disallowed DVSEC ranges Yanfei Xu
2024-08-09 19:02 ` Dan Williams
2024-08-10 11:36 ` Yanfei Xu [this message]
2024-08-09 9:34 ` [v2 3/4] cxl/pci: Check Mem_info_valid bit for each applicable DVSEC range Yanfei Xu
2024-08-09 19:13 ` Dan Williams
2024-08-10 11:50 ` Yanfei Xu
2024-08-09 9:34 ` [v2 4/4] cxl/pci: Simplify the code logic of cxl_hdm_decode_init Yanfei Xu
2024-08-09 19:15 ` Dan Williams
2024-08-10 12:11 ` Yanfei Xu
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=a2fb9764-a182-4371-aef2-aea2e7e1136f@intel.com \
--to=yanfei.xu@intel.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=ming4.li@intel.com \
--cc=vishal.l.verma@intel.com \
/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