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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 3B13CC10F14 for ; Thu, 3 Oct 2019 15:56:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 04DB921D71 for ; Thu, 3 Oct 2019 15:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570118174; bh=ShkHZbdkeYGi6+KaL0/7gVGfrQBtWi52h4/mpWlR4+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=c0Ai9kZu4IeEGDRyDw9aV6M7Wz2vKHdgBaL2PhfmGRFY2wX4yOsNtuQLcEY57NLZ0 ixNetz29IWVMu4L3TN1hWtrcPXzSMpsYDkNdDDmbThuUpGJuE+hvz+inpHfbL2jIMM 0e/l4ElDa+k4gFvDQcCYPgjm5kRk1s7ZdfwDlQjk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730533AbfJCP4N (ORCPT ); Thu, 3 Oct 2019 11:56:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:37844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730433AbfJCP4I (ORCPT ); Thu, 3 Oct 2019 11:56:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 618E421A4C; Thu, 3 Oct 2019 15:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570118165; bh=ShkHZbdkeYGi6+KaL0/7gVGfrQBtWi52h4/mpWlR4+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ziYjTsLj0RJdrE4wd/VD4UaXwc0fqZWTNR3bfybZtCCfCN4uXbFbEdSOe7IhCtQXu NrDhNpxdWGTFloz14/mw/m+6Lz4lEJFVJHy3JeUiV2I5p/sJ5ezhUfuOzua3rK21Pr /O3plwJuWrO0QRszQgjaG+e9Kf1uycGr7YvduyAk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiaxing Luo , John Garry , Marc Zyngier , Sasha Levin Subject: [PATCH 4.4 14/99] irqchip/gic-v3-its: Fix LPI release for Multi-MSI devices Date: Thu, 3 Oct 2019 17:52:37 +0200 Message-Id: <20191003154300.400522277@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154252.297991283@linuxfoundation.org> References: <20191003154252.297991283@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 114d5883d4978..cf11d43ce2416 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1372,14 +1372,13 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, struct its_device *its_dev = irq_data_get_irq_chip_data(d); 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