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,URIBL_BLOCKED,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 344FDC4740C for ; Sun, 22 Sep 2019 19:23:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 01C0B20869 for ; Sun, 22 Sep 2019 19:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569180181; bh=SDsplUQ38BrLxov/WNrXRt5KjDvvNUs5suzHFutubz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mJivIcuvW87SvrFC1EearaENC0t8q3tf9pWHCT0FTz925XYLwn4SAdfdeWjBsBoUv x+yctFxey1Ctl6c3ETv5fazkY/OJb+3MfpvfEKv6IuvLZdKmJ/OWLPbX4NCbyxUexC aE0DCgjrzYOCk2bhpe1g+cCxXfTdhQHXyPoK/Krw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394336AbfIVSxe (ORCPT ); Sun, 22 Sep 2019 14:53:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:53458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392845AbfIVSxd (ORCPT ); Sun, 22 Sep 2019 14:53:33 -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 4958921D81; Sun, 22 Sep 2019 18:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569178413; bh=SDsplUQ38BrLxov/WNrXRt5KjDvvNUs5suzHFutubz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uqaUBA0D56bSKcGXdCT9gDT2PScIWzDI2zyqbrJAgSXVZCefkOeFsV+G8Jc+7LKnD 1QdLhMeJTfyeH1Mc4jiHG3RaZMRd1wD29ISNh9RY4R54mZJ0NQaabyw2UkaKa7C8lv N/Q/2bXrDE7AThhQF5IWqrrpMuucpbig+9xFa/Mw= 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 5.2 153/185] irqchip/gic-v3-its: Fix LPI release for Multi-MSI devices Date: Sun, 22 Sep 2019 14:48:51 -0400 Message-Id: <20190922184924.32534-153-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190922184924.32534-1-sashal@kernel.org> References: <20190922184924.32534-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 20e5482d91b94..fca8b90028522 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2641,14 +2641,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