From: Terry Bowman <Terry.Bowman@amd.com>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>,
Robert Richter <rrichter@amd.com>
Cc: Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Ben Widawsky <bwidawsk@kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Dave Jiang <dave.jiang@intel.com>,
linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH v11 07/20] cxl/hdm: Use stored Component Register mappings to map HDM decoder capability
Date: Mon, 9 Oct 2023 09:35:10 -0500 [thread overview]
Message-ID: <fc3bfa6b-3635-4185-a28c-3e1ea76e5970@amd.com> (raw)
In-Reply-To: <20231002154351.0000136a@Huawei.com>
Hi Jonathan,
I added responses below.
On 10/2/23 09:43, Jonathan Cameron wrote:
> On Wed, 27 Sep 2023 17:43:26 +0200
> Robert Richter <rrichter@amd.com> wrote:
>
>> Now, that the Component Register mappings are stored, use them to
>> enable and map the HDM decoder capabilities. The Component Registers
>> do not need to be probed again for this, remove probing code.
>>
>> The HDM capability applies to Endpoints, USPs and VH Host Bridges. The
>> Endpoint's component register mappings are located in the cxlds and
>> else in the port's structure. Duplicate the cxlds->reg_map in
>> port->reg_map for endpoint ports.
>>
>> Signed-off-by: Terry Bowman <terry.bowman@amd.com>
>> Signed-off-by: Robert Richter <rrichter@amd.com>
>> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
>> [rework to drop cxl_port_get_comp_map()]
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> A few comments inline.
>
> Also, Dan's SoB doesn't make sense if you are the Author and he's not
> the one sending the email. The fun of patches bounced back and forwards
> is sometimes you have to tweak this stuff on each posting... :(
>
>> ---
>> drivers/cxl/core/hdm.c | 48 ++++++++++++++++-------------------------
>> drivers/cxl/core/port.c | 29 +++++++++++++++++++------
>> drivers/cxl/mem.c | 5 ++---
>> 3 files changed, 43 insertions(+), 39 deletions(-)
>>
>> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
>> index 11d9971f3e8c..14a0d0017df3 100644
>> --- a/drivers/cxl/core/hdm.c
>> +++ b/drivers/cxl/core/hdm.c
>> @@ -81,26 +81,6 @@ static void parse_hdm_decoder_caps(struct cxl_hdm *cxlhdm)
>> cxlhdm->interleave_mask |= GENMASK(14, 12);
>> }
>>
>> -static int map_hdm_decoder_regs(struct cxl_port *port, void __iomem *crb,
>> - struct cxl_component_regs *regs)
>> -{
>> - struct cxl_register_map map = {
>> - .host = &port->dev,
>> - .resource = port->component_reg_phys,
>> - .base = crb,
>> - .max_size = CXL_COMPONENT_REG_BLOCK_SIZE,
>> - };
>> -
>> - cxl_probe_component_regs(&port->dev, crb, &map.component_map);
>> - if (!map.component_map.hdm_decoder.valid) {
>> - dev_dbg(&port->dev, "HDM decoder registers not implemented\n");
>> - /* unique error code to indicate no HDM decoder capability */
>> - return -ENODEV;
>> - }
>> -
>> - return cxl_map_component_regs(&map, regs, BIT(CXL_CM_CAP_CAP_ID_HDM));
>> -}
>> -
>> static bool should_emulate_decoders(struct cxl_endpoint_dvsec_info *info)
>> {
>> struct cxl_hdm *cxlhdm;
>> @@ -155,7 +135,7 @@ struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port,
>> {
>> struct device *dev = &port->dev;
>> struct cxl_hdm *cxlhdm;
>> - void __iomem *crb;
>> + struct cxl_register_map *reg_map;
>> int rc;
>>
>> cxlhdm = devm_kzalloc(dev, sizeof(*cxlhdm), GFP_KERNEL);
>> @@ -164,19 +144,29 @@ struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port,
>> cxlhdm->port = port;
>> dev_set_drvdata(dev, cxlhdm);
>>
>> - crb = ioremap(port->component_reg_phys, CXL_COMPONENT_REG_BLOCK_SIZE);
>> - if (!crb && info && info->mem_enabled) {
>> - cxlhdm->decoder_count = info->ranges;
>> - return cxlhdm;
>> - } else if (!crb) {
>> + reg_map = &port->reg_map;
>
> Could you set this where it's defined above?
>
Yes.
>> + if (reg_map->resource == CXL_RESOURCE_NONE) {
>
> A reminder comment on why/when this happens might be a good addition.
>
Yes, we will add.
>> + if (info && info->mem_enabled) {
>> + cxlhdm->decoder_count = info->ranges;
>> + return cxlhdm;
>> + }
>
> Trivial (and true before this patch) but I'd rather see the error path out of line
>
Ok, we will change the conditional check to be for the error case and the default path
for success.
>
> if (!info || !info->mem_enabled) {
> WARN_ON(1);
> dev_err(dev, "No ...
> ...
> }
>
> cxlhdm->decoder_count = info->ranges;
> return cxlhdm;
> }
>
>
>> + WARN_ON(1);
>> dev_err(dev, "No component registers mapped\n");
>> return ERR_PTR(-ENXIO);
>> }
>>
>> - rc = map_hdm_decoder_regs(port, crb, &cxlhdm->regs);
>> - iounmap(crb);
>> - if (rc)
>> + if (!reg_map->component_map.hdm_decoder.valid) {
>> + dev_dbg(&port->dev, "HDM decoder registers not implemented\n");
>> + /* unique error code to indicate no HDM decoder capability */
>> + return ERR_PTR(-ENODEV);
>> + }
>> +
>> + rc = cxl_map_component_regs(reg_map, &cxlhdm->regs,
>> + BIT(CXL_CM_CAP_CAP_ID_HDM));
>> + if (rc) {
>> + dev_dbg(dev, "Failed to map HDM capability.\n");
> dev_err() seems appropriate here.
>
Yes, we will change dev_dbg() here to use dev_err().
Regards,
Terry
>> return ERR_PTR(rc);
>> + }
>>
>> parse_hdm_decoder_caps(cxlhdm);
>> if (cxlhdm->decoder_count == 0) {
>
next prev parent reply other threads:[~2023-10-09 14:35 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-27 15:43 [PATCH v11 00/20] cxl/pci: Add support for RCH RAS error handling Robert Richter
2023-09-27 15:43 ` [PATCH v11 01/20] cxl/port: Fix release of RCD endpoints Robert Richter
2023-10-02 14:14 ` Jonathan Cameron
2023-09-27 15:43 ` [PATCH v11 02/20] cxl/core/regs: Rename @dev to @host in struct cxl_register_map Robert Richter
2023-10-02 14:19 ` Jonathan Cameron
2023-09-27 15:43 ` [PATCH v11 03/20] cxl/port: Fix @host confusion in cxl_dport_setup_regs() Robert Richter
2023-10-02 14:32 ` Jonathan Cameron
2023-09-27 15:43 ` [PATCH v11 04/20] cxl/port: Rename @comp_map to @reg_map in struct cxl_register_map Robert Richter
2023-10-02 14:34 ` Jonathan Cameron
2023-10-09 14:27 ` Terry Bowman
2023-09-27 15:43 ` [PATCH v11 05/20] cxl/port: Pre-initialize component register mappings Robert Richter
2023-09-27 15:43 ` [PATCH v11 06/20] cxl/pci: Store the endpoint's Component Register mappings in struct cxl_dev_state Robert Richter
2023-09-27 15:43 ` [PATCH v11 07/20] cxl/hdm: Use stored Component Register mappings to map HDM decoder capability Robert Richter
2023-10-02 14:43 ` Jonathan Cameron
2023-10-09 14:35 ` Terry Bowman [this message]
2023-10-16 14:09 ` Robert Richter
2023-09-27 15:43 ` [PATCH v11 08/20] cxl/pci: Remove Component Register base address from struct cxl_dev_state Robert Richter
2023-09-27 15:43 ` [PATCH v11 09/20] cxl/port: Remove Component Register base address from struct cxl_port Robert Richter
2023-09-27 15:43 ` [PATCH v11 10/20] cxl/pci: Introduce config option PCIEAER_CXL Robert Richter
2023-10-02 14:46 ` Jonathan Cameron
2023-10-09 14:44 ` Terry Bowman
2023-10-16 13:40 ` Terry Bowman
2023-10-16 14:08 ` Jonathan Cameron
2023-09-27 15:43 ` [PATCH v11 11/20] cxl/pci: Add RCH downstream port AER register discovery Robert Richter
2023-10-02 14:53 ` Jonathan Cameron
2023-10-09 14:55 ` Terry Bowman
2023-09-27 15:43 ` [PATCH v11 12/20] PCI/AER: Refactor cper_print_aer() for use by CXL driver module Robert Richter
2023-09-27 15:43 ` [PATCH v11 13/20] cxl/pci: Update CXL error logging to use RAS register address Robert Richter
2023-09-27 15:43 ` [PATCH v11 14/20] cxl/pci: Map RCH downstream AER registers for logging protocol errors Robert Richter
2023-10-02 14:56 ` Jonathan Cameron
2023-10-09 14:56 ` Terry Bowman
2023-09-27 15:43 ` [PATCH v11 15/20] cxl/pci: Add RCH downstream port error logging Robert Richter
2023-09-27 15:43 ` [PATCH v11 16/20] cxl/pci: Disable root port interrupts in RCH mode Robert Richter
2023-09-27 15:43 ` [PATCH v11 17/20] PCI/AER: Forward RCH downstream port-detected errors to the CXL.mem dev handler Robert Richter
2023-09-27 15:43 ` [PATCH v11 18/20] PCI/AER: Unmask RCEC internal errors to enable RCH downstream port error handling Robert Richter
2023-09-27 15:43 ` [PATCH v11 19/20] cxl/core/regs: Rename phys_addr in cxl_map_component_regs() Robert Richter
2023-09-27 15:43 ` [PATCH v11 20/20] cxl/core/regs: Rework cxl_map_pmu_regs() to use map->dev for devm Robert Richter
2023-10-02 15:01 ` Jonathan Cameron
2023-09-27 16:04 ` [PATCH v11 00/20] cxl/pci: Add support for RCH RAS error handling Robert Richter
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=fc3bfa6b-3635-4185-a28c-3e1ea76e5970@amd.com \
--to=terry.bowman@amd.com \
--cc=Jonathan.Cameron@Huawei.com \
--cc=alison.schofield@intel.com \
--cc=bhelgaas@google.com \
--cc=bwidawsk@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rrichter@amd.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