From patchwork Thu Jan 21 16:51:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 8083181 Return-Path: X-Original-To: patchwork-xen-devel@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 804359F6FA for ; Thu, 21 Jan 2016 16:54:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8EB5620504 for ; Thu, 21 Jan 2016 16:54:36 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AB01B204FF for ; Thu, 21 Jan 2016 16:54:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMISk-0003Yg-3h; Thu, 21 Jan 2016 16:51:58 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMISj-0003YE-4M for xen-devel@lists.xenproject.org; Thu, 21 Jan 2016 16:51:57 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id DC/15-13487-CAC01A65; Thu, 21 Jan 2016 16:51:56 +0000 X-Env-Sender: prvs=8211775ec=roger.pau@citrix.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1453395110!17350081!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 51881 invoked from network); 21 Jan 2016 16:51:55 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-12.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 21 Jan 2016 16:51:55 -0000 X-IronPort-AV: E=Sophos;i="5.22,326,1449532800"; d="scan'208";a="326845296" From: Roger Pau Monne To: Date: Thu, 21 Jan 2016 17:51:32 +0100 Message-ID: <1453395092-88090-7-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 1.9.5 (Apple Git-50.3) In-Reply-To: <1453395092-88090-1-git-send-email-roger.pau@citrix.com> References: <1453395092-88090-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Andrew Cooper , Jan Beulich , Roger Pau Monne Subject: [Xen-devel] [PATCH v4 6/6] x86/HVM: report the set of enabled emulated devices through CPUID X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable 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 Add a new HVM-specific feature flag that signals the presence of a bitmap that contains the current set of enabled emulated devices. The bitmap is placed in the ecx register. The bit fields used in the bitmap are the same as the ones used in the xen_arch_domainconfig emulation_flags field, and their meaning can be found at arch-x86/xen.h. This will allow Xen to enable emulated devices for HVMlite guests in the future, by having a proper ABI for reporting which devices are enabled. Signed-off-by: Roger Pau Monné --- Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/hvm/hvm.c | 4 ++++ xen/include/public/arch-x86/cpuid.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 674feea..f0145f6 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4536,6 +4536,10 @@ void hvm_hypervisor_cpuid_leaf(uint32_t sub_idx, /* Indicate presence of vcpu id and set it in ebx */ *eax |= XEN_HVM_CPUID_VCPU_ID_PRESENT; *ebx = current->vcpu_id; + + /* Indicate the presence of the devices bitmap in ecx. */ + *eax |= XEN_HVM_CPUID_DEVICES_BITMAP; + *ecx = current->domain->arch.emulation_flags; } } diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h index d709340..7222483 100644 --- a/xen/include/public/arch-x86/cpuid.h +++ b/xen/include/public/arch-x86/cpuid.h @@ -78,12 +78,17 @@ * HVM-specific features * EAX: Features * EBX: vcpu id (iff EAX has XEN_HVM_CPUID_VCPU_ID_PRESENT flag) + * ECX: bitmap of enabled devices, according to the bit fields defined in + * arch-x86/xen.h. All unused bits have undefined values. The contents + * of this register is only valid if EAX has the + * XEN_HVM_CPUID_DEVICES_BITMAP flag set. */ #define XEN_HVM_CPUID_APIC_ACCESS_VIRT (1u << 0) /* Virtualized APIC registers */ #define XEN_HVM_CPUID_X2APIC_VIRT (1u << 1) /* Virtualized x2APIC accesses */ /* Memory mapped from other domains has valid IOMMU entries */ #define XEN_HVM_CPUID_IOMMU_MAPPINGS (1u << 2) #define XEN_HVM_CPUID_VCPU_ID_PRESENT (1u << 3) /* vcpu id is present in EBX */ +#define XEN_HVM_CPUID_DEVICES_BITMAP (1u << 4) /* device bitmap in ECX */ #define XEN_CPUID_MAX_NUM_LEAVES 4