Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3268779imw; Mon, 11 Jul 2022 05:33:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sPEsvcayb5X/UEd1FCXuq1BeOJg8rEX1isiZkH5vZlEm62U5CKKiBDmb0R69ZXz76TPfvN X-Received: by 2002:a05:6402:4301:b0:43a:e374:1557 with SMTP id m1-20020a056402430100b0043ae3741557mr451182edc.229.1657542779886; Mon, 11 Jul 2022 05:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657542779; cv=none; d=google.com; s=arc-20160816; b=OfbyntlCO5aw7SubKi+KOX1+VXDWa9GgpSO6FTItCBFKKDujub2erAfGryJ0Tiq3ya rzJ/dq47R6rAFXY2duLPkzm94qHT0Bmwh4zhhl0qLsytHFjlmL//YU1nrIiGX6NUUgvJ kbm3Eq6/R69BduxNP5kgFUmyN2sniDXbMxRQFdUqRuOGJwD4lBVq2V1FkMeXmVSfYB8d 2UIU/85ryMvUOyXo0RNibNL4jDqVJhn+kN4vTiotKC1hH3bFB5r2X7Et4S3650a1NBys 0KMX0Jzxgz12XlYWRWGA0i3LkOaae73aPCC+a+fW52urm1/Z6c854scl24F3aPAds6is jWFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iwpXSYfBqEFQ61Hc+EIKBzHwkbG9eRE7i6M/DeF5X9Q=; b=zX8I5n8p/HC2H8gbrQRDqaNGy3h/ZZ5EShRtIA9PBXdhDYAaXRA6ccYmimeGReHsxR fS6BC+bgsZWLeyGSsLhDsPXDyhzlUVqWaobfPakAfPpIXiE3mlGaOwrgI5geVtF48fK6 NAh6Dr4tH/thTohWo2TSWn5U0JMlhgNh1mMpmmh0hSA40cwIYv7WxWdWIelJ50IhZKC9 gC6SF1xE3cjMprVmQaxRBzurtlBgFkr2wFKQNV8cDjDTW6vShMv8E1HGVnKpK5UoVQuy i+WIJHfK2hYx6sndzTvl1UC5jCB7fG3UqC1x1j50ViD1ZKmWt8Y+NsJo01Ezt+GHqImQ APzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=glwCOyvV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020aa7d402000000b0042bd2c39f07si9355661edq.596.2022.07.11.05.32.34; Mon, 11 Jul 2022 05:32:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=glwCOyvV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231607AbiGKMKq (ORCPT + 99 others); Mon, 11 Jul 2022 08:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbiGKMKp (ORCPT ); Mon, 11 Jul 2022 08:10:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2783348EB9; Mon, 11 Jul 2022 05:10:45 -0700 (PDT) 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 94478611F1; 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=20Roh=C3=A1r?= To: Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Bjorn Helgaas , =?UTF-8?q?Marek=20Beh=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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); } -- 2.20.1