Re: [PATCH 00/20] x86: Cleanup alternative_io() and friends, prep for asm_call()

From: Uros Bizjak
Date: Sat Mar 15 2025 - 05:52:39 EST


On Fri, Mar 14, 2025 at 11:25 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> On Fri, Mar 14, 2025 at 02:41:13PM -0700, Josh Poimboeuf wrote:
> > Make the alternative_io() interface more straightforward and flexible,
> > and get rid of alternative_input().
> >
> > These patches are a prereq for another set[1] which will get rid of
> > ASM_CALL_CONSTRAINT[2] in favor of a much more flexible asm_call()
> > interface similar to the new alternative_io().
> >
> > [1] Additional 20+ patches not posted yet to avoid flooding inboxes
>
> The rest of the patches are here if anybody wants to see where this is
> going:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git asm-call

FYI, you missed one conversion of asm involving ALTERNATIVE in
arch/x86/include/asm/nospec-branch.h:

void alternative_msr_write(unsigned int msr, u64 val, unsigned int feature)
{
asm volatile(ALTERNATIVE("", "wrmsr", %c[feature])
: : "c" (msr),
"a" ((u32)val),
"d" ((u32)(val >> 32)),
[feature] "i" (feature)
: "memory");

Uros.