Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp805766pxj; Fri, 11 Jun 2021 12:00:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6A/+2pKJK2Sk2bO5CCSs/gQgH9fN2J352YMSW4p41wZ5jGC8lBzBMJCLfKGRhtq7sH11T X-Received: by 2002:aa7:cfc7:: with SMTP id r7mr5207027edy.13.1623438007626; Fri, 11 Jun 2021 12:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623438007; cv=none; d=google.com; s=arc-20160816; b=VvvagwCk2zRMVQtPwwlAnKj5zJ2uRCfHwt5NVRVjgmxpjgRfX095DNcrPnWHO8B0N4 SIvsIkQxhPTZ4tXS91eWcCgP/DPuLFZO0Je5gJ2GnGXK7Ifu9g8URPQbQSZUGT8wAboA +AyVqfjnZb9KjfUrD8fdCCghOFPzMXCS5aUOvjRL3/sJ7rMInUB77YuEI2ad5EcpUvzc 16EiAtKRkq6AUh1EU9yr3fMpn8ImOYZsrAwTxeF6UT4qS8Cyup0vbm6RGOzHf+zbRyxY IAF0/o73otFqqvXDSB1oiVjZIe+VCShCpt56F4vOqtFUCVuFjuO0Pm1pEmYxc7Vd7g5V Xb6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=kI53Z+V1yTIGhMYD3HVCzqkT1+IVR3Un8CLLjrdyiOs=; b=y80fSRZUkAP/SdVblKE9sKw/eAikBFF/DXdjLsdMYAZ8tcXf6c8IjzSyrj7NoQnbo3 p0qg1s1hNpXuNK8wfG6tVGmoOnJmzU5+AZKnDW47qzdkwUYo3yTdeX1o0nP7ZlHbevpx jCyPcNxdSYa0Y15cRIkkSDYOW6v+5+ue/oWPcYiN1Jm8782NoLgQ+Cj4B07GcNOOgwjc P8mRNWXJRMIP/tfhPVUywOz/O9ruaf2+1+D5pHEwjrWyEq+gNv5rpoW3ZNirjFFPONGn nxEz0Q+fdELqGwfGD1RK4dPkff6CqffEzJ78QFIc4f2uQfydzxoUhUqLpNm7Uxh45l4U LDng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=eBJNwcfa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq18si5205793edb.549.2021.06.11.11.59.44; Fri, 11 Jun 2021 12:00:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=eBJNwcfa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbhFKS6t (ORCPT + 99 others); Fri, 11 Jun 2021 14:58:49 -0400 Received: from mail-pj1-f54.google.com ([209.85.216.54]:54003 "EHLO mail-pj1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbhFKS6s (ORCPT ); Fri, 11 Jun 2021 14:58:48 -0400 Received: by mail-pj1-f54.google.com with SMTP id ei4so6195401pjb.3 for ; Fri, 11 Jun 2021 11:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kI53Z+V1yTIGhMYD3HVCzqkT1+IVR3Un8CLLjrdyiOs=; b=eBJNwcfa0JaWCYzFgaEniV+zLZWtVHQwsScf5x35yGxrkKnfNGToJT2tVmKva+NBmm Is0JaMgDOJhJtzpp6Xj7ckHHBtt+NAUZLm0d2DoW4GylxKhTYQv/PF4+WKnIcO2O2RnX CfmACMYSNcXnEh6+fDv/FJ4pgyeJscSiZw68zzPBKjAiELpWW6nlMbPjd8JT/16WYANN wBkLMSLvBwMFQ2biTSAmZN5C+s4A3Z4Y1/sDWTXecPBIrlsEP+x/rspMHSIG0c2i0V6X FwTKAY3leUWh5qYvK75kbRD+RUxsfoHsnqisN9wrW4c1fB7XVIOY43Y8TD1zDCqhJvHH 61DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kI53Z+V1yTIGhMYD3HVCzqkT1+IVR3Un8CLLjrdyiOs=; b=UIP3LH5K87BtDgGF+LgYj8PaSQ4yZc31FOU7KTrO5PbCHNxO8IaLufXfYkTpdRhi4x yDQdEbe5pwvxnLdInRozDdD+uepuAewax65Ro7Y5HFKXjvCGEIow3l43qI4RH1d9IQ3G wvlUSh/w5sEdZndWXlkACNtVaCdObB96Trxv+UpsNhEswFYwxiG8zpOdbefiMnUjqe9F LToAPRkivFkOfKsWJHLqQOFS8HCeAoEYQyQRS+062DJYo/YIjUca50BQ8mxhCoVwormS V0uW91+n2h0dLZ7KkPfBClPOCMuDTIXmWkxNo3ulD4yOyiuNHVx/kwqCf/VLM0+E85fr 5BCg== X-Gm-Message-State: AOAM530exKB6nlKSh4ZNj6qNAO9tP7DxUdNzhmZptNX+zPPbEk3594Bf 6P1KlPAVI4eO5UBvxU8jZcqmjjLMJevB5a9kLqHIWQ== X-Received: by 2002:a17:90a:fc88:: with SMTP id ci8mr10605989pjb.13.1623437750427; Fri, 11 Jun 2021 11:55:50 -0700 (PDT) MIME-Version: 1.0 References: <162336395765.2462439.11368504490069925374.stgit@dwillia2-desk3.amr.corp.intel.com> <162336396329.2462439.16556923116284874437.stgit@dwillia2-desk3.amr.corp.intel.com> <20210611174736.ttzpk5uniyoyd4vw@intel.com> In-Reply-To: <20210611174736.ttzpk5uniyoyd4vw@intel.com> From: Dan Williams Date: Fri, 11 Jun 2021 11:55:39 -0700 Message-ID: Subject: Re: [PATCH 1/5] cxl/core: Add cxl-bus driver infrastructure To: Ben Widawsky Cc: linux-cxl@vger.kernel.org, Linux NVDIMM , "Schofield, Alison" , Vishal L Verma , "Weiny, Ira" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 11, 2021 at 10:47 AM Ben Widawsky wrote: > > On 21-06-10 15:26:03, Dan Williams wrote: > > Enable devices on the 'cxl' bus to be attached to drivers. The initial > > user of this functionality is a driver for an 'nvdimm-bridge' device > > that anchors a libnvdimm hierarchy attached to CXL persistent memory > > resources. Other device types that will leverage this include: > > > > cxl_port: map and use component register functionality (HDM Decoders) > > Since I'm looking at this now, perhaps I can open the discussion here. Have you > thought about how this works yet? Right now I'm thinking there are two "drivers": > cxl_port: Switches (and ACPI0016) > cxl_mem: The memory device's HDM decoders > > For port, probe() will figure out that the thing is an upstream port, call > cxl_probe_component_regs and then call devm_cxl_add_port(). I think that's > straight forward. I was expecting cxl_port_driver.probe() comes *after* port discovery. Think of it like PCI discovery. Some agent does the hardware topology scan to add devices, in this case devm_cxl_add_port(), and that triggers cxl_port_driver to load. So the initial enumeration done by the cxl_acpi driver will populate the first two levels of the port hierarchy with port objects and populate their component register physical base addresses. For any other port deeper in the hierarchy I was expecting that to be scanned after the discovery of a cxl_memdev that is not attached to the current hierarchy. So, for example imagine a config like: Platform --> Host Bridge --> Switch --> Endpoint ...where in sysfs that's modeled as: root0 --> port1 --> port2 --> port3 Where port3 is assuming that the CXL core models the device's connection to the topology as yet another cxl_port. At the beginning of time after cxl_acpi has loaded but before cxl_pci has discovered the endpoint the topology is: root0 --> port1 Upon the detection of the endpoint the CXL core can assume that all intermediary switches between the root and this device have been registered as PCI devices. So, it follows that endpoint device arrival triggers "cxl_bus_rescan()" that goes and enumerates all the CXL resources in the topology to produce: root0 --> port1 --> port2 --> port3 > For the memory device we've already probed the thing via class code so there is > no need to use this driver registration, however, I think it would be nice to do > so. Is there a clean way to do that? The PCI device associated with the endpoint is already probed, but the cxl_memdev itself can have a driver on the CXL bus. So I think the cxl_memdev driver should try to register a cxl_port after telling cxl_acpi to rescan. If a check like "is_cxl_dport(pdev->dev.parent)" for the endpoint returns false it means that the cxl_bus_rescan() failed to enumerate the CXL topology to this endpoint and this endpoint is limited to only CXL.io operation. > Also, I'd like to make sure we're on the same page about struct cxl_decoder. > Right now they are only created for active HDM decoders. No, I was expecting they are also created for inactive ones. I am thinking that all decoders ultimately belong to the cxl_acpi driver, or whatever driver is acting as the root on a non-ACPI system. All decoder programming is driven by region activation stimulus that asks the root driver to try to establish a decode chain through the hieararchy per a given region. > Going forward, we can > either maintain a count of unused decoders on the given CXL component, or we can > instantiate a struct cxl_decoder that isn't active, ie. no interleave ways > granularit, base, etc. What's your thinking there? All resources are enumerated, just like PCI. Decode setup belongs to the core, just like PCI MMIO resource setup. The difference is that port drivers are needed to map component registers and service requests from cxl_acpi to reconfigure, but other than that cxl_decoders themselves don't have drivers and just reflect the current state of what cxl_acpi / cxl_core have established.