From patchwork Thu Dec 4 09:48:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 5436561 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 831839F319 for ; Thu, 4 Dec 2014 09:51:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C35C020357 for ; Thu, 4 Dec 2014 09:51:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 04FDD20272 for ; Thu, 4 Dec 2014 09:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753354AbaLDJuv (ORCPT ); Thu, 4 Dec 2014 04:50:51 -0500 Received: from mail-wi0-f177.google.com ([209.85.212.177]:49645 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753200AbaLDJty (ORCPT ); Thu, 4 Dec 2014 04:49:54 -0500 Received: by mail-wi0-f177.google.com with SMTP id l15so27251640wiw.10 for ; Thu, 04 Dec 2014 01:49:53 -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=v40VJog7pjraEmiXcl07+8IbqPtoRvnYMfVxkKb0ldY=; b=bDWJkNG1OEXuEoDfYSUR7OhrNsr7AGfOtDix/aPie8n84yM40QAFL0gOTBhYMOncsj kFMjUCnjXE0gCb1YnRvDxu5frc2qWHERpqEAr3yRwplrsjMO4OgsOoB8bgXyBT+bDFHl KAVX/akIc+AO5qBOy9EdOm9/ZV9Oy9S7sbhtnOO1aPGNbf9uV6xcEII+920K72DNG4t/ xtzRRIVKqPjHRYOvfzwGCWeJUKzsLybVOmcWTgnR4nlsmjEHH9ZMykvi16Pu/Er9XiSR wIeix6AaBuEOceluCZTdYpW2AtMcJy1YogIc+kkscv9hcxRvSb+EA20V3vHPzK6a66Rt Ht6g== X-Gm-Message-State: ALoCoQmd1R6lJ8zSQ01yMr7st4FTYecoELEDFmsveHIjBk+R7Ze0B0i8St0C4S8cDQBqNS8lINbA X-Received: by 10.181.28.3 with SMTP id jk3mr10682763wid.16.1417686593370; Thu, 04 Dec 2014 01:49:53 -0800 (PST) Received: from gnx2579.gnb.st.com (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id wz5sm39765342wjc.29.2014.12.04.01.49.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Dec 2014 01:49:52 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, andre.przywara@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, alex.williamson@redhat.com, agraf@suse.de, gleb@kernel.org, pbonzini@redhat.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, will.deacon@arm.com, a.motakis@virtualopensystems.com Subject: [PATCH v2 3/4] KVM: arm/arm64: check vgic_initialized before VCPU creation Date: Thu, 4 Dec 2014 10:48:03 +0100 Message-Id: <1417686484-20828-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417686484-20828-1-git-send-email-eric.auger@linaro.org> References: <1417686484-20828-1-git-send-email-eric.auger@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Now that user-space can initiate VGIC initialization independently on the first vcpu run, let's check the user-space does not attempt to create a VCPU after this initialization. Signed-off-by: Eric Auger --- arch/arm/kvm/arm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index b5401f7..edcc66b 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -216,6 +216,11 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) int err; struct kvm_vcpu *vcpu; + if (unlikely(vgic_initialized(kvm))) { + err = -EBUSY; + goto out; + } + vcpu = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL); if (!vcpu) { err = -ENOMEM;