Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3702580rwl; Tue, 27 Dec 2022 13:38:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXvFHTa27BjmDFd+y3xBgd9h/Anu3AwWvID3iSqx+tMXflDkKK9/8o4XKc2TDgJV6igMUcCC X-Received: by 2002:a17:907:8d16:b0:7c4:fa17:71fe with SMTP id tc22-20020a1709078d1600b007c4fa1771femr20741426ejc.45.1672177109875; Tue, 27 Dec 2022 13:38:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672177109; cv=none; d=google.com; s=arc-20160816; b=Hw+aFZFob0Iu/Zv6yyKHHzBdRXdAG3FXvkRt/0AKH9kqDmDrXT2ou9PZJzMGfGi4Ft KrWILtZlkuJYLuQgzSCvYj8D4ri5cQdSPHBE98E6jvgaBRUS/+bfm/eTp9OW2llA0FsO xdg+JhIZ/Pmno3vg58zq2Rd5KwR0y0Ub+cq5A2EwPccK2iX0amQpDdr2d5NMwK5JYO1P ihzNPtLp3puvnSQ1PwV3uGZOyC0JjrS3RLNWmGIZVLP+KpYMzbJ9I0HrmIUtFeh9JZO0 suENWd5+NhOkXeV1cWhnZPnHyZScyt1Tt1Xteg1//pYqu6zzaxYTeTvMR6VEG66xLheH GaAw== 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=N479mCRe7Tb6qp9Its7xsfuVSJsOD9B0JXPHdEV820o=; b=sXvY6wsGo/ihqQJtzCBEUx4lAk/kBaq6qApRR4WFEWJMMCSIyXRLDPL0zAzqeYs8Si Py22d6Xg/apMs2cA5QnzW7eJdnIxkT1dmVupxEeDa55rnenmSYoMv7nVcVypYUsVgjsi 43ZR5GnOeJ8L1GAs9aAKSsrHZywz2i4bK4kP5RbtXn65dKTa910JeU5NCyMsRkTDCJ11 a5IX0mN025ATrNA97eR3H4MQTP5hlGvYk6KEARD3hDbkDsVBD5KdKO3HYvuX9K9gweup zJA3RdgXKsX8Gh4IimaHjrtE7nWiC4d94jVLnXjcs30dIpFm5IPl50cpCbF+8WLItBMT C+bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uLqZs9VN; 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 hd39-20020a17090796a700b00779e6c93108si12573925ejc.598.2022.12.27.13.38.14; Tue, 27 Dec 2022 13:38:29 -0800 (PST) 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=uLqZs9VN; 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 S232762AbiL0Umh (ORCPT + 67 others); Tue, 27 Dec 2022 15:42:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232874AbiL0UlY (ORCPT ); Tue, 27 Dec 2022 15:41:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E7E1FD3C; Tue, 27 Dec 2022 12:35:32 -0800 (PST) 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 7A9E76123D; Tue, 27 Dec 2022 20:35:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD273C433D2; Tue, 27 Dec 2022 20:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672173328; bh=7wQl5/oWT1LEhstKllgC6D1gj33l6pQNUMUP8MBxe44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uLqZs9VNs0HtuG3urM0sTUFx6OeklyOcGPpSa4vSqZuaTvTOFixt9wioBQ4Z/Go1T ApsxTaLKXX8jJcinBCygvVxKkTMXUuHifHQfK7A012R7DfRN+eAgdyC86qspsCgN4q qctlyheHE+R5GqfMgv+IsB8W0rIlGGkEyUWGn1gM10l2QwHnhgxtje/90TU+X2Wam5 HnXEp5T1BWgfoFlNbHZqYFIlnZNIXhHLMwmdcw3azV+sP6d3nZbuBseCESw20Z/6VH YWWh2+5kh6Mxm2oao4Lu0j8lRSlxuG4wfgNja1zQVKUlSnyqA6pHg65vVd0M7jLWw4 0DK9e9tWPVq1Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Marc Zyngier , Guenter Roeck , Sasha Levin , mpe@ellerman.id.au, christophe.leroy@csgroup.eu, windhl@126.com, Julia.Lawall@inria.fr, linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 5.10 5/7] powerpc/msi: Fix deassociation of MSI descriptors Date: Tue, 27 Dec 2022 15:35:08 -0500 Message-Id: <20221227203512.1214527-5-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221227203512.1214527-1-sashal@kernel.org> References: <20221227203512.1214527-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 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 From: Marc Zyngier [ Upstream commit 4545c6a3d6ba71747eaa984c338ddd745e56e23f ] Since 2f2940d16823 ("genirq/msi: Remove filter from msi_free_descs_free_range()"), the core MSI code relies on the msi_desc->irq field to have been cleared before the descriptor can be freed, as it indicates that there is no association with a device anymore. The irq domain code provides this guarantee, and so does s390, which is one of the two architectures not using irq domains for MSIs. Powerpc, however, is missing this particular requirements, leading in a splat and leaked MSI descriptors. Adding the now required irq reset to the handful of powerpc backends that implement MSIs fixes that particular problem. Reported-by: Guenter Roeck Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/70dab88e-6119-0c12-7c6a-61bcbe239f66@roeck-us.net Signed-off-by: Sasha Levin --- arch/powerpc/platforms/4xx/hsta_msi.c | 1 + arch/powerpc/platforms/cell/axon_msi.c | 1 + arch/powerpc/platforms/pasemi/msi.c | 1 + arch/powerpc/sysdev/fsl_msi.c | 1 + arch/powerpc/sysdev/mpic_u3msi.c | 1 + 5 files changed, 5 insertions(+) diff --git a/arch/powerpc/platforms/4xx/hsta_msi.c b/arch/powerpc/platforms/4xx/hsta_msi.c index c950fed43b32..4f65bd0cf111 100644 --- a/arch/powerpc/platforms/4xx/hsta_msi.c +++ b/arch/powerpc/platforms/4xx/hsta_msi.c @@ -117,6 +117,7 @@ static void hsta_teardown_msi_irqs(struct pci_dev *dev) msi_bitmap_free_hwirqs(&ppc4xx_hsta_msi.bmp, irq, 1); pr_debug("%s: Teardown IRQ %u (index %u)\n", __func__, entry->irq, irq); + entry->irq = 0; } } diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index ffbc7d2e9464..9f77dde61f31 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c @@ -295,6 +295,7 @@ static void axon_msi_teardown_msi_irqs(struct pci_dev *dev) irq_set_msi_desc(entry->irq, NULL); irq_dispose_mapping(entry->irq); + entry->irq = 0; } } diff --git a/arch/powerpc/platforms/pasemi/msi.c b/arch/powerpc/platforms/pasemi/msi.c index d38944a1e258..76393c158ada 100644 --- a/arch/powerpc/platforms/pasemi/msi.c +++ b/arch/powerpc/platforms/pasemi/msi.c @@ -69,6 +69,7 @@ static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev) hwirq = virq_to_hw(entry->irq); irq_set_msi_desc(entry->irq, NULL); irq_dispose_mapping(entry->irq); + entry->irq = 0; msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq, ALLOC_CHUNK); } diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index d276c5e96445..5c3f3173638e 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c @@ -132,6 +132,7 @@ static void fsl_teardown_msi_irqs(struct pci_dev *pdev) msi_data = irq_get_chip_data(entry->irq); irq_set_msi_desc(entry->irq, NULL); irq_dispose_mapping(entry->irq); + entry->irq = 0; msi_bitmap_free_hwirqs(&msi_data->bitmap, hwirq, 1); } diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c index 3861023d378a..43686c82e483 100644 --- a/arch/powerpc/sysdev/mpic_u3msi.c +++ b/arch/powerpc/sysdev/mpic_u3msi.c @@ -111,6 +111,7 @@ static void u3msi_teardown_msi_irqs(struct pci_dev *pdev) hwirq = virq_to_hw(entry->irq); irq_set_msi_desc(entry->irq, NULL); irq_dispose_mapping(entry->irq); + entry->irq = 0; msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq, 1); } -- 2.35.1