Re: [PATCH v4 12/12] x86/traps: Fix up invalid PASID

From: Borislav Petkov
Date: Fri Jun 26 2020 - 14:16:00 EST


On Fri, Jun 26, 2020 at 11:10:00AM -0700, Luck, Tony wrote:
> Do we have a standard way of coding for a feature that depends on multiple
> other features? For this case the system needs to both suport the ENQCMD
> instruction, and also have kernel code that programs the IOMMU.

Yes, you need both. Consider distros enabling everything so that they
can ship a single kernel image.

> And/or guidance on when to use each of the very somewhat simlar looking
> boot_cpu_has()
> static_cpu_has()

See the comment over _static_cpu_has() in arch/x86/include/asm/cpufeature.h

In the exception path you should use the static_ variant.

> IS_ENABLED()

This is testing CONFIG_ settings, i.e., build time.

> cpu_feature_enabled()

This too, indirectly. See

arch/x86/include/asm/disabled-features.h

--
Regards/Gruss,
Boris.

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