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@suse.com>
--- 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 )
{
On 16/08/2023 10:51 am, Jan Beulich wrote: > 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@suse.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>, although > --- 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; Any chance we can make this = {} while at it? ~Andrew
Hi Jan, On 16/08/2023 10:51, Jan Beulich wrote: > Old gcc won't cope with initializers involving unnamed struct/union Can you specify the newest version of GCC that breaks? This would help to reproduce your problem in case someone complain about this change. > fields. Cheers, -- Julien Grall
On 16/08/2023 10:51 am, Jan Beulich wrote: > 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@suse.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>, although > --- 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; Any chance we can make this = {} while at it? ~Andrew
© 2016 - 2024 Red Hat, Inc.