From patchwork Mon Jul 15 11:48:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13733357 X-Patchwork-Delegate: kw@linux.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CA3B143878 for ; Mon, 15 Jul 2024 11:49:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721044146; cv=none; b=DanbB/J0oj5wIPebrNP7Y8sTk+aWeRlXjlWTe3NibVXFl/NicH3sb2xlmR+fSW6s1v83XRfzKFperraZudH47nHcO+yujCh9Bje8SqL9xSrI2dNOG5HvG1LIWpZN5zVAHrGrKPuxFFSHlN3fID1GWArJkP0CvcNZfRmGCFqT/Dk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721044146; c=relaxed/simple; bh=GBWvRjJ6Uyft1k+kSz5hldpNuIiPrjwuJYXhdOBdovA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RrHFv41I2pFm2B/sWLzR+kvhsLU1GNcXgnH2ovzYRHr7Hv0mTfT/S3azOWvxVredrPaFzABXlLUBCSjKQ0U2OWZmOgHsC0mhupPJtxT6L1r2QcoUJT82G+rUp4mkBur1hVHv2Qy7kx94Y5XyDS2AGW78mKsd4+qQS3a8y7DT9fM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EhS6XZKX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EhS6XZKX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B0D2C4AF10; Mon, 15 Jul 2024 11:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721044145; bh=GBWvRjJ6Uyft1k+kSz5hldpNuIiPrjwuJYXhdOBdovA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EhS6XZKXwXzsjtqjy/rJaeb44sU681IzCcpp0DwpeVIAEGtX2j1axs8+3kGfSqN8C GEVA7dcOlqc/DzC8FL9g/VrntK6pP6S+6IjgZypPlgoRke6TOJQnFxfh6zLLlFpr0f hsnoUgXfT0mVw6e7biUQxB4ZJtxsii0LX0it9W9txkZtsUxHyXN4LryI35wcW30uv8 XxvWSgds8nxXfzwBgb/fPzh9Zjlm+AIaMhJAMPGEysPQ8A5HgMcxjBX0IdO4/T4HOY 0Q0lR2hCea/E7YVgCrm2eryS84RlnsUsxg9Fx/wLnlxHJu5hLdmh4lWJAZR3ly5hPs YvfAVtVJtRBOg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Thomas Gleixner , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas , Andrew Lunn , Gregory Clement Cc: Thomas Petazzoni , Rob Herring , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Manivannan Sadhasivam , =?utf-8?q?Marek_B?= =?utf-8?q?eh=C3=BAn?= Subject: [PATCH v3 2/2] PCI: mvebu: Dispose INTx IRQs before to removing INTx domain Date: Mon, 15 Jul 2024 13:48:54 +0200 Message-ID: <20240715114854.4792-3-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240715114854.4792-1-kabel@kernel.org> References: <20240715114854.4792-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Pali Rohár The documentation for the irq_domain_remove() function says that all mappings within the IRQ domain must be disposed before the domain is removed. Use the new helper function pci_remove_irq_domain() that also disposes all IRQ mappings of a IRQ domain before removing sait domain. Currently, the INTx IRQs are not disposed in pci-mvebu driver .remove() method, which causes the kernel to crash when unloading the driver and then reading /sys/kernel/debug/irq/irqs/ or /proc/interrupts. Unmapping of the IRQs at this point of the .remove() method is safe, since the PCIe bus is already unregistered, and all its devices are unbound from their drivers and removed. If there was indeed any remaining use of PCIe resources, then it would mean that PCIe hotplug code is broken, and we have bigger problems. Fixes: ec075262648f ("PCI: mvebu: Implement support for legacy INTx interrupts") Reported-by: Hajo Noerenberg Signed-off-by: Pali Rohár Reviewed-by: Marek Behún [ Marek: refactored a little, added more explanation to commit message ] Signed-off-by: Marek Behún Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/pci-mvebu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index 29fe09c99e7d..590f121bd91a 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -1684,7 +1684,7 @@ static void mvebu_pcie_remove(struct platform_device *pdev) /* Remove IRQ domains. */ if (port->intx_irq_domain) - irq_domain_remove(port->intx_irq_domain); + pci_remove_irq_domain(port->intx_irq_domain); /* Free config space for emulated root bridge. */ pci_bridge_emul_cleanup(&port->bridge);