From patchwork Thu Mar 8 04:56:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 130960 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp6122306lja; Wed, 7 Mar 2018 22:59:07 -0800 (PST) X-Google-Smtp-Source: AG47ELv/k3PTZ/PT/cz0aZ8D9kMT7h/VjeX0fNOXudkvOufxxEnpnDP+qUXJVRAt9aL5pcPGmTit X-Received: by 10.99.116.28 with SMTP id p28mr20455645pgc.306.1520492347350; Wed, 07 Mar 2018 22:59:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520492347; cv=none; d=google.com; s=arc-20160816; b=YnByApbMjPopdytx1NMYrSaAntushjFuyfFxtC82ovd6yXUvqo35WCv5DSy2S/N/Ej l9IAvgO5iclU8osmA7DncESw/c+CpAgiBTaTsTb4gFdSOayYfl74zICqDM/qO10H6hgj PKZ/9NA89PlGIB33+jeNxBU7UsPpwQCp68UEY1H38WCrD3CBVFWNQfgIXTi1859EamgO YiBVmOOJeIEkBOYu1gETU4wMGvNdTscGhwpQrSJkaZTfg20PsBlJNRO26Iv64nm7kzTB q390RE70Vv/85PBVSZRqbi9xtYtBU2BkL50UeGroUF4XWMF0HWrtoqmUdTfLIXRWozzT iIFQ== 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=ENxQnFVjquaPqICICeChZjCgzAkgkdMcCpywCdLJ27Iq1j5S/3qpBVrHYivETw6vJl Ru6nKBX1ymqkqE/9ictru0y8xxbPcQ9U8fqRKAaCqGwCJ4iMQK7n0SA45PCV3fzWfMof mqTEMk4RqGtKelzQew3o7Gv0NLMnUyy1/SjvZQgaeHaABeEr7Bz8I6ZF/4TUAEz70VTT EvgLjUx9RJRKpN1XvVedwJGUbMOZZsnLrj5bFXqL6WHJxuFFfVTHOOE2VABcBuYARic7 c1bCRZBSE8VQNRZrhYmmIRZmPRoEo0N3lDYTd+ONFZRDat4C1Ilz14TTNTsmvwODGGuX 7v3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=hIB0rYy+; 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 q6-v6si14814061pli.790.2018.03.07.22.59.07; Wed, 07 Mar 2018 22:59:07 -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=hIB0rYy+; 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 S935047AbeCHE5Y (ORCPT + 28 others); Wed, 7 Mar 2018 23:57:24 -0500 Received: from mail-sn1nam02on0127.outbound.protection.outlook.com ([104.47.36.127]:4352 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934948AbeCHE5R (ORCPT ); Wed, 7 Mar 2018 23:57:17 -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=hIB0rYy+Uu6UYs4IzXgBUGE5gVRpXIXcrkUrYlaMo68uzfRdZD+2fWByS4gix7S1j8kpQK0dgg8ErWmswFxN7dwh8WMpQjjTsLhzQyBH9UAADt+2Ul5jMOR65eYhBlCIWfLdXxNnsfpCOsPbpcE+XfSoX4drlcueKYyWJ7HEHbQ= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) 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:57:14 +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:57:14 +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.15 53/78] PCI: designware-ep: Fix ->get_msi() to check MSI_EN bit Thread-Topic: [PATCH AUTOSEL for 4.15 53/78] PCI: designware-ep: Fix ->get_msi() to check MSI_EN bit Thread-Index: AQHTtpnPLeG+NGMoa0Okfott0VH1Zg== Date: Thu, 8 Mar 2018 04:56:24 +0000 Message-ID: <20180308045525.7662-53-alexander.levin@microsoft.com> References: <20180308045525.7662-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045525.7662-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; DM5PR2101MB1032; 7:S6Zk066UBoxq5aQ/HqGqAP99BsCWuDc44SVaz4F5xPpAHsXNwqnO8Gk3hGow8U8DDA0r+JKROTOU7IBkj4VgEYyYk/38Qkk5HwdE5C/cSXcSrk5vDwTHMrtsUyUKJnHUjcza5dP6CvIny9HLJ8XnXiCGJCwbLffQuPpkGOodPo1jkXzpAOX1KR+SzwbMK7ncaTJPl/zSY4RQ18SixwcUY7S2tHPOV34FiA770iAJN0YDnKxxHYkPgXRY5sQLTV1+; 20:ihB0P04HExDiRBtdFWOm8Igg93y/aZDV5lED33wU8362CXyLR2A5PiQg0yA3kv9P43Excm6J63MBA6BEmwsKArJeRS9c38P1AFDdgBf5YOSFyvBCNd2tTEW21naWMHytOwUGhu4g0F509kXYL79QFqHbrPJzUFzdG61Cv/xvOgk= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: bf22de95-8d8c-4d6e-2a63-08d584b10f3d x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB1032; x-ms-traffictypediagnostic: DM5PR2101MB1032: 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)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB1032; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1032; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(376002)(39860400002)(39380400002)(366004)(396003)(199004)(189003)(97736004)(36756003)(8936002)(105586002)(2950100002)(2501003)(6666003)(186003)(8676002)(5250100002)(86362001)(2900100001)(3846002)(5660300001)(6116002)(10090500001)(2906002)(7736002)(22452003)(81156014)(26005)(6506007)(1076002)(102836004)(575784001)(81166006)(305945005)(3280700002)(72206003)(110136005)(86612001)(54906003)(99286004)(10290500003)(316002)(107886003)(4326008)(25786009)(68736007)(6486002)(6436002)(6512007)(53936002)(76176011)(66066001)(3660700001)(478600001)(14454004)(106356001)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1032; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: mYyH37HsU38UNZZwyUSVl9y1ULZkOpybQiGYt/99rScrSMEOyPBVEvSpq1ZSbqWexv/Jt+MkjfCSle3x+AblIKqOzqPk3+P1WdHgMfju1qWvDvlG3NYiNRrgZI+0KG6LX0auiSR/AlOGJg/ixLPn3u6tmRqFBu5SYRaG3qRCJw3EYUP0YIzhVq+ZqxuS32e82z4Sgqdd9M6OECTmWyA3Vgp+MYMU1egr8rQo2zqLymFMQlIEFIT10enThS5Hsg30PChWQzzKNwvFY+YNuIbJAM/EHD407U+74WIQxpOHMJtv9XkWH3hzFhTIlf/AnvvkW5ySMOJ+hGOta56kVHNZgQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf22de95-8d8c-4d6e-2a63-08d584b10f3d X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 04:56:24.7622 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1032 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=1' - 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(-) -- 2.14.1 diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-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, phys_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 = epc_get_drvdata(epc); struct dw_pcie *pci = to_dw_pcie_from_ep(ep); - val = dw_pcie_readb_dbi(pci, MSI_MESSAGE_CONTROL); - val = (val & MSI_CAP_MME_MASK) >> MSI_CAP_MME_SHIFT; - - lower_addr = dw_pcie_readl_dbi(pci, MSI_MESSAGE_ADDR_L32); - upper_addr = dw_pcie_readl_dbi(pci, MSI_MESSAGE_ADDR_U32); - - if (!(lower_addr || upper_addr)) + val = dw_pcie_readw_dbi(pci, MSI_MESSAGE_CONTROL); + if (!(val & MSI_CAP_MSI_EN_MASK)) return -EINVAL; + val = (val & MSI_CAP_MME_MASK) >> MSI_CAP_MME_SHIFT; return val; } diff --git a/drivers/pci/dwc/pcie-designware.h b/drivers/pci/dwc/pcie-designware.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