Received: by 10.223.185.116 with SMTP id b49csp5960481wrg; Wed, 7 Mar 2018 22:42:12 -0800 (PST) X-Google-Smtp-Source: AG47ELuDTytkCRFOKM84QVNB3lcAx9GweOL06dAkNArvnY2+79dsOsyYjmCvkuaN2/In9b1FcntN X-Received: by 10.101.97.175 with SMTP id i15mr19913873pgv.55.1520491332637; Wed, 07 Mar 2018 22:42:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520491332; cv=none; d=google.com; s=arc-20160816; b=Wd9o9sVpW+TF5e56JZTXnbhT1xePuGvf8RBEwgCkuyjUvuMMT/pyCzFeFkmFQne2Re p/iWsbqtpv6fglLWnS1+kOe2Ua0LINnPj11FEUIu/rC2OpIFLpl+lqM2FrZTuhOy1Okh 1fYJCMvvJ5JX078GS3wDH0mGkzNLQ1JXbvTjWEp6w5fJdvJ2+UKGnI3PwHAAmBmFCCbX 6K8b6vM98C5CgcXpdOfK4b5COr8/RpPRMps/l+BWxH/lVE03SKdvyCoSrgP8HY17OfvU S/jaCsEs6VqOQoAwdSCEdVZinh1UxGgGmfaE820734aPM013tfhKrQ7Utw1vKL0EaRmZ HMeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Wf2jXcVZOT2Z9mBzrfGCRvJb5+7RE+3B4jxCzN4Z4G8=; b=Gkd2BNU6cLy2uRtZ204J/CAf7wapIoE7kxFzy2u7tJFkBEQbkD2xalxr15MUUIZW/4 7tNlZCI8ApohM7RIxPPyjqZgXEJS2fq+u4+DtLLexPq64SarKxyFLUUDWf5tdFPTtXWx 2232gwuUBsuPSecZ3fymSImmystqdd43QuMQYcyYp46WuY/gDyq8Qv1/ky9OURVf5LHb PyRXXaZ//XLSh/LTSKqCxPQ8+JtTh5XxDtelLVG7gB4ePvjpzJLak7T7Hfqnw7Jo6Tbp 7sLy8LRzZjNnTMQOmSRly0NEQZOl20+R3e3y3+cPZBHVp50yB3JDa9K+OZHmQ1dpsc1l GdWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=VeA9e1rX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7si5355061pgv.831.2018.03.07.22.41.58; Wed, 07 Mar 2018 22:42:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=VeA9e1rX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965404AbeCHGlB (ORCPT + 99 others); Thu, 8 Mar 2018 01:41:01 -0500 Received: from mail-sn1nam01on0106.outbound.protection.outlook.com ([104.47.32.106]:14491 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935349AbeCHE7I (ORCPT ); Wed, 7 Mar 2018 23:59:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Wf2jXcVZOT2Z9mBzrfGCRvJb5+7RE+3B4jxCzN4Z4G8=; b=VeA9e1rXv0zNTBR0nKFvMcPyRrWW949olF1KoCkJlCzdyqw1uo/hk2znxz9GGpxsF8HY4te/wxxmiUb+SsV+c54dfrxt4op/rDYBmTq21kDNDjRKzllAQ+c9EHYwjRx22JQTFR8WN7qBeehYCAPQ6USQ6vhbkmj/IBchehPIRTg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1015.namprd21.prod.outlook.com (52.132.133.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.3; Thu, 8 Mar 2018 04:59:06 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0588.008; Thu, 8 Mar 2018 04:59:06 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Kishon Vijay Abraham I , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 46/67] PCI: designware-ep: Fix ->get_msi() to check MSI_EN bit Thread-Topic: [PATCH AUTOSEL for 4.14 46/67] PCI: designware-ep: Fix ->get_msi() to check MSI_EN bit Thread-Index: AQHTtpoD22YSCWqcKkGq95a3r9pRaQ== Date: Thu, 8 Mar 2018 04:57:51 +0000 Message-ID: <20180308045641.7814-46-alexander.levin@microsoft.com> References: <20180308045641.7814-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045641.7814-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1015;7:n9f4aRxPLeHHs0Sr0Vfii0jExhhOKVOJuXgPaKWXnnLCKZYw8jL5VqY0X5ayOi6iU9EuFOPJl4tn9zNN6O4QYHZbahVS7nubXmdPcwQk7CPiPk4OizesCxzFLfrWidZzt63GJ979YmZkggigOSp7XZyqLOisryzRH27yVok7n0txVBTXk29Blpkr6F5WknjXS8XPQljaWBmBvejCn9ZIntOTzX7mESLD1c/4ks+StMfogL293zwQ8HNHXYugT94E;20:wodZgjXzIQ+ZjTtRZvpectog2C21fwWFF9isVNFtuwO60e3wacnbX0+NTLCiRTxIX/lEiLd/jGS2YuCdyXc9RQF5lxo14ZMKlcEamXBPfS11YfP4UVX9+9OoneoyavyaxDg0meCwCgtFw1ClQdmUq26Kwp72Ruqaua78ySK3SJI= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 8397f4a7-2151-4f86-d925-08d584b15201 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1015; x-ms-traffictypediagnostic: DM5PR2101MB1015: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(31051911155226)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB1015;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1015; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(396003)(366004)(39860400002)(39380400002)(346002)(189003)(199004)(6116002)(53936002)(1076002)(107886003)(3846002)(3660700001)(10090500001)(6666003)(2950100002)(2906002)(6512007)(99286004)(8936002)(6486002)(76176011)(6506007)(68736007)(316002)(110136005)(81156014)(81166006)(8676002)(54906003)(3280700002)(2900100001)(6436002)(97736004)(72206003)(25786009)(10290500003)(86612001)(4326008)(305945005)(7736002)(66066001)(22452003)(478600001)(5660300001)(86362001)(575784001)(14454004)(106356001)(36756003)(102836004)(5250100002)(105586002)(26005)(2501003)(186003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1015;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: UM7ZhY8hK0uJ8qX527m+e2DLIokQI8bLwEHoo53C3wZdTDErnUzPcTj6z5/I7vgDpKhWqWtbWdjk+RgTVtfvgHRFTCOtvcuYdEA3SCK0jWXGswAq5NHWV1R3aneLvFjVMsa/uKXgc9aMrkkSf1QmGaxzLVkmUt+sXC4GQHzeAhH7PFRSnr1OHAfYD/zivtkW6JzgSwDJPc83qJPiIvjxsLZf7x/p+cn+hIIk9cv7h7qe4bSp9RNR61BQY7YET++WMuagO/oRaF5CBhScTvn9kI4WpqF5O8pWUEduTwLgpTYCEuwEYrt7Ye1yzZiwjLTTABdxNf3V0/W0HWi7pMJkMQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8397f4a7-2151-4f86-d925-08d584b15201 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 04:57:51.6038 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kishon Vijay Abraham I [ Upstream commit a134a457ed985dca8cce7ac4ea66129ea70eba73 ] ->get_msi() now checks MSI_EN bit in the MSI CAPABILITY register to find whether the host supports MSI instead of using the MSI ADDRESS in the MSI CAPABILITY register. This fixes the issue with the following sequence 'modprobe pci_endpoint_test' enables MSI 'rmmod pci_endpoint_test' disables MSI but MSI address (in EP's capability register) has a valid value 'modprobe pci_endpoint_test no_msi=3D1' - Since MSI address (in EP's capability register) has a valid value (set during the previous insertion of the module), EP thinks host supports MSI. Fixes: f8aed6ec624f ("PCI: dwc: designware: Add EP mode support") Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- drivers/pci/dwc/pcie-designware-ep.c | 12 +++--------- drivers/pci/dwc/pcie-designware.h | 1 + 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-de= signware-ep.c index d53d5f168363..7c621877a939 100644 --- a/drivers/pci/dwc/pcie-designware-ep.c +++ b/drivers/pci/dwc/pcie-designware-ep.c @@ -197,20 +197,14 @@ static int dw_pcie_ep_map_addr(struct pci_epc *epc, p= hys_addr_t addr, static int dw_pcie_ep_get_msi(struct pci_epc *epc) { int val; - u32 lower_addr; - u32 upper_addr; struct dw_pcie_ep *ep =3D epc_get_drvdata(epc); struct dw_pcie *pci =3D to_dw_pcie_from_ep(ep); =20 - val =3D dw_pcie_readb_dbi(pci, MSI_MESSAGE_CONTROL); - val =3D (val & MSI_CAP_MME_MASK) >> MSI_CAP_MME_SHIFT; - - lower_addr =3D dw_pcie_readl_dbi(pci, MSI_MESSAGE_ADDR_L32); - upper_addr =3D dw_pcie_readl_dbi(pci, MSI_MESSAGE_ADDR_U32); - - if (!(lower_addr || upper_addr)) + val =3D dw_pcie_readw_dbi(pci, MSI_MESSAGE_CONTROL); + if (!(val & MSI_CAP_MSI_EN_MASK)) return -EINVAL; =20 + val =3D (val & MSI_CAP_MME_MASK) >> MSI_CAP_MME_SHIFT; return val; } =20 diff --git a/drivers/pci/dwc/pcie-designware.h b/drivers/pci/dwc/pcie-desig= nware.h index e5d9d77b778e..cb493bcae8b4 100644 --- a/drivers/pci/dwc/pcie-designware.h +++ b/drivers/pci/dwc/pcie-designware.h @@ -101,6 +101,7 @@ #define MSI_MESSAGE_CONTROL 0x52 #define MSI_CAP_MMC_SHIFT 1 #define MSI_CAP_MME_SHIFT 4 +#define MSI_CAP_MSI_EN_MASK 0x1 #define MSI_CAP_MME_MASK (7 << MSI_CAP_MME_SHIFT) #define MSI_MESSAGE_ADDR_L32 0x54 #define MSI_MESSAGE_ADDR_U32 0x58 --=20 2.14.1