Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1135303imm; Fri, 22 Jun 2018 10:56:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIzOvZMHV5nVGIxA6rX+Xff51pJb3GZ4KfidiMVDQZqky72CnMiGkpBRgVYevGhBiTtKjNV X-Received: by 2002:a65:6619:: with SMTP id w25-v6mr2266048pgv.195.1529690203163; Fri, 22 Jun 2018 10:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529690203; cv=none; d=google.com; s=arc-20160816; b=NpZgeGa6hAkUk7bhTL98qbfluegItO70b2maQuo1u2eNhCVOePhc0K1SercqZMn57k CgAKg4EPEiYC8+bSMcQblShyiEve0svOz0sKh80xKrZFdGQ2QG7qVMm/hH52T+tIFw+H q90RxSX5sCyv/X7vKgOZKGKzsCPXXy2n6htiMV3YHAB5WXXwT39jAAE9bqaAFSlL9yZE yTmmCADhbJjYKriq/UvpeF9UBzCtoBbX4Spx6PEBp73r7NZfAtokkR4WnLRFIzUyevgY 7QAsDnZkZy/Kwy50xGj2mcCDAkF27vpmZbLcIXYqSyaJV4LvaJpAgZA+IWtuz3qAefvS TaAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:user-agent :references:in-reply-to:subject:cc:to:from:message-id:date :arc-authentication-results; bh=odSLcdmy0t6ArlB/NhHOcxlh2LxBZDNQTBP5Zam05MQ=; b=GCp9uJM0ZbufHh4YiTJUmSuPfkDBddaCFGzOGGT856p38ZxhmBlkanyv5RSCHlMzlL aVHr9ML4ksXhE4a3KyZAAYDoYAfY5A1py+Q0xaa0UuMi+BSifyJdKXC3d5NFODjjq0sF HrD40v/0tj8zi4YO0ACI4Qp7Q73nKFf4OCTjllTQ2jxy5Ib/HH0piMzlUrRwYxMjZuHn 1Mu+doESgSlA/jjbHoPXmDJrPxwxjDkxOiA4dxk0YtEPAzwmPghjvm6RpP1s0b4I60hW wORpZcPTHB51zPOjJBdopt3aoIFCZSWc5Y+TCDfDKRCNloxjEhh+GqiKkbif+71H7v1P zg7A== 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 m3-v6si8048917pfc.312.2018.06.22.10.56.25; Fri, 22 Jun 2018 10:56:43 -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 S934044AbeFVRya (ORCPT + 99 others); Fri, 22 Jun 2018 13:54:30 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39238 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932973AbeFVRy3 (ORCPT ); Fri, 22 Jun 2018 13:54: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 62D8A14; Fri, 22 Jun 2018 10:54:29 -0700 (PDT) Received: from big-swifty.misterjones.org (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4B9963F557; Fri, 22 Jun 2018 10:54:27 -0700 (PDT) Date: Fri, 22 Jun 2018 18:54:16 +0100 Message-ID: <86k1qq7lmf.wl-marc.zyngier@arm.com> From: Marc Zyngier To: Shameerali Kolothum Thodi Cc: "linux-kernel@vger.kernel.org" , Thomas Gleixner , Ard Biesheuvel , Shanker Donthineni , Laurentiu Tudor , Lei Zhang , Linuxarm Subject: Re: [PATCH 6/7] irqchip/gic-v3-its: Honor hypervisor enforced LPI range In-Reply-To: <5FC3163CFD30C246ABAA99954A238FA838706A1B@FRAEML521-MBX.china.huawei.com> References: <20180620135234.32101-1-marc.zyngier@arm.com> <20180620135234.32101-7-marc.zyngier@arm.com> <5FC3163CFD30C246ABAA99954A238FA838706A1B@FRAEML521-MBX.china.huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: ARM Ltd MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shammer, On Fri, 22 Jun 2018 17:31:40 +0100, Shameerali Kolothum Thodi wrote: > > Hi Marc, > > > -----Original Message----- > > From: Marc Zyngier [mailto:marc.zyngier@arm.com] > > Sent: 20 June 2018 14:53 > > To: linux-kernel@vger.kernel.org > > Cc: Thomas Gleixner ; Ard Biesheuvel > > ; Shanker Donthineni > > ; Shameerali Kolothum Thodi > > ; MaJun ; > > Laurentiu Tudor ; Lei Zhang > > > > Subject: [PATCH 6/7] irqchip/gic-v3-its: Honor hypervisor enforced LPI range > > > > A recent extension to the GIC architecture allows a hypervisor to > > arbitrarily reduce the number of LPIs available to a guest, no > > matter what the GIC says about the valid range of IntIDs. > > > > Let's factor in this information when computing the number of > > available LPIs > > On our D05 board, this limits the lpis to 2 and results in MSI irq > alloc fails: > > [ 0.000000] ITS: Using hypervisor restricted LPI range [2] > .... > [ 10.543889] ixgbe 000a:11:00.1: Failed to allocate MSI interrupt, falling back to legacy. Error: -12 > > > Signed-off-by: Marc Zyngier > > --- > > drivers/irqchip/irq-gic-v3-its.c | 9 +++++++++ > > include/linux/irqchip/arm-gic-v3.h | 1 + > > 2 files changed, 10 insertions(+) > > > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > > index 8c7e8c235faf..903ca1c19553 100644 > > --- a/drivers/irqchip/irq-gic-v3-its.c > > +++ b/drivers/irqchip/irq-gic-v3-its.c > > @@ -1525,8 +1525,17 @@ static int free_lpi_range(u32 base, u32 nr_lpis) > > static int __init its_lpi_init(u32 id_bits) > > { > > u32 lpis = (1UL << id_bits) - 8192; > > + u32 numlpis; > > int err; > > > > + numlpis = 1UL << GICD_TYPER_NUM_LPIS(gic_rdists->gicd_typer); > > + > > + if (numlpis > 1 && !WARN_ON(numlpis > lpis)) { > > + lpis = numlpis; > > + pr_info("ITS: Using hypervisor restricted LPI range [%u]\n", > > + lpis); > > + } > > I don't have the GICv3 extension doc, but did you intent to check for, > > if (numlpis > 2 && !WARN_ON(numlpis > lpis)) { > > as it looks like D05 returns 0 for bits 11-15 and that makes numlpis=2. Absolutely. This really is a silly bug, thanks for catching that one. I've pushed out an update on my irq/lpi-allocator branch. Thanks, M. -- Jazz is not dead, it just smell funny.