From patchwork Mon Mar 20 17:08:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9634607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2461760132 for ; Mon, 20 Mar 2017 17:11:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FCB620453 for ; Mon, 20 Mar 2017 17:11:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04B8D27D4D; Mon, 20 Mar 2017 17:11:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ADDD120453 for ; Mon, 20 Mar 2017 17:11:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cq0na-00075f-5z; Mon, 20 Mar 2017 17:08:50 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cq0nY-00074h-Dh for xen-devel@lists.xenproject.org; Mon, 20 Mar 2017 17:08:48 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 9E/02-14551-F9C00D85; Mon, 20 Mar 2017 17:08:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeJIrShJLcpLzFFi42JxWrohUnc+z4U IgwOXpS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozvz16wFRzhrHj29ghTA+NK9i5GTg4JAX+J 8zcbWEFsNgEdialPLwHZHBwiAioSt/cagJjMAuUSHRNqQUxhgSiJm0cEQIpZBFQl2n9NZQOxe QXcJPZuX8gMMVBO4vzxn2A2p4C7xL5nt1lAbCGgmodL9jBC2CoS66fOguoVlDg58wlYDbOAhM TBFy+YJzDyzkKSmoUktYCRaRWjRnFqUVlqka6RuV5SUWZ6RkluYmaOrqGBsV5uanFxYnpqTmJ SsV5yfu4mRmDY1DMwMO5gbNnrd4hRkoNJSZRXRfBEhBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ 3ikLgXKCRanpqRVpmTnAAIZJS3DwKInwTgVJ8xYXJOYWZ6ZDpE4xKkqJ8z4CSQiAJDJK8+DaY FFziVFWSpiXkYGBQYinILUoN7MEVf4VozgHo5Iwr/YioCk8mXklcNNfAS1mAlqc+PMIyOKSRI SUVAMjH/tEkcTMNy6eM1QiNx6pTarnKFvd6qPU69upd2vS1bU/zxieP9XNL3tUzvJZL/+shyf /W6UvNNGS+e7Ce16k8rt4qqvktBXBc6tT5++adiLkLMs5Ralf7Wx3DLlnGX1lOPPi7YzapxuV WsIsfIPvvTMWkT9/aeG6xn17c1QF7NvbtgjsW75GiaU4I9FQi7moOBEADh22TZUCAAA= X-Env-Sender: prvs=245da84ed=Paul.Durrant@citrix.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1490029723!33058188!3 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: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63678 invoked from network); 20 Mar 2017 17:08:47 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-4.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 20 Mar 2017 17:08:47 -0000 X-IronPort-AV: E=Sophos;i="5.36,195,1486425600"; d="scan'208";a="415033665" From: Paul Durrant To: Date: Mon, 20 Mar 2017 17:08:18 +0000 Message-ID: <1490029701-4311-4-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1490029701-4311-1-git-send-email-paul.durrant@citrix.com> References: <1490029701-4311-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Paul Durrant , Jan Beulich Subject: [Xen-devel] [PATCH v2 3/6] x86/viridian: get rid of the magic numbers in CPUID leaves 1 and 2 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The numbers correspond to ASCII characters so just use appropriate character strings directly. Signed-off-by: Paul Durrant Reviewed-by: Jan Beulich --- Cc: Jan Beulich Cc: Andrew Cooper v2: - Use memcpy() rather than cast-and-assign --- xen/arch/x86/hvm/viridian.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c index 0d208c3..27ad5e8 100644 --- a/xen/arch/x86/hvm/viridian.c +++ b/xen/arch/x86/hvm/viridian.c @@ -134,14 +134,16 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf, switch ( leaf ) { case 0: + /* See section 2.4.1 of the specification */ res->a = 0x40000006; /* Maximum leaf */ - res->b = 0x7263694d; /* Magic numbers */ - res->c = 0x666F736F; - res->d = 0x76482074; + memcpy(&res->b, "Micr", 4); + memcpy(&res->c, "osof", 4); + memcpy(&res->d, "t Hv", 4); break; case 1: - res->a = 0x31237648; /* Version number */ + /* See section 2.4.2 of the specification */ + memcpy(&res->a, "Hv#1", 4); break; case 2: