Skip to content

Commit 5b422b9

Browse files
committed
Merge branch 'x86/cc' into x86/apic
Pick up the cc_vendor changes.
2 parents 805ae9d + 3d91c53 commit 5b422b9

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

arch/x86/coco/core.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <asm/coco.h>
1414
#include <asm/processor.h>
1515

16-
static enum cc_vendor vendor __ro_after_init;
16+
enum cc_vendor cc_vendor __ro_after_init;
1717
static u64 cc_mask __ro_after_init;
1818

1919
static bool intel_cc_platform_has(enum cc_attr attr)
@@ -83,7 +83,7 @@ static bool hyperv_cc_platform_has(enum cc_attr attr)
8383

8484
bool cc_platform_has(enum cc_attr attr)
8585
{
86-
switch (vendor) {
86+
switch (cc_vendor) {
8787
case CC_VENDOR_AMD:
8888
return amd_cc_platform_has(attr);
8989
case CC_VENDOR_INTEL:
@@ -105,7 +105,7 @@ u64 cc_mkenc(u64 val)
105105
* - for AMD, bit *set* means the page is encrypted
106106
* - for Intel *clear* means encrypted.
107107
*/
108-
switch (vendor) {
108+
switch (cc_vendor) {
109109
case CC_VENDOR_AMD:
110110
return val | cc_mask;
111111
case CC_VENDOR_INTEL:
@@ -118,7 +118,7 @@ u64 cc_mkenc(u64 val)
118118
u64 cc_mkdec(u64 val)
119119
{
120120
/* See comment in cc_mkenc() */
121-
switch (vendor) {
121+
switch (cc_vendor) {
122122
case CC_VENDOR_AMD:
123123
return val & ~cc_mask;
124124
case CC_VENDOR_INTEL:
@@ -129,11 +129,6 @@ u64 cc_mkdec(u64 val)
129129
}
130130
EXPORT_SYMBOL_GPL(cc_mkdec);
131131

132-
__init void cc_set_vendor(enum cc_vendor v)
133-
{
134-
vendor = v;
135-
}
136-
137132
__init void cc_set_mask(u64 mask)
138133
{
139134
cc_mask = mask;

arch/x86/include/asm/coco.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,30 @@ enum cc_vendor {
1111
CC_VENDOR_INTEL,
1212
};
1313

14-
void cc_set_vendor(enum cc_vendor v);
15-
void cc_set_mask(u64 mask);
16-
1714
#ifdef CONFIG_ARCH_HAS_CC_PLATFORM
15+
extern enum cc_vendor cc_vendor;
16+
17+
static inline enum cc_vendor cc_get_vendor(void)
18+
{
19+
return cc_vendor;
20+
}
21+
22+
static inline void cc_set_vendor(enum cc_vendor vendor)
23+
{
24+
cc_vendor = vendor;
25+
}
26+
27+
void cc_set_mask(u64 mask);
1828
u64 cc_mkenc(u64 val);
1929
u64 cc_mkdec(u64 val);
2030
#else
31+
static inline enum cc_vendor cc_get_vendor(void)
32+
{
33+
return CC_VENDOR_NONE;
34+
}
35+
36+
static inline void cc_set_vendor(enum cc_vendor vendor) { }
37+
2138
static inline u64 cc_mkenc(u64 val)
2239
{
2340
return val;

0 commit comments

Comments
 (0)