Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp888480ybe; Thu, 5 Sep 2019 07:24:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvFAZuJ/ClHwY7+oVVfUl5AigKzIB2xUlMkE/n1ZM5WQMq4QIAf9IZ+im2880Uw1DsaZbg X-Received: by 2002:a65:4844:: with SMTP id i4mr3450986pgs.113.1567693467020; Thu, 05 Sep 2019 07:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567693467; cv=none; d=google.com; s=arc-20160816; b=n22tcsN/+fGl45pHo7IjUQVDiyN/841zaoO6CgyjKDw+9pczVWJ6fInCLupB/cnmps VfFt57mUpHwwNVfCJ+ZgcGaLcSc7L6gqn8W4ABmEOzPGCy25BhI1quirdQvagyRQJMz8 37vNftjbbqOSyUMgLSoWWIAd7aRBTKu1uxaMGhis9C0DBhXrEsfFZPq6hOUyGAqYjVJs f/zfPi3RmcrX+s9tLtH3WF8gOPkt2VxonJk17joydCiybMiLO59YAYjzCKYdZrLLIJx0 LQdKhoQK+/h07RQwlAqU41WXo+3jl3AM1OyvaoCD/aGAKKeKCKBFp2JKfnbCBNdIyyXZ 1UyQ== 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=+ms/RhsS0fMzoDur+J7QJCOESLCY4GvCQjCVO50bpww=; b=DgBpICedKlbj5a2WrGvrUzBjd4ONm6jwA0LakaJn4OQSAfrOFhd/UicAI0x0eKQucw L9PIs+23o8TF7kmmk9oUAbAYBRQpRBpU7p+ACoU0/AY6bQucZPPt+b4hUIcD5AU0HIQ7 bc6WlsDtu/zlvu81q+c8Im/5wdMTqskWy87wbqsOsgNOKb2FxIDPRcXQDlb67bDlzb5h OJfTN+n0uqHKvriFib0bL0uT9XWki7hsUY0mNGFs+Um6kg3HpXwqfM+HL2oVi5+sUtOS nsYV7rU3NlSAiJu7M3P9DIud6H5Sk6Dgdn7r+iEu+z/CbGmx39jgMCPvWOyAxmUf3N6Q 6OpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=YFclnYdi; 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 f26si1862079pga.117.2019.09.05.07.24.07; Thu, 05 Sep 2019 07:24:26 -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=YFclnYdi; 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 S2387471AbfIEOA5 (ORCPT + 99 others); Thu, 5 Sep 2019 10:00:57 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:32483 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726968AbfIEOA4 (ORCPT ); Thu, 5 Sep 2019 10:00:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1567692055; x=1599228055; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=+ms/RhsS0fMzoDur+J7QJCOESLCY4GvCQjCVO50bpww=; b=YFclnYdiO2zrOlKjaQ1AZTFJJCIPoKdmqxRiNbKpyV9vwKOhjacx4m2b S67jQQZB4lNyUJGnN3KrzTXJMyBforEjs8/77lWySgnCphRZ6P7yZkdGC tx00PrAwN4ThrsAKbqIXXCox3eDqyhDt6xBz056tIYjxUYMDTfhs8B/k/ s=; X-IronPort-AV: E=Sophos;i="5.64,470,1559520000"; d="scan'208";a="419628456" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-98acfc19.us-east-1.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 05 Sep 2019 14:00:54 +0000 Received: from EX13MTAUWA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-98acfc19.us-east-1.amazon.com (Postfix) with ESMTPS id EB3DFA29C8; Thu, 5 Sep 2019 14:00:50 +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; Thu, 5 Sep 2019 14:00:50 +0000 Received: from u9ff250417f405e.ant.amazon.com (10.43.160.20) by EX13D13UWA001.ant.amazon.com (10.43.160.136) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Sep 2019 14:00:44 +0000 From: Jonathan Chocron To: , , , , , CC: , , , , , , , , , , , , Subject: [PATCH v5 2/7] PCI: Add ACS quirk for Amazon Annapurna Labs root ports Date: Thu, 5 Sep 2019 17:00:16 +0300 Message-ID: <20190905140018.5139-3-jonnyc@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190905140018.5139-1-jonnyc@amazon.com> References: <20190905140018.5139-1-jonnyc@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.20] X-ClientProxiedBy: EX13D06UWA002.ant.amazon.com (10.43.160.143) 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 Reviewed-by: Andrew Murray --- drivers/pci/quirks.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index ded60757a573..8fe765592943 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4418,6 +4418,24 @@ 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, @@ -4611,6 +4629,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