Received: by 10.213.65.68 with SMTP id h4csp695649imn; Tue, 27 Mar 2018 07:09:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Gjz2zSi4q8ZJvlZYuT8JzHmMvjc6biIanZI80TvCWBegYdrEst9SEpH29KCb6TtEi6EZH X-Received: by 10.98.32.87 with SMTP id g84mr3787098pfg.28.1522159747507; Tue, 27 Mar 2018 07:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522159747; cv=none; d=google.com; s=arc-20160816; b=JolYXqzAmwdDg4nieAhrqJKSYkXL4g17iJ/wzy+oVuGSYKCQw2BTT/tTSp/QndPpQv wZ/fOsqrTM8fJOryIPoPPZdwZdRaBTjJKvYj7P4cmCmkN+VaJeERxb8iznUPKn1ILMID F64JwFw8buepXjTz7rKfyW+xhv5MuLszeQ871jPH6gOBND+k7EQq5xV4etrSXGpIir3D xozfRNPKTzWZ5cp+3ihmiHV0+hYs9tnLKnTGKC1JwBZ6SNax/6zXUKxFf7DCQ1Sph6lX jLSOK0S7ZDrtdWGaBpqBkYdSGPe2TQoDBJVF/NE+vedkLzrLUSSdeKiFY45LMGNQNckD kdkQ== 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=KnjKDnWisHyMLUWiBnO4oSf6MiKQV9n23YCcUoTeTDhyD+x9rmmathMtwipvb/YgXL KSIT35WsZh9r9FgG4DAVeNKr5a8yrg42S+PWtcRg5Ix6py/gHoqCdhRCf8DvBVv6c2K8 mMF0IBCOPSdv2eS61OfA5h83XHtm09HeDDzev+D3fOb0xlZWCDzbBTWV2x5w5swgoS1p q382GNEw1lW7YH3ARpgmrM8WFGR6AGHXboiMvy8WxqpxccILp/2yDmVI4I8u3r3hmcxW qP4RiULqmimErxxI0DeJ6CyJnLOh68VBlYZ8ZaXG5qx4DEaOCLoHZqAgSWioDqUsIHAU 1x5w== 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 136si906241pgf.810.2018.03.27.07.08.52; Tue, 27 Mar 2018 07:09:07 -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 S1752759AbeC0OHE (ORCPT + 99 others); Tue, 27 Mar 2018 10:07:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35952 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750944AbeC0OEf (ORCPT ); Tue, 27 Mar 2018 10:04:35 -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 451B17CBBA; Tue, 27 Mar 2018 14:04:35 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-135.ams2.redhat.com [10.36.116.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B398215CDB5; Tue, 27 Mar 2018 14:04:33 +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: [RFC v2 05/12] KVM: arm/arm64: Revisit Redistributor TYPER last bit computation Date: Tue, 27 Mar 2018 16:04:09 +0200 Message-Id: <1522159456-10419-6-git-send-email-eric.auger@redhat.com> In-Reply-To: <1522159456-10419-1-git-send-email-eric.auger@redhat.com> References: <1522159456-10419-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.2]); Tue, 27 Mar 2018 14:04:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 27 Mar 2018 14:04:35 +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