Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp518017rwe; Thu, 1 Sep 2022 03:39:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR5BYeVND6RmxJWTek9msLTb/SqqLBNgJbNtpzF9t2f767eFW9jU6AE8umkqOU2fzPLgX4xf X-Received: by 2002:a17:907:2e01:b0:730:9ecc:cd28 with SMTP id ig1-20020a1709072e0100b007309ecccd28mr22512564ejc.360.1662028755346; Thu, 01 Sep 2022 03:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662028755; cv=none; d=google.com; s=arc-20160816; b=su0jiv0RSEcKgDsEvOv1by01pzeywZijWjnPa84Mc1oV7WeVvNCZJYvz7RGcdAoMr0 K4tGl3HINajvgtBRT+m17VWnxdHOPeuhtL+JQ7DJkgpu7a879ykF1Wssge3zp1hVWJB3 MmFDhl/yFqpDqp8slbA9vVvRBE8w9VRTE4VyWQhe5OR9Cdjd8nM2/K89K65YwwWMa++T uXxomIUd5wWFKD7s1PyPsJpUWnr+QJDGKcEgPTjpQ8LMbJWYQqWym0kzL4XxaoF72xGB 9QZcwUHgka2felKQnQ5Xa15gfFjbx0/uD88VgbFM7Pi9fNAj/9Xgt4gexm67vk41xhaw uIjw== 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=iGr7+at/J+M7BVB/TBeojQo3s7Hc/TmnhvbVeuOlQT4=; b=xTXwm9tYhPH53UqOtM+L+uK79wKoWnDIDH2BTX8tg2rBduEg9aAVqfGDepJPXKujWq EGGfWQGM7/l9dDKdypn3QFKGRhuGAPyq3t1HK39YoUdvKM5NsrENVpZJ+qGeEsUKmIL4 LK9XVQ4NC+Vbn2XjbTLL2ZOpYg1tpWsU3aMF24CGnTlJGRp03Zt9+GTel9vhSK0GIwOs PbqylRdLnwsVdV36Y8uoDsfHkJmqV48vqG/ueX6ZM5Y2W1hzPRBHgr3Wzzub6TYmycWA XT3nWorD+0xDHtw/Vb56WYnnY296v97s/tuSLzhu9Pyav47Bsxx/XsyddrfCyZgW3NT8 pfeQ== 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 nc29-20020a1709071c1d00b0072b33152db1si14808970ejc.858.2022.09.01.03.38.48; Thu, 01 Sep 2022 03:39:15 -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 S234186AbiIAKYJ (ORCPT + 99 others); Thu, 1 Sep 2022 06:24:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234144AbiIAKYD (ORCPT ); Thu, 1 Sep 2022 06:24:03 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81A93138582; Thu, 1 Sep 2022 03:23:53 -0700 (PDT) Received: from fraeml739-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MJHDz37Fqz67xgN; Thu, 1 Sep 2022 18:23:15 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml739-chm.china.huawei.com (10.206.15.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 1 Sep 2022 12:23:50 +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; Thu, 1 Sep 2022 11:23:50 +0100 Date: Thu, 1 Sep 2022 11:23:48 +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 08/15] cxl/acpi: Check RCH's CXL DVSEC capabilities Message-ID: <20220901112348.000003f1@huawei.com> In-Reply-To: References: <20220831081603.3415-1-rrichter@amd.com> <20220831081603.3415-9-rrichter@amd.com> <20220831115224.00003afd@huawei.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: lhrpeml500006.china.huawei.com (7.191.161.198) 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 Thu, 1 Sep 2022 08:30:49 +0200 Robert Richter wrote: > On 31.08.22 11:52:24, Jonathan Cameron wrote: > > On Wed, 31 Aug 2022 10:15:56 +0200 > > Robert Richter wrote: > > > > diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c > > > index ffdf439adb87..f9cdf23a91a8 100644 > > > --- a/drivers/cxl/acpi.c > > > +++ b/drivers/cxl/acpi.c > > > @@ -322,6 +322,8 @@ struct pci_host_bridge *cxl_find_next_rch(struct pci_host_bridge *host) > > > { > > > struct pci_bus *bus = host ? host->bus : NULL; > > > struct acpi_device *adev; > > > + struct pci_dev *pdev; > > > + bool is_restricted_host; > > > > > > while ((bus = pci_find_next_bus(bus)) != NULL) { > > > host = bus ? to_pci_host_bridge(bus->bridge) : NULL; > > > @@ -343,6 +345,20 @@ struct pci_host_bridge *cxl_find_next_rch(struct pci_host_bridge *host) > > > dev_dbg(&host->dev, "PCI ACPI host found: %s\n", > > > acpi_dev_name(adev)); > > > > > > + /* Check CXL DVSEC of dev 0 func 0 */ > > > > So assumption here is that the hostbridge has a one or more RCiEPs. > > The spec (r3.0 9.11.4) allows for the EP to appear behind a root port > > - that case always felt odd to me, so I'm fine with not supporting it until > > we see a user. > > The software view of an RCD is always the same, it shows up always as > an RCiEP. See figure 9-12 and 9-13 of the spec. Ah. I see I misread the following from CXL r3.0 9.11.4 "This ACPI Host Bridge spawns a legal PCIe hierarchy. All PCIe Endpoints located in the RCD are children of this ACPI Host Bridge. These Endpoints may appear directly on the Root bus number or may appear behind a Root Port located on the Root bus." I guess that is allowing 'additional' PCIe endpoints below a root port attached to the ACPI Host Bridge, but not dev 0 func 0. That's a subtle distinction I missed. > > -Robert > > > > > > + pdev = pci_get_slot(bus, PCI_DEVFN(0, 0)); > > > + is_restricted_host = pdev > > > + && (pci_pcie_type(pdev) == PCI_EXP_TYPE_RC_END) > > > + && pci_find_dvsec_capability(pdev, > > > + PCI_DVSEC_VENDOR_ID_CXL, > > > + CXL_DVSEC_PCIE_DEVICE); > > > + pci_dev_put(pdev); > > > + > > > + if (!is_restricted_host) > > > + continue; > > > + > > > + dev_dbg(&host->dev, "CXL restricted host found\n"); > > > + > > > return host; > > > }