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 E7940C4332F for ; Wed, 9 Nov 2022 23:12:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232159AbiKIXMC (ORCPT ); Wed, 9 Nov 2022 18:12:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231786AbiKIXLf (ORCPT ); Wed, 9 Nov 2022 18:11:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38A5B30F5B; Wed, 9 Nov 2022 15:11:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DD240B8203E; Wed, 9 Nov 2022 23:11:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B15DC433C1; Wed, 9 Nov 2022 23:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668035486; bh=gTQxZ1egZZFdLRU5hjINvNkzMgHAG+RtZvuMob2tT+Y=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=tqp2zijGCjx3e4LT1ETg9ytMhBiwUXmObb7RMccEFfWgPld6SmHjyXCkNGpr2hxnZ lUiRLwEmN7sHGdtxqfDFPR9+XUtyKUhSpszIx13n8USwk/9KXP9fdxW3RhzKFh/IDz DSUWAWXG5WSdDOIHi6wESaYN+FRNs8Bm9IBOwsSVkPokWV4j8DpU6W+iUfU2Wux3cO t2mHxjL+XydD8mus/sUQ+8mj21cz//Uy0gIO+tsyf6wxMpPpni6BWwCxC4EB6+UyVU jVDAH1wJUgW548yPkLhhQWdNSBVGyps755sr8zU2cMiR7rQxVS73TZf+TI2tWZJA1I aBsOlPl4IzHEQ== Date: Wed, 9 Nov 2022 17:11:24 -0600 From: Bjorn Helgaas To: Robert Richter Cc: Alison Schofield , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , Jonathan Cameron , Davidlohr Bueso , Dave Jiang Subject: Re: [PATCH v3 1/9] cxl/acpi: Register CXL host ports by bridge device Message-ID: <20221109231124.GA581464@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221109104059.766720-2-rrichter@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org On Wed, Nov 09, 2022 at 11:40:51AM +0100, Robert Richter wrote: > A port of a CXL host bridge links to the bridge's acpi device s/acpi/ACPI/ to match usage below. > (&adev->dev) with its corresponding uport/dport device (uport_dev and > dport_dev respectively). The device is not a direct parent device in > the PCI topology as pdev->dev.parent points to a PCI bridge's (struct > pci_host_bridge) device. The following CXL memory device hierarchy > would be valid for an endpoint once an RCD EP would be enabled (note > this will be done in a later patch): > > VH mode: > > cxlmd->dev.parent->parent > ^^^\^^^^^^\ ^^^^^^\ > \ \ pci_dev (Type 1, Downstream Port) > \ pci_dev (Type 0, PCI Express Endpoint) > cxl mem device > > RCD mode: > > cxlmd->dev.parent->parent > ^^^\^^^^^^\ ^^^^^^\ > \ \ pci_host_bridge > \ pci_dev (Type 0, RCiEP) > cxl mem device > > In VH mode a downstream port is created by port enumeration and thus > always exists. > > Now, in RCD mode the host bridge also already exists but it references > to an ACPI device. A port lookup by the PCI device's parent device > will fail as a direct link to the registered port is missing. The ACPI > device of the bridge must be determined first. > > To prevent this, change port registration of a CXL host to use the > bridge device instead. Do this also for the VH case as port topology > will better reflect the PCI topology then. > > If a mock device is registered by a test driver, the bridge pointer > can be NULL. Keep using the matching ACPI device (&adev->dev) as a > fallback in this case. > > Signed-off-by: Robert Richter