From patchwork Wed Dec 9 13:07:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ley Foon Tan X-Patchwork-Id: 7808441 Return-Path: X-Original-To: patchwork-ltsi-dev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E0C16BEEE1 for ; Wed, 9 Dec 2015 13:08:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0630C204AE for ; Wed, 9 Dec 2015 13:08:39 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A350204A9 for ; Wed, 9 Dec 2015 13:08:38 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 1ABBBE4F; Wed, 9 Dec 2015 13:08:38 +0000 (UTC) X-Original-To: ltsi-dev@lists.linuxfoundation.org Delivered-To: ltsi-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id F06EAE4F for ; Wed, 9 Dec 2015 13:08:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0053.outbound.protection.outlook.com [157.56.110.53]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 35405154 for ; Wed, 9 Dec 2015 13:08:34 +0000 (UTC) Received: from BY2PR03CA050.namprd03.prod.outlook.com (10.141.249.23) by BY2PR03MB443.namprd03.prod.outlook.com (10.141.141.152) with Microsoft SMTP Server (TLS) id 15.1.331.20; Wed, 9 Dec 2015 13:08:32 +0000 Received: from BY2FFO11FD044.protection.gbl (2a01:111:f400:7c0c::144) by BY2PR03CA050.outlook.office365.com (2a01:111:e400:2c5d::23) with Microsoft SMTP Server (TLS) id 15.1.337.19 via Frontend Transport; Wed, 9 Dec 2015 13:08:32 +0000 Authentication-Results: spf=softfail (sender IP is 66.35.236.227) smtp.mailfrom=altera.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=none action=none header.from=altera.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning altera.com discourages use of 66.35.236.227 as permitted sender) Received: from sj-itexedge03.altera.priv.altera.com (66.35.236.227) by BY2FFO11FD044.mail.protection.outlook.com (10.1.14.229) with Microsoft SMTP Server (TLS) id 15.1.337.8 via Frontend Transport; Wed, 9 Dec 2015 13:08:31 +0000 Received: from sj-mail01.altera.com (137.57.1.6) by webmail.altera.com (66.35.236.227) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 9 Dec 2015 05:07:32 -0800 Received: from ubuntu (pg-lftan-440b.altera.priv.altera.com [137.57.93.25]) by sj-mail01.altera.com (8.13.7+Sun/8.13.7) with SMTP id tB9D8Q81028342; Wed, 9 Dec 2015 05:08:27 -0800 (PST) Received: by ubuntu (sSMTP sendmail emulation); Wed, 09 Dec 2015 21:08:20 +0800 From: Ley Foon Tan To: Date: Wed, 9 Dec 2015 21:07:26 +0800 Message-ID: <1449666448-31276-6-git-send-email-lftan@altera.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449666448-31276-1-git-send-email-lftan@altera.com> References: <1449666448-31276-1-git-send-email-lftan@altera.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD044; 1:/4L/etjETogRss9d83f5hx8f9zLAgvt/XbDVES5FM/x43Oz+W+os7om14w72jFji24D8cFUVxaGDhTW+u4wsNMozjLmyIiN3bB6tnF+GJuWonA/ALTiRnkIwPFirSwxo2WVlVfSB6Uw92pO0D6B4lHTic+TYCRI71cn0U7kE5Irzk6g5/RvM6o5+ryyjSbsPA1u64F7CKPLXXPTpuGX8KtDC/TlzWDfnAXsN4x/6Xe/0vp6AW1qLHIyN7USb+ZIihG052SbwSl3SpRGNdNDtGXDtL7EeZL/94Y1hiZnxEjbcBO6aFudBD8UhebRcx6x0U0YC4G0qU6l9vFO5S/1umupzU0ZWxxD7RTQyUNhANOk= X-Forefront-Antispam-Report: CIP:66.35.236.227; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(199003)(189002)(4001430100002)(586003)(47776003)(105596002)(106466001)(2351001)(229853001)(33646002)(42186005)(50226001)(76176999)(50986999)(48376002)(50466002)(87936001)(86362001)(6806005)(5001960100002)(5003940100001)(1096002)(107886002)(110136002)(97736004)(1220700001)(11100500001)(5008740100001)(189998001)(81156007)(92566002)(2950100001)(36756003)(19580395003)(19580405001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB443; H:sj-itexedge03.altera.priv.altera.com; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB443; 2:Td15B5WFZZJW3JVpGLhT3eMcTCyBAIrDZKxib1S9Mfc7pKun6tFuy3Qxgmh0YUzDTxMLpUpbqZB6ibpA+nEUrP9fGHTitCYyjs23O/loagk89kkNXRCd9ryk+3nuVhlNg9KOmTP9sCyrh4I0pbWPHg==; 3:332JWRW/S1kAw1CrAw7Lvp6D1m4Nc0mwIEXg0QBPbe9um75QBwpYzc2KB48cdtXk8awP4JTBZiUh+NusCX05EoX9hFFbvMXckXlgLHay4Vt+aVa/8PArnkB4bztlkGVjK5scMqhehjhzPV0DjBBQ1pvh3uc/KCZt+IG+cIfmTpCey9+AOyXCbKPZ9jG9RfYmj+1wO7mMN1P0+Lc2F8UtONzjXVa5dmunAhLOPuBlbP0=; 25:eWGwop92SDxgfAqzMJ/jT6G6h4OwIkcy8d97Bcavmjtkb3daF2QkAn7OCGeg/GUbXWShaGeGobrzrUCtPvMAufTLezanUqxgPyr873Mbd/cQpUfYf9s2FVf64VB9mZ8OLJHE3Zqw424bjVzPXYu4D7KpDFvSjXnp68csM0K6ChVNRiaWOTK38ZzjWc+IDb8kMrfTRqupedg2Z+CQ0y1VCzFw7Uxlnkk4Eaq6TaxWp1IhAwa4TV1Qz6BfVgcf5umDu+97/Mc4lzsvk4u59EUU2g==; 20:Fn9rBUQQ9wbZd8NhGwFVb3pwxD8WyYxXAshMs7k+sxUPC0dXABl1LnPqrrnlVqtytmkd3/bKNuAIxlwwyyQSyiqVejTdu2jAUGB43MPUDD5CerrLFBsXEPW4qYO5sdBEFf5RxN8Hxf8Cz9T/PU14YGBXGXPYmfOtnYn37G4koxM= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB443; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(80048183373757); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001); SRVR:BY2PR03MB443; BCL:0; PCL:0; RULEID:; SRVR:BY2PR03MB443; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB443; 4:BnltUE91nPUSdq7HY/W0GFF2xJmYnFYUk5gRuJoqWYE210pvaEeHstijNvGxc2bdpv/mnm5RW7P7hLwPkLj3gPurxX7XTjGd5RFF2YJQW4VWgkMJVldetxVzUMpOaxqIy2NvIxP55FMOA8s8v1h4A544bgkU8XpD8xO/8vSEBsNpv9uesqbsZQYA4mKcbPgDGuV1bPPTi+JPbMzHBvwr0CtZr2u6C3WTnFi47Qw1dJECIo5Q4qbzsBwWCSW6QuqNfiHmmMQNABlJzukpns7lgj1z+HNNP1MOvXNt4cURnJJrwPagkP04nkXoUZ+btbGiObGNwBVJN3P38YnyhyY6uPD/7zm80qskBnhrF1bXZLVj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4YPxq/jqPnxg?= =?us-ascii?Q?X+VwyNL1+QK5GrYdqVfmkHrOwBax74PThA9x7tCGSwdvi9He3R6pGLGKTho5?= =?us-ascii?Q?Hbu8kfP8Q2Bjxtz9jAjqh7SuXmt6OBeZikxUhJILcAnS/h4bZb7+2n2kAaZ3?= =?us-ascii?Q?Ug/nRznzIye53l6VgN4+NZSEfqEzWCVvoK95Ln01+gnISRwrCD6vqn2REhjx?= =?us-ascii?Q?4kiOGH+bpGZ20t7BLvcOmrn3zObgJyqUReUXGOlx34chxHqiKetCn08PBGyI?= =?us-ascii?Q?GrKI9x2xgctT3STIpEZfvmBmghGFyy+7DJBs5C7zqipA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB443; 5:8Kh8ibP+7SNY62ekCII3cjPKr2JV8wQ8ngZcqRtK3wY8hHRcr3t5Vf7rsgMU9TZD8/CKi7LWPyMO7laJ/HBzT1ljGCdBMBAD4TSGsI7HeA4CnuJ9y4MV6miXaO9fyAYPKkEgt1GpHn63g6dpa1Ewtw==; 24:rLsU2GEMTPNFQj+Qeo7/Haz8PTpBeNPzpGG7nu79BtMxsTcICH64dKSX4FOTzJ7kx1J6KAolaJvtaMqoMio9M5lIcZ/f8K3PQm+H7IL8Zqg=; 20:8j24UvKFfS20BpNfFQhuN5DudkRpxh1bU6nXqCJ5AP4k0ZR2b4R3cHpEE5hXO6LFC2fhDO06HN9xCwkfRrv+IJx3H1oOILZMmPE2aHtTNsutqR4m3k484LmmHNPlNEeVKfAi4luyg2AsHzvCr7hW/QOEvkjcO/vqM+HS/TqP1KU= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2015 13:08:31.5202 (UTC) X-MS-Exchange-CrossTenant-Id: fbd72e03-d4a5-4110-adce-614d51f2077a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fbd72e03-d4a5-4110-adce-614d51f2077a; Ip=[66.35.236.227]; Helo=[sj-itexedge03.altera.priv.altera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB443 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org Cc: ltsi-dev@lists.linuxfoundation.org Subject: [LTSI-dev] [PATCH 5/7] PCI: altera: Fix Requester ID for config accesses X-BeenThere: ltsi-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "A list to discuss patches, development, and other things related to the LTSI project" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ltsi-dev-bounces@lists.linuxfoundation.org Errors-To: ltsi-dev-bounces@lists.linuxfoundation.org X-Virus-Scanned: ClamAV using ClamSMTP The Requester ID should use the Root Port devfn and it should be always 0. Previously we constructed the Requester ID using the *Completer* devfn, i.e., the devfn of the Function we expect to respond to the config access. This causes issues when accessing configuration space for devices other than the Root Port. Build the Requester ID using the Root Port devfn. Tested on Ethernet adapter card with multi-functions. Signed-off-by: Ley Foon Tan Signed-off-by: Bjorn Helgaas --- drivers/pci/host/pcie-altera.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c index 0ff6b00..f23d3d1 100644 --- a/drivers/pci/host/pcie-altera.c +++ b/drivers/pci/host/pcie-altera.c @@ -57,6 +57,7 @@ #define TLP_REQ_ID(bus, devfn) (((bus) << 8) | (devfn)) #define TLP_HDR_SIZE 3 #define TLP_LOOP 500 +#define RP_DEVFN 0 #define INTX_NUM 4 @@ -243,7 +244,7 @@ static int tlp_cfg_dword_read(struct altera_pcie *pcie, u8 bus, u32 devfn, else headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD1); - headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, devfn), + headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, RP_DEVFN), TLP_READ_TAG, byte_en); headers[2] = TLP_CFG_DW2(bus, devfn, where); @@ -263,7 +264,7 @@ static int tlp_cfg_dword_write(struct altera_pcie *pcie, u8 bus, u32 devfn, else headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGWR1); - headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, devfn), + headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, RP_DEVFN), TLP_WRITE_TAG, byte_en); headers[2] = TLP_CFG_DW2(bus, devfn, where);