Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp442656rwe; Wed, 31 Aug 2022 05:36:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR4hDU2mBQrfZl168rqYDz1cTFYby7lsWy0xD75YKFEqjIwUTDj+EUgjcOqy8Sj6hV5d3X1y X-Received: by 2002:a17:902:694a:b0:16e:e270:1f84 with SMTP id k10-20020a170902694a00b0016ee2701f84mr25345627plt.89.1661949395087; Wed, 31 Aug 2022 05:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661949395; cv=none; d=google.com; s=arc-20160816; b=FD0GkjKr9Vk3inSUKIk6pqxMKtCa9qOLupIcrMRClOdDEHs75Y29X7xxm1yn2Vb+HK +1eLUfAQ0tz9/wx452YkbGbH16yC4RR2afC5i511vMu9lCDqAc1arpu4H1qzvOO8dWmV KqRlc8jORRAl2XCSco+6fQNyGVi2YDOihzaTo41tT4tmWIOXeqvrSXH6dchc0zkatZxz YBd8Vx2PLDMUPnn4DytXN+U0fCxIgUtz2h2cEk3aBYUfxXr2t/FiS/zYLIWnB2jxmRO+ tjOW7KOq96/NZqZoGh0VY8PRY+I380QL32aIGsV8Y3y2Ybq5Hl6UI47GVyhNPm0fytKR JKCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=gZd71m9FJVeFpLTHXNKl7718jzK4wAWY5vfHO3bAD1Q=; b=UimfghzaxMJ46JR4Bw9rpTk91vi8T0W2NDV5ax2dXm9rkw6DSAPsTxsPYB1g0xbvwn ujyrKJksnYMBPNcMAfw7WdJZRxBSMM3GTFi3sSAzuUmaoQtj7rps/UY3oSWgXTzG3INJ PDjIl/6nbsqeSStZFJ2qBHrBsJQ6XQ5g8nZ346PwhU1sS3lOQVhEi9BfZwRpoFJBnng1 A0UVf1AZcWUquloIhvQHJnEMUFdD1SefahQvZg7ZZO9cArySCieaMT6bMuWIGdTLHh+t NTfMfMqxoxVLgLQh6x+T/ZjB9C5kmlekFB98ffEvvxeJTPT30E2kp2C4s/uaPItBEAkr eM2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s11-20020a17090aad8b00b001f2757da25asi1709999pjq.91.2022.08.31.05.36.24; Wed, 31 Aug 2022 05:36:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230151AbiHaL6j (ORCPT + 99 others); Wed, 31 Aug 2022 07:58:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbiHaL6f (ORCPT ); Wed, 31 Aug 2022 07:58:35 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4B73D275C; Wed, 31 Aug 2022 04:58:34 -0700 (PDT) Received: from fraeml705-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MHjNf59Twz67mg9; Wed, 31 Aug 2022 19:57:54 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml705-chm.china.huawei.com (10.206.15.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Wed, 31 Aug 2022 13:58:32 +0200 Received: from localhost (10.202.226.42) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 31 Aug 2022 12:58:32 +0100 Date: Wed, 31 Aug 2022 12:58:30 +0100 From: Jonathan Cameron To: Robert Richter CC: Alison Schofield , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , , , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown Subject: Re: [PATCH 12/15] cxl/acpi: Skip devm_cxl_port_enumerate_dports() when in RCD mode Message-ID: <20220831125830.00005105@huawei.com> In-Reply-To: <20220831081603.3415-13-rrichter@amd.com> References: <20220831081603.3415-1-rrichter@amd.com> <20220831081603.3415-13-rrichter@amd.com> 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.42] X-ClientProxiedBy: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 31 Aug 2022 10:16:00 +0200 Robert Richter wrote: > RCD mode has a different enumeration scheme other than in CXL VH mode. > An RCD is directly connected to an RCH without downstream and upstream > ports showing up in between in the PCI hierarchy. Skip dport > enumeration for RCHs. Upstream and downstream ports of RCH and RCD > will be setup separately in a later patch. > > Introduce the function is_rch_uport() to detect an RCH port. For RCHs > the parent root port is not the "ACPI0017" device and instead does not > have a fw node connected to it. > > Signed-off-by: Robert Richter > --- > drivers/cxl/core/pci.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c > index 0dbbe8d39b07..86ed112eb262 100644 > --- a/drivers/cxl/core/pci.c > +++ b/drivers/cxl/core/pci.c > @@ -65,6 +65,15 @@ static int match_add_dports(struct pci_dev *pdev, void *data) > return 0; > } > > +/* > + * A parent of an RCH (CXL 1.1 host) is a plain platform device while > + * a 2.0 host links to the ACPI0017 root device. > + */ > +static inline bool is_rch_uport(struct cxl_port *port) > +{ > + return is_cxl_port(&port->dev) && !port->dev.parent->fwnode; I'm not keen on the presence of fwnode being used to distinguish anything. That's the sort of thing that gets 'fixed' by later patches. Can we check something more specific? > +} > + > /** > * devm_cxl_port_enumerate_dports - enumerate downstream ports of the upstream port > * @port: cxl_port whose ->uport is the upstream of dports to be enumerated > @@ -74,10 +83,19 @@ static int match_add_dports(struct pci_dev *pdev, void *data) > */ > int devm_cxl_port_enumerate_dports(struct cxl_port *port) > { > - struct pci_bus *bus = cxl_port_to_pci_bus(port); > + struct pci_bus *bus; > struct cxl_walk_context ctx; > int type; > > + /* > + * Skip enumeration in Restricted CXL Device mode as the > + * device has been already registered at the host's dport > + * during host discovery. > + */ > + if (is_rch_uport(port)) > + return 0; > + > + bus = cxl_port_to_pci_bus(port); > if (!bus) > return -ENXIO; >