On 16.03.2025 11:08, Andrii Sultanov wrote:
> Following a similar change to amd_iommu struct, make two more structs
> take pci_sbdf_t directly instead of seg and bdf separately. This lets us
> drop several conversions from the latter to the former and simplifies
> several comparisons and assignments.
> 
> Signed-off-by: Andrii Sultanov <sultanovand...@gmail.com>
> 
> ---
> 
> This particular commit does not have any effect on code size:
> add/remove: 0/0 grow/shrink: 2/6 up/down: 96/-96 (0)
> Function                                     old     new   delta
> _einittext                                 22092   22156     +64

I'm puzzled by this: _einittext being last (and not itself a function);
how can it grow? What follows it (as per the linker script) is
.altinstr_replacement, yet I wouldn't expect that to change in size.

> --- a/xen/drivers/passthrough/amd/iommu.h
> +++ b/xen/drivers/passthrough/amd/iommu.h
> @@ -268,7 +268,13 @@ int cf_check amd_setup_hpet_msi(struct msi_desc 
> *msi_desc);
>  void cf_check amd_iommu_dump_intremap_tables(unsigned char key);
>  
>  extern struct ioapic_sbdf {
> -    u16 bdf, seg;
> +    union {
> +        struct {
> +            uint16_t bdf;
> +            uint16_t seg;
> +        };
> +        pci_sbdf_t sbdf;
> +    };
>      u8 id;
>      bool cmdline;
>      u16 *pin_2_idx;
> @@ -279,7 +285,14 @@ unsigned int ioapic_id_to_index(unsigned int apic_id);
>  unsigned int get_next_ioapic_sbdf_index(void);
>  
>  extern struct hpet_sbdf {
> -    u16 bdf, seg, id;
> +    union {
> +        struct {
> +            uint16_t bdf;
> +            uint16_t seg;
> +        };
> +        pci_sbdf_t sbdf;
> +    };
> +    uint16_t id;
>      enum {
>          HPET_NONE,
>          HPET_CMDL,

Oh, yet more fragile aliasing. No, please don't. Just have a single pci_sbdf_t
there.

Jan

Reply via email to