Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5253948imu; Tue, 15 Jan 2019 14:09:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN486gI9aCo2i6q0LXS/0qeuv4Xb1PPAeNnxCKflOnNbhwA7wAtp3VqXM4AGaQ+sA6LhgufJ X-Received: by 2002:a63:cf48:: with SMTP id b8mr5874877pgj.17.1547590167589; Tue, 15 Jan 2019 14:09:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547590167; cv=none; d=google.com; s=arc-20160816; b=u/fWjut533HZhMFPJN3RZKTaihnLhw/cyxPFcq7RnVYnFXULqRIpISiGEvPUKlEMXR mxQICdedqBB1NGokTwYoKaCOBhhSzc/UxpNd4R710P/Lz8DBxcOVe9zFxGNClTVSBhzw No3slRLC3ntbR2vx5TOue6WtknOjfGUxAw2+xuogU0+vLsGb+T/eSX3LWW3qYCWLFRDc Fq7iHAje5IW6m6V9y9ZJtRRqVHOLc93VekJUAievfK4+ZZdKBr2IfCAvN0kbl3pVBrJQ t7jr7ex5br7qn+3pNI9v2HOGQNWN+Jj72ZqrcwpN7ndgQpD5GCMuHTLR8UsFjuhZjSTd Ummw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/0WE+BLIa7ZGVRB89rUjwXq5B2YsKGt1vT/P2cwIJlQ=; b=C5cpAMUhII0/9kZDaUiZKlH3xzHjMdX3VxHuCz+Ewg28235iZRnaDSc29Egw8bu2m5 u9GOqjsMm9BT3pre61P5QeN1yri3Q7FhF9mELB9Of3+pe5pB+3pBRO7mNaccoSfXExeG i8f+aEG59bZkJu24mrx8qR5gJGTcT9u9bk/dcrLQy8XinrK6kBoKopQhPk4TdSxKeSzK VCBGdmSW3S6riNne4uP7KhlHJLjWKOun2Kbs8ZiIKlh1Itow2dxCw3xbjX8v7A/kkpka YA5LdOifzA/8Z0ps3r3VaKtrS/+L+u9pti78i4Orrgf1HLNW7k/+IRFBwJF86uwN9nC1 s+3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="k3IK/Gxy"; 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 90si1478004plb.17.2019.01.15.14.09.08; Tue, 15 Jan 2019 14:09:27 -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=@kernel.org header.s=default header.b="k3IK/Gxy"; 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 S2387926AbfAOQqL (ORCPT + 99 others); Tue, 15 Jan 2019 11:46:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:35794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731025AbfAOQqI (ORCPT ); Tue, 15 Jan 2019 11:46:08 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 080502054F; Tue, 15 Jan 2019 16:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570767; bh=QJU7qkOY7YOaXBfBA0TnkLgnCAwVuYMp/GjkTAE8xyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k3IK/GxyyCGwhaCoREaR2bo+ekRG0qBV1NOOdeWPU3lXgsXvxgSnXvHPIBGFZi8Gh vzWhoaGm+c7VzdwRdl2EFE2hTx08WQ0/0PUtcunmDCO+1+DSXL1AiJx3hwFy0SozGK 52kY6+nFXyaQGPrA6EL0oVffIrkJeZBsjXz41Q1E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Gustavo Pimentel , Stanimir Varbanov , Marc Zyngier , Lorenzo Pieralisi Subject: [PATCH 4.20 38/57] PCI: dwc: Use interrupt masking instead of disabling Date: Tue, 15 Jan 2019 17:36:19 +0100 Message-Id: <20190115154912.966712767@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154910.734892368@linuxfoundation.org> References: <20190115154910.734892368@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Zyngier commit 830920e065e90db318a0da98bf13a02b641eae7f upstream. The dwc driver is showing an interesting level of brokeness, as it insists on using the enable/disable set of registers to mask/unmask MSIs, meaning that an MSIs being generated while the interrupt is in that "disabled" state will simply be lost. Let's move to the mask/unmask set of registers, which offers the expected semantics. Fixes: 7c5925afbc58 ("PCI: dwc: Move MSI IRQs allocation to IRQ domains hierarchical API") Link: https://lore.kernel.org/linux-pci/20181113225734.8026-1-marc.zyngier@arm.com/ Tested-by: Niklas Cassel Tested-by: Gustavo Pimentel Tested-by: Stanimir Varbanov Signed-off-by: Marc Zyngier [lorenzo.pieralisi@arm.com: updated commit log] Signed-off-by: Lorenzo Pieralisi Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/pci/controller/dwc/pcie-designware-host.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -168,8 +168,8 @@ static void dw_pci_bottom_mask(struct ir bit = data->hwirq % MAX_MSI_IRQS_PER_CTRL; pp->irq_status[ctrl] &= ~(1 << bit); - dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, - pp->irq_status[ctrl]); + dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + res, 4, + ~pp->irq_status[ctrl]); } raw_spin_unlock_irqrestore(&pp->lock, flags); @@ -191,8 +191,8 @@ static void dw_pci_bottom_unmask(struct bit = data->hwirq % MAX_MSI_IRQS_PER_CTRL; pp->irq_status[ctrl] |= 1 << bit; - dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, - pp->irq_status[ctrl]); + dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + res, 4, + ~pp->irq_status[ctrl]); } raw_spin_unlock_irqrestore(&pp->lock, flags); @@ -658,10 +658,15 @@ void dw_pcie_setup_rc(struct pcie_port * num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; /* Initialize IRQ Status array */ - for (ctrl = 0; ctrl < num_ctrls; ctrl++) - dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + + for (ctrl = 0; ctrl < num_ctrls; ctrl++) { + dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + (ctrl * MSI_REG_CTRL_BLOCK_SIZE), - 4, &pp->irq_status[ctrl]); + 4, ~0); + dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + + (ctrl * MSI_REG_CTRL_BLOCK_SIZE), + 4, ~0); + pp->irq_status[ctrl] = 0; + } /* Setup RC BARs */ dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, 0x00000004);