Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3268321imw; Mon, 11 Jul 2022 05:32:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vNHK99KHCKVP19ftk0xJiBeBtY0yQROt1Mu/RdH2odLZ0hR7cPf0FVGlUyCOGkNyf0swug X-Received: by 2002:a63:4b20:0:b0:401:ae11:2593 with SMTP id y32-20020a634b20000000b00401ae112593mr16143431pga.375.1657542749313; Mon, 11 Jul 2022 05:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657542749; cv=none; d=google.com; s=arc-20160816; b=Ts67y2fYlUSXkP9bSMspSJ4bGghIpnymj7kLo9O0AeJZnXN9EldT6c3UZmXLLsbGG1 o3pqYjpQAzzQr5Nw9L9+8DPsPQkvSGStmJMYGCe08w7s3ke2qJnO0C+zAZ4fj7+EVa5T ajFcAaXPM+HeDtNYYle3I6DTalDL7qUjyvnHckB/7zkQeMMkxWeIxrRjEGU6IhuW7dA9 Bq5mv5HTJl0cUz4ugUaZoMxFYW/jWmbAqBrtBfVnMuhA0aXOFa508Cvy7jLbmbmiZdvz NWfnICrmrHzcfK4YJ8B8xsmNNEG7cqDPCgCAkSmYR8dagsiHQnaFY2RxyJrq/Tyf/UDX yBjw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=raQcmEB47e9EZhV4cm4b4Q7TQ05X1K2X5cdj6G5EPuw=; b=gttL4QfHXHzPemwTAzDGRO04OSaJjR/fs+/4kGDpBcvr4KPqwaxwt805IVERJ34q+b OyVsLyxga1U3FMm/7dHkuqHuvq5bO+5znE/PyomLg8o3hbWQMexw4trbTrLct244zyOU LHN4SluUvLrU3oTm9wYvY0Vaqu7QtATguSdbgYeFutCI5j2nFwbWBTFAV4ekYJgJB1ge a8m94Qoc5wakOFGYczklfB+3yKcV4aZaDoqyJz+VQY7hAFSBgGwt5JxaGX0vGFaf1YZ+ fRDNaioJstRqpmfJQI7qUMnvT32MvrvRs5OaedSHUEB6dvZfK2prcPp274NCxEnhKvUz 9a1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tchk8X2I; 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 s6-20020a635246000000b00411bc000639si9396416pgl.93.2022.07.11.05.32.16; Mon, 11 Jul 2022 05:32:29 -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=tchk8X2I; 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 S231627AbiGKMKu (ORCPT + 99 others); Mon, 11 Jul 2022 08:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231616AbiGKMKr (ORCPT ); Mon, 11 Jul 2022 08:10:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07211491EF; Mon, 11 Jul 2022 05:10:46 -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 ams.source.kernel.org (Postfix) with ESMTPS id B4BB4B80EBD; Mon, 11 Jul 2022 12:10:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ED5AC341CD; Mon, 11 Jul 2022 12:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657541444; bh=s2hcWfrzOt/eRRX9Dn00HKwF/BMj8aqOvof1DioxKO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tchk8X2Ik8KgJcy+3Y30fPgbo8x29dRap611vgKQ+8IpK46gQ54jszkZisuYrYLT1 TSTfOo7iNglhfmhlhhBzSdGnTSKPlH0pulGY3yPulajIKXLWAm5RBI0JDPRykuUzjP Ab5kDOQE4xZa4tH6NQKnfvyDtAWYdLsAVxvkXW1Ii4hVjdMFATkBsXarvP7uPwPN6X M77McHeZF9lsDpQiqvZ3WI5OcPJxVL24BjHPLUb+ycd7OOVlv4qTqkRpMu8FHWcmxz u4T5wtL4/tCZm5QAkkpiQxQ0ucmq6CbcPXzYp+Y8m8wL9c/SL19XBaHl14QbPSzJm8 pYg/0t9Yr1Aiw== Received: by pali.im (Postfix) id E5673276E; 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 2/3] PCI: aardvark: Dispose bridge irq prior to removing bridge domain Date: Mon, 11 Jul 2022 14:06:25 +0200 Message-Id: <20220711120626.11492-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220711120626.11492-1-pali@kernel.org> References: <20220711120626.11492-1-pali@kernel.org> 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 bridge irq is 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: 815bc3136867 ("PCI: aardvark: Use separate INTA interrupt for emulated root bridge") Signed-off-by: Pali Rohár --- drivers/pci/controller/pci-aardvark.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index 6cb65e64859d..8bea5801d50a 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -1479,6 +1479,12 @@ static int advk_pcie_init_rp_irq_domain(struct advk_pcie *pcie) static void advk_pcie_remove_rp_irq_domain(struct advk_pcie *pcie) { + int virq; + + virq = irq_find_mapping(pcie->rp_irq_domain, 0); + if (virq > 0) + irq_dispose_mapping(virq); + irq_domain_remove(pcie->rp_irq_domain); } -- 2.20.1