From patchwork Tue Apr 30 14:49:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 2505471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 74BEBDFB75 for ; Tue, 30 Apr 2013 15:43:12 +0000 (UTC) Received: from merlin.infradead.org ([205.233.59.134]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXC1u-0005Dd-AW; Tue, 30 Apr 2013 14:59:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXBvt-0003I7-BB; Tue, 30 Apr 2013 14:53:29 +0000 Received: from casper.infradead.org ([85.118.1.10]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXBtA-00035b-Tt for linux-arm-kernel@merlin.infradead.org; Tue, 30 Apr 2013 14:50:41 +0000 Received: from mail-da0-x236.google.com ([2607:f8b0:400e:c00::236]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXBt7-0001hv-60 for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2013 14:50:39 +0000 Received: by mail-da0-f54.google.com with SMTP id s35so279429dak.13 for ; Tue, 30 Apr 2013 07:50:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=1IVwEQXymaSNirr3mJ6AihKL6oEuyxRsyzqwhIb/DEs=; b=A+a90HMv/dOrkj6DdyukCTdWjuNBTA10VMuMpzmN+euau0JDeM7Yp5OEYMBGgozdhp LXqrudinbfqqObw5n4fbYLr9kUnB0nrCN+hsBm5dOapjhjdDgk3t8/MwD8kOHzFCQgKf gO2Zw2mxf0eyJB95HQv58mCJmF15+RqJC3xksGvax4fbV/Rnos+mkWPE5aB+5LdCxc9R lmC3Sjcto5BUTxGQX9MXx0BjN0nv/NKLchfsJgrjQ/rPysvPo/Mf25LBwnZd6l5LIpQT 1KpfftinPxV79zv85ke/fyRDKxWKVPWgasO1xXz6qdpGHP1q0qT7SAde23SBAqBVOMxa veSQ== X-Received: by 10.66.254.162 with SMTP id aj2mr24774173pad.85.1367333412954; Tue, 30 Apr 2013 07:50:12 -0700 (PDT) Received: from localhost.localdomain (c-67-169-183-77.hsd1.ca.comcast.net. [67.169.183.77]) by mx.google.com with ESMTPSA id cq1sm28799244pbc.13.2013.04.30.07.50.11 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Apr 2013 07:50:12 -0700 (PDT) From: Christoffer Dall To: kvm@vger.kernel.org Subject: [PATCH 15/15] ARM: KVM: iterate over all CPUs for CPU compatibility check Date: Tue, 30 Apr 2013 07:49:36 -0700 Message-Id: <1367333376-30983-16-git-send-email-cdall@cs.columbia.edu> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1367333376-30983-1-git-send-email-cdall@cs.columbia.edu> References: <1367333376-30983-1-git-send-email-cdall@cs.columbia.edu> X-Gm-Message-State: ALoCoQkp8RZc5iyd6ihL3AxAHW9hHk6AyI6gHXjs7XPnGmIqt6JAhUdsEYIyEtrKnylft/IpHOOh X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130430_155037_522055_7559CE11 X-CRM114-Status: GOOD ( 16.71 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Christoffer Dall , Andre Przywara , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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 From: Andre Przywara kvm_target_cpus() checks the compatibility of the used CPU with KVM, which is currently limited to ARM Cortex-A15 cores. However by calling it only once on any random CPU it assumes that all cores are the same, which is not necessarily the case (for example in Big.Little). [ I cut some of the commit message and changed the formatting of the code slightly to pass checkpatch and look more like the rest of the kvm/arm init code - Christoffer ] Signed-off-by: Andre Przywara Signed-off-by: Christoffer Dall --- arch/arm/kvm/arm.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 089c0a4..5bc99b4 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -947,21 +947,30 @@ out_err: return err; } +static void check_kvm_target_cpu(void *ret) +{ + *(int *)ret = kvm_target_cpu(); +} + /** * Initialize Hyp-mode and memory mappings on all CPUs. */ int kvm_arch_init(void *opaque) { int err; + int ret, cpu; if (!is_hyp_mode_available()) { kvm_err("HYP mode not available\n"); return -ENODEV; } - if (kvm_target_cpu() < 0) { - kvm_err("Target CPU not supported!\n"); - return -ENODEV; + for_each_online_cpu(cpu) { + smp_call_function_single(cpu, check_kvm_target_cpu, &ret, 1); + if (ret < 0) { + kvm_err("Error, CPU %d not supported!\n", cpu); + return -ENODEV; + } } err = init_hyp_mode();