| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] IOMMU/x86: fix build with old gcc after IO-APIC RTE changes
 Old gcc 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@xxxxxxxx>
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -321,8 +321,7 @@ static int update_intremap_entry_from_io
 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_ir
     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;
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -432,8 +432,7 @@ unsigned int cf_check io_apic_read_remap
 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 )
     {
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |