Re: [RFC 01/14] x86/apic: Add new driver for Secure AVIC

From: Borislav Petkov
Date: Wed Oct 09 2024 - 09:54:17 EST


On Wed, Oct 09, 2024 at 03:12:41PM +0300, Kirill A. Shutemov wrote:
> If you use SNP or TDX check in generic code something is wrong. Abstraction
> is broken somewhere. Generic code doesn't need to know concrete
> implementation.

That's perhaps because you're thinking that the *actual* coco implementation type
should be hidden away from generic code. But SNP and TDX are pretty different
so we might as well ask for them by their name.

But I can see why you'd think there might be some abstraction violation there.

My goal here - even though there might be some bad taste of abstraction
violation here - is simplicity. As expressed a bunch of times already, having
cc_platform *and* X86_FEATURE* things used in relation to coco code can be
confusing. So I'd prefer to avoid that confusion.

Nothing says anywhere that arch code cannot use cc_platform interfaces.
Absolutely nothing. So for the sake of KISS I'm going in that direction.

If it turns out later that this was a bad idea and we need to change it, we
can always can. As we do for other interfaces in the kernel.

If you're still not convinced, I already asked you:

"Do you have a better idea which is cleaner than what we do now?"

Your turn.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette