[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 1/7] x86/vioapic: introduce a internal vIO APIC structure
>>> On 28.03.17 at 10:15, <roger.pau@xxxxxxxxxx> wrote: > On Tue, Mar 28, 2017 at 01:17:27AM -0600, Jan Beulich wrote: >> >>> On 27.03.17 at 18:49, <roger.pau@xxxxxxxxxx> wrote: >> > Yes, I think the unnamed structure is way better, here's what I've done: >> > >> > save.h: >> > >> > union vioapic_redir_entry >> > { >> > uint64_t bits; >> > struct { >> > uint8_t vector; >> > uint8_t delivery_mode:3; >> > uint8_t dest_mode:1; >> > uint8_t delivery_status:1; >> > uint8_t polarity:1; >> > uint8_t remote_irr:1; >> > uint8_t trig_mode:1; >> > uint8_t mask:1; >> > uint8_t reserve:7; >> > uint8_t reserved[4]; >> > uint8_t dest_id; >> > } fields; >> > }; >> > >> > #define VIOAPIC_NUM_PINS 48 /* 16 ISA IRQs, 32 non-legacy PCI IRQS. */ >> > >> > #define DECLARE_VIOAPIC(name, cnt) \ >> > struct name { \ >> > uint64_t base_address; \ >> > uint32_t ioregsel; \ >> > uint32_t id; \ >> > union vioapic_redir_entry redirtbl[cnt]; \ >> > } >> > >> > DECLARE_VIOAPIC(hvm_hw_vioapic, VIOAPIC_NUM_PINS); >> > >> > #ifndef __XEN__ >> > #undef DECLARE_VIOAPIC >> > #endif >> > >> > vioapic.h: >> > >> > struct hvm_vioapic { >> > struct domain *domain; >> > DECLARE_VIOAPIC(, VIOAPIC_NUM_PINS); >> > }; >> > >> > This seems to work fine, and now the BUILD_BUG_ON is just pointless. >> >> Well, no, not entirely. As said you still want to exclude alignment >> effects prior structure members of hvm_vioapic may have (please >> continue to not make assumptions on the alignment of the first >> field of the structure here). > > But doesn't the usage of an unnamed structure get rid of the alignment issue? Oh, of course it does - provided there are no differing packing options in effect at the time the two structures get actually declared. But yes, perhaps we can live with this being implied. And too big of an alignment is no problem in the first place. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |