|
[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 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).
Furthermore, despite the #undef the macro name should start
with XEN_, perhaps even with XEN_HVM_. Whether the
DECLARE part is really needed/useful I'm not sure.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |