Received: by 10.192.165.156 with SMTP id m28csp438515imm; Fri, 13 Apr 2018 01:41:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+aZgyF+s/U3PdqqyBOEBqX76AO3+xupDyY5Xw3mn7y8xcdiFIeX0ReFZ6Xg89Lfa10q+oU X-Received: by 2002:a17:902:bf05:: with SMTP id bi5-v6mr4281811plb.235.1523608905555; Fri, 13 Apr 2018 01:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523608905; cv=none; d=google.com; s=arc-20160816; b=aA6BoIvElHQf86Vjl6qqWCcqxlu5bfk8BYQTpz4c2mawpBcO9WMgsr15x5p23n4byg JcfV19onHagt06BCOD7/ppxC0O/99WTskGEmtD0WzCCB9PCAxD+l6A2wavcDyEyRceap Eqfn9Dtc5soB7Wn/flGZc7FyJNcK2QgBlYFELDPtfqsnNFRjJzkj+thVPb1b7dPbmI/9 WUsGGLSiItiel/cBXGFH/BsukzQhoY9Qk8JGqX5Y/isS80mpms3BoDXQOhQRnaAKXQor her87TVSKZnGBz8PpUnOUzFjbJ2rVvXY0DeWYwOuxAHmaRua43EF0U1e+q4KvfIr1JG5 45TQ== 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=cVE2peNOOy8Ign7Qy4op4ywNd+lK/BadlUmDKF9AZnI=; b=XYrxFK18CinscoJYprFtHnBH1/unU9z9QObPsrRajiqavBLnu/qF2IWoymWTNXujAy rxFw7LcMabsM2GOKVxpL1y2/w2IafqM2kd35oXUMIROIzA+pewMLeDWfAKdVJuq4g4HD 4DYPdI9cBxUaR388zi+snfm4ASN3+2G/lj6eIjekdltkbkZfSo2/VP2fiEgBVoe4NAYt mxMHKq/JIPgNvdUQiMokfDjqisEJp2Stp4RHRfcb2yv3enmWB8Ej3g8kRBygKgzIIejT BZOYXmKIPcVfwZsrPZVd4QQzFZjwigEJ3wA5E+eJIeehmAEJ5/5Nd32nC/BRBqV8yHxa Z3Fg== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a123si3739344pgc.43.2018.04.13.01.41.31; Fri, 13 Apr 2018 01:41:45 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753745AbeDMIVZ (ORCPT + 99 others); Fri, 13 Apr 2018 04:21:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43932 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753306AbeDMIVO (ORCPT ); Fri, 13 Apr 2018 04:21:14 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4C2CC401DEA9; Fri, 13 Apr 2018 08:21:14 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-192.ams2.redhat.com [10.36.116.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F070215CDC8; Fri, 13 Apr 2018 08:21:12 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, cdall@kernel.org, peter.maydell@linaro.org Cc: andre.przywara@arm.com, drjones@redhat.com, wei@redhat.com Subject: [PATCH v3 05/12] KVM: arm/arm64: Revisit Redistributor TYPER last bit computation Date: Fri, 13 Apr 2018 10:20:51 +0200 Message-Id: <1523607658-9166-6-git-send-email-eric.auger@redhat.com> In-Reply-To: <1523607658-9166-1-git-send-email-eric.auger@redhat.com> References: <1523607658-9166-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 13 Apr 2018 08:21:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 13 Apr 2018 08:21:14 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eric.auger@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The TYPER of an redistributor reflects whether the rdist is the last one of the redistributor region. Let's compare the TYPER GPA against the address of the last occupied slot within the redistributor region. Signed-off-by: Eric Auger --- virt/kvm/arm/vgic/vgic-mmio-v3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c index 49ca176..ce5c927 100644 --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c @@ -184,12 +184,17 @@ static unsigned long vgic_mmio_read_v3r_typer(struct kvm_vcpu *vcpu, gpa_t addr, unsigned int len) { unsigned long mpidr = kvm_vcpu_get_mpidr_aff(vcpu); + struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; + struct vgic_redist_region *rdreg = vgic_cpu->rdreg; int target_vcpu_id = vcpu->vcpu_id; + gpa_t last_rdist_typer = rdreg->base + GICR_TYPER + + (rdreg->free_index - 1) * KVM_VGIC_V3_REDIST_SIZE; u64 value; value = (u64)(mpidr & GENMASK(23, 0)) << 32; value |= ((target_vcpu_id & 0xffff) << 8); - if (target_vcpu_id == atomic_read(&vcpu->kvm->online_vcpus) - 1) + + if (addr == last_rdist_typer) value |= GICR_TYPER_LAST; if (vgic_has_its(vcpu->kvm)) value |= GICR_TYPER_PLPIS; -- 2.5.5