From patchwork Thu Jan 5 18:01:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9499437 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 8F65C606B5 for ; Thu, 5 Jan 2017 18:04:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82A7828414 for ; Thu, 5 Jan 2017 18:04:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 759F22841D; Thu, 5 Jan 2017 18:04:24 +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 0931128414 for ; Thu, 5 Jan 2017 18:04:23 +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 1cPCMH-0008Oe-Qi; Thu, 05 Jan 2017 18:01:49 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPCMG-0008OY-Hh for xen-devel@lists.xen.org; Thu, 05 Jan 2017 18:01:48 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id EC/8A-25360-B0A8E685; Thu, 05 Jan 2017 18:01:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRWlGSWpSXmKPExsXitHSDvS5XV16 EwZbZvBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bbu8vZCpbyVux8sJW9gfELVxcjJ4eEgL/E i9kzWUBsNgF9id0vPjGB2CIC6hKnOy6ygtjMArUSix+dAIpzcAgD1TdNsQcJswioSGw83MUMY vMKeEjse36dCWKknMT54z/B4kICahLX+i+xQ9QISpyc+YQFYqSExMEXL5gnMHLPQpKahSS1gJ FpFaNGcWpRWWqRrpGhXlJRZnpGSW5iZo6uoYGpXm5qcXFiempOYlKxXnJ+7iZGYCjUMzAw7mC 8O9nvEKMkB5OSKO+cyrwIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8zp1AOcGi1PTUirTMHGBQ wqQlOHiURHjbQNK8xQWJucWZ6RCpU4yKUuK8SiAJAZBERmkeXBssEi4xykoJ8zIyMDAI8RSkF uVmlqDKv2IU52BUEoaYwpOZVwI3/RXQYiagxdsDskEWlyQipKQaGHWnG/3ylKn0VnH7MH/J1o SkTp2tDE0ej+/dObTu03OWK+xC5p12h1+Kdlx98bHaNvZDwru+dEe/DYaN9gpHw3fx9Lj9r+F L92GtiWXdwnST983ag4evbIr6eO2kk2PksarpvFMmGVVcNzcPic7ccWzzJo1X69Y/3r/9NfvJ ii0X9+v93D85xU+JpTgj0VCLuag4EQCHU2mRfwIAAA== X-Env-Sender: prvs=1717c234d=Andrew.Cooper3@citrix.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1483639304!63000194!1 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.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 46367 invoked from network); 5 Jan 2017 18:01:45 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-13.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 5 Jan 2017 18:01:45 -0000 X-IronPort-AV: E=Sophos;i="5.33,322,1477958400"; d="scan'208";a="407020285" From: Andrew Cooper To: Xen-devel Date: Thu, 5 Jan 2017 18:01:42 +0000 Message-ID: <1483639302-3084-1-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Cc: Andrew Cooper , Boris Ostrovsky , Jan Beulich Subject: [Xen-devel] [PATCH] xen: Fix build with older versions of GCC following e34bc403c3 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 GCCs of at least 4.4 and earlier do not tollerate the initialisiation of the $VENDOR_cpu_dev structures, because of c_ident becoming an anonymous union. Instead of using an anonymous union, reintepret c_ident[] in its CPUID form just in get_cpu_vendor(). Signed-off-by: Andrew Cooper Tested-by: Boris Ostrovsky Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Boris Ostrovsky RFC, as I don't have easy access to a compiler which causes this to fail in the first place. --- xen/arch/x86/cpu/common.c | 7 +++++-- xen/arch/x86/cpu/cpu.h | 8 +------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index d17a2ee..7d6d024 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -163,8 +163,11 @@ int get_cpu_vendor(uint32_t b, uint32_t c, uint32_t d, enum get_cpu_vendor mode) for (i = 0; i < X86_VENDOR_NUM; i++) { if (cpu_devs[i]) { - if (cpu_devs[i]->b == b && cpu_devs[i]->c == c && - cpu_devs[i]->d == d) { + struct { + uint32_t b, d, c; + } *ptr = (void *)cpu_devs[i]->c_ident; + + if (ptr->b == b && ptr->c == c && ptr->d == d) { if (mode == gcv_host) this_cpu = cpu_devs[i]; return i; diff --git a/xen/arch/x86/cpu/cpu.h b/xen/arch/x86/cpu/cpu.h index 5a7905c..3eeebe3 100644 --- a/xen/arch/x86/cpu/cpu.h +++ b/xen/arch/x86/cpu/cpu.h @@ -1,13 +1,7 @@ /* attempt to consolidate cpu attributes */ struct cpu_dev { char c_vendor[8]; - - union { - char c_ident[13]; - struct { - uint32_t b, d, c; - }; - }; + char c_ident[13]; void (*c_early_init)(struct cpuinfo_x86 *c); void (*c_init)(struct cpuinfo_x86 * c);