From patchwork Thu Dec 3 09:54:47 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: 7758031 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 009C49F350 for ; Thu, 3 Dec 2015 10:11:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3488B20551 for ; Thu, 3 Dec 2015 10:11:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BDBF20567 for ; Thu, 3 Dec 2015 10:11:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759439AbbLCKLH (ORCPT ); Thu, 3 Dec 2015 05:11:07 -0500 Received: from mail-bl2on0062.outbound.protection.outlook.com ([65.55.169.62]:56374 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759357AbbLCKLB (ORCPT ); Thu, 3 Dec 2015 05:11:01 -0500 Received: from BLUPR03CA009.namprd03.prod.outlook.com (10.255.124.26) by BY2PR0301MB2072.namprd03.prod.outlook.com (10.163.197.14) with Microsoft SMTP Server (TLS) id 15.1.331.20; Thu, 3 Dec 2015 09:55:02 +0000 Received: from BY2FFO11FD050.protection.gbl (10.255.124.4) by BLUPR03CA009.outlook.office365.com (10.255.124.26) with Microsoft SMTP Server (TLS) id 15.1.331.20 via Frontend Transport; Thu, 3 Dec 2015 09:55:01 +0000 Authentication-Results: spf=softfail (sender IP is 66.35.236.227) smtp.mailfrom=altera.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.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 BY2FFO11FD050.mail.protection.outlook.com (10.1.15.187) with Microsoft SMTP Server (TLS) id 15.1.337.8 via Frontend Transport; Thu, 3 Dec 2015 09:55:00 +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; Thu, 3 Dec 2015 01:54:13 -0800 Received: from leyfoon-vm (pg-lftan-l.altera.com [137.57.103.123]) by sj-mail01.altera.com (8.13.7+Sun/8.13.7) with SMTP id tB39sui2022244; Thu, 3 Dec 2015 01:54:57 -0800 (PST) Received: by leyfoon-vm (sSMTP sendmail emulation); Thu, 03 Dec 2015 17:54:56 +0800 From: Ley Foon Tan To: Bjorn Helgaas CC: , , Ley Foon Tan , Subject: [PATCH 1/3] PCI: altera: fix incorrect devfn for requester ID Date: Thu, 3 Dec 2015 17:54:47 +0800 Message-ID: <1449136489-2559-2-git-send-email-lftan@altera.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1449136489-2559-1-git-send-email-lftan@altera.com> References: <1449136489-2559-1-git-send-email-lftan@altera.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD050; 1:4yvSTJHDcic0iM0X4vj78FoUzJxqJdHE4YcEaAdqZ+PiwAapg/WXvOj6CbWNoTzTsEk2+WoBHC9ct3AHYMeAbtaUjoJmauj1UWfFDbzR4VXk2inzMfd2VR/GBawUvOy5efsYj9CHap/z6SjrySW7NRvW6pr2nmXdEw60GUIKmm/M32NM0MFbogI/BEmHbMyUQlslsV4UrtZ+SfyD2qeWLP28iy66H7tWX7FvJJUVgP5FrqxZcVFOMzGELuxgC3DgWzrqV/ftXdJf+3xSGggiBQg2NptEF9xz1jz0qIX3mdy8M8nS0mQjQaJvdW98weXHeoP/KwybxU0w4tdy8nOC9mcxHDTXrrA2xCVaO8L3MnyXlALlrMN3x6KfJV3GCfMLq27bYOds+NPDwrf0L4obQA== X-Forefront-Antispam-Report: CIP:66.35.236.227; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(189002)(199003)(110136002)(5003940100001)(19580395003)(81156007)(586003)(19580405001)(97736004)(189998001)(92566002)(87936001)(33646002)(229853001)(5001960100002)(47776003)(50986999)(76176999)(50466002)(48376002)(2950100001)(86362001)(42186005)(105596002)(50226001)(106466001)(1096002)(36756003)(6806005)(5008740100001)(1220700001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB2072; H:sj-itexedge03.altera.priv.altera.com; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2072; 2:Df72p3Xm5yzi2I6PuWdh2x2EWjuojZbsl29DKcxh8csw/3XD6xkeLlL7f5C9OK9szIPyaN/835s3Ujbglv8N3dtUfnPXCyWGutTxjJiP3lrvpzyDTXUcBMR2NBvxR6rtbbe76nyYYZQqSzAjRfjeZQ==; 3:YeNDZJT+4bC+sPozmuWxVAC24Ax232WzQmOfTgluYDF5h/gpvkQ0ul8GLBX3bXtlU1eOJVW8TsAXeHgC14+ZztEW7Ks7/KdppigmchL1q6RNNlI/kvc7WnKZevrafjcnocqDgtWYQnGMeuTbEmT6wWdptOZNrLZjT0svDHRRX2xoEmrq4397/AQ9v1ZQ8+WbjKOqPviXYmYaG+Mfz4bmiMFd0zRUDpFZ4w2mJti1vXQ=; 25:pPDx8rGph5a7oOYU9xwmagX15NVM5a+2Gsyf8PgI3oUDkB00RW3vG4dNugWIFMaf5yvWLDn0Gr8VPQf26/4EqEaCbRGqqwJXQDy14s4/FHafp3nCsKRm61ionAkA2t+SlYXpm5kC2bxoq7d1YP80eIS1mCRsVnL//xlLw2TA6rodsiGKmIZMaDg4iFAdh8Opt0VWlaXn5uEU/BHLnMS7Xunlw+/uWYJPGa0dgjxYBx0t4xbVvFWor9r1rLAZywpOD3VeVnMg7Eb1t5xxY0FcTw==; 20:h/cFnEOdAvTVdTLIXqPUr0rz6vdimWcuNz9Rs+9UBNxFbJSwydNhd8pFYYR9AOCPTSybGuXd4c2VCljXXQnZJfrHjcZGyH2Y8ya2SoY9nfMuSjWPrhila/qa2d65LvGpPXBXoukE4sC3zlfAJSDxiTt4DcnEV5UqJquy+0c+Zz8= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB2072; 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)(8121501046)(520078)(3002001)(10201501046); SRVR:BY2PR0301MB2072; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0301MB2072; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2072; 4:jATMPnLXtic7+rDNQ5J5JCxkeDHmILDZI6VGHDk344mnnkB0Jxsh0/ylYqfvtdu4QhhcdfFwORy7co8SqJd4+p09XDUZUtv2XK6B0udWa5Fd/7BIcqE1D0J1R80j3xKDpOBMRzt3ERFEunjgXF79Kjjn+7/XOmFb9ZEMzp8ODx0RBFzrS7n7LidF02lXVcnRu58wrg5BC4S7cSaQEhIJGN2LWT1cdROoCvZPIw/0bvYqj+REctyQQKONOTbLVRuA1Evif8g/gtvb1BRoYWy6UK4eOeiDh2xCfqKmX7Z6wIs0CNg/GIdkkmsv5PiidCz1Om/F1k6FMxVKJ4Uu5ji39SXS2yTt3Yu3Dw1NfB0moHme20L9Gj4TLJDvMbI9YQ4hWlXruj9iObAFwzTlL4/XDbxarmAyWDQG8oPUqdtMAzHz9ji0hnV6kzovG/Awug4p X-Forefront-PRVS: 077929D941 X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2072; 23:yxrQ0mY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u+zmtSNG1enfia86K4d296I08dzkMMsjRERkA==; 24:VG0su0frKZoX7iyD3e0LQihfZH4TbaDTnQBZU4kPnS2QbjeIePGMuWXA0V175ME4WaVq1NjySRdhelbS5Hnm4EN+AyeWn53HZDa3OZi+8zQ=; 20:mqnnioDIooos2urhS7lMcKnGIhe4hrfwwiL+WuxOopRA4BstzLMgsV5FQ8NnKWjgx/T/8BOXpxhGwjlcwg6ldZGPczYF13zI7UndbqrfsRqHGgX6wUqgLp5QM4dswH8A1HyTh5TO892Z33FfEoktqF/8rPo2QpQ1uoenfqq2Dek= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2015 09:55:00.4358 (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: BY2PR0301MB2072 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 X-Virus-Scanned: ClamAV using ClamSMTP Requester ID should use the rootport devfn and it should be always 0. But, devfn argument in these 2 functions can be rootport or endpoint. It causes the issue when accessing configuration register from multi-functions PCIe devices. Tested on Ethernet adapter card with multi-functions. Signed-off-by: Ley Foon Tan --- 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 e5dda38..f05180f 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 @@ -233,7 +234,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); @@ -253,7 +254,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);