From patchwork Wed Dec 3 16:07:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 41861 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E9BAB25E88 for ; Wed, 3 Dec 2014 16:09:12 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf9908043eek.0 for ; Wed, 03 Dec 2014 08:09:12 -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=Jucit/lAXd9wPEa1ZRWMQkhYc7v2fXpVCWukcy3/1nY=; b=FYvBnwmq3rvPjbxlkTRtz9quFxclYFPoXpFHM82I/1azkNUab2CfGvs6nwK0AEywry ZpshYq8AHT0vW+ASiPPqDvhk24t+8bHulVNDw/mV5hOiJLzWBVPFe5LoQKdXExvW1RiY oxB115g1WLc0RGLcXMt4N6qnD+v3jy3v/SSchfbU8fMSdIbj1cyZ1LUFr9I+NDrUzDzF VV9mQb+IZndt+SHNCXJK5jvtWDFUpTXiT6PgVtw6Nz/LvN17ISLbKfPcAzdMDyHRa0IJ 3jbO986Vl5eoEiDASm/Nk5Zwowbh7xyHEliAnUMXIcY8pTrxb5qzep7NJYEPx9ozRvzB pgLg== X-Gm-Message-State: ALoCoQlY7af9/tTssDvPhpZuB29gyQb23r3BuZWvl2ROK1vqOXVz3+QYM8EpuTCBRo5OQRqKdszx X-Received: by 10.112.169.101 with SMTP id ad5mr1244076lbc.1.1417622951766; Wed, 03 Dec 2014 08:09:11 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.202 with SMTP id u10ls138810lau.68.gmail; Wed, 03 Dec 2014 08:09:11 -0800 (PST) X-Received: by 10.112.202.71 with SMTP id kg7mr4978588lbc.16.1417622951585; Wed, 03 Dec 2014 08:09:11 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id cr10si23445711lad.33.2014.12.03.08.09.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 08:09:11 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id s18so13059641lam.35 for ; Wed, 03 Dec 2014 08:09:11 -0800 (PST) X-Received: by 10.112.14.69 with SMTP id n5mr5038688lbc.34.1417622951122; Wed, 03 Dec 2014 08:09:11 -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 ew9csp691585lbc; Wed, 3 Dec 2014 08:09:10 -0800 (PST) X-Received: by 10.194.243.106 with SMTP id wx10mr8260944wjc.97.1417622950272; Wed, 03 Dec 2014 08:09:10 -0800 (PST) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com. [209.85.212.180]) by mx.google.com with ESMTPS id t6si40599189wjz.101.2014.12.03.08.09.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 08:09:10 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.180 as permitted sender) client-ip=209.85.212.180; Received: by mail-wi0-f180.google.com with SMTP id n3so24904347wiv.7 for ; Wed, 03 Dec 2014 08:09:09 -0800 (PST) X-Received: by 10.194.200.1 with SMTP id jo1mr8937072wjc.64.1417622949545; Wed, 03 Dec 2014 08:09:09 -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 kn5sm36849121wjb.48.2014.12.03.08.09.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 08:09:08 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, alex.williamson@redhat.com, agraf@suse.de, joel.schopp@amd.com, gleb@kernel.org, pbonzini@redhat.com, borntraeger@de.ibm.com, cornelia.huck@de.ibm.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, a.motakis@virtualopensystems.com Subject: [PATCH v5 4/5] KVM: irqfd: use kvm_arch_is_virtual_intc_initialized Date: Wed, 3 Dec 2014 17:07:11 +0100 Message-Id: <1417622832-5460-5-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417622832-5460-1-git-send-email-eric.auger@linaro.org> References: <1417622832-5460-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.215.48 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: , On arm/arm64, the interrupt controller is dynamically instantiated. There is a risk the user-space assigns an irqfd before this latter is initialized and ready to accept virtual irq injection. On such attempt, the IRQFD setup is rejected and -EAGAIN is returned. Signed-off-by: Eric Auger --- virt/kvm/eventfd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index b0fb390..f837c83 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -314,6 +314,9 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args) unsigned int events; int idx; + if (!kvm_arch_is_virtual_intc_initialized(kvm)) + return -EAGAIN; + irqfd = kzalloc(sizeof(*irqfd), GFP_KERNEL); if (!irqfd) return -ENOMEM;