Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp489389rwe; Wed, 31 Aug 2022 06:18:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR6fwZR2qnCm0GVboDaryb+tXg0ezXg+hGDQSyuPRJC178vFJ9D7UA+nGr0qtTLKMN4H5CiX X-Received: by 2002:a17:906:8a54:b0:73d:c3c4:5db4 with SMTP id gx20-20020a1709068a5400b0073dc3c45db4mr21175389ejc.17.1661951917515; Wed, 31 Aug 2022 06:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661951917; cv=none; d=google.com; s=arc-20160816; b=xpFsDBWtW8jpNevHHpNqTS/0AGOM4jMZqN6MPzeMbywz5o3HvkGnuAV/6TaSE6m56w BbzyIcoSy8pGsE+hf7XKg4hPpObL3IpR/Qxk/eUKcNGbER8quGy/8JTl4Zx9xvLR0X+Z +lMnbeaDhTd89b0btoU9jpvBvIfq4ZXpfJ7EBmDm2LRr8zPwhiiY/93q6e+oR6YAgXdJ bespVP6wocLYz4V6B0qnoULeoN2fTBvfbh6FO5jscRV9S9RDWlec/q+b62Oxk/J+lQWw 9GzyjDH9GvUV0BOzE0Colsz8d/m+A5UWhuOr0MGk2xOOQreHmfbLw38DYoCeCKDNG4dL UmRw== 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=3nswpWvcGp9AUwP1vIRZ+hI5PSh5q8pf0a12sAVqVq0=; b=kdZymOKGHB2mdocKQq+vfKHJlZ06dmXM4vfXUYa7lPn2dTFqgTBMnWqTICxkBicj3e oJNbqGT3AP9dhaqLeCAb+nPi5w500TDKfteCrg6r8WKtp3MdBf91B/1bW8V0ZKMfd+ua dOcsoprfSj7o2VXbV2LCzvtebEkDomwkWI9bRB+Df+u+NeIfYNljVgv9ahNO4MAUR2lK z7HuorQSaDhMvbAD9OEvOQj6WtF12jtX7XMOjb7Ykx6fEaqP4/3PQObyjawIkTHw/QRf sj0HmX0pqKo9TSw/vA6jkJGw3NqocEWK29mf/lTgwhvWx/9cDLCkgYrECoDWrB5sUFBK 0Oew== 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 m6-20020a1709061ec600b00706b9787b43si9547367ejj.319.2022.08.31.06.18.10; Wed, 31 Aug 2022 06:18:37 -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 S230507AbiHaMXf (ORCPT + 99 others); Wed, 31 Aug 2022 08:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229761AbiHaMXe (ORCPT ); Wed, 31 Aug 2022 08:23:34 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED6CCEB13; Wed, 31 Aug 2022 05:23:32 -0700 (PDT) Received: from fraeml735-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MHjst0WWpz684wN; Wed, 31 Aug 2022 20:19:46 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml735-chm.china.huawei.com (10.206.15.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 31 Aug 2022 14:23:30 +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 13:23:30 +0100 Date: Wed, 31 Aug 2022 13:23:29 +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 00/15] cxl: Add support for Restricted CXL hosts (RCD mode) Message-ID: <20220831132329.00007c46@huawei.com> In-Reply-To: <20220831081603.3415-1-rrichter@amd.com> References: <20220831081603.3415-1-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: lhrpeml100002.china.huawei.com (7.191.160.241) 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:15:48 +0200 Robert Richter wrote: > In Restricted CXL Device (RCD) mode (formerly referred to as CXL 1.1) > the PCIe enumeration hierarchy is different from CXL VH Enumeration > (formerly referred to as 2.0, for both modes see CXL spec 3.0: 9.11 > and 9.12, [1]). This series adds support for RCD mode. It implements > the detection of Restricted CXL Hosts (RCHs) and its corresponding > Restricted CXL Devices (RCDs). It does the necessary enumeration of > ports and connects the endpoints. With all the plumbing an RCH/RCD > pair is registered at the Linux CXL bus and becomes visible in sysfs > in the same way as CXL VH hosts and devices do already. RCDs are > brought up as CXL endpoints and bound to subsequent drivers such as > cxl_mem. > > For CXL VH the host driver (cxl_acpi) starts host bridge discovery > once the ACPI0017 CXL root device is detected and then searches for > ACPI0016 host bridges to enable CXL. In RCD mode an ACPI0017 device > might not necessarily exist and the host bridge can have a standard > PCIe host bridge PNP0A08 ID, there aren't any CXL port or switches in > the PCIe hierarchy visible. As such the RCD mode enumeration and host > discovery is very different from CXL VH. See patch #5 for > implementation details. > > This implementation expects the host's downstream and upstream port > RCRBs base address being reported by firmware using the optional CEDT > CHBS entry of the host bridge (see CXL spec 3.0, 9.17.1.2). > > RCD mode does not support hot-plug, so host discovery is at boot time > only. > > Patches #1 to #4 are prerequisites of the series with fixes needed and > a rework of debug messages for port enumeration. Those are general > patches and could be applied earlier and independently from the rest > assuming there are no objections with them. Patches #5 to #15 contain > the actual implementation of RCD mode support. > > [1] https://www.computeexpresslink.org/spec-landing Hi Robert, I'm curious on the aims of this work. Given expectation for RCDs is often that the host firmware has set them up before the OS loads, what functionality do you want to gain by mapping these into the CXL 2.0+ focused infrastructure? When I did some analysis a while back on CXL 1.1 I was pretty much assuming that there was no real reason to let the OS know about it because it couldn't do much of any use with the information. There are some corners like RAS where it might be useful or perhaps to enable some of the CXL 3.0 features that are allowed to be EP only and so could be relevant for an older host (e.g. CPMUs). With my QEMU hat on I wasn't planning to bother with anything pre 2.0 but it might be worth considering to let us exercise this code... Jonathan > > Robert Richter (15): > cxl/core: Remove duplicate declaration of devm_cxl_iomap_block() > cxl/core: Check physical address before mapping it in > devm_cxl_iomap_block() > cxl: Unify debug messages when calling devm_cxl_add_port() > cxl: Unify debug messages when calling devm_cxl_add_dport() > cxl/acpi: Add probe function to detect restricted CXL hosts in RCD > mode > PCI/ACPI: Link host bridge to its ACPI fw node > cxl/acpi: Check RCH's PCIe Host Bridge ACPI ID > cxl/acpi: Check RCH's CXL DVSEC capabilities > cxl/acpi: Determine PCI host bridge's ACPI UID > cxl/acpi: Extract the RCH's RCRB base address from CEDT > cxl/acpi: Extract the host's component register base address from RCRB > cxl/acpi: Skip devm_cxl_port_enumerate_dports() when in RCD mode > cxl/acpi: Rework devm_cxl_enumerate_ports() to support RCD mode > cxl/acpi: Enumerate ports in RCD mode to enable RCHs and RCDs > cxl/acpi: Specify module load order dependency for the cxl_acpi module > > drivers/acpi/pci_root.c | 1 + > drivers/cxl/acpi.c | 311 ++++++++++++++++++++++++++++++++++- > drivers/cxl/core/pci.c | 22 ++- > drivers/cxl/core/port.c | 103 ++++++++---- > drivers/cxl/core/regs.c | 3 + > drivers/cxl/cxl.h | 2 - > drivers/cxl/mem.c | 1 + > tools/testing/cxl/test/cxl.c | 8 +- > 8 files changed, 400 insertions(+), 51 deletions(-) >