From patchwork Tue Jan 13 17:33:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 5622641 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5CBCD9F6E2 for ; Tue, 13 Jan 2015 17:36:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F4A120551 for ; Tue, 13 Jan 2015 17:36:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A738820573 for ; Tue, 13 Jan 2015 17:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752829AbbAMRfs (ORCPT ); Tue, 13 Jan 2015 12:35:48 -0500 Received: from mail-wg0-f50.google.com ([74.125.82.50]:50678 "EHLO mail-wg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752600AbbAMRfq (ORCPT ); Tue, 13 Jan 2015 12:35:46 -0500 Received: by mail-wg0-f50.google.com with SMTP id a1so4327226wgh.9 for ; Tue, 13 Jan 2015 09:35:44 -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=zsFmyxD4wMqrMk3OD+ODF138CACoaWqZNKO/XsVIte8=; b=P8V2Wtwj9MaYVe77WNXSOAu6m3E4mTB31XS/6yp2f3rxnI7Eg+RdklUklnBR8Rs2xH t1FV09K8pQ51x1I84b7EgOWrbHrsMCmTKnumVn3bCju/8pldPiThC6z30CmAiaim1WHw e+x7L67rPBUiE2oV+smZlJiG9cM2rQ/H7BrZGlvxFrDLoFq1MfmeMof1FRaPcLifnYSm YYc2a2ox0Gt1WY/H5fijuLwL5WVD2PwU/dc6q93PpYGEEu0ReHiqKN4LACDC+Gm1EoPa k0Gg+bAUzSGCRpHi7u1SzKM1cdMpaOtPgh6toWjtWS+vPxlMlEOo/DHvCiD4nlUQF4PO L/Og== X-Gm-Message-State: ALoCoQnCZL6HE+AdbOZApWmDB1cDBWSwdOuQy9/Gup3PCAj+5kPn3a0A2iWIDq///7zXG2GhHHJc X-Received: by 10.180.24.138 with SMTP id u10mr779849wif.80.1421170544770; Tue, 13 Jan 2015 09:35:44 -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 fw6sm2660487wib.1.2015.01.13.09.35.42 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 09:35:43 -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, joel.schopp@amd.com, kim.phillips@freescale.com, paulus@samba.org, gleb@kernel.org, pbonzini@redhat.com, borntraeger@de.ibm.com, cornelia.huck@de.ibm.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, will.deacon@arm.com, a.motakis@virtualopensystems.com, a.rigo@virtualopensystems.com, john.liuli@huawei.com, ming.lei@canonical.com, feng.wu@intel.com, b.reynal@virtualopensystems.com Subject: [PATCH v6 2/4] KVM: introduce kvm_arch_intc_initialized Date: Tue, 13 Jan 2015 18:33:38 +0100 Message-Id: <1421170420-30617-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421170420-30617-1-git-send-email-eric.auger@linaro.org> References: <1421170420-30617-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 Introduce __KVM_HAVE_ARCH_INTC_INITIALIZED define and associated kvm_arch_intc_initialized function. This latter allows to test whether the virtual interrupt controller is initialized and ready to accept virtual IRQ injection. On some architectures, the virtual interrupt controller is dynamically instantiated, justifying that kind of check. Signed-off-by: Eric Auger Acked-by: Christoffer Dall --- v5 -> v6: - rename function name and macro - add kvm_arch_intc_initialized declaration in case the archi defines the macro --- include/linux/kvm_host.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 26f1060..702036a 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -706,6 +706,20 @@ static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) #endif } +#ifdef __KVM_HAVE_ARCH_INTC_INITIALIZED +/* + * returns trues if the virtual interrupt controller is initialized and + * ready to accept virtual IRQ. On some architectures the virtual interrupt + * controller is dynamically instantiated and this is not always true. + */ +bool kvm_arch_intc_initialized(struct kvm *kvm); +#else +static inline bool kvm_arch_intc_initialized(struct kvm *kvm) +{ + return true; +} +#endif + int kvm_arch_init_vm(struct kvm *kvm, unsigned long type); void kvm_arch_destroy_vm(struct kvm *kvm); void kvm_arch_sync_events(struct kvm *kvm);