From patchwork Fri Nov 8 01:32:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 21405 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AB1AB25E16 for ; Fri, 8 Nov 2013 01:31:08 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id z20sf2138411yhz.7 for ; Thu, 07 Nov 2013 17:31:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=EOcqTRg7AXrkX9svo1kIyxix0QqLelGUcmzGfH7erTo=; b=k+g/IrMUmSw1KcNb8mrFSoSvINdMCNc5eq14IW37FuLwUX7QRXFpoF41N04hvIQ1UN 2MHOCs09pE1SqXxd5WKaK8+8LOgKB6nszUb2TXbCv1SCYcu2lPTaiH00dJWphu1xsxve aqFXBQAvXP5tTRaJTDXBfE8NwDKvaE5NSGqA0wQfUoP5hvPYDyJtmxZJLBg7GtR31PSO 9ldjtGkgX0ys9u3+aBwF68fjO8RSoS7NPpI4DxGS8p7w32eoc6xSgrUzCE3QSBQhTKqy B88fsPN/eHfPzUplHgcigeev6/Gr7PrAGDjbcejbpat73oUy22uN1O2B8/Qbpf8nps7V pO8g== X-Gm-Message-State: ALoCoQl+2+x8RGTwumlnUV+wT/AHtCwNlTSf+SELb2ATiI4C6MI8vhrZHBwaMymoVZ6N4Y5QemHb X-Received: by 10.236.220.39 with SMTP id n37mr1451458yhp.15.1383874268455; Thu, 07 Nov 2013 17:31:08 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.133 with SMTP id h5ls1373571qej.54.gmail; Thu, 07 Nov 2013 17:31:08 -0800 (PST) X-Received: by 10.58.146.71 with SMTP id ta7mr9356461veb.23.1383874268340; Thu, 07 Nov 2013 17:31:08 -0800 (PST) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id rp4si2758218vcb.111.2013.11.07.17.31.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 17:31:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id jw12so260070veb.20 for ; Thu, 07 Nov 2013 17:31:08 -0800 (PST) X-Received: by 10.220.144.18 with SMTP id x18mr9304217vcu.15.1383874268037; Thu, 07 Nov 2013 17:31:08 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp62522vcz; Thu, 7 Nov 2013 17:31:07 -0800 (PST) X-Received: by 10.68.195.36 with SMTP id ib4mr12210639pbc.56.1383874267256; Thu, 07 Nov 2013 17:31:07 -0800 (PST) Received: from mail-pb0-f45.google.com (mail-pb0-f45.google.com [209.85.160.45]) by mx.google.com with ESMTPS id it5si4501177pbc.185.2013.11.07.17.31.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 17:31:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.45 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.160.45; Received: by mail-pb0-f45.google.com with SMTP id ma3so1433258pbc.4 for ; Thu, 07 Nov 2013 17:31:06 -0800 (PST) X-Received: by 10.67.22.38 with SMTP id hp6mr12889137pad.53.1383874266820; Thu, 07 Nov 2013 17:31:06 -0800 (PST) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id i6sm8072833pbc.1.2013.11.07.17.31.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 17:31:06 -0800 (PST) From: Christoffer Dall To: Gleb Natapov , Paolo Bonzini Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, Christoffer Dall Subject: [PATCH 2/4] ARM: KVM: fix L2CTLR to be per-cluster Date: Thu, 7 Nov 2013 17:32:00 -0800 Message-Id: <1383874322-12328-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1383874322-12328-1-git-send-email-christoffer.dall@linaro.org> References: <1383874322-12328-1-git-send-email-christoffer.dall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Marc Zyngier The L2CTLR register contains the number of CPUs in this cluster. Make sure the register content is actually relevant to the vcpu that is being configured by computing the number of cores that are part of its cluster. Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm/kvm/coproc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c index 631e6bd..78c0885 100644 --- a/arch/arm/kvm/coproc.c +++ b/arch/arm/kvm/coproc.c @@ -124,6 +124,10 @@ static void reset_l2ctlr(struct kvm_vcpu *vcpu, const struct coproc_reg *r) asm volatile("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr)); l2ctlr &= ~(3 << 24); ncores = atomic_read(&vcpu->kvm->online_vcpus) - 1; + /* How many cores in the current cluster and the next ones */ + ncores -= (vcpu->vcpu_id & ~3); + /* Cap it to the maximum number of cores in a single cluster */ + ncores = min(ncores, 3U); l2ctlr |= (ncores & 3) << 24; vcpu->arch.cp15[c9_L2CTLR] = l2ctlr;