From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CED0EC3A5A2 for ; Sun, 22 Sep 2019 19:15:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5DFF206C2 for ; Sun, 22 Sep 2019 19:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569179700; bh=fArfNnT5vFYjofUn+0euUGANcA1sp8AW4rWpRpsRnTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hjf8hELcQOTi7EFmXcFwvZIepiSuWehsR7XwIlPsWTo3/9DEyi5LeQF8y7b3cZEWK WAu5gPXu8e0Ar+zQV9Oj3DcXgCdHd7ceJ+umgtvLAhuexSzvpYw6uTdYDusgAPEIDo kmmbr5Tfa6SnBkx0teBhNJLoCxA0SnDuT4pXhbHw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726408AbfIVTO4 (ORCPT ); Sun, 22 Sep 2019 15:14:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:58996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392303AbfIVS4q (ORCPT ); Sun, 22 Sep 2019 14:56:46 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3EB1421A4A; Sun, 22 Sep 2019 18:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569178606; bh=fArfNnT5vFYjofUn+0euUGANcA1sp8AW4rWpRpsRnTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1XaqySEose42bVf+IxZYY+19yg3mba5r3d7TmEEY5sG7xzGnJxfPD5aIIGz8nCdki /ypzr3IKABEL64HGc9EKDi5fUColxpV0JAukxsUSrY3Tk5NtDYhK6tL+/qg7gmqd/V nfODgnVLlDCrA5F6M8PEFenN0FLlYmaqjlogpYSc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Marc Zyngier , Jiaxing Luo , John Garry , Sasha Levin Subject: [PATCH AUTOSEL 4.19 108/128] irqchip/gic-v3-its: Fix LPI release for Multi-MSI devices Date: Sun, 22 Sep 2019 14:53:58 -0400 Message-Id: <20190922185418.2158-108-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190922185418.2158-1-sashal@kernel.org> References: <20190922185418.2158-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier [ Upstream commit c9c96e30ecaa0aafa225aa1a5392cb7db17c7a82 ] When allocating a range of LPIs for a Multi-MSI capable device, this allocation extended to the closest power of 2. But on the release path, the interrupts are released one by one. This results in not releasing the "extra" range, leaking the its_device. Trying to reprobe the device will then fail. Fix it by releasing the LPIs the same way we allocate them. Fixes: 8208d1708b88 ("irqchip/gic-v3-its: Align PCI Multi-MSI allocation on their size") Reported-by: Jiaxing Luo Tested-by: John Garry Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/f5e948aa-e32f-3f74-ae30-31fee06c2a74@huawei.com Signed-off-by: Sasha Levin --- drivers/irqchip/irq-gic-v3-its.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 9ba73e11757d9..e7549a2b1482b 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2514,14 +2514,13 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, struct its_node *its = its_dev->its; int i; + bitmap_release_region(its_dev->event_map.lpi_map, + its_get_event_id(irq_domain_get_irq_data(domain, virq)), + get_count_order(nr_irqs)); + for (i = 0; i < nr_irqs; i++) { struct irq_data *data = irq_domain_get_irq_data(domain, virq + i); - u32 event = its_get_event_id(data); - - /* Mark interrupt index as unused */ - clear_bit(event, its_dev->event_map.lpi_map); - /* Nuke the entry in the domain */ irq_domain_reset_irq_data(data); } -- 2.20.1