From patchwork Fri Apr 24 05:26:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47486 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AA31520553 for ; Fri, 24 Apr 2015 05:28:48 +0000 (UTC) Received: by labgx2 with SMTP id gx2sf9437862lab.1 for ; Thu, 23 Apr 2015 22:28:47 -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=y/fHKwBZpEiDX2WnFP10li6NnoAtjW0hlBOOc5T/Jbc=; b=JhCXnSz287Qnwx7IguFKtws61w5L/GNleptWWgq21iJtR/8sDz0dc8scwX+lEjtei0 zzm7ioZk8l+IbtGtZxF68NrxOWW96AH1h/aWQeIuu5FlkUmhcXP+zcTcYyPGDoCS87HT YtpPpMDHWEvYkGHaSeQgXTgTOdVVz9N+YPo4gAuza/wK7uPJV01AGSvsy0v+1k0+9fg9 qAr3oHZIi4/+doxR9piw5I9kqPo8V9JqFBub8ZhieZ0TdSuKaCRe6WPkBJ8bMXvqzm+B 2/x8njEXuLbZzzemVGm3bGtpyb5A3E5lzXG0Pun11iDwSo66seAziRYrVkG3pwkwzt5C I3yQ== X-Gm-Message-State: ALoCoQkb+uy5DQgnwY+/vf3JvmYHqvmajZMYHk+bAAY69P621XcA+Ul1JNPX3BglaNCl/fMQ7hS8 X-Received: by 10.112.122.39 with SMTP id lp7mr3180166lbb.5.1429853327591; Thu, 23 Apr 2015 22:28:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.36 with SMTP id g4ls445928lah.33.gmail; Thu, 23 Apr 2015 22:28:47 -0700 (PDT) X-Received: by 10.112.35.230 with SMTP id l6mr5409117lbj.5.1429853327441; Thu, 23 Apr 2015 22:28:47 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id ps10si7475713lbb.26.2015.04.23.22.28.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 22:28:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lagv1 with SMTP id v1so27494838lag.3 for ; Thu, 23 Apr 2015 22:28:47 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr3655375lbc.19.1429853327113; Thu, 23 Apr 2015 22:28:47 -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 l1csp976623lbt; Thu, 23 Apr 2015 22:28:46 -0700 (PDT) X-Received: by 10.69.17.68 with SMTP id gc4mr2042047pbd.7.1429853324551; Thu, 23 Apr 2015 22:28:44 -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.28.43; Thu, 23 Apr 2015 22:28:44 -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 S1754494AbbDXF2m (ORCPT + 2 others); Fri, 24 Apr 2015 01:28:42 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:35228 "EHLO mail-ob0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754481AbbDXF2m (ORCPT ); Fri, 24 Apr 2015 01:28:42 -0400 Received: by obcux3 with SMTP id ux3so30159366obc.2 for ; Thu, 23 Apr 2015 22:28:41 -0700 (PDT) X-Received: by 10.202.190.134 with SMTP id o128mr3413304oif.111.1429853321530; Thu, 23 Apr 2015 22:28:41 -0700 (PDT) Received: from localhost ([167.160.116.36]) by mx.google.com with ESMTPSA id i6sm6007299oep.4.2015.04.23.22.28.39 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 23 Apr 2015 22:28:40 -0700 (PDT) From: shannon.zhao@linaro.org To: stable@vger.kernel.org Cc: jslaby@suse.cz, christoffer.dall@linaro.org, shannon.zhao@linaro.org, Jonathan Austin Subject: [PATCH for 3.12.y stable 01/63] KVM: ARM: Fix calculation of virtual CPU ID Date: Fri, 24 Apr 2015 13:26:59 +0800 Message-Id: <1429853281-6136-2-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.215.54 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: Jonathan Austin commit 1158fca401e09665c440a9fe4fd4f131ee85c13b upstream. KVM does not have a notion of multiple clusters for CPUs, just a linear array of CPUs. When using a system with cores in more than one cluster, the current method for calculating the virtual MPIDR will leak the (physical) cluster information into the virtual MPIDR. One effect of this is that Linux under KVM fails to boot multiple CPUs that aren't in the 0th cluster. This patch does away with exposing the real MPIDR fields in favour of simply using the virtual CPU number (but preserving the U bit, as before). Signed-off-by: Jonathan Austin Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall Signed-off-by: Shannon Zhao --- arch/arm/kvm/coproc_a15.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/arm/kvm/coproc_a15.c b/arch/arm/kvm/coproc_a15.c index cf93472..bbd4b88 100644 --- a/arch/arm/kvm/coproc_a15.c +++ b/arch/arm/kvm/coproc_a15.c @@ -27,14 +27,11 @@ static void reset_mpidr(struct kvm_vcpu *vcpu, const struct coproc_reg *r) { /* - * Compute guest MPIDR: - * (Even if we present only one VCPU to the guest on an SMP - * host we don't set the U bit in the MPIDR, or vice versa, as - * revealing the underlying hardware properties is likely to - * be the best choice). + * Compute guest MPIDR. No need to mess around with different clusters + * but we read the 'U' bit from the underlying hardware directly. */ - vcpu->arch.cp15[c0_MPIDR] = (read_cpuid_mpidr() & ~MPIDR_LEVEL_MASK) - | (vcpu->vcpu_id & MPIDR_LEVEL_MASK); + vcpu->arch.cp15[c0_MPIDR] = (read_cpuid_mpidr() & MPIDR_SMP_BITMASK) + | vcpu->vcpu_id; } #include "coproc.h"