From patchwork Mon Jul 11 12:06:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12913443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87213C43334 for ; Mon, 11 Jul 2022 12:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=TpWNQoFCKp0lJli31V8o3LRtOSZ+LyRX9VVF+mSH/YY=; b=abKbx2a4LzM1RJ ITbhm2bgIwqKvmiTkrtjUJkpxzCdSMiRVJ35eNIJRbeaEP8HMxzpFlaFpkUqQzri7w+6/RnZOmZU1 4D+6iw7c6fJBOZOwrmBkyOYC6kdnUy4OlAP/bnbXP1OdcQh5wjvsKO4I0Ic0WTgOtaR8GU3Jyk2bm RWKCJ422CCiGNeO9hhu7BH2WNdELyf9RoL/g5iZZgxVhRA2Q18ywnSL5Voo6MHYUct5xd+kUbLWY4 diHoyr5UHeIkWgAciHuZox83rHYgwQXZ3lraYj1PVIK+bNxrQur7QXWmfWPYWo3HMQxEy4Z7qmJaW C92yh1AxCCwuLf37NZ0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAsFV-001JL0-Fq; Mon, 11 Jul 2022 12:10:49 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAsFT-001JJD-4c for linux-arm-kernel@lists.infradead.org; Mon, 11 Jul 2022 12:10:48 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 94491611F2; Mon, 11 Jul 2022 12:10:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D09B6C34115; Mon, 11 Jul 2022 12:10:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657541444; bh=UhBDGGujuZLS3CJAhdKmbeMA357lNLuZ6bu22I/qh4A=; h=From:To:Cc:Subject:Date:From; b=glwCOyvV3axdfL+tWz2pua8rdElVCMNOlQzDZgTqkg6bkBUQflkGYTDBloo5+qn34 YAWULHW98zKKiF+4HtfR22GfgSW63DJSJwtRfOiWKEkf59aofgKHR/OPoXQ2SBYBNI lPzNRvJLM/njn7/ReVj17yBf6IAE2qBNEZGQCpy0z9uotk7wDlzWy4P2G5rZl+IEA1 wKv65EdTpqCL56+cSM8+plBiBmTLKo6xJEdlrJuVOtWzthZ5uoMGQqvaNMEkoRgPgs KlQph1Y+1tpHtU+wJiMz3B6ap7tNcHJZyJO022mFBvvkJA/wpGdQi4ELsnrDaqTIPL W8zflwMU86cyg== Received: by pali.im (Postfix) id 874E09D7; Mon, 11 Jul 2022 14:10:41 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , =?utf-8?q?Marek_Beh=C3=BAn?= Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] PCI: aardvark: Dispose INTx irqs prior to removing INTx domain Date: Mon, 11 Jul 2022 14:06:24 +0200 Message-Id: <20220711120626.11492-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220711_051047_262794_95BB8E66 X-CRM114-Status: GOOD ( 14.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Documentation for irq_domain_remove() says that all mapping within the domain must be disposed prior to domain remove. Currently INTx irqs are not disposed in pci-aardvark.c device unbind callback which cause that kernel crashes after unloading driver and trying to read /sys/kernel/debug/irq/irqs/ or /proc/interrupts. Fixes: 526a76991b7b ("PCI: aardvark: Implement driver 'remove' function and allow to build it as module") Signed-off-by: Pali Rohár --- drivers/pci/controller/pci-aardvark.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index ffec82c8a523..6cb65e64859d 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -1433,6 +1433,14 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie) static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie) { + int virq, i; + + for (i = 0; i < PCI_NUM_INTX; i++) { + virq = irq_find_mapping(pcie->irq_domain, i); + if (virq > 0) + irq_dispose_mapping(virq); + } + irq_domain_remove(pcie->irq_domain); }