Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/pseries/svm: Add a powerpc version of cc_platform_has()

Introduce a powerpc version of the cc_platform_has() function. This will
be used to replace the powerpc mem_encrypt_active() implementation, so
the implementation will initially only support the CC_ATTR_MEM_ENCRYPT
attribute.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lkml.kernel.org/r/20210928191009.32551-5-bp@alien8.de

authored by

Tom Lendacky and committed by
Borislav Petkov
bfebd37e aa5a4611

+29
+1
arch/powerpc/platforms/pseries/Kconfig
··· 159 159 select SWIOTLB 160 160 select ARCH_HAS_MEM_ENCRYPT 161 161 select ARCH_HAS_FORCE_DMA_UNENCRYPTED 162 + select ARCH_HAS_CC_PLATFORM 162 163 help 163 164 There are certain POWER platforms which support secure guests using 164 165 the Protected Execution Facility, with the help of an Ultravisor
+2
arch/powerpc/platforms/pseries/Makefile
··· 31 31 32 32 obj-$(CONFIG_SUSPEND) += suspend.o 33 33 obj-$(CONFIG_PPC_VAS) += vas.o 34 + 35 + obj-$(CONFIG_ARCH_HAS_CC_PLATFORM) += cc_platform.o
+26
arch/powerpc/platforms/pseries/cc_platform.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Confidential Computing Platform Capability checks 4 + * 5 + * Copyright (C) 2021 Advanced Micro Devices, Inc. 6 + * 7 + * Author: Tom Lendacky <thomas.lendacky@amd.com> 8 + */ 9 + 10 + #include <linux/export.h> 11 + #include <linux/cc_platform.h> 12 + 13 + #include <asm/machdep.h> 14 + #include <asm/svm.h> 15 + 16 + bool cc_platform_has(enum cc_attr attr) 17 + { 18 + switch (attr) { 19 + case CC_ATTR_MEM_ENCRYPT: 20 + return is_secure_guest(); 21 + 22 + default: 23 + return false; 24 + } 25 + } 26 + EXPORT_SYMBOL_GPL(cc_platform_has);