Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3173287ybl; Fri, 20 Dec 2019 05:10:07 -0800 (PST) X-Google-Smtp-Source: APXvYqx1QQYkuwfUEZF+NUGS5BWEDATVE5zz5OnXBWdubq1TpzdAiAzkH+sJdOMqLBUPQJn5bL7c X-Received: by 2002:a9d:53cb:: with SMTP id i11mr15378066oth.158.1576847407925; Fri, 20 Dec 2019 05:10:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576847407; cv=none; d=google.com; s=arc-20160816; b=rk1Ne4c1vtFTWp6xg2Uzdwx8AobcUOvzKncsHpdTid1Ijoi4OLEChtNDn48lFSqRiK Zu2WTKkMg0dQaTuwP8E9+2BEPc+iqlhRdypnXI+uXDYW3q+jTpn+e6eb63sCzUMoGw6I LMVN96SgGlm4FKAHU2JG1b5O4gmSwhIYz03uCVRwhsxS9jUgjYy3qgd3ewGap8u0jHrL ZhV+X9tYjyuSXFIppJR0O8HABh+Ump8egYgRXz9sWeV9jdhwGwdStXktwCVYbaa1EDHX fcSbl4Ta6AyB8p+GQOkSbQkq14BqaYcWZyUw/umb9p3t6tMzY+wdvy23QSAJ7q//NchK no1w== 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:cc:from:date:content-transfer-encoding:mime-version :subject:to; bh=aJKykE9W/t8feemZSjyvv3NGVdla+7PIC8RT3440Q74=; b=n2oiHDwlfxkpWnrR7jlh3xvth6Jod3/ybBCvi12wtC9wtEISWlwNiD3dMFRq5fRv/s szn/bQNZWHybvwHVff+P4QmLu8B789HylXy9OpaSQSQFheXMuUZPxyYO9n70i5xbbCsM mEYXhX4saz0csLAs/5DrXQtcr6UILeeTyDPQslLC94hulWPHAFquLpMWSSDl8HvzMRP6 nBIuOxeldojQGYW0fqWLoRMikX2d6A+TI/jdpScKRbIfhAXJQzmhsiLDwtx0mXCOkOU+ i9O+C2E2UeLZw0tuJ5hgD8vTl4AmNy9lW0pC3eMsKcJ4GUPoEKdUN9++4Ox1oK+M5owX PmoQ== 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; dmarc=fail (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 y6si1058514oih.217.2019.12.20.05.09.50; Fri, 20 Dec 2019 05:10:07 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727401AbfLTNHN (ORCPT + 99 others); Fri, 20 Dec 2019 08:07:13 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:45704 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727344AbfLTNHN (ORCPT ); Fri, 20 Dec 2019 08:07:13 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1iiHzl-0005uV-GW; Fri, 20 Dec 2019 14:07:05 +0100 To: Zenghui Yu Subject: Re: [PATCH] KVM: arm/arm64: vgic: Handle =?UTF-8?Q?GICR=5FPENDBAS?= =?UTF-8?Q?ER=2EPTZ=20filed=20as=20RAZ?= X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 20 Dec 2019 13:07:05 +0000 From: Marc Zyngier Cc: , , , , , In-Reply-To: <20191220111833.1422-1-yuzenghui@huawei.com> References: <20191220111833.1422-1-yuzenghui@huawei.com> Message-ID: <71e3dcc00ad5ab8dffd732bfe7381705@www.loen.fr> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: yuzenghui@huawei.com, andre.przywara@arm.com, eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, wanghaibin.wang@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.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 On 2019-12-20 11:18, Zenghui Yu wrote: > Although guest will hardly read and use the PTZ (Pending Table Zero) > bit in GICR_PENDBASER, let us emulate the architecture strictly. > As per IHI 0069E 9.11.30, PTZ field is WO, and reads as 0. > > Signed-off-by: Zenghui Yu > --- > > Noticed when checking all fields of GICR_PENDBASER register. > But _not_ sure whether it's worth a fix, as Linux never sets > the PTZ bit before enabling LPI (set GICR_CTLR_ENABLE_LPIS). > > And I wonder under which scenarios can this bit be written as 1. > It seems difficult for software to determine whether the pending > table contains all zeros when writing this bit. This is a useless HW optimization, where it can avoid reading the pending table the very first time you write to this register if it is told that it is all zero. A decent ITS implementation already has a mechanism to find out about the pending bits by looking into the IMPDEF area (the first 1kB) of the pending table. PTZ is just yet another way to do the same thing. This can only happen once in the lifetime of the system (when allocating the table), and Linux doesn't really care. As usual, the GIC is setting the level of useless complexity pretty high... > > virt/kvm/arm/vgic/vgic-mmio-v3.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c > b/virt/kvm/arm/vgic/vgic-mmio-v3.c > index 7dfd15dbb308..ebc218840fc2 100644 > --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c > +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c > @@ -414,8 +414,11 @@ static unsigned long > vgic_mmio_read_pendbase(struct kvm_vcpu *vcpu, > gpa_t addr, unsigned int len) > { > struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; > + u64 value = vgic_cpu->pendbaser; > > - return extract_bytes(vgic_cpu->pendbaser, addr & 7, len); > + value &= ~GICR_PENDBASER_PTZ; > + > + return extract_bytes(value, addr & 7, len); > } > > static void vgic_mmio_write_pendbase(struct kvm_vcpu *vcpu, Otherwise looks good. I'll queue it with Eric's correction to the subject line. Thanks, M. -- Jazz is not dead. It just smells funny...