From patchwork Fri Nov 8 01:31:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 3155011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C6932BEEB2 for ; Fri, 8 Nov 2013 01:31:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C92C72049C for ; Fri, 8 Nov 2013 01:31:41 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8442C2041A for ; Fri, 8 Nov 2013 01:31:40 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Veav5-0006li-58; Fri, 08 Nov 2013 01:31:31 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Veav2-000802-LQ; Fri, 08 Nov 2013 01:31:28 +0000 Received: from mail-pd0-f172.google.com ([209.85.192.172]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Veav0-0007z2-8W for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2013 01:31:26 +0000 Received: by mail-pd0-f172.google.com with SMTP id w10so1414920pde.17 for ; Thu, 07 Nov 2013 17:31:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5LBZHY2dNLhI9iojTAag29hi2XG7pEn/kL335ww2rLo=; b=hJoTJxq0djrVqTQTwUsaK/AKPCX2wj504CFAEXiLtx9mlkL0vHBnumiiD5ZdSrR0rr xpmMDXt0KYIRTnVq5IWhb3B4EXuURe1Oia9FdBjQEXlWLNUIQMMEzhMWe4zVEsUMgbJf mDZyOnHVZqW8ga/he8uOW+1lhfcm1hxQET6HDr46yteUqrF/wETi3xr8RIT/TR2oFa/j rm8PfHGvk6xTINu3hMOSNRc3Bo1i52UCWPdb4ODKkyxb2zgVLhRdVucnoWkU1pATARl1 2D6V2VKfIz2A8TgArvd56IUXKOqQEcgHbC1KgBoeG4Y0m3WMeVcleY5yv4g4FoystiR9 RLkQ== X-Gm-Message-State: ALoCoQmFnrzQI0zjsM0baqeZ4VbdPNJZ/nTWIkMLiFhD0dxby5mDM0quterA2FuccTd703MbjjRl X-Received: by 10.68.137.9 with SMTP id qe9mr12141833pbb.133.1383874264042; Thu, 07 Nov 2013 17:31:04 -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.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 17:31:03 -0800 (PST) From: Christoffer Dall To: Gleb Natapov , Paolo Bonzini Subject: [PATCH 1/4] ARM: KVM: Fix MPIDR computing to support virtual clusters Date: Thu, 7 Nov 2013 17:31:59 -0800 Message-Id: <1383874322-12328-2-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131107_203126_409520_E2DBC3AF X-CRM114-Status: GOOD ( 11.01 ) X-Spam-Score: -1.9 (-) Cc: kvm@vger.kernel.org, patches@linaro.org, Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, Christoffer Dall X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier In order to be able to support more than 4 A7 or A15 CPUs, we need to fix the MPIDR computing to reflect the fact that both A15 and A7 can only exist in clusters of at most 4 CPUs. Fix the MPIDR computing to allow virtual clusters to be exposed to the guest. Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm/kvm/coproc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c index a629f2c..631e6bd 100644 --- a/arch/arm/kvm/coproc.c +++ b/arch/arm/kvm/coproc.c @@ -74,11 +74,13 @@ int kvm_handle_cp14_access(struct kvm_vcpu *vcpu, struct kvm_run *run) static void reset_mpidr(struct kvm_vcpu *vcpu, const struct coproc_reg *r) { /* - * Compute guest MPIDR. No need to mess around with different clusters - * but we read the 'U' bit from the underlying hardware directly. + * Compute guest MPIDR. We build a virtual cluster out of the + * vcpu_id, but we read the 'U' bit from the underlying + * hardware directly. */ - vcpu->arch.cp15[c0_MPIDR] = (read_cpuid_mpidr() & MPIDR_SMP_BITMASK) - | vcpu->vcpu_id; + vcpu->arch.cp15[c0_MPIDR] = ((read_cpuid_mpidr() & MPIDR_SMP_BITMASK) | + ((vcpu->vcpu_id >> 2) << MPIDR_LEVEL_BITS) | + (vcpu->vcpu_id & 3)); } /* TRM entries A7:4.3.31 A15:4.3.28 - RO WI */