Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751748AbdITLdb (ORCPT ); Wed, 20 Sep 2017 07:33:31 -0400 Received: from mail-cys01nam02on0059.outbound.protection.outlook.com ([104.47.37.59]:7831 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751537AbdITLd3 (ORCPT ); Wed, 20 Sep 2017 07:33:29 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Vadim.Lomovtsev@cavium.com; Date: Wed, 20 Sep 2017 04:33:21 -0700 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, Vadim.Lomovtsev@cavium.com Subject: Re: [PATCH v4] PCI: quirks: update Cavium ThunderX ACS quirk implementation Message-ID: <20170920113321.GA32496@localhost.localdomain> References: <1505480233-22694-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> <1505724481-28413-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1505724481-28413-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> User-Agent: Mutt/1.6.1 (2016-04-27) X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: SN4PR0501CA0012.namprd05.prod.outlook.com (10.167.112.25) To MWHPR07MB3008.namprd07.prod.outlook.com (10.172.96.14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dc279e78-c75b-456c-0490-08d5001b68eb X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:MWHPR07MB3008; X-Micros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A7964FnMCHCvejwO8SrcmOh/jjSt5W2RQ6vNdObkm+VAnizgJ5no4OLvv+Ducn3DVp29NZfMkZjT525zY44YGMKNzpdxHB9tMGc6s4kV7hZrZqUpZSNxSvqrh5rRp+oUnyux5HCQq5NZhLvFCss/zzkS5dcRAmy6aECqlunDELBzFaRLd1LsmaOaJPcafRRcFbGBfFWK5qZe33QfC0vTtGBImg+mdKhd9W6ZTa3/gCFTCfA09i/YYuPnlsUFnceacVYG1+JvX0Wiy+iWADr/htzRfNm7NSbRz8F7Oukr7dv+h5dKt5emFyTGoUp0jQBQ8IjyWRVG1XSehDSHvaSCTFJANxgPavmhoQqST3EvrHsDrNIzwQNkC9oFztc1SdsE+D5MlYAMhIMs+qm9vZLHzxMRxOenYpViUD6la0xFLA7JhibdINSPa43+wCV3Y3hFVkIzEk7n4Pd8HXg4ivJ5xY2D2u8qf+p6M=;4:oX8+2DEQBFdFFxJQNbAGkzm8fVQL0DOqNKTLoEOnG1bltc0Lz806O3oeeakMpJUM+ca0/sJVMqPLkM966Sot5TOAw0xHSJDXfh8w+5pj6REA2vEGWEu0YzXgWrPw5Ei72hKj91N2sAXhU7awb5KHRYZvDQAykLKngv69OHPDkOF0/Q7eKVRa1Ij0XWXrvO1iItxbtogiR0FtUWCtq5/FBiZ4iXtkYAfbO2756VgLu6etOOjm0AknNbml3jMyd1+g/zy+thds1X6mzkK37igLwOthTrNHNUR5nLvcq3J8990= X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(6041248)(20161123558100)(20161123564025)(20161123560025)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:MWHPR07MB3008;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:MWHPR07MB3008; X-Forefront-PRVS: 04362AC73B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(6009001)(376002)(346002)(199003)(24454002)(189002)(6666003)(61506002)(72206003)(6246003)(5660300001)(42882006)(189998001)(575784001)(6506006)(83506001)(16586007)(53936002)(25786009)(16526017)(316002)(4326008)(229853002)(50466002)(58126008)(478600001)(107886003)(106356001)(105586002)(33656002)(101416001)(55016002)(50986999)(54356999)(76176999)(9686003)(15650500001)(97736004)(2906002)(66066001)(47776003)(23726003)(1076002)(2950100002)(3846002)(6116002)(8676002)(81166006)(81156014)(7736002)(8936002)(305945005)(68736007)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR07MB3008;H:localhost.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR07MB3008;23:++5jTxjJsMeElMFaGJoFV9bFT+TsXQl4sG2kdJiHl?= =?us-ascii?Q?Axneb/MKbHnsr2fNTk+yAuuTR5TLO9VFkAz+rrJPw3kbvqgQgV9kTB+op+4v?= =?us-ascii?Q?obLIWcgvuIUXcEQTGqjfQHnYT5g6Ivs8Tkg9KGgBj2621T071s8imCb/rkwJ?= =?us-ascii?Q?3OYa9qJReMDl538Yy9wkvEqqwOCnfPVj7bcs8fPtPbz1y09xikqAhX83ia3a?= =?us-ascii?Q?5odBG56WXu8csPvVy0uhxWk4V8AS/v6KaevkBdZQzDLItim3Tnwk+w9X0f7x?= =?us-ascii?Q?QvJtxseEOy82hsO29vNWgvdMXNttGPRsHs9r6YEbXMPe9Szsah0RSXlKjuFb?= =?us-ascii?Q?mXf6vs1lHqpXbybAFJHW3ePX4Tk/UktxkbNfgPChnFilFBja4xDq2VTOIbIp?= =?us-ascii?Q?gou0KNG+Zclf9C+SuwNokBGcG/GYUhsbwDM7y6+XZocoQ/hBcYYLD4+yt/cn?= =?us-ascii?Q?0wBJGNbr+IgtfXxifck3hv0lmKn27wFar0hrzbX8ngcV7mgPR9UESerzV7wO?= =?us-ascii?Q?KOX3FRctCPKHL6ymdrQUxZGKXgQ9iaiC42yAnyemh7S4gD1qWDSMqetKtZFQ?= =?us-ascii?Q?E1+kBtOulzP9RuRW5YqzXWpVf29S6OHiFSrA8SSj2AyOGo/ugy2xxgl9xgm7?= =?us-ascii?Q?562L/oPTK4jfqRr6cKKTtvgtEpTQbhfn2C6YktutoTvKmjO1KCxVCl9+lQdp?= =?us-ascii?Q?M8YlmBH/XULUZzb9rzSmZmsafM4szKaAnDCkWg6xk53qJoZbH+hc47sY3qBu?= =?us-ascii?Q?tO5VebjG6gpR/zkv1hBJ/b2g5ogH5cyY0+55QGoy7GB9oFxQajHk6kNs7jKA?= =?us-ascii?Q?n/Ml0dL4aNecI0n50NQQcnIsh8F8HajJCak1JHzXLApz/QngjzR8Wrbd40g6?= =?us-ascii?Q?uGS3KiOaEgbxReJVL3lZzX9RufPjQdnY0iEoaShLGPMYh9TbD5AdwKZIOb6D?= =?us-ascii?Q?fA0JGR0NxZmEbol9E83T16/5al06rqFjZjmNbBWo6jvsPAx6jwKmP8GrYaaS?= =?us-ascii?Q?GFRe8LVB8SD1TWpZfSYPZfL9s8yD8jrLILs97WT98+L2PrVL3myzMASGFQqB?= =?us-ascii?Q?by4zMyK786T43DflbjSE4zo+FQYGzvkYYW7kol8JVJpfVYXjkoTXoerU4cwv?= =?us-ascii?Q?OtVuXjSkDe6h542Oqr/UEym8voEwUEHji5pYql1b3eVUIqR7h2CWI01qbzMK?= =?us-ascii?Q?LFxKWK2wLsMyJU5loq+9lL2s64faI17yRWUfePT1PqFbLEYfrAFLF87vv8rW?= =?us-ascii?Q?gQX/2b/DFuo1ovNm7oFu7FBoAn5AQMHase/lhQw?= X-Microsoft-Exchange-Diagnostics: 1;MWHPR07MB3008;6:06L3laE6xBWNi5ymUCvAEQSq98v2nNGCwH3Hk28o5haCTxfwgTBvRPxALXlbl7zl2A/kdrFcsszMOSpoqrKgIXaLKEJRiwgfIWYO+hjCnZqskGujjKc+rvkBJ0XhFvVkMB7JGKT09SaWUbYiLR6f0qqmv72dkRcYa5mZyH3N26kAoQGp9bqOpbpGxNKZbdFPu80xa38zQaJ5osTXXRTirMFlu19cXS1bZXgKcFbjm7roOf0vC/7RVG/pOoGvQ7scBZGMditfhJSEG0HJF6cD+M3zuFIfrEonC36I6hfcNpzyxsN/3CGOglozUJDnOkNj98aE554JiVFID0ZfagLVCA==;5:L0B+7cH/ZxUsjeJl6PJIwzYU7/4vg5EdRoX1lUFJRvcMtSdzp1023m7zYE2Co6J1QGP2eeHvQYb8DQ38iVwIgnDwBA8FEnSSaRtcSBk/n/P349TOIrFMzEpSGsF9ESJJmQKROA0pvYUT8PxF7IJK3A==;24:Lsf/2GFmEZQeCXncjphASMdR5NWtkeSUMOVjZg2aI5yAsTgF/MOBkaE49sNVhILaXjsPUw+vHlNJDidtZ/+CBw2zCVC+dKXqwf6PZDmyf5o=;7:h3i6SFfk1LImHzr03R21/w6Z6zsaZkrCLO8cgLmZcYWf6Ncvf6v73lgVcP+PnPIhPVrmJCsJ58uZqZcM61lQMHVn0THh9i7nl0pePm/LVCBCi7kYhs8GjdVZrWLzrCNBjVTXuVkl2s0y8azkt9J4n1/nTVbtXhZWLRQFOHWqPwPNWC9LIKe+rMGh8iW+H+N9jvsGZeyViMjAhwpZ0hbnnLSOpl14btSAKXWuqGY/uPU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2017 11:33:25.9798 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3008 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3033 Lines: 77 Hi guys, Sorry for annoying topic .. Could you please provide your comments/objections on this if any ? WBR, Vadim On Mon, Sep 18, 2017 at 01:48:01AM -0700, Vadim Lomovtsev wrote: > This commit makes Cavium PCI ACS quirk applicable only to Cavium > ThunderX (CN81/83/88XX) 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 > --- > v1 : put device check into separate function and extend it to all > Cavium PCIERC/PCCBR devices; > v1 -> v2: update match function in order to filter only ThunderX devices by device > ids to properly filter CN8XXX devices, update subject & description with > ACS register info (rejected by maillist due to triple X in subject); > v2 -> v3: update subject: remove CN8XXX from subject line, replace it with ThunderX; > v3 -> v4: update ACS mask (remove TB and TD bits), update commit message (remove > ACS register printout); > > drivers/pci/quirks.c | 26 ++++++++++++++++---------- > 1 file changed, 16 insertions(+), 10 deletions(-) > > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c > index a4d3361..e6b904a 100644 > --- a/drivers/pci/quirks.c > +++ b/drivers/pci/quirks.c > @@ -4211,20 +4211,26 @@ 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) > +/* > + * 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. > + */ > +#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. > - */ > - 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) > -- > 2.9.5 >