Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8582888ybi; Tue, 23 Jul 2019 11:10:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHsJOruT2aYzScWPeeqPL9kZldKMX6Cp1gVKDqdOJ1a4gpkrhGEx3QIQIHnYfl1nc613zm X-Received: by 2002:a17:902:9b94:: with SMTP id y20mr81561618plp.260.1563905406370; Tue, 23 Jul 2019 11:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563905406; cv=none; d=google.com; s=arc-20160816; b=i3rzAHZZOuaDvTy0L2WXe3j/uTiVSdXxM2cFpvqfH2nY208MAfytu6/qZC3y2+E2aO Ij99To/pmdqiUh8oP70MLIlhWj82uVhXFRg+wJr/v+YU4o1FXssJx0fAU6AOYBlebfY+ EF34fWFIspZcU3mgKwZQMtlKkuWokkxFlGZSEbUiPrXDivhmNx3Fs7ErO/aPSiqkauiw YBKc1PydgG6f4ZRvC4AsZ0QNoSxIUNqWCVgMPGc00rLAoEbxQl6Eg8PCzH1QzPgdsRH5 HdklQaOcGtA40zvbFlVCAns1GGM0hp5o7kh7wSieu1k02VFb0nkjr9TSx8eWSmbJ7wZQ GkiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=1lQKq3hxKQkr7WB4YDlui/W/5OP1jSDsOKg2GvSonVs=; b=Z4LSK1mPLVB9W1FEi8lfNr1X+wkiij8P3bQ0Sisllif6/iH2TegYLcc3iTIl8lcdfP gfZmEOM9/KqC76aq6odiL5Lx5aMnQHxtqpKWrKoXx3AbfZYTAcGswl4q7YR5c9333XNv qSR3eqCaxO1qdehmgXN0fTuDuRATB54TRqhp9x1DG6n/GuZE7m6hLdFW1yeDOIWFCWpS t6p9ZQjMIbrOhZ4QSjGtZhI+nyViAMwEnzzEMRu91zAdgrDlNLp0bs2KUir2uewQ3XM7 nzYOPK301Y93OiJlOhWdHdKbyUMcoBH2ztJn0NGWz4TKTNFfh+bvZxml2JXDYrVll2c0 B6kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="S/zNy/O6"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15si13591593pjv.54.2019.07.23.11.09.50; Tue, 23 Jul 2019 11:10:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="S/zNy/O6"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387897AbfGWJ0A (ORCPT + 99 others); Tue, 23 Jul 2019 05:26:00 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:11924 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387874AbfGWJZ7 (ORCPT ); Tue, 23 Jul 2019 05:25:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1563873957; x=1595409957; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=1lQKq3hxKQkr7WB4YDlui/W/5OP1jSDsOKg2GvSonVs=; b=S/zNy/O6LcFd2tP9auIHemYbpGbSu1mRJC3Ynn1RpJB2/LuTLS610Ko8 iBGgVB4b1L2V85QSBCrUIkCahp/bamHRajhu9VSwbC07gUdkwQCJEjny4 If2jbaEbLuw5GSmje8aCSeBlVSgl7Dqmte9A1kH2dIH3Yci3Al7C8BXDW o=; X-IronPort-AV: E=Sophos;i="5.64,298,1559520000"; d="scan'208";a="812905024" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2c-4e7c8266.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 23 Jul 2019 09:25:55 +0000 Received: from EX13MTAUWA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2c-4e7c8266.us-west-2.amazon.com (Postfix) with ESMTPS id 8BBFAA293F; Tue, 23 Jul 2019 09:25:55 +0000 (UTC) Received: from EX13D13UWA001.ant.amazon.com (10.43.160.136) by EX13MTAUWA001.ant.amazon.com (10.43.160.58) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 23 Jul 2019 09:25:55 +0000 Received: from u9ff250417f405e.ant.amazon.com (10.43.160.245) by EX13D13UWA001.ant.amazon.com (10.43.160.136) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 23 Jul 2019 09:25:50 +0000 From: Jonathan Chocron To: , , , , , CC: , , , , , , , , , , , Subject: [PATCH v3 2/8] PCI: Add ACS quirk for Amazon Annapurna Labs root ports Date: Tue, 23 Jul 2019 12:25:27 +0300 Message-ID: <20190723092529.11310-3-jonnyc@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190723092529.11310-1-jonnyc@amazon.com> References: <20190723092529.11310-1-jonnyc@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.245] X-ClientProxiedBy: EX13D24UWB004.ant.amazon.com (10.43.161.4) To EX13D13UWA001.ant.amazon.com (10.43.160.136) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ali Saidi The Amazon's Annapurna Labs root ports don't advertise an ACS capability, but they don't allow peer-to-peer transactions and do validate bus numbers through the SMMU. Additionally, it's not possible for one RP to pass traffic to another RP. Signed-off-by: Ali Saidi Signed-off-by: Jonathan Chocron Reviewed-by: Gustavo Pimentel --- drivers/pci/quirks.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 208aacf39329..23672680dba7 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4366,6 +4366,23 @@ static int pci_quirk_qcom_rp_acs(struct pci_dev *dev, u16 acs_flags) return ret; } +static int pci_quirk_al_acs(struct pci_dev *dev, u16 acs_flags) +{ + /* + * Amazon's Annapurna Labs root ports don't include an ACS capability, + * but do include ACS-like functionality. The hardware doesn't support + * peer-to-peer transactions via the root port and each has a unique + * segment number. + * Additionally, the root ports cannot send traffic to each other. + */ + acs_flags &= ~(PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_SV | PCI_ACS_UF); + + if (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) + return -ENOTTY; + + return acs_flags ? 0 : 1; +} + /* * Sunrise Point PCH root ports implement ACS, but unfortunately as shown in * the datasheet (Intel 100 Series Chipset Family PCH Datasheet, Vol. 2, @@ -4559,6 +4576,8 @@ static const struct pci_dev_acs_enabled { { PCI_VENDOR_ID_AMPERE, 0xE00A, pci_quirk_xgene_acs }, { PCI_VENDOR_ID_AMPERE, 0xE00B, pci_quirk_xgene_acs }, { PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs }, + /* Amazon Annapurna Labs */ + { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs }, { 0 } }; -- 2.17.1