From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751648AbdBAPeT (ORCPT ); Wed, 1 Feb 2017 10:34:19 -0500 Received: from mail-bl2nam02on0046.outbound.protection.outlook.com ([104.47.38.46]:53043 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751582AbdBAPeR (ORCPT ); Wed, 1 Feb 2017 10:34:17 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Vadim.Lomovtsev@caviumnetworks.com; Date: Wed, 1 Feb 2017 07:34:09 -0800 From: Vadim Lomovtsev To: Bjorn Helgaas CC: , , , , , , , Subject: Re: [PATCH] PCI: ACPI: Fix ThunderX PEM initialization Message-ID: <20170201153409.GA16088@localhost.localdomain> References: <1485793552-12614-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> <20170130211236.GW20550@bhelgaas-glaptop.roam.corp.google.com> <20170131102830.GA13854@localhost.localdomain> <20170131142525.GA9942@bhelgaas-glaptop.roam.corp.google.com> <20170131145720.GA14231@localhost.localdomain> <20170131203109.GA14127@bhelgaas-glaptop.roam.corp.google.com> <20170201125325.GA15805@localhost.localdomain> <20170201151807.GA15793@bhelgaas-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20170201151807.GA15793@bhelgaas-glaptop.roam.corp.google.com> User-Agent: Mutt/1.6.1 (2016-04-27) X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: BY2PR16CA0008.namprd16.prod.outlook.com (10.164.126.146) To SN2PR07MB2654.namprd07.prod.outlook.com (10.167.15.142) X-MS-Office365-Filtering-Correlation-Id: 9d2c1139-fe05-4d9e-5578-08d44ab7c6e7 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN2PR07MB2654; X-Microsoft-Exchange-Diagnostics: 1;SN2P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:UaZbxkN0chlesAnCP7wHPqOKqQrEjV3QAD6vvKGPGYWsQoq5hWjgp/rvGq7D6ZhKPMCVwho24oVInvZ+vSC8yuYiCrPqIjRfI03gtMrmWXp2iB5kP1VPd/vSZeA8X9qLdG4Kc//3015MUOIomI5VmdMtzEOEGIb+T0asUt5fCwrBrI1cCy7UDjFKcBTsjVgukMQ9UoOnznqzw4NfzwTIjC9KVKGJmTZsJuQH7N5ZdAE15hxNpOHzJPNcpMWnK+sDgcdFzjh07SiQuxz3mlPZ7Szu8X5m5qSo52ze0NEfYkBSg7Yawhpiq1RyEMsfOjITUEUm6iNEUFmuzmqwi2rBGzByXWSyfltb8DMmajqZnomjIJaS42wEjZZujsBY6qV+pbK1AqNkZvpXS5n56NDfxNuz5gMPrtBDnoh1svyluj2M3WkUXt/h1Gc/C9SQo/VVeKWfxQRhXhMDqcblrqXCNTp2HyFm0zaK/hVUAzLY376mitr3/pUE5tUOImCejlLTL2mAJoYgy3cN8N5rBm1OtO/vIeWBcF40DWMlXO3doCoU0r0Mvdaf7Xvnw7goLE/CGjHn5DPy/sKJTuEOqv2xSHHn3cYSoaJpXGeHYJuLzi8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123564025)(20161123560025)(20161123558025)(20161123555025)(20161123562025)(6072148);SRVR:SN2PR07MB2654;BCL:0;PCL:0;RULEID:;SRVR:SN2PR07MB2654; X-Microsoft-Exchange-Diagnostics: 1;SN2PR07MB2654;4:kcctt3fOsZBdCbl9iSdpjb4motdTe5ZpLb11q30jgZ+oJuLZ+Z21wH8rx22O9osIdjB/Dv20kxHzNaXoLpHr934EXY3EqPnCYLLQJMDIobN9U/p8N/l82IUA4giK4lSJkFdPGyfjHDrY+Jffu4RsWLXzpcPGvNBtOUspPwFgALvyTRFg+yXetVPMXAkFoOammHAmPQ/TtGAz5ODw0k+t/ssb1onucsZbxDn+3aupgq88I9TdQ6oLZ/sWxFyzqg/5uRN5ZBfILwiG/2qPrk9xm+Kmm86G3h370qXm6MjsyBArQqlPoz/pg8R/wwUxmFdw25YzGZEmQ2praBlsrfZL4uETOyl5RKUjkq6WQ4VU3ALx7EHbWYBGzTYzqzptu1g6Pp5LMTS/ue3N29RaOu6bhNtzHfdpUY7eNw13Qw2w6rPNFKsPpHiE7++uwfWP45EEWfJih2GNp1ZuWVl85tJlpwVsLzuroT21sBNug2vKlFd19gLCo4Qt/QZUs9eg5jbdT8t0pu5qiRhTcBtXawIWF9QzTKEC3DTeRRHLPK69622z6gNm99cBMZ8iDB4oxrXFA31Jj1pCNUOIS/0/4VVllBu9q0NpC0ZZ0rOz8vaJ7m3EbqSVguAOJnORRGRba1XfYvUCnOf9oOxDUq1DIyUU2w== X-Forefront-PRVS: 0205EDCD76 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(54534003)(24454002)(199003)(189002)(81156014)(4001430100002)(55016002)(81166006)(4326007)(93886004)(575784001)(7736002)(50466002)(50986999)(106356001)(86362001)(3846002)(1076002)(68736007)(305945005)(23726003)(6116002)(8676002)(9686003)(345774005)(54906002)(76176999)(54356999)(6306002)(38730400001)(229853002)(2906002)(33656002)(97756001)(6506006)(92566002)(101416001)(97736004)(47776003)(107886002)(6666003)(46406003)(25786008)(83506001)(4001350100001)(6916009)(2950100002)(66066001)(42186005)(5660300001)(105586002)(53936002)(110136003)(61506002)(189998001)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2654;H:localhost.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR07MB2654;23:dPwErf5LL6mjeFMebglCdH++ksJ4H2Mf+fdA0kgB4?= =?us-ascii?Q?fgsXiSRcH0FZY4Uk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uqs1/gVdJsc99GOrhgfi/0tGx3c=;5:/ffkzcGzrg4eYtOx/GBeCcIxIgFmF8JzunXnncBvf49Jbx0bLem8lbukj1qKvbNgbG4qSS6x2jUN5mn5vp+rBdesHbaMjJPI53weOatoVcfxdS7OSRvhsUKg57bREh0/TdgYP2i3l7+EyYgeRhRDPA==;24:y5Kq6/t8KmY6yngSNJ7skMvJXbJM1tYqfwrLd/Hevr3ZvLiNRFU35wKFIY2xRn6hbu+YH0b7HwPBURxeNFTfYtxDUhVR07CGxRDZVpI3eqk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN2PR07MB2654;7:ZWXs31Fii37qBiHydsZa2MXS3+DBn2cXPpJ5y+Jg63SMaIpvKnPyJcFeNHzdZVDtaq5ddr110KJsYnw11NSrvNMFhSJlu3jl/ULXMHNrKjJcRgNWzDnysH4/dFgDuJbZgFrUTUOAb0bKTPiGlSubM8Eq1psa/zZogWyYruXmHrfrW8/WTdNUXYKujdJvtfwoI13TM+Q+btopxJ2IuTXc6sddEvmq41CC8/iYJqXAXL0utQyiTZBeekdBpAoJpMGy7SJVWEt9ykqy3M2Mclzt2ZeVVajnEsJeg5NXhEBKyvtWSEskv4DONV4knXMEiupDZlGhGVsjxPdVBnlBFI9VRqhKIairDUkBkaTZWcy9DF3r+a+e2JIfY008DJ09AjWx084EzeL3JbEiy0IjvVkwFFcnvKkxkmLCuM3TNIfdxqQxfcMc2vtOhwjS+2uSLaGAWPH0F+jgS8hvivuLojpdBe+NPgDexgXEnRcnpFPoKepKH8vbVydZIgMjyV9OhcEDJQS9MVGmSFq5YrB81fpRCGD0Poh6swiQIScK5HhwztaAKvQN9ptmiOsiMGJJ78Cq X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2017 15:34:13.8679 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2654 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 01, 2017 at 09:18:07AM -0600, Bjorn Helgaas wrote: > On Wed, Feb 01, 2017 at 04:53:25AM -0800, Vadim Lomovtsev wrote: > > On Tue, Jan 31, 2017 at 02:31:09PM -0600, Bjorn Helgaas wrote: > > > On Tue, Jan 31, 2017 at 06:57:20AM -0800, Vadim Lomovtsev wrote: > > > > On Tue, Jan 31, 2017 at 08:25:25AM -0600, Bjorn Helgaas wrote: > > > > > On Tue, Jan 31, 2017 at 02:28:30AM -0800, Vadim Lomovtsev wrote: > > > > > > Hi Bjorn, > > > > > > > > > > > > On Mon, Jan 30, 2017 at 03:12:37PM -0600, Bjorn Helgaas wrote: > > > > > > > Hi Vadim, > > > > > > > > > > > > > > On Mon, Jan 30, 2017 at 08:25:52AM -0800, Vadim Lomovtsev wrote: > > > > > > > > This patch is to address PEM initialization issue > > > > > > > > which causes network issues. > > > > > > > > > > > > > > > > It is necessary to search for _HID:PNP0A08 while requesting > > > > > > > > PEM resources via ACPI instead of "THRX0002". > > > > > > > > > > > > > > > > Signed-off-by: Vadim Lomovtsev > > > > > > > > --- > > > > > > > > drivers/pci/host/pci-thunder-pem.c | 2 +- > > > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > > > > > diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c > > > > > > > > index af722eb..aec30b8 100644 > > > > > > > > --- a/drivers/pci/host/pci-thunder-pem.c > > > > > > > > +++ b/drivers/pci/host/pci-thunder-pem.c > > > > > > > > @@ -331,7 +331,7 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg) > > > > > > > > if (!res_pem) > > > > > > > > return -ENOMEM; > > > > > > > > > > > > > > > > - ret = acpi_get_rc_resources(dev, "THRX0002", root->segment, res_pem); > > > > > > > > + ret = acpi_get_rc_resources(dev, "PNP0A08", root->segment, res_pem); > > > > > > > > > > > > > > This doesn't smell right: PNP0A08 is the generic ACPI ID. There's no > > > > > > > guarantee that if we find a PNP0A08 device, it is a ThunderX device. > > > > > > > > > > > > > > I think the only way to call thunder_pem_acpi_init() is via an MCFG > > > > > > > quirk that mentions thunder_pem_ecam_ops, which means we only call it > > > > > > > if we find an MCFG with "CAVIUM" "THUNDERX" OEM and table IDs, so it's > > > > > > > probably safe in that sense. > > > > > > > > > > > > Agree, it is not the best solution. > > > > > > We will implement such approach and send for review. > > > > > > > > > > > > > > > > > > > > But it's an abuse of the ACPI _HID model. If you match a device using > > > > > > > PNP0A08, all you can assume about it is that it uses the generic > > > > > > > PNP0A08 programming model, and I don't think that includes "the first > > > > > > > memory resource in _CRS contains ECAM space and MSI-X tables." > > > > > > > > > > > > > > I expect this is a teething issue because you have firmware in the > > > > > > > field that uses PNP0A08 and it's not feasible to update it. If that's > > > > > > > the case, the changelog should have details about it and we should > > > > > > > have a comment in the code, because I don't think this is the model we > > > > > > > want to end up with in future releases. > > > > > > > > > > > > It could become so. However, for now I didn't get any reports on that, > > > > > > (may be I miss something) except some internal emailings. > > > > > > At my testing HW I was able to see some issues related to acpi-PEM stuff. > > > > > > > > > > > > Thanks for feed-back, we will prepare another patch or patchset > > > > > > implementing approach you've highlighted. > > > > > > > > > > The approach I would like best is to search for THRX0002, because then > > > > > you know you have a ThunderX PEM device, and you can assume > > > > > device-specific details about its _CRS. > > > > > > > > > > But that's what the existing code does, and apparently that doesn't > > > > > work. My guess is that you have firmware in the field where the host > > > > > bridge has only PNP0A08 (and maybe PNP0A03) as device IDs. > > > > > > > > Because there is no such ACPI ID as "THRX0002" registered > > > > (http://www.uefi.org/acpi_id_list). > > > > > > To be pedantically correct, I think you want "THRX" registered. Then > > > you can manage the "0002" part internally without registering each > > > individual device. > > > > Not sure if it would be registered that way, because (AFAIK) > > it expected to be string constructed from Vendor ID (not the Product ID) plus > > four hex digit manged internaly. So we suggest to change it to 177DXXXX > > which corresponds to Cavium PCI ID https://pci-ids.ucw.cz/pci.ids. > > It's also possible to use the 3-digit PNP ID, "CAV", to construct these > > _HID/_CID/_SUB values (http://www.uefi.org/pnp_id_list). > > My point was that you only need to register the prefix ("CAV" or > "THRX") of the PNP or ACPI ID. Then you manage the suffixes > internally. You as long as you register "CAV" or "THRX", you can > assign and use "THRX0002" yourself without registering that > specifically. Yes, exactly. And the "CAV" perfix is already registered. And I think will'll use it to keep things aligned to specs & rules. > > > So the FW will be updated accordingly. > > > > For old FW we'll implement fallback scenario gathering resource info > > via _CRS object (comments will be provided in the code also). > > > > > > > > > From the other hand we may gather device resources through > > > > _CRS (we have acpi_device already set by this moment) but > > > > we need to be sure that we're running at Cavium ThunderX board then. > > > > > > > > To do that we may add _SUB value (accrodingly to spec) with > > > > exact ID string (a full PCI ID value "177DA22D" is suggested). > > > > This will eventually become the main method of finding out > > > > whether we run on a ThunderX PEM. > > > > > > I don't understand why you would use _SUB. I think the correct way to > > > handle this is to use a _HID of "THRX0002" with a _CID of "PNP0A08". > > > Is there some existing _SUB usage you're using as an example? > > > > Here we were talking about extra quirk to match PEM and ECAM and thus make > > a decision. This object could also store some vendor-specific IDs. > > To be honest I didn't see usage in kernel (didn't search), but ACPI Spec > > provide an example as (p 6.1.9) : > > Name (_SUB, "MSFT3000")// Vendor-defined subsystem > > > > However this is still debatable and we probably stick to _HID while > > implementing additional match functions. > > If you want a driver to bind to a specific device, e.g., the ThunderX > PCI host bridge, the firmware should use a unique _HID in the ACPI > namespace and the driver should claim that _HID. > > It's conceivable that you could use _SUB, but that's needlessly > different from everything else. See your point, thank you for quick and clear feed-back. Just to let you know: We are in the middle of developing solution for fall-back scenario (when ACPI/PNP ID wasn't found) for PEM initalization. Hope to be able to get it into 4.10. > > Bjorn Vadim