From patchwork Fri Apr 24 05:27:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47491 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3CB0920553 for ; Fri, 24 Apr 2015 05:29:55 +0000 (UTC) Received: by wgiv13 with SMTP id v13sf8997867wgi.3 for ; Thu, 23 Apr 2015 22:29:54 -0700 (PDT) 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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=/PKwFTRiE29baFezw5U23xlB/wxDbS5A7eBIugY2oek=; b=EQS85cN/D+vGuWzyYp0A6S+/xJoG8lOmmHppwR29bZwVlZEebM7yfihZdz/7XWHiGC f7qqHd+rszIPJ78APeH+AIIeq4bEww+kCdgjvf5hcu+/hEEuDT1KjYSmk41jZ2mSZLAH U2mRs4cKH7I9TFYqo6azFq1iX79z9o7OXUkAGmZE67CUVvP4gQdEbV6kNAqlURABmE8n bzBL8RZu7xserhE7BphgmN50S+2OKZheWLj8qC3b+EZtPw1nD4XF13WGk1FbEqZdJaLa QKOl5SXxQqvvklppF3zswVjAbTlxT6kD84Kdeu/l2k/eAbnVOVBeZqc4q9JNxZq+ysMt bscw== X-Gm-Message-State: ALoCoQnCI3sbyfKPOaDSn4pAYBKZutKYiG4Q1t7+FDQ10/py3HzuMn3CTFrANq5L+TVKhaorXg6K X-Received: by 10.112.219.200 with SMTP id pq8mr3254673lbc.7.1429853394521; Thu, 23 Apr 2015 22:29:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.66 with SMTP id i2ls453905lah.19.gmail; Thu, 23 Apr 2015 22:29:54 -0700 (PDT) X-Received: by 10.152.87.233 with SMTP id bb9mr5437595lab.38.1429853394245; Thu, 23 Apr 2015 22:29:54 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id dh4si7474303lac.35.2015.04.23.22.29.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 22:29:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbbzk7 with SMTP id zk7so28583619lbb.0 for ; Thu, 23 Apr 2015 22:29:54 -0700 (PDT) X-Received: by 10.152.4.137 with SMTP id k9mr5349186lak.29.1429853394102; Thu, 23 Apr 2015 22:29:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp976981lbt; Thu, 23 Apr 2015 22:29:53 -0700 (PDT) X-Received: by 10.66.151.98 with SMTP id up2mr11468632pab.63.1429853392285; Thu, 23 Apr 2015 22:29:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gw3si15799508pac.117.2015.04.23.22.29.51; Thu, 23 Apr 2015 22:29:52 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752681AbbDXF3v (ORCPT + 2 others); Fri, 24 Apr 2015 01:29:51 -0400 Received: from mail-ob0-f177.google.com ([209.85.214.177]:32772 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbbDXF3u (ORCPT ); Fri, 24 Apr 2015 01:29:50 -0400 Received: by oblw8 with SMTP id w8so30241509obl.0 for ; Thu, 23 Apr 2015 22:29:50 -0700 (PDT) X-Received: by 10.60.78.72 with SMTP id z8mr5679547oew.13.1429853390136; Thu, 23 Apr 2015 22:29:50 -0700 (PDT) Received: from localhost ([167.160.116.36]) by mx.google.com with ESMTPSA id e74sm6084309oib.16.2015.04.23.22.29.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 23 Apr 2015 22:29:49 -0700 (PDT) From: shannon.zhao@linaro.org To: stable@vger.kernel.org Cc: jslaby@suse.cz, christoffer.dall@linaro.org, shannon.zhao@linaro.org, Marc Zyngier Subject: [PATCH for 3.12.y stable 06/63] ARM: KVM: fix L2CTLR to be per-cluster Date: Fri, 24 Apr 2015 13:27:04 +0800 Message-Id: <1429853281-6136-7-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1429853281-6136-1-git-send-email-shannon.zhao@linaro.org> References: <1429853281-6136-1-git-send-email-shannon.zhao@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shannon.zhao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Marc Zyngier commit 9cbb6d969cb6561de45d917b8bb9281cb374bb35 upstream. 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 Signed-off-by: Shannon Zhao --- arch/arm/kvm/coproc_a15.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/kvm/coproc_a15.c b/arch/arm/kvm/coproc_a15.c index 8611c5c..935fa0f 100644 --- a/arch/arm/kvm/coproc_a15.c +++ b/arch/arm/kvm/coproc_a15.c @@ -79,6 +79,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;