]> xenbits.xensource.com Git - xen.git/commitdiff
IOMMU/x86: fix build with old gcc after IO-APIC RTE changes
authorJan Beulich <jbeulich@suse.com>
Thu, 17 Aug 2023 14:25:51 +0000 (16:25 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 17 Aug 2023 14:25:51 +0000 (16:25 +0200)
Old gcc (up to at least 4.3.4) won't cope with initializers involving
unnamed struct/union fields.

Fixes: 3e033172b025 ("x86/iommu: pass full IO-APIC RTE for remapping table update")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/drivers/passthrough/amd/iommu_intr.c
xen/drivers/passthrough/vtd/intremap.c

index e83a2a932af884934e40c714810aff900d337cc2..d9eefcd8e4114c58626cd29387ed42cef49380ad 100644 (file)
@@ -321,8 +321,7 @@ static int update_intremap_entry_from_ioapic(
 void cf_check amd_iommu_ioapic_update_ire(
     unsigned int apic, unsigned int pin, uint64_t rte)
 {
-    struct IO_APIC_route_entry old_rte;
-    struct IO_APIC_route_entry new_rte = { .raw = rte };
+    struct IO_APIC_route_entry old_rte, new_rte;
     int seg, bdf, rc;
     struct amd_iommu *iommu;
     unsigned int idx;
@@ -331,6 +330,9 @@ void cf_check amd_iommu_ioapic_update_ire(
     if ( idx == MAX_IO_APICS )
         return;
 
+    /* Not the initializer, for old gcc to cope. */
+    new_rte.raw = rte;
+
     /* get device id of ioapic devices */
     bdf = ioapic_sbdf[idx].bdf;
     seg = ioapic_sbdf[idx].seg;
index 706abefaccc2a9edbf28186117f6614135dcee99..c504852eb818b1e0fda6bc83bfa198dd1f899ae8 100644 (file)
@@ -432,8 +432,7 @@ unsigned int cf_check io_apic_read_remap_rte(
 void cf_check io_apic_write_remap_rte(
     unsigned int apic, unsigned int pin, uint64_t rte)
 {
-    struct IO_xAPIC_route_entry new_rte = { .raw = rte };
-    struct IO_xAPIC_route_entry old_rte = { };
+    struct IO_xAPIC_route_entry old_rte = {}, new_rte;
     struct vtd_iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic));
     bool masked = true;
     int rc;
@@ -453,6 +452,9 @@ void cf_check io_apic_write_remap_rte(
         }
     }
 
+    /* Not the initializer, for old gcc to cope. */
+    new_rte.raw = rte;
+
     rc = ioapic_rte_to_remap_entry(iommu, apic, pin, &old_rte, new_rte);
     if ( rc )
     {