Re: [GIT PULL] x86/sev for v6.9-rc1

From: Ingo Molnar
Date: Tue Mar 12 2024 - 05:04:22 EST



* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> > diff --cc arch/x86/include/asm/coco.h
> > index 76c310b19b11,21940ef8d290..42871bb262d0
> > --- a/arch/x86/include/asm/coco.h
> > +++ b/arch/x86/include/asm/coco.h
> > @@@ -10,9 -11,15 +11,15 @@@ enum cc_vendor
> > CC_VENDOR_INTEL,
> > };
> >
> > -extern enum cc_vendor cc_vendor;
> > + extern u64 cc_mask;
> > +
> > #ifdef CONFIG_ARCH_HAS_CC_PLATFORM
> > +extern enum cc_vendor cc_vendor;
>
> I put the 'cc_mask' declaration inside the #ifdef too.
>
> Because those two variables are defined together, and without
> CONFIG_ARCH_HAS_CC_PLATFORM the whole coco/ subdirectory that defines
> them won't even be built, as far as I can tell.
>
> And I don't see any _use_ of 'cc_mask' anywhere outside of that one
> 'cc_set_mask()' inline function and the coco/core.c file. So declaring
> it only when it's all enabled seems to be the right thing.
>
> Let's hope my artistic merge resolution doesn't end up coming back to bite me.

So it does come back in a fashion, because the tip:x86/boot tree has an
internal merge of x86/sev, where it dutifully followed the original pattern
of:

1c811d403afd x86/sev: Fix position dependent variable references in startup code

.. instead of merging it smartly like you did. :-/

And because I think it would suck to force you to do the same smart merge
conflict resolution *twice*, I did it myself in x86/boot and documented the
background:

commit 2e2bc42c8381d2c0e9604b59e49264821da29368 (origin/x86/boot, x86/boot)
Merge: 428080c9b19b 855684c7d938
Author: Ingo Molnar <mingo@xxxxxxxxxx>
Date: Tue Mar 12 09:49:52 2024 +0100

Merge branch 'linus' into x86/boot, to resolve conflict

There's a new conflict with Linus's upstream tree, because
in the following merge conflict resolution in <asm/coco.h>:

38b334fc767e Merge tag 'x86_sev_for_v6.9_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Linus has resolved the conflicting placement of 'cc_mask' better
than the original commit:

1c811d403afd x86/sev: Fix position dependent variable references in startup code

... which was also done by an internal merge resolution:

2e5fc4786b7a Merge branch 'x86/sev' into x86/boot, to resolve conflicts and to pick up dependent tree

But Linus is right in 38b334fc767e, the 'cc_mask' declaration is sufficient
within the #ifdef CONFIG_ARCH_HAS_CC_PLATFORM block.

So instead of forcing Linus to do the same resolution again, merge in Linus's
tree and follow his conflict resolution.

Conflicts:
arch/x86/include/asm/coco.h

Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>

You'll get the x86/boot pull request later today. If that extra merge
commit is too much, please merge FETCH_HEAD~1 instead to discard my merge
commit.

Thanks,

Ingo