Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752111AbdI0SDc (ORCPT ); Wed, 27 Sep 2017 14:03:32 -0400 Received: from mail-by2nam03on0060.outbound.protection.outlook.com ([104.47.42.60]:22987 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751554AbdI0SDa (ORCPT ); Wed, 27 Sep 2017 14:03:30 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Vadim.Lomovtsev@cavium.com; Date: Wed, 27 Sep 2017 11:03:23 -0700 From: Vadim Lomovtsev To: bhelgaas@google.com Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Wilson.Snyder@cavium.com, jcm@redhat.com, Vadim.Lomovtsev@cavium.com, alex.williamson@redhat.com Subject: Re: [PATCH v5] PCI: quirks: update Cavium ThunderX ACS quirk implementation Message-ID: <20170927180323.GB28672@localhost.localdomain> References: <1505724481-28413-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> <1506344920-24016-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> <20170926094343.3e0d8d90@w520.home> <20170926160026.GA26639@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170926160026.GA26639@localhost.localdomain> User-Agent: Mutt/1.6.1 (2016-04-27) X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: BN6PR11CA0020.namprd11.prod.outlook.com (10.172.17.30) To BN6PR07MB2994.namprd07.prod.outlook.com (10.172.106.12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25a720fe-6624-4985-8828-08d505d20e1e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075);SRVR:BN6PR07MB2994; X-Microsoft-Exchange-Diagnostics: 1;BN6PR07MB2994;3:a4jj/g+HOVMqJcwEnzxEa0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RTq04UHmq1r/wDcWLPMcPNp+EBtRRYWlUpfndcpx5rPkyo0LBHzPYzn42asxSIS2xlFhobGNyD2ljpUBEWIrGkYNmmxAeIgApEej4SNlF2B0D9A7cvXLPBz157GUY9hArOBhCHo+R+eYec47by2xRLedrVwAQW8n2AGFyQS2hPmCPkGAOuryt5ZN1wnkI4HeRdJF9uMeTgpUHOE+mBOF6BiGUX/3VsWvgAEz1LOAWmDec6Sg0S41LOgjkGcbfhqpYzKQbs5O6fT6i1bLXSQvQyYcPMKxCBPYsfJgDcpdRUKFIpbFnxFONIzgYmLne4zNamHbamvomE+yo/OxGwkV24o5c+Yy22G3O40PCgqzQakgN0qIW+25ul2saD4328UEIw67ASkUtAyf17h1/KYqyjvbBBop+oTMUEiCbUeONTvIlafE=;4:ricEXyLUVvtk+JiKvtH9rudGCacpJ8zw20ug4ZR7vOKwO4cp3SgpIqufJM/kvZCGt5yPsNO/lPRiQc5xZ+tlZmMXnXfgUQzyN1JR6ngDQBf5nqzgB+4tdVRfLASJh3QToJU2+QhnnsymxxRadpxo/RQFkzMT4qrhl1LtrXzYz+ySeALqIa0T9tD56yKGFYt4YApG3tYKG5XPyCX9aWCMoofEwCIiEL6Qk9IlwRVNu6EMor0TVSQ1uXWBAR1KKNxP 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)(93006095)(3002001)(10201501046)(100000703101)(100105400095)(6041248)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BN6PR07MB2994;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BN6PR07MB2994; X-Forefront-PRVS: 04433051BF X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(6009001)(346002)(376002)(24454002)(52284002)(199003)(189002)(81166006)(6666003)(81156014)(101416001)(50466002)(50986999)(76176999)(54356999)(61506002)(33656002)(189998001)(8676002)(97736004)(4326008)(25786009)(2351001)(23726003)(1076002)(2361001)(6116002)(93886005)(478600001)(6246003)(3846002)(2950100002)(42882006)(105586002)(6916009)(47776003)(66066001)(53936002)(106356001)(305945005)(7736002)(316002)(16586007)(16526017)(72206003)(58126008)(6506006)(68736007)(2906002)(345774005)(8936002)(575784001)(229853002)(83506001)(55016002)(9686003)(15650500001)(5660300001)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR07MB2994;H:localhost.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR07MB2994;23:eu1T+QVqMtnMDjKJfLrJ0fFOzNMcxjScx0tv5hG1n?= =?us-ascii?Q?Yg6gbEuu2ujzCkHqLXNdsv/yUYNikP42uXUIjH9TK+MSl5JUaek7UrkBFW7g?= =?us-ascii?Q?L/T+r21VAPKNpEXQ+zHmIIHpCc+C6khMPjzgrsCP2P5D2d+rWW3RyDUYRyZE?= =?us-ascii?Q?8X377wGj1I87dDwuxJ/YVTPiuhr0nBIph53GvhO+mO0V5QaduWb4iuZwHT9g?= =?us-ascii?Q?zZCUScPjDUWvQc7eMXBIJtgB8ehom7cipzLpKptF4P3K64FI3zz6qszP1pu3?= =?us-ascii?Q?teMX+weVBKGjKU3VdF49bUJFyA2IZr0UDubr9FO2VPKwaK49FpJeqfNjfzRH?= =?us-ascii?Q?CWaaTKdiih7sqhwQD2ls6j0K+NVOUHvgHhxhAKq86QJCtuedbLCQrczWb8Wk?= =?us-ascii?Q?RBK5cVrKJlYk90eA2mGJIoFutELRn2nCgeR46afvA1lNGK7JlGKZtCzbQv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ZK8QS7J745cgkniNC9rNK/LAagoEJiO0z2W9w7?= =?us-ascii?Q?KtbYg1X2yhR8yT9nLzfeCZG2wQ=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN6PR07MB2994;6:OJgmB1Uy/iU/H37U/hoNms/T8ceurwQUma4ppiWWc6O3gzU+cUKf/upzP9E53Jhepj/se9Eaq6Tt7tZ1tDYqTvgURpF+xamNCfGreNtvAn/1qZr1k+AhIw1WHAaZHfYwE8DSnQsio7T9RYDkeuWNKm7iidgnbiBYC0ngXtFA/ZPD+DT77YaNUYelEuu2zI2m+VqPdNM9dp8wL49e+fOhmi3H66hUSHBN1pr+Hq0CA+JtvE0NV5KfXSngxPvqfewAutYBVjudbG550UXxO7pAV6C4FACPxfTg0uesUc+swPUA/1p7ul97F8ONsUtinmTfrXUciZ20KrgQoodaMOJPYw==;5:LIMY60GXh+k+3EKhKxYlGZA1d1Fe81ugtjF1yFgQRh+tTpOdqiUKBApqKrmhJDDbLUTgR3XM7lN9X5WAf/F/h8l1D6UmtkkPWF0pT/VgiSAaDsK4qtlJB0yj99jWJoxer9c3evDNokpUBEG5+w2nBA==;24:tVyEy0exbO8u7ak4c09mBUxTghiR+HEvEEJtZSpOOMRMBk7GGUHeDDFroZdf2PwiOr1J2YOIsTcuCYlbDrK19D5yK6wqIq8guldzIUAoYug=;7:nVu6MgTI1HP72y2Yhkfe282Jbluw04XmLmAyxBjG3jDMEOeDD4RdAzu3vR7RHqhn0joPk0OizQJR1DBPNqn6Ry2URsIr+T+kPoMphYiVT4o3RHC9tz6eIF03l2UHUOXsVjLLPvhNdpWae/z9wUuHVyXbMOFBLiZKrUE1q8UqBXP5a2xxqMXscjWEuaBNyhhv0hUyHJZ0Ua3TNKhZQnoZ7p6D8pe9VRl+gXHcs7NE8ck= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2017 18:03:27.3133 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB2994 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3577 Lines: 95 On Tue, Sep 26, 2017 at 09:00:26AM -0700, Vadim Lomovtsev wrote: > On Tue, Sep 26, 2017 at 09:43:43AM -0600, Alex Williamson wrote: > > On Mon, 25 Sep 2017 06:08:40 -0700 > > Vadim Lomovtsev wrote: > > > > > This commit makes Cavium PCI ACS quirk applicable only to Cavium > > > ThunderX (CN8XXX) family PCIE Root Ports which has limited PCI capabilities > > > in terms of no ACS support advertisement. However, the RTL internally > > > implements similar protection as if ACS had completion/request redirection, > > > upstream forwarding and validation features enabled. > > > > > > Current quirk implementation doesn't take into account PCIERCs which > > > also needs to be quirked. So the pci device id check mask is updated > > > and check of device ID moved into separate function. > > > > > > Signed-off-by: Vadim Lomovtsev > > > --- > > > drivers/pci/quirks.c | 29 +++++++++++++++++++++-------- > > > 1 file changed, 21 insertions(+), 8 deletions(-) > > > > > > Reviewed-by: Alex Williamson > > > > Thanks for making the updates > > > > Thank you for your patience and for your time, Alex. > > > > Bjorn, > > Would you mind to pick up this patch ? > > WBR, > Vadim > > > > > > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c > > > index a4d3361..0fd2e15 100644 > > > --- a/drivers/pci/quirks.c > > > +++ b/drivers/pci/quirks.c > > > @@ -4211,20 +4211,33 @@ static int pci_quirk_amd_sb_acs(struct pci_dev *dev, u16 acs_flags) > > > #endif > > > } > > > > > > -static int pci_quirk_cavium_acs(struct pci_dev *dev, u16 acs_flags) > > > +/* > > > + * The Cavium downstream ports doesn't advertise their ACS capability registers. > > > + * However, the RTL internally implements similar protection as if > > > + * ACS had completion redirection, forwarding and validation features enabled. > > > + * So by this flags we're asserting that the hardware implements and > > > + * enables equivalent ACS functionality for these flags. > > > + */ > > > +#define CAVIUM_CN8XXX_ACS_FLAGS (PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_SV | PCI_ACS_UF) > > > + > > > +static __inline__ bool pci_quirk_cavium_acs_match(struct pci_dev *dev) > > > { > > > /* > > > - * Cavium devices matching this quirk do not perform peer-to-peer > > > - * with other functions, allowing masking out these bits as if they > > > - * were unimplemented in the ACS capability. > > > + * Effectively selects all downstream ports for whole ThunderX 1 family > > > + * by 0xa00 mask (which represents 8 SoCs), while the lower bits of device ID Bjorn, Please ignore this since I found one more typo here: it should be 0xa000, sorry. Will post v6. Sorry for wasting your time, guys. WBR, Vadim > > > + * are used to indicate which subdevice is used within the SoC. > > > */ > > > - acs_flags &= ~(PCI_ACS_SV | PCI_ACS_TB | PCI_ACS_RR | > > > - PCI_ACS_CR | PCI_ACS_UF | PCI_ACS_DT); > > > + return (pci_is_pcie(dev) && > > > + (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) && > > > + ((dev->device & 0xf800) == 0xa000)); > > > +} > > > > > > - if (!((dev->device >= 0xa000) && (dev->device <= 0xa0ff))) > > > +static int pci_quirk_cavium_acs(struct pci_dev *dev, u16 acs_flags) > > > +{ > > > + if (!pci_quirk_cavium_acs_match(dev)) > > > return -ENOTTY; > > > > > > - return acs_flags ? 0 : 1; > > > + return acs_flags & ~(CAVIUM_CN8XXX_ACS_FLAGS) ? 0 : 1; > > > } > > > > > > static int pci_quirk_xgene_acs(struct pci_dev *dev, u16 acs_flags) > >