Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1414961pxb; Fri, 10 Sep 2021 05:33:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjFsbJxdA20VQv0dhSIQibL/+jNdq34LsliGoG1W2vtP5/1NSuSEFtk9hPEoJtzMbUArPx X-Received: by 2002:a05:6e02:184a:: with SMTP id b10mr6418544ilv.90.1631277212007; Fri, 10 Sep 2021 05:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631277211; cv=none; d=google.com; s=arc-20160816; b=bDP/G6HGSnFTDGQ9DqkSpVO2HQHv3/0LgS7e+6rtbd83U3URnY3jfqRSxVCmgPyxjV pMG9n00RYdOl6emfZ60zsB4I2jb+p6d2oDU1EAS9oXl2mqIXXqz3DK7TKcxjd1MC+JRd 42t51a0z39+1ZVMqs+OW/TryB83tHgPFJqenKUEr7GaDa00E8v/r+GIGLRTzCU9+DVJk WP5Uog8gA+BuAOjs27jcOfdFlOIY1onHL8VtMaWoudh8K/xwajySRtbNZSLgHTeiqayg V1P9CN59FFwoAhgSRugnFmDAYBNVPxjlwWxb+tEmuS8pYvTrlZJE7/nWu22J7NQ7Nc1O +mNg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1IhWjrTsmR+bikeJjo1NoNU20G+kDBLZ9MtU+srgpsY=; b=ecp4wWuAcAlfE9DNGXoS7YQMnF/zu7SHp6mUWKbRHPPOBgoRlEWDYMy2y4PvT24eTm mL295p7g7VoPyGazFmgfAGUo/lMGpJ+/9YxC4PG5p753rMA64BCnW6Ic8cUx8ZydWNI3 tT3bpY9qLP1hURNtE0Z+j3QsdqDJBet6opMIoRWyucIaA2dyRy137H5v0xYVSz2GNxHL RiUINCQSPm3nS18TWl+/2MV0pefmWPNQJgs8/orKwHCIJqSQos7jhyhMB92RI0gLTPDj /AvROHtggE5Y5AQuKqGJaaANJevjlUaNyElDSLe3Cq1VIyxotWOVtJgbR9BGDD+MZvYN dMVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i6Mh4W2V; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si4783295jaa.118.2021.09.10.05.33.20; Fri, 10 Sep 2021 05:33:31 -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=@linuxfoundation.org header.s=korg header.b=i6Mh4W2V; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233429AbhIJMco (ORCPT + 99 others); Fri, 10 Sep 2021 08:32:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:50088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233416AbhIJMcm (ORCPT ); Fri, 10 Sep 2021 08:32:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 46140611C8; Fri, 10 Sep 2021 12:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631277091; bh=iGBWs8eZx6iMBITm5sk4wbZ5cYOTzTSsVuetQpDVX+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i6Mh4W2VA8gbnudxyLWUEjuI/dQGwfYqDSbT+EKBeTRxMI1yQYFs7pn8fckhEfKpI n2LxbfYMJlnECPyhbRy/m5y74iTPikEdB4+/kZS5WJ9W6IseZU6UVrEoFskRPL6qF9 FFJeyzIJ9w8girniaUjHesKrJxfDKQ3RYzai6suw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Williams , Alison Schofield , Jonathan Cameron Subject: [PATCH 5.14 23/23] cxl/acpi: Do not add DSDT disabled ACPI0016 host bridge ports Date: Fri, 10 Sep 2021 14:30:13 +0200 Message-Id: <20210910122916.744559067@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210910122916.022815161@linuxfoundation.org> References: <20210910122916.022815161@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alison Schofield commit a7bfaad54b8b9cf06041528988d6b75b4b921546 upstream. During CXL ACPI probe, host bridge ports are discovered by scanning the ACPI0017 root port for ACPI0016 host bridge devices. The scan matches on the hardware id of "ACPI0016". An issue occurs when an ACPI0016 device is defined in the DSDT yet disabled on the platform. Attempts by the cxl_acpi driver to add host bridge ports using a disabled device fails, and the entire cxl_acpi probe fails. The DSDT table includes an _STA method that sets the status and the ACPI subsystem has checks available to examine it. One such check is in the acpi_pci_find_root() path. Move the call to acpi_pci_find_root() to the matching function to prevent this issue when adding either upstream or downstream ports. Suggested-by: Dan Williams Signed-off-by: Alison Schofield Fixes: 7d4b5ca2e2cb ("cxl/acpi: Add downstream port data to cxl_port instances") Cc: Reviewed-by: Jonathan Cameron Link: https://lore.kernel.org/r/163072203957.2250120.2178685721061002124.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/cxl/acpi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/drivers/cxl/acpi.c +++ b/drivers/cxl/acpi.c @@ -243,6 +243,9 @@ static struct acpi_device *to_cxl_host_b { struct acpi_device *adev = to_acpi_device(dev); + if (!acpi_pci_find_root(adev->handle)) + return NULL; + if (strcmp(acpi_device_hid(adev), "ACPI0016") == 0) return adev; return NULL; @@ -266,10 +269,6 @@ static int add_host_bridge_uport(struct if (!bridge) return 0; - pci_root = acpi_pci_find_root(bridge->handle); - if (!pci_root) - return -ENXIO; - dport = find_dport_by_dev(root_port, match); if (!dport) { dev_dbg(host, "host bridge expected and not found\n"); @@ -282,6 +281,11 @@ static int add_host_bridge_uport(struct return PTR_ERR(port); dev_dbg(host, "%s: add: %s\n", dev_name(match), dev_name(&port->dev)); + /* + * Note that this lookup already succeeded in + * to_cxl_host_bridge(), so no need to check for failure here + */ + pci_root = acpi_pci_find_root(bridge->handle); ctx = (struct cxl_walk_context){ .dev = host, .root = pci_root->bus,