Skip to content

Commit bfebd37

Browse files
tlendackysuryasaimadhu
authored andcommitted
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 <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Michael Ellerman <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent aa5a461 commit bfebd37

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

arch/powerpc/platforms/pseries/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ config PPC_SVM
159159
select SWIOTLB
160160
select ARCH_HAS_MEM_ENCRYPT
161161
select ARCH_HAS_FORCE_DMA_UNENCRYPTED
162+
select ARCH_HAS_CC_PLATFORM
162163
help
163164
There are certain POWER platforms which support secure guests using
164165
the Protected Execution Facility, with the help of an Ultravisor

arch/powerpc/platforms/pseries/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ obj-$(CONFIG_FA_DUMP) += rtas-fadump.o
3131

3232
obj-$(CONFIG_SUSPEND) += suspend.o
3333
obj-$(CONFIG_PPC_VAS) += vas.o
34+
35+
obj-$(CONFIG_ARCH_HAS_CC_PLATFORM) += cc_platform.o
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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 <[email protected]>
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);

0 commit comments

Comments
 (0)