[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] libxl: allow building with old gcc again


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 3 Aug 2023 16:15:19 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pW0Q7b7mAbaCsN9ic44XlYuE60szaE3+3cpssf/B9Jw=; b=QTzN53d7Le6uhlStV/QGQCSzuAJU3cAjqTYctgC1IdCRJvoIKDQJDn0wC6VRY3tt4h7sVvhjaC7j+ht0KBCmbLG401/gbbkl1L3hUjnoZLcwfbs5wzGauVuWQLUi33YdixWkIhdnRjSNEUtEDoo9HzfwmZNZZe+wZcaMWNWrPiHUQrWY1PT/lY+ghPKwhrxqzTuSblz43nKskAl0n6zpsB9wab4yfcr1TZanbj1SKw1mm46KvnS8Y9Dd2j2vfykwo4t6vk3n3B/ONgsbt8NZ9ldMMF2Jj0In1VKfcaAYxLjg4gUlTOix0GgFFh02TYHoPh/ro/3KK0wBBKgaCXQ7kQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aYlbFVuVqu4CUqRNH4M/OO/m8/CyOQ3+xBmCk5+DVAC8W3U1U/HVoXc6UuugRdZQfScu62pv0gy56vsOOiSrztUnBrO8jZRXkfpq+UEEJOsxABCLwcU0plM8H7k+pPvSB/5NRUjCtG4KyZGiuQr/WEK0gVMZQSYTAUpi765RfgdFIab7S6iXhNfux9lJGDHmmGU7JaDPbsjhe7EQVd4XxUOmgR5pMy9LomANFWcQQhz82sbt88ICA0SscvpNygkrGT3ymBMfERSu88KDHIxMX0oJYx5bkzf8q2NaQX5jt0NgOP9DSE2jeZMHSM5SMBJgLt8MJGu2VTRDzggV3sgKcA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Anthony Perard <anthony.perard@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Thu, 03 Aug 2023 14:15:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

We can't use initializers of unnamed struct/union members just yet.

Fixes: d638fe233cb3 ("libxl: use the cpuid feature names from cpufeatureset.h")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -316,12 +316,16 @@ int libxl_cpuid_parse_config(libxl_cpuid
                 uint32_t index;
                 unsigned int reg;
             } msr;
-        };
+        } u;
     } feature_to_policy[] = {
 #define CPUID_ENTRY(l, s, r) \
-    { .type = FEAT_CPUID, .cpuid.leaf = l, .cpuid.subleaf = s, .cpuid.reg = r }
+    { .type = FEAT_CPUID, \
+      .u = { .cpuid.leaf = l, .cpuid.subleaf = s, .cpuid.reg = r } \
+    }
 #define MSR_ENTRY(i, r) \
-    { .type = FEAT_MSR, .msr.index = i, .msr.reg = r }
+    { .type = FEAT_MSR, \
+      .u = { .msr.index = i, .msr.reg = r } \
+    }
         CPUID_ENTRY(0x00000001, NA, CPUID_REG_EDX),
         CPUID_ENTRY(0x00000001, NA, CPUID_REG_ECX),
         CPUID_ENTRY(0x80000001, NA, CPUID_REG_EDX),
@@ -380,9 +384,9 @@ int libxl_cpuid_parse_config(libxl_cpuid
         struct cpuid_flags f;
 
         f.name = feat->name;
-        f.leaf = feature_to_policy[feat->bit / 32].cpuid.leaf;
-        f.subleaf = feature_to_policy[feat->bit / 32].cpuid.subleaf;
-        f.reg = feature_to_policy[feat->bit / 32].cpuid.reg;
+        f.leaf = feature_to_policy[feat->bit / 32].u.cpuid.leaf;
+        f.subleaf = feature_to_policy[feat->bit / 32].u.cpuid.subleaf;
+        f.reg = feature_to_policy[feat->bit / 32].u.cpuid.reg;
         f.bit = feat->bit % 32;
         f.length = 1;
 
@@ -393,10 +397,10 @@ int libxl_cpuid_parse_config(libxl_cpuid
     {
         unsigned int bit = feat->bit % 32;
 
-        if (feature_to_policy[feat->bit / 32].msr.reg == CPUID_REG_EDX)
+        if (feature_to_policy[feat->bit / 32].u.msr.reg == CPUID_REG_EDX)
             bit += 32;
 
-        return msr_add(policy, feature_to_policy[feat->bit / 32].msr.index,
+        return msr_add(policy, feature_to_policy[feat->bit / 32].u.msr.index,
                        bit, val);
     }
     }




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.