From patchwork Thu Jul 20 00:46:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feng Kan X-Patchwork-Id: 9853433 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 153B260388 for ; Thu, 20 Jul 2017 00:46:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0020323B24 for ; Thu, 20 Jul 2017 00:46:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7FFA28723; Thu, 20 Jul 2017 00:46:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7709623B24 for ; Thu, 20 Jul 2017 00:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754297AbdGTAq5 (ORCPT ); Wed, 19 Jul 2017 20:46:57 -0400 Received: from mail-pg0-f44.google.com ([74.125.83.44]:38495 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753527AbdGTAq4 (ORCPT ); Wed, 19 Jul 2017 20:46:56 -0400 Received: by mail-pg0-f44.google.com with SMTP id s4so7054831pgr.5 for ; Wed, 19 Jul 2017 17:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id; bh=QaJTEWqjEnCmo1LQ7FW7mgoCOAW4WjYrV8dogaOIADM=; b=JnbqFovHqMS7gdlAIgLwbklwhkLBhUoOqJC+DzrnHTCea9WX4pboXSItwiNhPvPfVH 1lKnRRnyDeQJvMcUUP+wMEOQ0PLgs9+MjJR2kg3ypaq5P9XZuHHXLLgr+4yf1/QRW/fv iAXZ+8J5WA9aHcRXOR/yozgkWzkP1Jl9Ydxho= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QaJTEWqjEnCmo1LQ7FW7mgoCOAW4WjYrV8dogaOIADM=; b=sc7SGsPJceuk6/mAXGT/BhAqCVD+JVRDBu0mH0lvKcybhWC4rypIG98f8jwvLMfjCY KGE4PhlSUCFUw794bKZhRvB/ZVgFTI76Hm4xVh4cwn02zSbttPDNNl90sPCoJeQCBxjH T1K+nKKKv2EF1ugGR0g8pxgfQLUKXKywDJbcea7zhSb0ucQcN6ey83+I1iUbJg3yuSPX VnivexA0TTaf5y50pmI9olNgIE02F+H17/ImF+SBruVbYq4F+czLMwh8QNmQdiNQFmsE sSRPupKuoqaxfVuDDviMskraBt+K4Xf269qbv6GD7iSUAHm6Cu2ZhHA9DIdIdV9FHFx5 qOBA== X-Gm-Message-State: AIVw110kpPnOxdzQYpNcBBCwADuaAyG0AJTT3G2hbujiptWDuh/wKUA3 QeFw9D2k1uS+Hhd1 X-Received: by 10.98.43.74 with SMTP id r71mr1874406pfr.245.1500511615630; Wed, 19 Jul 2017 17:46:55 -0700 (PDT) Received: from goldengate.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id p28sm1697734pfi.38.2017.07.19.17.46.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Jul 2017 17:46:54 -0700 (PDT) From: Feng Kan To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, bhelgaas@google.com, alex.williamson@redhat.com Cc: Feng Kan Subject: [PATCH V2] pci: quirk: Apply APM ACS quirk to XGene devices Date: Wed, 19 Jul 2017 17:46:51 -0700 Message-Id: <1500511611-2019-1-git-send-email-fkan@apm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The APM X-Gene PCIe root port does not support ACS at this point. However, the hw provides isolation and source validation through the SMMU. Turn on ACS but disable all the peer to peer features. Signed-off-by: Feng Kan --- drivers/pci/quirks.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 085fb78..0f8f1cd 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4120,6 +4120,19 @@ static int pci_quirk_cavium_acs(struct pci_dev *dev, u16 acs_flags) return acs_flags ? 0 : 1; } +static int pci_quirk_xgene_acs(struct pci_dev *dev, u16 acs_flags) +{ + /* + * XGene root matching this quirk do not allow peer-to-peer + * transactions with others, allowing masking out these bits as if they + * were unimplemented in the ACS capability. + */ + acs_flags &= ~(PCI_ACS_SV | PCI_ACS_TB | PCI_ACS_RR | + PCI_ACS_CR | PCI_ACS_UF | PCI_ACS_DT); + + return acs_flags ? 0 : 1; +} + /* * Many Intel PCH root ports do provide ACS-like features to disable peer * transactions and validate bus numbers in requests, but do not provide an @@ -4368,6 +4381,8 @@ static int pci_quirk_mf_endpoint_acs(struct pci_dev *dev, u16 acs_flags) { 0x10df, 0x720, pci_quirk_mf_endpoint_acs }, /* Emulex Skyhawk-R */ /* Cavium ThunderX */ { PCI_VENDOR_ID_CAVIUM, PCI_ANY_ID, pci_quirk_cavium_acs }, + /* APM XGene */ + { PCI_VENDOR_ID_AMCC, 0xE004, pci_quirk_xgene_acs }, { 0 } };