From patchwork Fri Mar 22 16:17:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160942 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp993880jan; Fri, 22 Mar 2019 09:18:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwaNtIQW/6J+HdP4NrUCHKsG98lcLxYPCQJeWHof2KTF9HgmJaAbwKwmIGafWi30SQpkmV X-Received: by 2002:a63:464c:: with SMTP id v12mr9592750pgk.431.1553271495378; Fri, 22 Mar 2019 09:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271495; cv=none; d=google.com; s=arc-20160816; b=Z1zUYGxeODRXfd+h81BzhjdGPrIh2ozOT6OGu+n8siL3C24ydwJcNFBn7X89K9Vm2k l7KhXuLweVxlUbv/xI2WNCHKP8nnVWeQrsSSO/8JYs193Hp486MgpaUwOvQxBoksxfmW huGF9GCKlWb2SFfOs11SxoABBpLMx8xO28bqL32vXjFujzNR5I7THc0fcmqJ14+9e4Ff JEC2t06bwgQArSVqLz/vWXPFO55G4QQw5Tjy3ZpWmz5jnIgpnIBOnA1heO8FYmPj9ziZ tANzoPVucISlFUJL2kEOXKDX4QnCL6MHRje9o4B3Hqt2dmlvxFcXkx+Otcms0SZmedR1 JN7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SK27rDf0D+tVQacfF6w8xnAFeC2VOTLExAzHHvbn9ZQ=; b=IA4kl5RieaQf/Xn8rclDL7E1sF2dtxGqxNRp0uUHP1wja/SPhD4+LL3o/hHNoXd7qj YrFWPSWdUfL08swbCTZ7YsmqSTktBUeUdYl4be4DxDg8xccrEauZgk4X9Xo/prGL3P1m 93dxec4ng6RCGryM+cYYmxcdCTWITJ+vx6UIsZqlH9Q5x/R/gV0rKLgYPopAIyilfh2m Qir/q7mfFapH21M+psMqAPoAaadNfxGLUIBnrVyPMlODx9KNG8eOkegpfQFvi4az/Pi/ a8WdamSns5izgf/mjU1RKGq+L5qZOOWFilkp/27w/y5n9jUtH5J4AJUe53iE1QBBywpa mpqw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si4230278plb.199.2019.03.22.09.18.15; Fri, 22 Mar 2019 09:18:15 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729470AbfCVQSN (ORCPT + 31 others); Fri, 22 Mar 2019 12:18:13 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:59561 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727898AbfCVQSM (ORCPT ); Fri, 22 Mar 2019 12:18:12 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1N5mSj-1gwtJa2zff-017GR7; Fri, 22 Mar 2019 17:17:53 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Jingoo Han , Joao Pinto , Lorenzo Pieralisi , Bjorn Helgaas Cc: Niklas Cassel , Gustavo Pimentel , Joao Pinto , Arnd Bergmann , Greg Kroah-Hartman , Kishon Vijay Abraham I , Sasha Levin , Jisheng Zhang , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.14.y 2/8] PCI: designware-ep: dw_pcie_ep_set_msi() should only set MMC bits Date: Fri, 22 Mar 2019 17:17:17 +0100 Message-Id: <20190322161727.1153278-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322161727.1153278-1-arnd@arndb.de> References: <20190322161727.1153278-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Uo8SCd+/FXufp8zP23YIUZ9XHIAhfqzREoeT+kXGkT8DrQcIvtO ISLMiq4LYOZCjxilA5CckNAfOAqFDM+LAjWLcxmlmgVxM4p5Bgr6VgHEQIuJGeRFS2s/GYC ilIhAbagAtbWHr8HrO/vV7yevV+US9cos7fN8GQFx4BXmKoWrebgZilbJPg+jAo5alncl90 z1hU1IY884EbOkFU6yBvg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:JgGkVkB65co=:ZK0Oq82pszuJbkxPzXZ9Yj 73QDqJompKb4wnxLc5id8fEuPESPHDKbHZD+sh2o9651pNR5mtS+elVnpUUQH1VfuTvwRE74a jltal0bsxPt8UciDilVITIrcljRKJJk+Gnq9AHk3xZ2YArlfEv/Aop60qz8DIl1ssD/nfbQjS ttClDHA1MxHmYMG60Tld6z3lC3PFxzRBnUuCDWnfguvkJl/fTOahNCwolB6HAMaZRESHHNECE E1RKlc0Hl2miLYvVfK4vOajLAuoiO8yZhurMBKBfXBgWT8FtTW1mT/niodvRkm/QrS5q7o3Cg 2cXEsm/LswE04L+gCAtyFepmsIVsEfloAT4xYv57+8CQxycUmmo4tUHEn+XeUSwvHso44d5o6 lpIb4+OpuEVkcwmeFb9EF91RlNjRhzBl8kfzEOMryFUCwflw7lUA0rCsTt1C6XE/gcTOgPHHM wJm+y262gz8OXYGAQ38EJWrEajVIhzXImAbUXgu4uEHrReRU4w6JV2xl1S0TzFwVv85bUJqXj DsYz0gF2/2VaGoKWkbrGjG7264IzWnugr2FP422/sn4l2++MjDsJ6925vL6PWKYkwqUAe+VD8 unr1v9Mri/9wzc5o35Gh7og3uKEMnU8Rz+Bdjy7RJ6iQYjScHYug1DY+n8uCkdnvIdpiDjF6i lK13EFS/7jhs/GOfb7r8VZK+APxrrPFU9vzUlWYPYX9T4rqLkQrp1VwmJYWVT8YXuzZUhWru8 hI8Gv+CORdm2j3FXOkJPtSfJRGnVY7UoBS3xbg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Niklas Cassel Previously, dw_pcie_ep_set_msi() wrote all bits in the Message Control register, thus overwriting the PCI_MSI_FLAGS_64BIT bit. By clearing the PCI_MSI_FLAGS_64BIT bit, we break MSI on systems where the RC has set a 64 bit MSI address. Fix dw_pcie_ep_set_msi() so that it only sets MMC bits. Tested-by: Gustavo Pimentel Signed-off-by: Niklas Cassel Signed-off-by: Lorenzo Pieralisi Acked-by: Joao Pinto (cherry picked from commit 099a95f3591ade29da52131895a3ba9f92a0e82c) Signed-off-by: Arnd Bergmann --- drivers/pci/dwc/pcie-designware-ep.c | 4 +++- drivers/pci/dwc/pcie-designware.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) -- 2.20.0 diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c index 7c621877a939..df317d390317 100644 --- a/drivers/pci/dwc/pcie-designware-ep.c +++ b/drivers/pci/dwc/pcie-designware-ep.c @@ -214,7 +214,9 @@ static int dw_pcie_ep_set_msi(struct pci_epc *epc, u8 encode_int) struct dw_pcie_ep *ep = epc_get_drvdata(epc); struct dw_pcie *pci = to_dw_pcie_from_ep(ep); - val = (encode_int << MSI_CAP_MMC_SHIFT); + val = dw_pcie_readw_dbi(pci, MSI_MESSAGE_CONTROL); + val &= ~MSI_CAP_MMC_MASK; + val |= (encode_int << MSI_CAP_MMC_SHIFT) & MSI_CAP_MMC_MASK; dw_pcie_writew_dbi(pci, MSI_MESSAGE_CONTROL, val); return 0; diff --git a/drivers/pci/dwc/pcie-designware.h b/drivers/pci/dwc/pcie-designware.h index 3551dd607b90..5af29d125c7e 100644 --- a/drivers/pci/dwc/pcie-designware.h +++ b/drivers/pci/dwc/pcie-designware.h @@ -99,6 +99,7 @@ #define MSI_MESSAGE_CONTROL 0x52 #define MSI_CAP_MMC_SHIFT 1 +#define MSI_CAP_MMC_MASK (7 << MSI_CAP_MMC_SHIFT) #define MSI_CAP_MME_SHIFT 4 #define MSI_CAP_MSI_EN_MASK 0x1 #define MSI_CAP_MME_MASK (7 << MSI_CAP_MME_SHIFT)