Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1054271imm; Fri, 22 Jun 2018 09:32:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKQkKtoEZtowIJ34Ou/rFQNB84s+FJM33t35QpgXB3zQ+tZQHg8t9zNrXz8fuIuWXPotEFS X-Received: by 2002:a65:43c9:: with SMTP id n9-v6mr2014705pgp.399.1529685177108; Fri, 22 Jun 2018 09:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529685177; cv=none; d=google.com; s=arc-20160816; b=Nd8UlZzWDyCDMnf2m9IUYvaox64PBbgfTCDmpyn91flnCTVDFefKsif5TaflKFQu0o 7DmrtknzfpVQAnOJyrEbFPS4+TG+WGBIg5DU3u7t/Gxz8E5ny8T+mettty1MSrIoev9C KfIIAsYlkKlePSdngARDQSsIVeag7IToUiCjgmOiI2F0EuAcSjX0CrTrkDkvR0afRBnZ IZ6i5ZgzWe1zy4QVzuq6I+MLH6o9mN3M5qxAaPYiDoz0Ekh8mY0lKHJ/htjy8FD/L5zv H3Bkb2Kj4oinNAkYq5O6eWh9FnDIcmvTUKda2NasRtDkzXr+eYjqmjj2TxucNE3S6/wv j9OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=XDPvMUcHfRbzPrcw78u83ZfctFATOKd9ataXHWrK8nQ=; b=XMuazNb+mC+FN43vqykSlVh/T4H0M59jxjGSPg3MbTS6PW43zdpunxUoBWWaYLSOpT UJORY0NsEU80ZaVsUlUEsfyubM+sTZCRzkHO5SgSf952fxyQA6sRQusbcQnzwF57Rtdo +ITiKnqB/zRsusjzVYwxZhtyQ6e0JmeaNhYVpMnmzzGsJoLQdLMcOzbs4rPbXkZvKp/q 7ONFyjuxBuETNEcNgddETS1clcWmGd5m/gcM2SJ1VV1LT+lX1jj9YsXmG9lKpcD86oM1 Q7GdXnnhMxWoIvV6sYN6Hds5giqHXD7y8fUfM5Mbwq2FdNTGMhTTgAU/sCNUK3u73wCh r4ng== 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 f184-v6si2813566pgc.309.2018.06.22.09.32.41; Fri, 22 Jun 2018 09:32:57 -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 S934312AbeFVQbw convert rfc822-to-8bit (ORCPT + 99 others); Fri, 22 Jun 2018 12:31:52 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:39111 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934061AbeFVQbv (ORCPT ); Fri, 22 Jun 2018 12:31:51 -0400 Received: from LHREML710-CAH.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 28DE9C97D054A; Fri, 22 Jun 2018 17:31:47 +0100 (IST) Received: from FRAEMA708-CHM.china.huawei.com (10.206.14.57) by LHREML710-CAH.china.huawei.com (10.201.108.33) with Microsoft SMTP Server (TLS) id 14.3.382.0; Fri, 22 Jun 2018 17:31:48 +0100 Received: from FRAEML521-MBX.china.huawei.com ([169.254.1.176]) by FRAEMA708-CHM.china.huawei.com ([169.254.8.193]) with mapi id 14.03.0382.000; Fri, 22 Jun 2018 18:31:41 +0200 From: Shameerali Kolothum Thodi To: Marc Zyngier , "linux-kernel@vger.kernel.org" CC: 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 Thread-Topic: [PATCH 6/7] irqchip/gic-v3-its: Honor hypervisor enforced LPI range Thread-Index: AQHUCJ4hzL+MVAKZUUSRAob8n9It1KRseE1Q Date: Fri, 22 Jun 2018 16:31:40 +0000 Message-ID: <5FC3163CFD30C246ABAA99954A238FA838706A1B@FRAEML521-MBX.china.huawei.com> References: <20180620135234.32101-1-marc.zyngier@arm.com> <20180620135234.32101-7-marc.zyngier@arm.com> In-Reply-To: <20180620135234.32101-7-marc.zyngier@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.227.237] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Please let me know. Thanks, Shameer > + > /* > * Initializing the allocator is just the same as freeing the > * full range of LPIs. > diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic- > v3.h > index 396cd99af02f..9d2ea3e907d0 100644 > --- a/include/linux/irqchip/arm-gic-v3.h > +++ b/include/linux/irqchip/arm-gic-v3.h > @@ -73,6 +73,7 @@ > #define GICD_TYPER_MBIS (1U << 16) > > #define GICD_TYPER_ID_BITS(typer) ((((typer) >> 19) & 0x1f) + 1) > +#define GICD_TYPER_NUM_LPIS(typer) ((((typer) >> 11) & 0x1f) + 1) > #define GICD_TYPER_IRQS(typer) ((((typer) & 0x1f) + 1) * 32) > > #define GICD_IROUTER_SPI_MODE_ONE (0U << 31) > -- > 2.17.1