Re: [PATCH v4 5/9] virt: geniezone: Add irqfd support
From: Arnd Bergmann
Date: Tue Jun 27 2023 - 05:30:22 EST
On Fri, Jun 9, 2023, at 10:52, Yi-De Wu wrote:
>
> /**
> * gzvm_hypercall_wrapper()
> @@ -72,6 +73,11 @@ static inline gzvm_vcpu_id_t
> get_vcpuid_from_tuple(unsigned int tuple)
> return (gzvm_vcpu_id_t)(tuple & 0xffff);
> }
>
> +struct gzvm_vcpu_hwstate {
> + __u32 nr_lrs;
> + __u64 lr[GIC_V3_NR_LRS];
> +};
This is not a good definition for a hardware data structure, as there
is architecture specific implicit padding between the two members.
Better add an explicit '__u32 __pad;' in the middle to make it clear
what the actual layout is and make it portable.
If this is an interface to the hypervisor, it should probably also
use explicit endianess, using __le32 and __le64 instead of __u32
and __u64, along with the corresponding accessors.
Arnd