File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 17
17
18
18
/* Function and variable pointers for hooks */
19
19
struct hygon_psp_hooks_table hygon_psp_hooks ;
20
+
21
+ int fixup_hygon_psp_caps (struct psp_device * psp )
22
+ {
23
+ /* the hygon psp is unavailable if bit0 is cleared in feature reg */
24
+ if (!(psp -> capability & PSP_CAPABILITY_SEV ))
25
+ return - ENODEV ;
26
+
27
+ psp -> capability &= ~(PSP_CAPABILITY_TEE |
28
+ PSP_CAPABILITY_PSP_SECURITY_REPORTING );
29
+ return 0 ;
30
+ }
Original file line number Diff line number Diff line change @@ -27,4 +27,6 @@ extern struct hygon_psp_hooks_table {
27
27
int (* __sev_do_cmd_locked )(int cmd , void * data , int * psp_ret );
28
28
} hygon_psp_hooks ;
29
29
30
+ int fixup_hygon_psp_caps (struct psp_device * psp );
31
+
30
32
#endif /* __CCP_HYGON_PSP_DEV_H__ */
Original file line number Diff line number Diff line change 17
17
#include "platform-access.h"
18
18
#include "dbc.h"
19
19
20
+ #include "hygon/psp-dev.h"
21
+
20
22
struct psp_device * psp_master ;
21
23
22
24
static struct psp_device * psp_alloc_struct (struct sp_device * sp )
@@ -73,6 +75,17 @@ static unsigned int psp_get_capability(struct psp_device *psp)
73
75
}
74
76
psp -> capability = val ;
75
77
78
+ /*
79
+ * Fix capability of Hygon psp, the meaning of Hygon psp feature
80
+ * register is not exactly the same as AMD.
81
+ * Return -ENODEV directly if hygon psp not configured with CSV
82
+ * capability.
83
+ */
84
+ if (is_vendor_hygon ()) {
85
+ if (fixup_hygon_psp_caps (psp ))
86
+ return - ENODEV ;
87
+ }
88
+
76
89
/* Detect if TSME and SME are both enabled */
77
90
if (psp -> capability & PSP_CAPABILITY_PSP_SECURITY_REPORTING &&
78
91
psp -> capability & (PSP_SECURITY_TSME_STATUS << PSP_CAPABILITY_PSP_SECURITY_OFFSET ) &&
You can’t perform that action at this time.
0 commit comments