Re: [PATCH 05/32] x86/mtrr: Stop using 32-bit MSR interfaces

From: Ingo Molnar

Date: Mon Jun 29 2026 - 07:38:26 EST



* Juergen Gross <jgross@xxxxxxxx> wrote:

> amd_get_mtrr(unsigned int reg, unsigned long *base,
> unsigned long *size, mtrr_type *type)
> {
> - unsigned long low, high;
> + unsigned long val;
> + struct msr msr;

So, 'struct msr' is defined in <asm/msr.h>, but:

> static void
> amd_set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type type)
> {
> - u32 regs[2];
> + union {
> + u32 regs[2];
> + u64 val;
> + } msr;

Why do we use a local anonymous union here with overlapping
nomenclature and a confusingly different but (AFAICS) functionally
equivalent definition to 'struct msr'?

Thanks,

Ingo