Re: [PATCH v2] x86/devmem: Drop /dev/mem access for confidential guests

From: Naveen N Rao

Date: Mon Nov 30 2026 - 04:28:50 EST


On Fri, Nov 27, 2026 at 05:42:12PM +0200, Nikolay Borisov wrote:
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 3159852fd6b3..1490e0019c71 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -901,6 +901,8 @@ config INTEL_TDX_GUEST
> depends on X86_X2APIC
> depends on EFI_STUB
> depends on PARAVIRT
> + select STRICT_DEVMEM
> + select IO_STRICT_DEVMEM
> select ARCH_HAS_CC_PLATFORM
> select X86_MEM_ENCRYPT
> select X86_MCE
> @@ -1490,6 +1492,8 @@ config AMD_MEM_ENCRYPT
> bool "AMD Secure Memory Encryption (SME) support"
> depends on X86_64 && CPU_SUP_AMD
> depends on EFI_STUB
> + select STRICT_DEVMEM
> + select IO_STRICT_DEVMEM
> select DMA_COHERENT_POOL
> select ARCH_USE_MEMREMAP_PROT
> select INSTRUCTION_DECODER

Sashiko had a comment on the previous posting about this, which I agree
with:
http://lore.kernel.org/r/sashiko-outbox-233694@xxxxxxxxxx

With the selects above, it will not be possible to disable CONFIG_DEVMEM
completely if also selecting AMD_MEM_ENCRYPT/INTEL_TDX_GUEST.

In addition, I don't see the need for IO_STRICT_DEVMEM, at least in
terms of the issue being addressed and the fix below in
devmem_is_allowed(). Dan's commit message refers to confidential MMIO,
and I think that series can add the select if necessary. Note that
adding this select will force-enable IO_STRICT_DEVMEM on baremetal as
well.

So, a simple 'select STRICT_DEVMEM if DEVMEM' instead?


- Naveen