Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp802191imm; Wed, 20 Jun 2018 06:54:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKO7ApNuSIaxPP3EdEg3D3epZ8ZQtOpYcBnrwqAuF+XsOG4vNHK6u/10QZCDLhHMypwGtrA X-Received: by 2002:a62:a09c:: with SMTP id p28-v6mr23107439pfl.9.1529502894272; Wed, 20 Jun 2018 06:54:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529502894; cv=none; d=google.com; s=arc-20160816; b=cFUQ+Qste304tkxd5zd0VO6bPJ02ctp/f9cGz045XLP7JZFahJkzcpbMnBtaCgj8E5 P+yfl2aUjdDM9JYiDT5EVUt/k444CqCZVt2PgXElfjVbLMsFoNlgvlopPXeUDjbW2U0U ewgaZgWLtjskKigzroVQS7j1EaGQBKu8yEH6BEqBdZDDYr0g83KEFA92zTIKrwSeONZp DcyP+EYUpHxgVfZRX2HpwGOQ188iGSguD19TE5JznvpvpTg0pzYVBTZhusRlJe5EifEo +pTq9SPNhamaCCB06yrkez/bxeKLvgOXpiDpkcR1aEiQRb1PhCcecMDBrbkERscKULCm UuQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=GHSrX9orkYXJnKbEiKdUKtZz/COIPv864IChPom6mzk=; b=lBZhxVa4dBJPQ20nZUiIH9/hRSGX9LxBgnZVOch/mbVbyMJ+Ewtnt4VXVcVfUAcpcR 1VgxgPd021zEONg2oB/eMdhhdKoExTr7zrlLYcpUCHgB1ts2A/F9Z49YXf7mu+AU3B/c Kn0o7mF09dacwwLdaWDa3sR8Vj0aELclXEjKHp3peMPjP8a/Xj9lR/A5slC38DzpJ93o JMXnyIovInBWu8fGnMl/TybCnwPm9V66JDcMXEmg90K4kQxb2qDAdFm8kNg4XEkdjDKW rqRvbc13BTG5ZB88vHRcaYTyvpA7yIqKUj5Un6g56F32IB4WQG9770jXtOWPQnMmznej D3IQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t64-v6si2655006pfb.98.2018.06.20.06.54.40; Wed, 20 Jun 2018 06:54:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754367AbeFTNxd (ORCPT + 99 others); Wed, 20 Jun 2018 09:53:33 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37500 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754345AbeFTNx3 (ORCPT ); Wed, 20 Jun 2018 09:53:29 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4F6C915B2; Wed, 20 Jun 2018 06:53:29 -0700 (PDT) Received: from big-swifty.cambridge.arm.com (big-swifty.cambridge.arm.com [10.1.31.224]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0F2A93F578; Wed, 20 Jun 2018 06:53:23 -0700 (PDT) From: Marc Zyngier To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Ard Biesheuvel , Shanker Donthineni , Shameer Kolothum , MaJun , Laurentiu Tudor , Lei Zhang Subject: [PATCH 4/7] irqchip/gic-v3-its: Drop chunk allocation compatibility Date: Wed, 20 Jun 2018 14:52:31 +0100 Message-Id: <20180620135234.32101-5-marc.zyngier@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620135234.32101-1-marc.zyngier@arm.com> References: <20180620135234.32101-1-marc.zyngier@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The chunk allocation system is now officially dead, so let's remove it. Signed-off-by: Marc Zyngier --- drivers/irqchip/irq-gic-v3-its.c | 41 +++++++++++++------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index cfe65776bb4c..554c9d040c5a 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1424,12 +1424,6 @@ static struct irq_chip its_irq_chip = { * freeing is expensive. We assumes that freeing rarely occurs. */ -/* - * Compatibility defines until we fully refactor the allocator - */ -#define IRQS_PER_CHUNK_SHIFT 5 -#define IRQS_PER_CHUNK (1UL << IRQS_PER_CHUNK_SHIFT) - static DEFINE_MUTEX(lpi_range_lock); static LIST_HEAD(lpi_range_list); @@ -1542,30 +1536,27 @@ static int __init its_lpi_init(u32 id_bits) return err; } -static unsigned long *its_lpi_alloc_chunks(int nr_irqs, u32 *base, int *nr_ids) +static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids) { unsigned long *bitmap = NULL; int err = 0; - int nr_lpis; - - nr_lpis = round_up(nr_irqs, IRQS_PER_CHUNK); do { - err = alloc_lpi_range(nr_lpis, base); + err = alloc_lpi_range(nr_irqs, base); if (!err) break; - nr_lpis -= IRQS_PER_CHUNK; - } while (nr_lpis > 0); + nr_irqs /= 2; + } while (nr_irqs > 0); if (err) goto out; - bitmap = kcalloc(BITS_TO_LONGS(nr_lpis), sizeof (long), GFP_ATOMIC); + bitmap = kcalloc(BITS_TO_LONGS(nr_irqs), sizeof (long), GFP_ATOMIC); if (!bitmap) goto out; - *nr_ids = nr_lpis; + *nr_ids = nr_irqs; out: if (!bitmap) @@ -1574,7 +1565,7 @@ static unsigned long *its_lpi_alloc_chunks(int nr_irqs, u32 *base, int *nr_ids) return bitmap; } -static void its_lpi_free_chunks(unsigned long *bitmap, u32 base, u32 nr_ids) +static void its_lpi_free(unsigned long *bitmap, u32 base, u32 nr_ids) { WARN_ON(free_lpi_range(base, nr_ids)); kfree(bitmap); @@ -2192,7 +2183,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; itt = kzalloc(sz, GFP_KERNEL); if (alloc_lpis) { - lpi_map = its_lpi_alloc_chunks(nvecs, &lpi_base, &nr_lpis); + lpi_map = its_lpi_alloc(nvecs, &lpi_base, &nr_lpis); if (lpi_map) col_map = kcalloc(nr_lpis, sizeof(*col_map), GFP_KERNEL); @@ -2420,9 +2411,9 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, /* If all interrupts have been freed, start mopping the floor */ if (bitmap_empty(its_dev->event_map.lpi_map, its_dev->event_map.nr_lpis)) { - its_lpi_free_chunks(its_dev->event_map.lpi_map, - its_dev->event_map.lpi_base, - its_dev->event_map.nr_lpis); + its_lpi_free(its_dev->event_map.lpi_map, + its_dev->event_map.lpi_base, + its_dev->event_map.nr_lpis); kfree(its_dev->event_map.col_map); /* Unmap device/itt */ @@ -2821,7 +2812,7 @@ static void its_vpe_irq_domain_free(struct irq_domain *domain, } if (bitmap_empty(vm->db_bitmap, vm->nr_db_lpis)) { - its_lpi_free_chunks(vm->db_bitmap, vm->db_lpi_base, vm->nr_db_lpis); + its_lpi_free(vm->db_bitmap, vm->db_lpi_base, vm->nr_db_lpis); its_free_prop_table(vm->vprop_page); } } @@ -2836,18 +2827,18 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq BUG_ON(!vm); - bitmap = its_lpi_alloc_chunks(roundup_pow_of_two(nr_irqs), &base, &nr_ids); + bitmap = its_lpi_alloc(roundup_pow_of_two(nr_irqs), &base, &nr_ids); if (!bitmap) return -ENOMEM; if (nr_ids < nr_irqs) { - its_lpi_free_chunks(bitmap, base, nr_ids); + its_lpi_free(bitmap, base, nr_ids); return -ENOMEM; } vprop_page = its_allocate_prop_table(GFP_KERNEL); if (!vprop_page) { - its_lpi_free_chunks(bitmap, base, nr_ids); + its_lpi_free(bitmap, base, nr_ids); return -ENOMEM; } @@ -2874,7 +2865,7 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq if (i > 0) its_vpe_irq_domain_free(domain, virq, i - 1); - its_lpi_free_chunks(bitmap, base, nr_ids); + its_lpi_free(bitmap, base, nr_ids); its_free_prop_table(vprop_page); } -- 2.17.1