Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp606174ybv; Thu, 13 Feb 2020 06:28:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxwZO5p94W0JMPTjf35HVm0/4XmGhXlPWk05Vq+flWydLHIB0e7PjLXTjSCdm/nvgoRmIOZ X-Received: by 2002:aca:4b0f:: with SMTP id y15mr2894514oia.153.1581604105458; Thu, 13 Feb 2020 06:28:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581604105; cv=none; d=google.com; s=arc-20160816; b=f5fcZj17nh72uK8g6D9obYn/tdkEPRbf+iKHtz5f+hnp5nkJfGwvdQrG75KJi1I0de woMWITILh2El0aTPLu0Zp56UeS6m3NtuplIGDP8c5ALcwezOF7pFudJCi+azF83XsnXv hdCyYioFLTWlhfjPZmrhy6N27uzlltEdu6B4Q0nHRDwjMZQcrOF7wQ3KbDcDbrC3vaJp 3CV5UWGbvpYnKGaibZRB2G+CPqkyLXq7CZjyk7eftfxD3M5S/Gkfd0BU8QLZMgNQdhJw LsM4HzDbLI9ENeeWKW4l6JvszjwSeTGeGB+YhmUAc2d+G75FWQNEkPAPbWWNwWcFTQnS ytgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=rIiRKAi099zXUsZITnwfRBnHCgGll39nNhqp3mPUaXk=; b=XAewoESSNjhSCk4AXX3y670vzaQRd79KVmbPWXb60N+IwHeIIix4T9to7Bcll90Mxa bW0Rydw5NRa1SphESILrh89FfPbr/IMT3bCIyAxzGnH1W67dGUF0/IKCACmmW8oyGfRa TCF3NfzHIj64h5DwP27sYL46zkMVEtFVbLPnMhhMGQ4SNibedhBO6zEUL0FHXbsNV0X/ NodDqJdjgV4f0jQAuDajishIrs0kMMw27VqsN0qcX0jttuwQTXWzm6gpwhv4KbfQGN3r VgZFl7TOT1FlHLrWCzPHyNkPIXRzNX+lKwDTDjU57JY0HIlcGDd/lEwR25cDi4yScF7R JBow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kSeAbcjQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i20si1114475otk.270.2020.02.13.06.28.13; Thu, 13 Feb 2020 06:28:25 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=kSeAbcjQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727455AbgBMO1t (ORCPT + 99 others); Thu, 13 Feb 2020 09:27:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:46512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbgBMO1s (ORCPT ); Thu, 13 Feb 2020 09:27:48 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (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 A312F222C2; Thu, 13 Feb 2020 14:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581603729; bh=6VfGSAC1HNOSPZvAehIj0dyrn4ZvRctoIk3FH92JPYI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kSeAbcjQ8QOxAe4QgIbYkEwyQm3vrPqRAkJtjE0GbKOtRmcwL4e4Um3YxtPHyFnrh sMbizg7K02UaBIu2Fg5l9afFMJ+YXwXAZ+pOfkgKZPgX3I8z6mAeRgXjKDavzXGviQ cFL3ig+yq/2tfGch9ygjX6/xRILMKkgI2klDov8I= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j2FNX-004qXJ-U9; Thu, 13 Feb 2020 14:22:08 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 13 Feb 2020 14:22:07 +0000 From: Marc Zyngier To: Zenghui Yu Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, tglx@linutronix.de, jason@lakedaemon.net, wanghaibin.wang@huawei.com Subject: Re: [PATCH v2 3/6] irqchip/gic-v4.1: Ensure L2 vPE table is allocated at RD level In-Reply-To: <20200206075711.1275-4-yuzenghui@huawei.com> References: <20200206075711.1275-1-yuzenghui@huawei.com> <20200206075711.1275-4-yuzenghui@huawei.com> Message-ID: <2f6a27ac57aef9b948952c210c9a5882@kernel.org> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: yuzenghui@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, tglx@linutronix.de, jason@lakedaemon.net, wanghaibin.wang@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Zenghui, On 2020-02-06 07:57, Zenghui Yu wrote: > In GICv4, we will ensure that level2 vPE table memory is allocated > for the specified vpe_id on all v4 ITS, in its_alloc_vpe_table(). > This still works well for the typical GICv4.1 implementation, where > the new vPE table is shared between the ITSs and the RDs. > > To make it explicit, let us introduce allocate_vpe_l2_table() to > make sure that the L2 tables are allocated on all v4.1 RDs. We're > likely not need to allocate memory in it because the vPE table is > shared and (L2 table is) already allocated at ITS level, except > for the case where the ITS doesn't share anything (say SVPET == 0, > practically unlikely but architecturally allowed). > > The implementation of allocate_vpe_l2_table() is mostly copied from > its_alloc_table_entry(). > > Signed-off-by: Zenghui Yu > --- > drivers/irqchip/irq-gic-v3-its.c | 80 ++++++++++++++++++++++++++++++++ > 1 file changed, 80 insertions(+) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c > b/drivers/irqchip/irq-gic-v3-its.c > index 0f1fe56ce0af..ae4e7b355b46 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -2443,6 +2443,72 @@ static u64 > inherit_vpe_l1_table_from_rd(cpumask_t **mask) > return 0; > } > > +static bool allocate_vpe_l2_table(int cpu, u32 id) > +{ > + void __iomem *base = gic_data_rdist_cpu(cpu)->rd_base; > + u64 val, gpsz, npg; > + unsigned int psz, esz, idx; > + struct page *page; > + __le64 *table; > + > + if (!gic_rdists->has_rvpeid) > + return true; > + > + val = gits_read_vpropbaser(base + SZ_128K + GICR_VPROPBASER); Having rebased the rest of the GICv4.1 series on top of -rc1, I've hit a small issue right here. I run a FVP model that only spawns 4 CPUs, while the DT has 8 of them. This means that online_cpus = 4, and possible_cpus = 8. So in my case, half of the RDs have base == NULL, and things stop quickly. I plan to queue the following: diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index d85dc8dcb0ad..7656b353a95f 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2526,6 +2526,10 @@ static bool allocate_vpe_l2_table(int cpu, u32 id) if (!gic_rdists->has_rvpeid) return true; + /* Skip non-present CPUs */ + if (!base) + return true; + val = gicr_read_vpropbaser(base + SZ_128K + GICR_VPROPBASER); esz = FIELD_GET(GICR_VPROPBASER_4_1_ENTRY_SIZE, val) + 1; Thanks, M. -- Jazz is not dead. It just smells funny...