From patchwork Mon Jan 21 14:27:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 156202 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6441208jaa; Mon, 21 Jan 2019 06:28:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN5h/DHpU8tKsfggsWCUcfgjAiG5rsa8UZVbteMCudTIXZ2RHxHc0tVGnvsE8PiwNCUCXRHy X-Received: by 2002:a17:902:29a7:: with SMTP id h36mr30666944plb.244.1548080904541; Mon, 21 Jan 2019 06:28:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548080904; cv=none; d=google.com; s=arc-20160816; b=Js4g8zfUvLHiBONmsQ+DN26IjLLW9hJYFeWjTMcM1d97RwkMkAnMITjTZ68k+iTvvU Ci7zTD81cHz/ZnD3Y62BaKDeiwSod8tBCAelBKnu+pp8FrcatTRaBu1saZG+/GkWTgU4 jXjI3ZuHAy1TmVsm+0qvatNr6UTtlPwDX7HA1DyGK5g+PW8WHtsFKLCqguxWKR3mGGn2 w4s0uHZ2rizD2hRmMt/JXLO0Wvlx6evkrJ+72Trp7T5+ZcLWhT5iZhoykrTqbNlpEHBB VGrl1F+yO96SHkuGVi2LbjNUGuSIlOamWraRnFUc4RZHxvOqllCg2wWQfuTAN25Lg3W3 wZzw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=nhu5qeWrx7WrTmCbpLzHXIWrfXvW3N8fEcAL4dGzFlw=; b=J07y8CdNEB7iB6Vw3HYEkMo9+Z7cUXEkZh6RGays+fmhvqVGdcVKaQSWgNByBItUPm O+8skAHC97YTnNTYDYwDoqB9Kcn6IaLE5h/+GvPkcocx1dTTuTPO6VAXUhcfkRvfm6QX 9R+0owT/9NEk6uqI7E/n0T9FjR+3hTIQEFJTLy4YA/2REAon7FGp9HfFLqCC2ZjwGb67 sStPulOZ+cVb5QQ5e+JWc5Z8RWcsWU74IrhEoAdGR+r83M8iKz+G7Pb13LtyaN8UxcO5 CJ3ytdtv8kwY8/+EbtzYFrZ3/iUSvqbjRkAFE0fmXstz+o81QMNuNlz0WOnEGTmvI904 5Ubw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UcjLdSxt; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a68si13291973pla.267.2019.01.21.06.28.24; Mon, 21 Jan 2019 06:28:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=UcjLdSxt; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728982AbfAUO2X (ORCPT + 15 others); Mon, 21 Jan 2019 09:28:23 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:38951 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728801AbfAUO2X (ORCPT ); Mon, 21 Jan 2019 09:28:23 -0500 Received: by mail-lf1-f65.google.com with SMTP id n18so15634557lfh.6 for ; Mon, 21 Jan 2019 06:28:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nhu5qeWrx7WrTmCbpLzHXIWrfXvW3N8fEcAL4dGzFlw=; b=UcjLdSxt89sOSwr+ro6zsT01GFcIVoUObk29HbJxx8e4TtViq69i6jRCopZxEX3LsC 0IjsHd4AF/acD+8an4w8xbpAuVQ39/b+yv42Z8LPuRhXvglCG3IvsUqi114q+H22/GBU 4pI4tBJcptOstD5r/8nD9XSWtvOOrw2mARXfM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nhu5qeWrx7WrTmCbpLzHXIWrfXvW3N8fEcAL4dGzFlw=; b=hVPKv6do5nIYnqFX8+2n/VE5uQNGJVYfafQrHpg0l1lGzZLgYNGfxxMT+K3anjBSBj KDnRZwI/oROEWcOki04DaIwOd3ttMNVu3kpcg4EVWJKDMHx8hYgBIl4hrLKwKA8vvPQF FrL82NpUupsJgQoodZZZ/dblxrFqktGedBTqLUDzrK7yNKOMixtLjcVgmEVH//twzu8U icAkoGoBM7Dog8CveuYEwy+EF0W0hC9DWtWtwdSDWukSqYdAkH4HLuvnLwylCOem02YR NWqzREXjmdLRLPnee8qsUx3gTNBPoVYpQXVWPDxNASPt82F3EuThi4792s6gIv+NO0i9 kN2w== X-Gm-Message-State: AJcUukdQ5/Drb+k7nJbZLrFJ4n0ei3qiCE9+uVhp2iesiKsW4DALirqn tPAs7n46rBedUA5SihmgFCo7YrvSoMk= X-Received: by 2002:a19:4bc9:: with SMTP id y192mr17996410lfa.49.1548080900868; Mon, 21 Jan 2019 06:28:20 -0800 (PST) Received: from centauri.lan (h-229-118.A785.priv.bahnhof.se. [5.150.229.118]) by smtp.gmail.com with ESMTPSA id f20-v6sm2314214ljk.33.2019.01.21.06.28.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 06:28:20 -0800 (PST) From: Niklas Cassel To: stable@vger.kernel.org Cc: marc.zyngier@arm.com, gustavo.pimentel@synopsys.com, lorenzo.pieralisi@arm.com, svarbanov@mm-sol.com, tpiepho@impinj.com, Niklas Cassel Subject: [PATCH] PCI: dwc: Move interrupt acking into the proper callback Date: Mon, 21 Jan 2019 15:27:09 +0100 Message-Id: <20190121142709.22403-1-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier The write to the status register is really an ACK for the HW, and should be treated as such by the driver. Let's move it to the irq_ack() callback, which will prevent people from moving it around in order to paper over other bugs. Fixes: 8c934095fa2f ("PCI: dwc: Clear MSI interrupt status after it is handled, not before") 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/ Reported-by: Trent Piepho 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 --- Original upstream commit SHA1: 3f7bb2ec20ce07c02b2002349d256c91a463fcc5 Sending a backport (which is authored by Marc, just like the original commit), for 4.14-stable, since the original commit failed to apply there. Not sure if Tested-by tags should remain. Mine can be kept, since I've tested the backport. drivers/pci/dwc/pcie-designware-host.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/drivers/pci/dwc/pcie-designware-host.c b/drivers/pci/dwc/pcie-designware-host.c index bc3e2d8d0cce..58b38c54a7cf 100644 --- a/drivers/pci/dwc/pcie-designware-host.c +++ b/drivers/pci/dwc/pcie-designware-host.c @@ -45,8 +45,19 @@ static int dw_pcie_wr_own_conf(struct pcie_port *pp, int where, int size, return dw_pcie_write(pci->dbi_base + where, size, val); } +static void dwc_irq_ack(struct irq_data *d) +{ + struct msi_desc *msi = irq_data_get_msi_desc(d); + struct pcie_port *pp = msi_desc_to_pci_sysdata(msi); + int pos = d->hwirq % 32; + int i = d->hwirq / 32; + + dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_STATUS + i * 12, 4, BIT(pos)); +} + static struct irq_chip dw_msi_irq_chip = { .name = "PCI-MSI", + .irq_ack = dwc_irq_ack, .irq_enable = pci_msi_unmask_irq, .irq_disable = pci_msi_mask_irq, .irq_mask = pci_msi_mask_irq, @@ -72,8 +83,6 @@ irqreturn_t dw_handle_msi_irq(struct pcie_port *pp) pos)) != 32) { irq = irq_find_mapping(pp->irq_domain, i * 32 + pos); generic_handle_irq(irq); - dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_STATUS + i * 12, - 4, 1 << pos); pos++; } } @@ -263,7 +272,7 @@ static struct msi_controller dw_pcie_msi_chip = { static int dw_pcie_msi_map(struct irq_domain *domain, unsigned int irq, irq_hw_number_t hwirq) { - irq_set_chip_and_handler(irq, &dw_msi_irq_chip, handle_simple_irq); + irq_set_chip_and_handler(irq, &dw_msi_irq_chip, handle_edge_irq); irq_set_chip_data(irq, domain->host_data); return 0;