From patchwork Tue Oct 17 12:47:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Lomovtsev X-Patchwork-Id: 10011901 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 44517600CC for ; Tue, 17 Oct 2017 12:48:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 347D12889E for ; Tue, 17 Oct 2017 12:48:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 291FA288A0; Tue, 17 Oct 2017 12:48:34 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 B4C9A2889E for ; Tue, 17 Oct 2017 12:48:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761970AbdJQMsc (ORCPT ); Tue, 17 Oct 2017 08:48:32 -0400 Received: from mail-by2nam01on0084.outbound.protection.outlook.com ([104.47.34.84]:30784 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1761949AbdJQMs2 (ORCPT ); Tue, 17 Oct 2017 08:48:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=8/sKH4bmj0HEgjpQEKTCycN6whNKcf8Dc0dB0CVE71g=; b=mJmLvLQPxPVv+SkA64170zVrKVj3Y3aPkciKB5vB9+v0511gXr/W2lHndEThodttYkZYZwrAo1dQsh4kdEJekUhOgNZ1s3+/ahMNqsdXA5/LOV3HflD5Ap2AdJ7+AxWQ53b3a+EftvTZPaLyTJ0zO5Tb8Dmgssvz8A5cGdQy6FM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Vadim.Lomovtsev@cavium.com; Received: from localhost.localdomain.com (50.233.148.156) by BN6PR07MB2993.namprd07.prod.outlook.com (10.172.106.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 17 Oct 2017 12:48:25 +0000 From: Vadim Lomovtsev To: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, alex.williamson@redhat.com Cc: Wilson.Snyder@cavium.com, robert.richter@cavium.com, david.daney@cavium.com, mjaggi@caviumnetworks.com, Vadim Lomovtsev Subject: [PATCH v7 2/2] PCI: quirks: Apply Cavium ThunderX ACS quirk only to Root Ports Date: Tue, 17 Oct 2017 05:47:39 -0700 Message-Id: <1508244459-2615-3-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1508244459-2615-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> References: <1506536439-29318-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> <1508244459-2615-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: MWHPR15CA0050.namprd15.prod.outlook.com (10.174.254.12) To BN6PR07MB2993.namprd07.prod.outlook.com (10.172.106.11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 728b242d-3cd0-456d-10e6-08d5155d5c60 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR07MB2993; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB2993; 3:co/iE1l6lqNEUWGMc3ptHVOAr+5acoY0QXPAojvrlVVTTNCVv+JU8Tg/WJw/8enFlZ83vgtHGqmsWhjnFDTPzdgkqm7h2rBl3JEDQQxAptw8HikmoD1GjUW1Q5PNklRuTrMHb8OMSYiuplOvS7TKPaW7ZdOEncCHyk+NfcKp5l6yFYA6hM97UZ6CrzhvOpTFfhvkd5uzsib7j9veQCF5bjNhM470vKE2EmxrFP9mENdhu1450HpHO3UF39Npg7Li; 25:COutlW2lCrxiRH59EA7h2/sQHyFIBPv4a5APaRrwRM8/nQp4yJvmFpXzNxISDv2xO1JvTj/mkVqgUowSMHfaqVfBrmOtz9x5Qul+3AdhzJFKEraFP+Up5BuC7UCIbxIc30oMhBZ4VJwxEKXevRjanm6C+VuLqTT/n45CHtDcw3fK3UXn38HV8W/Ad8qjYoXERsu5NGfm4Spzjr7G8uCN+W3A2isx3DuWFQqDu+Z8yst9S/oSWb4QeBgq0opmLkGN1lXeMMhhIJ6lsr0Dq1gGTZIyvuD73bgnZbF7lvfa9GivYC1gIpPTEA60MhrFmU343f+ozmUPehErW2hs6uLOiA==; 31:lcjPYYwgzGWs/zB4dUZh+YqUP2IJQC0zJtylkQLyNNks9t3bPlImOOe6u5c2yaLiS8AXCQ1zXwT/VvmOJ85keK9RQmGCTMkV4kYHFcow3aCZskqSGFQFxhsHUkuauxqAcGxdBGnHYXfufgPeZVrHqJWC2PjrBKCRoGUV9/ahwaFe9DzBn44CgUxPj9fHdZxrrZjDZRwA0ZXBoMcoMr6HhLNL2S8SCN7RopMS8Sw+ziE= X-MS-TrafficTypeDiagnostic: BN6PR07MB2993: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB2993; 20:4GTTh8nM8WqH+NPnjnLRpi7m1LqtjhuJ9VID9Ye2E8c/YNcFZl2VgsrDUQ/m2cZqLbahUMmNcMKClWDW6M/B8IX4ePJJPL+S6bJaXQRmsBP8MBIGvQ5ropX4a/rerbyoo+pLMEvy0GbpA55i3TOaftB7rQZe7zi1HtXhy8F4eILovoh0IBwu934ojrwhrSPDVdk79NlQRY3dHeP1KlILwi5hP2OSzwAnd9fi83dDP/qOYh+BhsRtHrE6lgNRSPXzasB72j+2KxjjoT+wgVK/2gdVqqK2HJd9fXePZzM0Jfrx8xopFF7qXFEbw3eRpjkyZi5rvAIJJjlZDnmAe9JuiL9erPQTADmBvIwRAnV3C9OvFXZNwQoehdekLGZSL4B/scW7p/5du/YDt0DJCE0L7tJrHehTet19YP75CEACaMcnrIyzcUhYKVGLMNIgvVlo8Uea25lzS8gbg9r06tDKjz8b8HAnhGyzNBdr6Q+8J5rJzE9XhZhTxGIfQiXd8MvYGNP1J4eSHx4Cd/sl10+eis6qzVTetBXhfLQkbxdVFIjndmv9+UfP+3XV6Vkq8X7ze58K5vwb/KBT/NvZnKEVEDg0h2F/cWQjKIdOe3OljNQ=; 4:8NaP/NFGUZHEh3Jdg+2uF45xd1Gu072l75GTj114IeQxiwaZA4V7PAzWcl3htwxnc8YXzAIfFs/r7NZ/WGpeg+0cnIpymUlpOgB+Qrv+lvkKnTEiwf6At8OUHXecJ3/AkHODsF4kDZvxbRfWjCUTBWxKPENBRO64HD48yiRv8t8TeATbdo24lL7svzICOklTN9rNh0KgVLWGGwCyvmKmSB7gHv3eQb0M9jG0gvmM2sVl6XbX27dNac9RHg5NJW4U X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(6041248)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB2993; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB2993; X-Forefront-PRVS: 04631F8F77 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(346002)(376002)(199003)(189002)(50226002)(3846002)(305945005)(4326008)(50466002)(575784001)(105586002)(5003940100001)(53416004)(69596002)(16586007)(72206003)(25786009)(16526018)(53936002)(478600001)(36756003)(97736004)(48376002)(6116002)(6512007)(5660300001)(2906002)(101416001)(2950100002)(68736007)(8676002)(42882006)(6486002)(8936002)(316002)(81166006)(50986999)(47776003)(76176999)(7736002)(106356001)(6506006)(189998001)(107886003)(66066001)(81156014)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB2993; H:localhost.localdomain.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR07MB2993; 23:/iU9XYU3bi3gOd8FyeXHlgZcauh12Q8a48cx0yAcz?= =?us-ascii?Q?5itTt4nJZQm7e0jeKiEtwF6EI0hJUkI+W+pmYGaIw2zwy2yMCxj4gRXWZx8V?= =?us-ascii?Q?42OgJAP3uZLOtJiGx/KVSPgZVSp803g0zL3TgCF5xLWyJr717oC/iw1SiMMZ?= =?us-ascii?Q?jf/v3ZOWYF2r5oFDsA7UoQdp6j+towGc7k9UhsLj+VAeylcaIHdNwWnMDBuy?= =?us-ascii?Q?AY/bLO4QcJQAZpqrKxzI6Y6NT/cT2wbQXfy4aB1qG43EsUN9QerIqpDB7iwj?= =?us-ascii?Q?u3nQr8+tN/eLyLx9eohHu7Q5S6BQmrGtDxmWHbDULKGwqNtD37tpg7x4QEL4?= =?us-ascii?Q?fbpCF83A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wHKJJAyE4ZSTaYePS25N13OPxobmKCfsZ4ty6ledpeRqnTuCEam+Y35WmKSnR1xPbo0yGofo3/bX6EFc4p1KFy1vU/Ka9GjBnr/vspp/75Z5uuZPdiZ+vgqSE4LgX5XIsTN4+pg/ksY4/q9KoHL01v0F9TX75VsAOjzLHO7ES60dUwyO5GltziAy3bY0t/YmGWqhF/ih/AHcjWKa8Xf2PVqotw0cTbfzJdHgFuwF7T3iWgN5uzmibV8A4TWUpn7FBcMrz0iKzTt8MvlaQ97Q3EE4XZMucEcclwIEs2df7idg==; 5:KWsHUe9P/OZZ3VRkZhqlP6T4x8ae+IFosLNQ/L1Tyk3pK4oZBEmc16sGuYzm0g0Opie62Ptyuvp55PkpUMDYnLtcu5oo31hAN1dQKAJFTf3S+jy3WkX+efxS6p36nUvcugYfEg9ia3frjrCxBV8oqQ==; 24:25VVLGDRvFnVv7A5DKcpYNzBf2v2dLw6sO2TBKlpT7Ct0RNpCBaSHOfNmMlWTJKsNE6oLubNdUr7lp5Sl8l3KGllSuME2Bw8t/H6x2ltRK8=; 7:GJYv2MNSVtR2nwHyUDL0YmSl3v17jKg5Ka7N6U5kMh08YwIi+7Kwiu7TWAY/gVb/rdX8j6SOb7bCjJV2tMbRhzWMyRTZBN/lIyMPtcCq2GEHStqIbynRPsEIXOs1dNFU+1ek0DtG7i4ChADtar0MNkp3nTuf5pLLL7DlUIB7stV0uhKUMVsu7lL7+R69RbdD31xTCBxiARg0Ys0yts0gZMsq7lxLO2c6JC/2zM2FYZ0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2017 12:48:25.7640 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB2993 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 From: Vadim Lomovtsev This commit changes the Cavium PCI ACS quirk appliance only to Cavium CN8xxx PICe Root Ports. Current quirk implementation doesn't take into account PCIe Root Ports which needs to be quirked. So the pci device id check mask is updated accordingly to CN8xxx device identification scheme and check of device ID moved into separate function. Signed-off-by: Vadim Lomovtsev --- drivers/pci/quirks.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 5e0e83304fda..cfefb2431348 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4211,6 +4211,19 @@ static int pci_quirk_amd_sb_acs(struct pci_dev *dev, u16 acs_flags) #endif } +static bool pci_quirk_cavium_acs_match(struct pci_dev *dev) +{ + /* + * Effectively selects all downstream ports for whole ThunderX 1 + * family by 0xf800 mask (which represents 8 SoCs), while the lower + * bits of device ID are used to indicate which subdevice is used + * within the SoC. + */ + return (pci_is_pcie(dev) && + (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) && + ((dev->device & 0xf800) == 0xa000)); +} + static int pci_quirk_cavium_acs(struct pci_dev *dev, u16 acs_flags) { /* @@ -4222,7 +4235,7 @@ static int pci_quirk_cavium_acs(struct pci_dev *dev, u16 acs_flags) */ acs_flags &= ~(PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_SV | PCI_ACS_UF); - if (!((dev->device >= 0xa000) && (dev->device <= 0xa0ff))) + if (!pci_quirk_cavium_acs_match(dev)) return -ENOTTY; return acs_flags ? 0 : 1;