From patchwork Tue Mar 21 18:17:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9637267 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 DC29B60216 for ; Tue, 21 Mar 2017 18:19:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D358C2041F for ; Tue, 21 Mar 2017 18:19:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C843E2830A; Tue, 21 Mar 2017 18:19:43 +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 83A212041F for ; Tue, 21 Mar 2017 18:19:43 +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 1cqOLb-0000WL-6O; Tue, 21 Mar 2017 18:17:31 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqOLa-0000V3-3A for xen-devel@lists.xenproject.org; Tue, 21 Mar 2017 18:17:30 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 6E/14-13192-93E61D85; Tue, 21 Mar 2017 18:17:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmkeJIrShJLcpLzFFi42JxWrrBXtcy72K Ewb0drBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8alM9uZC85yVlxv2MDYwLiJvYuRk0NCwF9i 5b/rrCA2m4COxNSnl4BsDg4RARWJ23sNQMLMAmESqxdcZASxhQWiJBr628FsFgFVibuTvrKA2 LwCbhJv7v+BGikncf74T2YQm1PAXeLbpk1g9UJANd2dB5kgbBWJ9VNnsUH0CkqcnPmEBWKXhM TBFy+YJzDyzkKSmoUktYCRaRWjenFqUVlqka6hXlJRZnpGSW5iZo6uoYGZXm5qcXFiempOYlK xXnJ+7iZGYOAwAMEOxp3PnQ4xSnIwKYnyJjpdjBDiS8pPqcxILM6ILyrNSS0+xCjDwaEkwfsy BygnWJSanlqRlpkDDGGYtAQHj5II7xuQNG9xQWJucWY6ROoUo6KUOO9skIQASCKjNA+uDRY3l xhlpYR5GYEOEeIpSC3KzSxBlX/FKM7BqCTMexZkCk9mXgnc9FdAi5mAFpftuQCyuCQRISXVwB huX+JgddvhcoOwtV1fQK/axw//Zu633mHpIh+7I2hi22RZp+cGM2q0Pj0MnvFj1aJrqwR4t5i aTb0vmDdta1jz3xYbzVOK0p+PHFwo8eXgKtG82e3S6mbPeEuWRcTFM9irvWhZ6z07mb1nqwjj YonupIW9PfU3ZB3rorP5PmvWXtFLXLjhphJLcUaioRZzUXEiAMZuatqWAgAA X-Env-Sender: prvs=246d8669f=Paul.Durrant@citrix.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1490120244!63374732!4 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8438 invoked from network); 21 Mar 2017 18:17:28 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-9.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 21 Mar 2017 18:17:28 -0000 X-IronPort-AV: E=Sophos;i="5.36,200,1486425600"; d="scan'208";a="424078516" From: Paul Durrant To: Date: Tue, 21 Mar 2017 18:17:19 +0000 Message-ID: <1490120242-3587-4-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1490120242-3587-1-git-send-email-paul.durrant@citrix.com> References: <1490120242-3587-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Paul Durrant Subject: [Xen-devel] [PATCH v3 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: 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 8a5c831..41f550c 100644 --- a/xen/arch/x86/hvm/viridian.c +++ b/xen/arch/x86/hvm/viridian.c @@ -132,14 +132,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: