Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1877515rwb; Fri, 19 Aug 2022 10:55:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR61QKP6Bo9t6dvAVgT82k4X/tz9R+swcD3rtMggFASzU1gc24HrIEeM0r4K9/02cgjMc/+8 X-Received: by 2002:a17:907:270b:b0:73d:6063:cd94 with SMTP id w11-20020a170907270b00b0073d6063cd94mr561392ejk.672.1660931728496; Fri, 19 Aug 2022 10:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660931728; cv=none; d=google.com; s=arc-20160816; b=l4LqYM117bA/wbQmMGuZblivRu79bJRJuIuiNvbtmcqrwCLDKhWR8eZwKAefh+aP5Q KUelT9XC5tsY0a9TzUqII0Rv4RCPdgaaZ9Vtyc7FOXSbBL/irL5qS7PJSuhxliRtf4Ln 2C3OE/1gZ4Au2p2wiIFm4f0UrL28ZI4fTldSguizWML3wg5h3sjr9bD4dwF5VgaWo4NC IvBVS/pbmuTWsFn0OkXMmwEia/F33dJlkc7HdKpqvUzCWHXl7TDB48hG8F9mS/0KhpHc 3ecjFON+BDhp0ElZBF8ZjcKXxGv3az6O9zLaaSAj3vAMSP0E1cmCGSnKWc9r177gPNQ6 ircg== 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=6wGwXesMNRETpcbMuv1zmowqLu7zOYv8Mq3lpaFASFQ=; b=Ck/uwsC9Hmj05mNDlX92gjXKO6upCPn9YPambbTXTrCPb+Nqk0BNveJ0cGQbxxI4II JW5D1lhtTW8dr4E4nDErM8YbLC60qri8SBW9tlUPvt6fzlsgHEww4u7VcaKtbUM7AuLk x9wT/lEYlbudJCHiCRNNua4JHMk74St+4U5X8Et4qS5ENVnove49gSJhWnQdFilcLdSh yfujQUyR2vzTvsbEmqVvvsmq/zngV1lFj3QB8sQX4EpNOJqkoQxppCGQfYNqe2blgTmD pRCnkPwpfMSEl0369Uy2d1gLhZfjip0T1o4E7bPrSizBjkn5+joT1JyYfsUkejpxofUD mklg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QdH5ZNrQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp13-20020a1709073e0d00b0072f9d01a48esi3941821ejc.40.2022.08.19.10.55.02; Fri, 19 Aug 2022 10:55:28 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QdH5ZNrQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354084AbiHSQro (ORCPT + 99 others); Fri, 19 Aug 2022 12:47:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353974AbiHSQpe (ORCPT ); Fri, 19 Aug 2022 12:45:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52140113683; Fri, 19 Aug 2022 09:11:40 -0700 (PDT) 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 6EC5DB82824; Fri, 19 Aug 2022 16:11:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1E80C433D6; Fri, 19 Aug 2022 16:11:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660925482; bh=QWd+XTRh/sAbJlgTeFNlnx+uy1bYEv5b8wttiJs9ZYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QdH5ZNrQztwkSWGWAz+7bNvTHCLnZ3TrW/aLvOyxEEEKlUnAW3JMOkveWoqW2nbNL z9R9Hjlqnxbo4Ityju1ass+DKzi9HPrvqY7Ingske8MkiStJFcDj96nHLwlUPSohNa Hxn7YKheOfbr0f7NMziCXIpNZsj6Dc1XDuhk38Gk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean V Kelley , Qiuxu Zhuo , Bjorn Helgaas , Jonathan Cameron , Kuppuswamy Sathyanarayanan , Sasha Levin Subject: [PATCH 5.10 474/545] PCI/ERR: Bind RCEC devices to the Root Port driver Date: Fri, 19 Aug 2022 17:44:04 +0200 Message-Id: <20220819153850.615001084@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Qiuxu Zhuo [ Upstream commit c9d659b60770db94b898f94947192a94bbf95c5c ] If a Root Complex Integrated Endpoint (RCiEP) is implemented, it may signal errors through a Root Complex Event Collector (RCEC). Each RCiEP must be associated with no more than one RCEC. For an RCEC (which is technically not a Bridge), error messages "received" from associated RCiEPs must be enabled for "transmission" in order to cause a System Error via the Root Control register or (when the Advanced Error Reporting Capability is present) reporting via the Root Error Command register and logging in the Root Error Status register and Error Source Identification register. Given the commonality with Root Ports and the need to also support AER and PME services for RCECs, extend the Root Port driver to support RCEC devices by adding the RCEC Class ID to the driver structure. Co-developed-by: Sean V Kelley Link: https://lore.kernel.org/r/20201121001036.8560-3-sean.v.kelley@intel.com Tested-by: Jonathan Cameron # non-native/no RCEC Signed-off-by: Sean V Kelley Signed-off-by: Qiuxu Zhuo Signed-off-by: Bjorn Helgaas Reviewed-by: Jonathan Cameron Reviewed-by: Kuppuswamy Sathyanarayanan Signed-off-by: Sasha Levin --- drivers/pci/pcie/portdrv_pci.c | 5 ++++- include/linux/pci_ids.h | 1 + include/uapi/linux/pci_regs.h | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c @@ -106,7 +106,8 @@ static int pcie_portdrv_probe(struct pci if (!pci_is_pcie(dev) || ((pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) && (pci_pcie_type(dev) != PCI_EXP_TYPE_UPSTREAM) && - (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM))) + (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM) && + (pci_pcie_type(dev) != PCI_EXP_TYPE_RC_EC))) return -ENODEV; status = pcie_port_device_register(dev); @@ -195,6 +196,8 @@ static const struct pci_device_id port_p { PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0) }, /* subtractive decode PCI-to-PCI bridge, class type is 060401h */ { PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x01), ~0) }, + /* handle any Root Complex Event Collector */ + { PCI_DEVICE_CLASS(((PCI_CLASS_SYSTEM_RCEC << 8) | 0x00), ~0) }, { }, }; --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -83,6 +83,7 @@ #define PCI_CLASS_SYSTEM_RTC 0x0803 #define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 #define PCI_CLASS_SYSTEM_SDHCI 0x0805 +#define PCI_CLASS_SYSTEM_RCEC 0x0807 #define PCI_CLASS_SYSTEM_OTHER 0x0880 #define PCI_BASE_CLASS_INPUT 0x09 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -837,6 +837,13 @@ #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ #define PCI_EXT_CAP_PWR_SIZEOF 16 +/* Root Complex Event Collector Endpoint Association */ +#define PCI_RCEC_RCIEP_BITMAP 4 /* Associated Bitmap for RCiEPs */ +#define PCI_RCEC_BUSN 8 /* RCEC Associated Bus Numbers */ +#define PCI_RCEC_BUSN_REG_VER 0x02 /* Least version with BUSN present */ +#define PCI_RCEC_BUSN_NEXT(x) (((x) >> 8) & 0xff) +#define PCI_RCEC_BUSN_LAST(x) (((x) >> 16) & 0xff) + /* Vendor-Specific (VSEC, PCI_EXT_CAP_ID_VNDR) */ #define PCI_VNDR_HEADER 4 /* Vendor-Specific Header */ #define PCI_VNDR_HEADER_ID(x) ((x) & 0xffff)