public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Axel Forsman <axfo@kvaser.com>,
	Jimmy Assarsson <extja@kvaser.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 6.14 01/73] can: kvaser_pciefd: Force IRQ edge in case of nested IRQ
Date: Mon,  2 Jun 2025 15:46:47 +0200	[thread overview]
Message-ID: <20250602134241.733750260@linuxfoundation.org> (raw)
In-Reply-To: <20250602134241.673490006@linuxfoundation.org>

6.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Axel Forsman <axfo@kvaser.com>

commit 9176bd205ee0b2cd35073a9973c2a0936bcb579e upstream.

Avoid the driver missing IRQs by temporarily masking IRQs in the ISR
to enforce an edge even if a different IRQ is signalled before handled
IRQs are cleared.

Fixes: 48f827d4f48f ("can: kvaser_pciefd: Move reset of DMA RX buffers to the end of the ISR")
Cc: stable@vger.kernel.org
Signed-off-by: Axel Forsman <axfo@kvaser.com>
Tested-by: Jimmy Assarsson <extja@kvaser.com>
Reviewed-by: Jimmy Assarsson <extja@kvaser.com>
Link: https://patch.msgid.link/20250520114332.8961-2-axfo@kvaser.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

---
 drivers/net/can/kvaser_pciefd.c |   81 ++++++++++++++++++----------------------
 1 file changed, 38 insertions(+), 43 deletions(-)

--- a/drivers/net/can/kvaser_pciefd.c
+++ b/drivers/net/can/kvaser_pciefd.c
@@ -1673,24 +1673,28 @@ static int kvaser_pciefd_read_buffer(str
 	return res;
 }
 
-static u32 kvaser_pciefd_receive_irq(struct kvaser_pciefd *pcie)
+static void kvaser_pciefd_receive_irq(struct kvaser_pciefd *pcie)
 {
+	void __iomem *srb_cmd_reg = KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CMD_REG;
 	u32 irq = ioread32(KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_IRQ_REG);
 
-	if (irq & KVASER_PCIEFD_SRB_IRQ_DPD0)
+	iowrite32(irq, KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_IRQ_REG);
+
+	if (irq & KVASER_PCIEFD_SRB_IRQ_DPD0) {
 		kvaser_pciefd_read_buffer(pcie, 0);
+		iowrite32(KVASER_PCIEFD_SRB_CMD_RDB0, srb_cmd_reg); /* Rearm buffer */
+	}
 
-	if (irq & KVASER_PCIEFD_SRB_IRQ_DPD1)
+	if (irq & KVASER_PCIEFD_SRB_IRQ_DPD1) {
 		kvaser_pciefd_read_buffer(pcie, 1);
+		iowrite32(KVASER_PCIEFD_SRB_CMD_RDB1, srb_cmd_reg); /* Rearm buffer */
+	}
 
 	if (unlikely(irq & KVASER_PCIEFD_SRB_IRQ_DOF0 ||
 		     irq & KVASER_PCIEFD_SRB_IRQ_DOF1 ||
 		     irq & KVASER_PCIEFD_SRB_IRQ_DUF0 ||
 		     irq & KVASER_PCIEFD_SRB_IRQ_DUF1))
 		dev_err(&pcie->pci->dev, "DMA IRQ error 0x%08X\n", irq);
-
-	iowrite32(irq, KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_IRQ_REG);
-	return irq;
 }
 
 static void kvaser_pciefd_transmit_irq(struct kvaser_pciefd_can *can)
@@ -1718,29 +1722,22 @@ static irqreturn_t kvaser_pciefd_irq_han
 	struct kvaser_pciefd *pcie = (struct kvaser_pciefd *)dev;
 	const struct kvaser_pciefd_irq_mask *irq_mask = pcie->driver_data->irq_mask;
 	u32 pci_irq = ioread32(KVASER_PCIEFD_PCI_IRQ_ADDR(pcie));
-	u32 srb_irq = 0;
-	u32 srb_release = 0;
 	int i;
 
 	if (!(pci_irq & irq_mask->all))
 		return IRQ_NONE;
 
+	iowrite32(0, KVASER_PCIEFD_PCI_IEN_ADDR(pcie));
+
 	if (pci_irq & irq_mask->kcan_rx0)
