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: Auger Eric X-Patchwork-Id: 41915 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 9B47D25E8C for ; Thu, 4 Dec 2014 09:49:56 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf10670837lab.7 for ; Thu, 04 Dec 2014 01:49:55 -0800 (PST) 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=v40VJog7pjraEmiXcl07+8IbqPtoRvnYMfVxkKb0ldY=; b=C/Z7LHaNOg3elDLjhAefAFmazTYPcXdwcwyOItdKrc2XnSqCG3O7gVjnsXt6vmFGNK i7//8KsXx6bLMhxOHGc0/d7iPInZEzc5wJtVMBSu5Ia9VUw232A8NBa5Wn9XXYC9cTj1 T2Uk0yNot1U4rXzUPZrm4Lks/emNwV/qohCgPQNMsuqbB2VJN+TDyKC0Nn1msm1jJSQl lJ9jA1kruERapY9yzS0DnzKvZkSyFPZILvUEkY1ySm0w/OfoFF4T9W3RkKneLAftbRm4 rKwD8wcR2/asgYwHqJIo1208wvomRDMopaDqBC6TsGtCyyLYp9gNdMV26IdUYd/m4wXJ JLnA== X-Gm-Message-State: ALoCoQnw1n41e2P0Nlp0MA+bo1+fsFieuE0BnSxpi1Y3U/e4EqO4dX5lbsqjW+H7E0Vn1EVX3zrn X-Received: by 10.180.105.97 with SMTP id gl1mr16212969wib.7.1417686595608; Thu, 04 Dec 2014 01:49:55 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.106 with SMTP id x10ls203842laj.58.gmail; Thu, 04 Dec 2014 01:49:55 -0800 (PST) X-Received: by 10.152.25.168 with SMTP id d8mr8522902lag.41.1417686595456; Thu, 04 Dec 2014 01:49:55 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id la2si16717032lbc.44.2014.12.04.01.49.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Dec 2014 01:49:55 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id u10so13553247lbd.6 for ; Thu, 04 Dec 2014 01:49:55 -0800 (PST) X-Received: by 10.152.2.165 with SMTP id 5mr8570319lav.40.1417686595385; Thu, 04 Dec 2014 01:49:55 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp6853lbc; Thu, 4 Dec 2014 01:49:54 -0800 (PST) X-Received: by 10.194.185.68 with SMTP id fa4mr13870580wjc.83.1417686593587; Thu, 04 Dec 2014 01:49:53 -0800 (PST) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com. [209.85.212.173]) by mx.google.com with ESMTPS id dr1si715644wib.48.2014.12.04.01.49.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Dec 2014 01:49:53 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.173 as permitted sender) client-ip=209.85.212.173; Received: by mail-wi0-f173.google.com with SMTP id r20so34124639wiv.12 for ; Thu, 04 Dec 2014 01:49:53 -0800 (PST) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@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.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;