From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD182C433F5 for ; Tue, 1 Feb 2022 18:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233708AbiBASVd (ORCPT ); Tue, 1 Feb 2022 13:21:33 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:4608 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230372AbiBASVc (ORCPT ); Tue, 1 Feb 2022 13:21:32 -0500 Received: from fraeml734-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4JpCpJ69NPz67bSr; Wed, 2 Feb 2022 02:17:44 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml734-chm.china.huawei.com (10.206.15.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 1 Feb 2022 19:21:30 +0100 Received: from localhost (10.202.226.41) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 1 Feb 2022 18:21:29 +0000 Date: Tue, 1 Feb 2022 18:21:28 +0000 From: Jonathan Cameron To: Ben Widawsky CC: , , Alison Schofield , Dan Williams , "Ira Weiny" , Vishal Verma , "Bjorn Helgaas" , , Subject: Re: [PATCH v3 10/14] cxl/region: Collect host bridge decoders Message-ID: <20220201182128.000010d9@Huawei.com> In-Reply-To: <20220128002707.391076-11-ben.widawsky@intel.com> References: <20220128002707.391076-1-ben.widawsky@intel.com> <20220128002707.391076-11-ben.widawsky@intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.41] X-ClientProxiedBy: lhreml733-chm.china.huawei.com (10.201.108.84) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Thu, 27 Jan 2022 16:27:03 -0800 Ben Widawsky wrote: > Part of host bridge verification in the CXL Type 3 Memory Device > Software Guide calculates the host bridge interleave target list (6th > step in the flow chart), ie. verification and state update are done in > the same step. Host bridge verification is already in place, so go ahead > and store the decoders with their target lists. > > Switches are implemented in a separate patch. > > Signed-off-by: Ben Widawsky Looks like a little bit of code got in here that I think belongs in a different patch. > --- > drivers/cxl/region.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/cxl/region.c b/drivers/cxl/region.c > index 145d7bb02714..b8982be13bfe 100644 > --- a/drivers/cxl/region.c > +++ b/drivers/cxl/region.c > @@ -428,6 +428,7 @@ static bool region_hb_rp_config_valid(struct cxl_region *cxlr, > return simple_config(cxlr, hbs[0]); > > for (i = 0; i < hb_count; i++) { > + struct cxl_decoder *cxld; > int idx, position_mask; > struct cxl_dport *rp; > struct cxl_port *hb; > @@ -486,6 +487,18 @@ static bool region_hb_rp_config_valid(struct cxl_region *cxlr, > "One or more devices are not connected to the correct Host Bridge Root Port\n"); > goto err; > } > + > + if (!state_update) > + continue; > + > + if (dev_WARN_ONCE(&cxld->dev, > + port_grouping >= cxld->nr_targets, > + "Invalid port grouping %d/%d\n", > + port_grouping, cxld->nr_targets)) > + goto err; > + > + cxld->interleave_ways++; > + cxld->target[port_grouping] = get_rp(ep); > } > } > } > @@ -538,7 +551,7 @@ static bool rootd_valid(const struct cxl_region *cxlr, > > struct rootd_context { > const struct cxl_region *cxlr; > - struct cxl_port *hbs[CXL_DECODER_MAX_INTERLEAVE]; > + const struct cxl_port *hbs[CXL_DECODER_MAX_INTERLEAVE]; > int count; > }; > > @@ -564,7 +577,7 @@ static struct cxl_decoder *find_rootd(const struct cxl_region *cxlr, > struct rootd_context ctx; > struct device *ret; > > - ctx.cxlr = cxlr; > + ctx.cxlr = (struct cxl_region *)cxlr; Why is this here? If it's needed, that need doesn't seem to have come in as part of this patch. > > ret = device_find_child((struct device *)&root->dev, &ctx, rootd_match); > if (ret)