-		srb_irq = kvaser_pciefd_receive_irq(pcie);
+		kvaser_pciefd_receive_irq(pcie);
 
 	for (i = 0; i < pcie->nr_channels; i++) {
 		if (pci_irq & irq_mask->kcan_tx[i])
 			kvaser_pciefd_transmit_irq(pcie->can[i]);
 	}
 
-	if (srb_irq & KVASER_PCIEFD_SRB_IRQ_DPD0)
-		srb_release |= KVASER_PCIEFD_SRB_CMD_RDB0;
-
-	if (srb_irq & KVASER_PCIEFD_SRB_IRQ_DPD1)
-		srb_release |= KVASER_PCIEFD_SRB_CMD_RDB1;
-
-	if (srb_release)
-		iowrite32(srb_release, KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CMD_REG);
+	iowrite32(irq_mask->all, KVASER_PCIEFD_PCI_IEN_ADDR(pcie));
 
 	return IRQ_HANDLED;
 }
@@ -1760,13 +1757,22 @@ static void kvaser_pciefd_teardown_can_c
 	}
 }
 
+static void kvaser_pciefd_disable_irq_srcs(struct kvaser_pciefd *pcie)
+{
+	unsigned int i;
+
+	/* Masking PCI_IRQ is insufficient as running ISR will unmask it */
+	iowrite32(0, KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_IEN_REG);
+	for (i = 0; i < pcie->nr_channels; ++i)
+		iowrite32(0, pcie->can[i]->reg_base + KVASER_PCIEFD_KCAN_IEN_REG);
+}
+
 static int kvaser_pciefd_probe(struct pci_dev *pdev,
 			       const struct pci_device_id *id)
 {
 	int ret;
 	struct kvaser_pciefd *pcie;
 	const struct kvaser_pciefd_irq_mask *irq_mask;
-	void __iomem *irq_en_base;
 
 	pcie = devm_kzalloc(&pdev->dev, sizeof(*pcie), GFP_KERNEL);
 	if (!pcie)
@@ -1832,8 +1838,7 @@ static int kvaser_pciefd_probe(struct pc
 		  KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_IEN_REG);
 
 	/* Enable PCI interrupts */
-	irq_en_base = KVASER_PCIEFD_PCI_IEN_ADDR(pcie);
-	iowrite32(irq_mask->all, irq_en_base);
+	iowrite32(irq_mask->all, KVASER_PCIEFD_PCI_IEN_ADDR(pcie));
 	/* Ready the DMA buffers */
 	iowrite32(KVASER_PCIEFD_SRB_CMD_RDB0,
 		  KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CMD_REG);
@@ -1847,8 +1852,7 @@ static int kvaser_pciefd_probe(struct pc
 	return 0;
 
 err_free_irq:
-	/* Disable PCI interrupts */
-	iowrite32(0, irq_en_base);
+	kvaser_pciefd_disable_irq_srcs(pcie);
 	free_irq(pcie->pci->irq, pcie);
 
 err_pci_free_irq_vectors:
@@ -1871,35 +1875,26 @@ err_disable_pci:
 	return ret;
 }
 
-static void kvaser_pciefd_remove_all_ctrls(struct kvaser_pciefd *pcie)
-{
-	int i;
-
-	for (i = 0; i < pcie->nr_channels; i++) {
-		struct kvaser_pciefd_can *can = pcie->can[i];
-
-		if (can) {
-			iowrite32(0, can->reg_base + KVASER_PCIEFD_KCAN_IEN_REG);
-			unregister_candev(can->can.dev);
-			del_timer(&can->bec_poll_timer);
-			kvaser_pciefd_pwm_stop(can);
-			free_candev(can->can.dev);
-		}
-	}
-}
-
 static void kvaser_pciefd_remove(struct pci_dev *pdev)
 {
 	struct kvaser_pciefd *pcie = pci_get_drvdata(pdev);
+	unsigned int i;
 
-	kvaser_pciefd_remove_all_ctrls(pcie);
+	for (i = 0; i < pcie->nr_channels; ++i) {
+		struct kvaser_pciefd_can *can = pcie->can[i];
 
-	/* Disable interrupts */
-	iowrite32(0, KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CTRL_REG);
-	iowrite32(0, KVASER_PCIEFD_PCI_IEN_ADDR(pcie));
+		unregister_candev(can->can.dev);
+		del_timer(&can->bec_poll_timer);
+		kvaser_pciefd_pwm_stop(can);
+	}
 
+	kvaser_pciefd_disable_irq_srcs(pcie);
 	free_irq(pcie->pci->irq, pcie);
 	pci_free_irq_vectors(pcie->pci);
+
+	for (i = 0; i < pcie->nr_channels; ++i)
+		free_candev(pcie->can[i]->can.dev);
+
 	pci_iounmap(pdev, pcie->reg_base);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);



  reply	other threads:[~2025-06-02 13:56 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-02 13:46 [PATCH 6.14 00/73] 6.14.10-rc1 review Greg Kroah-Hartman
2025-06-02 13:46 ` Greg Kroah-Hartman [this message]
2025-06-02 13:46 ` [PATCH 6.14 02/73] arm64: dts: socfpga: agilex5: fix gpio0 address Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 03/73] arm64: dts: rockchip: fix internal USB hub instability on RK3399 Puma Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 04/73] arm64: dts: qcom: ipq9574: Add missing properties for cryptobam Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 05/73] arm64: dts: qcom: sa8775p: " Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 06/73] arm64: dts: qcom: sa8775p: Remove extra entries from the iommus property Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 07/73] arm64: dts: qcom: sa8775p: Remove cdsp compute-cb@10 Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 08/73] arm64: dts: qcom: sm8350: Fix typo in pil_camera_mem node Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 09/73] arm64: dts: qcom: sm8450: Add missing properties for cryptobam Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 10/73] arm64: dts: qcom: sm8550: " Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 11/73] arm64: dts: qcom: sm8650: " Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 12/73] arm64: dts: qcom: x1e001de-devkit: Fix vreg_l2j_1p2 voltage Greg Kroah-Hartman
2025-06-02 13:46 ` [PATCH 6.14 13/73] arm64: dts: qcom: x1e001de-devkit: mark l12b and l15b always-on Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 14/73] arm64: dts: qcom: x1e80100-asus-vivobook-s15: Fix vreg_l2j_1p2 voltage Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 15/73] arm64: dts: qcom: x1e80100-dell-xps13-9345: mark l12b and l15b always-on Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 16/73] arm64: dts: qcom: x1e80100-hp-omnibook-x14: Enable SMB2360 0 and 1 Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 17/73] arm64: dts: qcom: x1e80100-hp-omnibook-x14: Fix vreg_l2j_1p2 voltage Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 18/73] arm64: dts: qcom: x1e80100-hp-x14: mark l12b and l15b always-on Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 19/73] arm64: dts: qcom: x1e80100-lenovo-yoga-slim7x: Fix vreg_l2j_1p2 voltage Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 20/73] arm64: dts: qcom: x1e80100-qcp: " Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 21/73] arm64: dts: qcom: x1e80100-qcp: mark l12b and l15b always-on Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 22/73] arm64: dts: qcom: x1e80100-yoga-slim7x: " Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 23/73] arm64: dts: qcom: x1e80100: Fix video thermal zone Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 24/73] arm64: dts: qcom: x1e80100: Apply consistent critical thermal shutdown Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 25/73] arm64: dts: qcom: x1e80100: Add GPU cooling Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 26/73] arm64: dts: qcom: x1e80100: Fix PCIe 3rd controller DBI size Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 27/73] arm64: dts: ti: k3-am62-main: Set eMMC clock parent to default Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 28/73] arm64: dts: ti: k3-am62a-main: " Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 29/73] arm64: dts: ti: k3-am62p-j722s-common-main: " Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 30/73] arm64: dts: ti: k3-am62x: Remove clock-names property from IMX219 overlay Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 31/73] arm64: dts: ti: k3-am62x: Rename I2C switch to I2C mux in " Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 32/73] arm64: dts: ti: k3-am62x: Rename I2C switch to I2C mux in OV5640 overlay Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 33/73] arm64: dts: ti: k3-am65-main: Add missing taps to sdhci0 Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 34/73] arm64: dts: ti: k3-am68-sk: Fix regulator hierarchy Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 35/73] arm64: dts: ti: k3-j721e-sk: Add DT nodes for power regulators Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 36/73] arm64: dts: ti: k3-j721e-sk: Remove clock-names property from IMX219 overlay Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 37/73] arm64: dts: ti: k3-j721e-sk: Add requiried voltage supplies for IMX219 Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 38/73] arm64: dts: ti: k3-j722s-evm: Enable "serdes_wiz0" and "serdes_wiz1" Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 39/73] arm64: dts: ti: k3-j722s-main: Disable " Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 40/73] arm64: dts: ti: k3-j784s4-j742s2-main-common: Fix length of serdes_ln_ctrl Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 41/73] net_sched: hfsc: Address reentrant enqueue adding class to eltree twice Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 42/73] perf/arm-cmn: Fix REQ2/SNP2 mixup Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 43/73] perf/arm-cmn: Initialise cmn->cpu earlier Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 44/73] perf/arm-cmn: Add CMN S3 ACPI binding Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 45/73] iommu: Handle yet another race around registration Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 46/73] coredump: fix error handling for replace_fd() Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 47/73] coredump: hand a pidfd to the usermode coredump helper Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 48/73] dmaengine: idxd: cdev: Fix uninitialized use of sva in idxd_cdev_open Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 49/73] HID: amd_sfh: Avoid clearing reports for SRA sensor Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 50/73] HID: quirks: Add ADATA XPG alpha wireless mouse support Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 51/73] nfs: dont share pNFS DS connections between net namespaces Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 52/73] platform/x86: thinkpad_acpi: Support also NEC Lavie X1475JAS Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 53/73] kbuild: Require pahole <v1.28 or >v1.29 with GENDWARFKSYMS on X86 Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 54/73] um: let make clean properly clean underlying SUBARCH as well Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 55/73] nvmet: pci-epf: cleanup nvmet_pci_epf_raise_irq() Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 56/73] gpio: virtuser: fix potential out-of-bound write Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 57/73] drm/amd/display: fix link_set_dpms_off multi-display MST corner case Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 58/73] drm/amd/display: check stream id dml21 wrapper to get plane_id Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 59/73] nvme: multipath: enable BLK_FEAT_ATOMIC_WRITES for multipathing Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 60/73] phy: starfive: jh7110-usb: Fix USB 2.0 host occasional detection failure Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 61/73] phy: phy-rockchip-samsung-hdptx: Fix PHY PLL output 50.25MHz error Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 62/73] spi: spi-sun4i: fix early activation Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 63/73] nvme: all namespaces in a subsystem must adhere to a common atomic write size Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 64/73] nvme-pci: add NVME_QUIRK_NO_DEEPEST_PS quirk for SOLIDIGM P44 Pro Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 65/73] drm/xe/xe2hpg: Add Wa_22021007897 Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 66/73] drm/xe: Save the gt pointer in lrc and drop the tile Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 67/73] char: tpm: tpm-buf: Add sanity check fallback in read helpers Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 68/73] NFS: Avoid flushing data while holding directory locks in nfs_rename() Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 69/73] platform/x86: fujitsu-laptop: Support Lifebook S2110 hotkeys Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 70/73] ALSA: hda/realtek - restore auto-mute mode for Dell Chrome platform Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 71/73] platform/x86: thinkpad_acpi: Ignore battery threshold change event notification Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 72/73] net: ethernet: ti: am65-cpsw: Lower random mac address error print to info Greg Kroah-Hartman
2025-06-02 13:47 ` [PATCH 6.14 73/73] ksmbd: use list_first_entry_or_null for opinfo_get_list() Greg Kroah-Hartman
2025-06-02 17:52 ` [PATCH 6.14 00/73] 6.14.10-rc1 review Florian Fainelli
2025-06-02 18:46 ` Peter Schneider
2025-06-02 20:11 ` Ronald Warsow
2025-06-03  7:29 ` Ron Economos
2025-06-03  9:19 ` Mark Brown
2025-06-03 12:30 ` Naresh Kamboju
2025-06-03 17:10 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250602134241.733750260@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=axfo@kvaser.com \
    --cc=extja@kvaser.com \
    --cc=mkl@pengutronix.de \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox