Re: [PATCH v11 2/2] Drivers: hv: Introduce mshv_vtl driver

Paolo Bonzini
2025-11-12T08:54:27Z

On Wed, Nov 12, 2025 at 5:12 AM Michael Kelley <mhklinux@outlook.com> wrote:
> > + .section .discard.addressable,"aw"
> > + .align 8
> > + .type __UNIQUE_ID_addressable___SCK____mshv_vtl_return_hypercall_662.0, @object
> > + .size __UNIQUE_ID_addressable___SCK____mshv_vtl_return_hypercall_662.0, 8
> > +__UNIQUE_ID_addressable___SCK____mshv_vtl_return_hypercall_662.0:
> > + .quad __SCK____mshv_vtl_return_hypercall
>
> This is pretty yucky itself. Why is it better than calling out to a C function?
> Is it because in spite of the annotations, there's no guarantee the C
> compiler won't generate some code that messes up a register value? Or is
> there some other reason?
>
> Does the magic "_662.0" have any significance? Or is it just some
> uniqueness salt on the symbol name?

It's just a counter coming from include/linux/compiler.h:

#define __UNIQUE_ID(prefix) \
__PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)

#define ___ADDRESSABLE(sym, __attrs) \
static void * __used __attrs \
__UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)(uintptr_t)&sym;

#define __ADDRESSABLE(sym) \
___ADDRESSABLE(sym, __section(".discard.addressable"))

You can replace the whole ugly symbol with just something like
__dummy_SCK____mshv_vtl_return_hypercall if you prefer.

Paolo

Paolo