psp-sev.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * AMD Secure Encrypted Virtualization (SEV) driver interface
  4. *
  5. * Copyright (C) 2016-2017 Advanced Micro Devices, Inc.
  6. *
  7. * Author: Brijesh Singh <[email protected]>
  8. *
  9. * SEV API spec is available at https://developer.amd.com/sev
  10. */
  11. #ifndef __PSP_SEV_H__
  12. #define __PSP_SEV_H__
  13. #include <uapi/linux/psp-sev.h>
  14. #ifdef CONFIG_X86
  15. #include <linux/mem_encrypt.h>
  16. #define __psp_pa(x) __sme_pa(x)
  17. #else
  18. #define __psp_pa(x) __pa(x)
  19. #endif
  20. #define SEV_FW_BLOB_MAX_SIZE 0x4000 /* 16KB */
  21. /**
  22. * SEV platform state
  23. */
  24. enum sev_state {
  25. SEV_STATE_UNINIT = 0x0,
  26. SEV_STATE_INIT = 0x1,
  27. SEV_STATE_WORKING = 0x2,
  28. SEV_STATE_MAX
  29. };
  30. /**
  31. * SEV platform and guest management commands
  32. */
  33. enum sev_cmd {
  34. /* platform commands */
  35. SEV_CMD_INIT = 0x001,
  36. SEV_CMD_SHUTDOWN = 0x002,
  37. SEV_CMD_FACTORY_RESET = 0x003,
  38. SEV_CMD_PLATFORM_STATUS = 0x004,
  39. SEV_CMD_PEK_GEN = 0x005,
  40. SEV_CMD_PEK_CSR = 0x006,
  41. SEV_CMD_PEK_CERT_IMPORT = 0x007,
  42. SEV_CMD_PDH_CERT_EXPORT = 0x008,
  43. SEV_CMD_PDH_GEN = 0x009,
  44. SEV_CMD_DF_FLUSH = 0x00A,
  45. SEV_CMD_DOWNLOAD_FIRMWARE = 0x00B,
  46. SEV_CMD_GET_ID = 0x00C,
  47. SEV_CMD_INIT_EX = 0x00D,
  48. /* Guest commands */
  49. SEV_CMD_DECOMMISSION = 0x020,
  50. SEV_CMD_ACTIVATE = 0x021,
  51. SEV_CMD_DEACTIVATE = 0x022,
  52. SEV_CMD_GUEST_STATUS = 0x023,
  53. /* Guest launch commands */
  54. SEV_CMD_LAUNCH_START = 0x030,
  55. SEV_CMD_LAUNCH_UPDATE_DATA = 0x031,
  56. SEV_CMD_LAUNCH_UPDATE_VMSA = 0x032,
  57. SEV_CMD_LAUNCH_MEASURE = 0x033,
  58. SEV_CMD_LAUNCH_UPDATE_SECRET = 0x034,
  59. SEV_CMD_LAUNCH_FINISH = 0x035,
  60. SEV_CMD_ATTESTATION_REPORT = 0x036,
  61. /* Guest migration commands (outgoing) */
  62. SEV_CMD_SEND_START = 0x040,
  63. SEV_CMD_SEND_UPDATE_DATA = 0x041,
  64. SEV_CMD_SEND_UPDATE_VMSA = 0x042,
  65. SEV_CMD_SEND_FINISH = 0x043,
  66. SEV_CMD_SEND_CANCEL = 0x044,
  67. /* Guest migration commands (incoming) */
  68. SEV_CMD_RECEIVE_START = 0x050,
  69. SEV_CMD_RECEIVE_UPDATE_DATA = 0x051,
  70. SEV_CMD_RECEIVE_UPDATE_VMSA = 0x052,
  71. SEV_CMD_RECEIVE_FINISH = 0x053,
  72. /* Guest debug commands */
  73. SEV_CMD_DBG_DECRYPT = 0x060,
  74. SEV_CMD_DBG_ENCRYPT = 0x061,
  75. SEV_CMD_MAX,
  76. };
  77. /**
  78. * struct sev_data_init - INIT command parameters
  79. *
  80. * @flags: processing flags
  81. * @tmr_address: system physical address used for SEV-ES
  82. * @tmr_len: len of tmr_address
  83. */
  84. struct sev_data_init {
  85. u32 flags; /* In */
  86. u32 reserved; /* In */
  87. u64 tmr_address; /* In */
  88. u32 tmr_len; /* In */
  89. } __packed;
  90. /**
  91. * struct sev_data_init_ex - INIT_EX command parameters
  92. *
  93. * @length: len of the command buffer read by the PSP
  94. * @flags: processing flags
  95. * @tmr_address: system physical address used for SEV-ES
  96. * @tmr_len: len of tmr_address
  97. * @nv_address: system physical address used for PSP NV storage
  98. * @nv_len: len of nv_address
  99. */
  100. struct sev_data_init_ex {
  101. u32 length; /* In */
  102. u32 flags; /* In */
  103. u64 tmr_address; /* In */
  104. u32 tmr_len; /* In */
  105. u32 reserved; /* In */
  106. u64 nv_address; /* In/Out */
  107. u32 nv_len; /* In */
  108. } __packed;
  109. #define SEV_INIT_FLAGS_SEV_ES 0x01
  110. /**
  111. * struct sev_data_pek_csr - PEK_CSR command parameters
  112. *
  113. * @address: PEK certificate chain
  114. * @len: len of certificate
  115. */
  116. struct sev_data_pek_csr {
  117. u64 address; /* In */
  118. u32 len; /* In/Out */
  119. } __packed;
  120. /**
  121. * struct sev_data_cert_import - PEK_CERT_IMPORT command parameters
  122. *
  123. * @pek_address: PEK certificate chain
  124. * @pek_len: len of PEK certificate
  125. * @oca_address: OCA certificate chain
  126. * @oca_len: len of OCA certificate
  127. */
  128. struct sev_data_pek_cert_import {
  129. u64 pek_cert_address; /* In */
  130. u32 pek_cert_len; /* In */
  131. u32 reserved; /* In */
  132. u64 oca_cert_address; /* In */
  133. u32 oca_cert_len; /* In */
  134. } __packed;
  135. /**
  136. * struct sev_data_download_firmware - DOWNLOAD_FIRMWARE command parameters
  137. *
  138. * @address: physical address of firmware image
  139. * @len: len of the firmware image
  140. */
  141. struct sev_data_download_firmware {
  142. u64 address; /* In */
  143. u32 len; /* In */
  144. } __packed;
  145. /**
  146. * struct sev_data_get_id - GET_ID command parameters
  147. *
  148. * @address: physical address of region to place unique CPU ID(s)
  149. * @len: len of the region
  150. */
  151. struct sev_data_get_id {
  152. u64 address; /* In */
  153. u32 len; /* In/Out */
  154. } __packed;
  155. /**
  156. * struct sev_data_pdh_cert_export - PDH_CERT_EXPORT command parameters
  157. *
  158. * @pdh_address: PDH certificate address
  159. * @pdh_len: len of PDH certificate
  160. * @cert_chain_address: PDH certificate chain
  161. * @cert_chain_len: len of PDH certificate chain
  162. */
  163. struct sev_data_pdh_cert_export {
  164. u64 pdh_cert_address; /* In */
  165. u32 pdh_cert_len; /* In/Out */
  166. u32 reserved; /* In */
  167. u64 cert_chain_address; /* In */
  168. u32 cert_chain_len; /* In/Out */
  169. } __packed;
  170. /**
  171. * struct sev_data_decommission - DECOMMISSION command parameters
  172. *
  173. * @handle: handle of the VM to decommission
  174. */
  175. struct sev_data_decommission {
  176. u32 handle; /* In */
  177. } __packed;
  178. /**
  179. * struct sev_data_activate - ACTIVATE command parameters
  180. *
  181. * @handle: handle of the VM to activate
  182. * @asid: asid assigned to the VM
  183. */
  184. struct sev_data_activate {
  185. u32 handle; /* In */
  186. u32 asid; /* In */
  187. } __packed;
  188. /**
  189. * struct sev_data_deactivate - DEACTIVATE command parameters
  190. *
  191. * @handle: handle of the VM to deactivate
  192. */
  193. struct sev_data_deactivate {
  194. u32 handle; /* In */
  195. } __packed;
  196. /**
  197. * struct sev_data_guest_status - SEV GUEST_STATUS command parameters
  198. *
  199. * @handle: handle of the VM to retrieve status
  200. * @policy: policy information for the VM
  201. * @asid: current ASID of the VM
  202. * @state: current state of the VM
  203. */
  204. struct sev_data_guest_status {
  205. u32 handle; /* In */
  206. u32 policy; /* Out */
  207. u32 asid; /* Out */
  208. u8 state; /* Out */
  209. } __packed;
  210. /**
  211. * struct sev_data_launch_start - LAUNCH_START command parameters
  212. *
  213. * @handle: handle assigned to the VM
  214. * @policy: guest launch policy
  215. * @dh_cert_address: physical address of DH certificate blob
  216. * @dh_cert_len: len of DH certificate blob
  217. * @session_address: physical address of session parameters
  218. * @session_len: len of session parameters
  219. */
  220. struct sev_data_launch_start {
  221. u32 handle; /* In/Out */
  222. u32 policy; /* In */
  223. u64 dh_cert_address; /* In */
  224. u32 dh_cert_len; /* In */
  225. u32 reserved; /* In */
  226. u64 session_address; /* In */
  227. u32 session_len; /* In */
  228. } __packed;
  229. /**
  230. * struct sev_data_launch_update_data - LAUNCH_UPDATE_DATA command parameter
  231. *
  232. * @handle: handle of the VM to update
  233. * @len: len of memory to be encrypted
  234. * @address: physical address of memory region to encrypt
  235. */
  236. struct sev_data_launch_update_data {
  237. u32 handle; /* In */
  238. u32 reserved;
  239. u64 address; /* In */
  240. u32 len; /* In */
  241. } __packed;
  242. /**
  243. * struct sev_data_launch_update_vmsa - LAUNCH_UPDATE_VMSA command
  244. *
  245. * @handle: handle of the VM
  246. * @address: physical address of memory region to encrypt
  247. * @len: len of memory region to encrypt
  248. */
  249. struct sev_data_launch_update_vmsa {
  250. u32 handle; /* In */
  251. u32 reserved;
  252. u64 address; /* In */
  253. u32 len; /* In */
  254. } __packed;
  255. /**
  256. * struct sev_data_launch_measure - LAUNCH_MEASURE command parameters
  257. *
  258. * @handle: handle of the VM to process
  259. * @address: physical address containing the measurement blob
  260. * @len: len of measurement blob
  261. */
  262. struct sev_data_launch_measure {
  263. u32 handle; /* In */
  264. u32 reserved;
  265. u64 address; /* In */
  266. u32 len; /* In/Out */
  267. } __packed;
  268. /**
  269. * struct sev_data_launch_secret - LAUNCH_SECRET command parameters
  270. *
  271. * @handle: handle of the VM to process
  272. * @hdr_address: physical address containing the packet header
  273. * @hdr_len: len of packet header
  274. * @guest_address: system physical address of guest memory region
  275. * @guest_len: len of guest_paddr
  276. * @trans_address: physical address of transport memory buffer
  277. * @trans_len: len of transport memory buffer
  278. */
  279. struct sev_data_launch_secret {
  280. u32 handle; /* In */
  281. u32 reserved1;
  282. u64 hdr_address; /* In */
  283. u32 hdr_len; /* In */
  284. u32 reserved2;
  285. u64 guest_address; /* In */
  286. u32 guest_len; /* In */
  287. u32 reserved3;
  288. u64 trans_address; /* In */
  289. u32 trans_len; /* In */
  290. } __packed;
  291. /**
  292. * struct sev_data_launch_finish - LAUNCH_FINISH command parameters
  293. *
  294. * @handle: handle of the VM to process
  295. */
  296. struct sev_data_launch_finish {
  297. u32 handle; /* In */
  298. } __packed;
  299. /**
  300. * struct sev_data_send_start - SEND_START command parameters
  301. *
  302. * @handle: handle of the VM to process
  303. * @policy: policy information for the VM
  304. * @pdh_cert_address: physical address containing PDH certificate
  305. * @pdh_cert_len: len of PDH certificate
  306. * @plat_certs_address: physical address containing platform certificate
  307. * @plat_certs_len: len of platform certificate
  308. * @amd_certs_address: physical address containing AMD certificate
  309. * @amd_certs_len: len of AMD certificate
  310. * @session_address: physical address containing Session data
  311. * @session_len: len of session data
  312. */
  313. struct sev_data_send_start {
  314. u32 handle; /* In */
  315. u32 policy; /* Out */
  316. u64 pdh_cert_address; /* In */
  317. u32 pdh_cert_len; /* In */
  318. u32 reserved1;
  319. u64 plat_certs_address; /* In */
  320. u32 plat_certs_len; /* In */
  321. u32 reserved2;
  322. u64 amd_certs_address; /* In */
  323. u32 amd_certs_len; /* In */
  324. u32 reserved3;
  325. u64 session_address; /* In */
  326. u32 session_len; /* In/Out */
  327. } __packed;
  328. /**
  329. * struct sev_data_send_update - SEND_UPDATE_DATA command
  330. *
  331. * @handle: handle of the VM to process
  332. * @hdr_address: physical address containing packet header
  333. * @hdr_len: len of packet header
  334. * @guest_address: physical address of guest memory region to send
  335. * @guest_len: len of guest memory region to send
  336. * @trans_address: physical address of host memory region
  337. * @trans_len: len of host memory region
  338. */
  339. struct sev_data_send_update_data {
  340. u32 handle; /* In */
  341. u32 reserved1;
  342. u64 hdr_address; /* In */
  343. u32 hdr_len; /* In/Out */
  344. u32 reserved2;
  345. u64 guest_address; /* In */
  346. u32 guest_len; /* In */
  347. u32 reserved3;
  348. u64 trans_address; /* In */
  349. u32 trans_len; /* In */
  350. } __packed;
  351. /**
  352. * struct sev_data_send_update - SEND_UPDATE_VMSA command
  353. *
  354. * @handle: handle of the VM to process
  355. * @hdr_address: physical address containing packet header
  356. * @hdr_len: len of packet header
  357. * @guest_address: physical address of guest memory region to send
  358. * @guest_len: len of guest memory region to send
  359. * @trans_address: physical address of host memory region
  360. * @trans_len: len of host memory region
  361. */
  362. struct sev_data_send_update_vmsa {
  363. u32 handle; /* In */
  364. u64 hdr_address; /* In */
  365. u32 hdr_len; /* In/Out */
  366. u32 reserved2;
  367. u64 guest_address; /* In */
  368. u32 guest_len; /* In */
  369. u32 reserved3;
  370. u64 trans_address; /* In */
  371. u32 trans_len; /* In */
  372. } __packed;
  373. /**
  374. * struct sev_data_send_finish - SEND_FINISH command parameters
  375. *
  376. * @handle: handle of the VM to process
  377. */
  378. struct sev_data_send_finish {
  379. u32 handle; /* In */
  380. } __packed;
  381. /**
  382. * struct sev_data_send_cancel - SEND_CANCEL command parameters
  383. *
  384. * @handle: handle of the VM to process
  385. */
  386. struct sev_data_send_cancel {
  387. u32 handle; /* In */
  388. } __packed;
  389. /**
  390. * struct sev_data_receive_start - RECEIVE_START command parameters
  391. *
  392. * @handle: handle of the VM to perform receive operation
  393. * @pdh_cert_address: system physical address containing PDH certificate blob
  394. * @pdh_cert_len: len of PDH certificate blob
  395. * @session_address: system physical address containing session blob
  396. * @session_len: len of session blob
  397. */
  398. struct sev_data_receive_start {
  399. u32 handle; /* In/Out */
  400. u32 policy; /* In */
  401. u64 pdh_cert_address; /* In */
  402. u32 pdh_cert_len; /* In */
  403. u32 reserved1;
  404. u64 session_address; /* In */
  405. u32 session_len; /* In */
  406. } __packed;
  407. /**
  408. * struct sev_data_receive_update_data - RECEIVE_UPDATE_DATA command parameters
  409. *
  410. * @handle: handle of the VM to update
  411. * @hdr_address: physical address containing packet header blob
  412. * @hdr_len: len of packet header
  413. * @guest_address: system physical address of guest memory region
  414. * @guest_len: len of guest memory region
  415. * @trans_address: system physical address of transport buffer
  416. * @trans_len: len of transport buffer
  417. */
  418. struct sev_data_receive_update_data {
  419. u32 handle; /* In */
  420. u32 reserved1;
  421. u64 hdr_address; /* In */
  422. u32 hdr_len; /* In */
  423. u32 reserved2;
  424. u64 guest_address; /* In */
  425. u32 guest_len; /* In */
  426. u32 reserved3;
  427. u64 trans_address; /* In */
  428. u32 trans_len; /* In */
  429. } __packed;
  430. /**
  431. * struct sev_data_receive_update_vmsa - RECEIVE_UPDATE_VMSA command parameters
  432. *
  433. * @handle: handle of the VM to update
  434. * @hdr_address: physical address containing packet header blob
  435. * @hdr_len: len of packet header
  436. * @guest_address: system physical address of guest memory region
  437. * @guest_len: len of guest memory region
  438. * @trans_address: system physical address of transport buffer
  439. * @trans_len: len of transport buffer
  440. */
  441. struct sev_data_receive_update_vmsa {
  442. u32 handle; /* In */
  443. u32 reserved1;
  444. u64 hdr_address; /* In */
  445. u32 hdr_len; /* In */
  446. u32 reserved2;
  447. u64 guest_address; /* In */
  448. u32 guest_len; /* In */
  449. u32 reserved3;
  450. u64 trans_address; /* In */
  451. u32 trans_len; /* In */
  452. } __packed;
  453. /**
  454. * struct sev_data_receive_finish - RECEIVE_FINISH command parameters
  455. *
  456. * @handle: handle of the VM to finish
  457. */
  458. struct sev_data_receive_finish {
  459. u32 handle; /* In */
  460. } __packed;
  461. /**
  462. * struct sev_data_dbg - DBG_ENCRYPT/DBG_DECRYPT command parameters
  463. *
  464. * @handle: handle of the VM to perform debug operation
  465. * @src_addr: source address of data to operate on
  466. * @dst_addr: destination address of data to operate on
  467. * @len: len of data to operate on
  468. */
  469. struct sev_data_dbg {
  470. u32 handle; /* In */
  471. u32 reserved;
  472. u64 src_addr; /* In */
  473. u64 dst_addr; /* In */
  474. u32 len; /* In */
  475. } __packed;
  476. /**
  477. * struct sev_data_attestation_report - SEV_ATTESTATION_REPORT command parameters
  478. *
  479. * @handle: handle of the VM
  480. * @mnonce: a random nonce that will be included in the report.
  481. * @address: physical address where the report will be copied.
  482. * @len: length of the physical buffer.
  483. */
  484. struct sev_data_attestation_report {
  485. u32 handle; /* In */
  486. u32 reserved;
  487. u64 address; /* In */
  488. u8 mnonce[16]; /* In */
  489. u32 len; /* In/Out */
  490. } __packed;
  491. #ifdef CONFIG_CRYPTO_DEV_SP_PSP
  492. /**
  493. * sev_platform_init - perform SEV INIT command
  494. *
  495. * @error: SEV command return code
  496. *
  497. * Returns:
  498. * 0 if the SEV successfully processed the command
  499. * -%ENODEV if the SEV device is not available
  500. * -%ENOTSUPP if the SEV does not support SEV
  501. * -%ETIMEDOUT if the SEV command timed out
  502. * -%EIO if the SEV returned a non-zero return code
  503. */
  504. int sev_platform_init(int *error);
  505. /**
  506. * sev_platform_status - perform SEV PLATFORM_STATUS command
  507. *
  508. * @status: sev_user_data_status structure to be processed
  509. * @error: SEV command return code
  510. *
  511. * Returns:
  512. * 0 if the SEV successfully processed the command
  513. * -%ENODEV if the SEV device is not available
  514. * -%ENOTSUPP if the SEV does not support SEV
  515. * -%ETIMEDOUT if the SEV command timed out
  516. * -%EIO if the SEV returned a non-zero return code
  517. */
  518. int sev_platform_status(struct sev_user_data_status *status, int *error);
  519. /**
  520. * sev_issue_cmd_external_user - issue SEV command by other driver with a file
  521. * handle.
  522. *
  523. * This function can be used by other drivers to issue a SEV command on
  524. * behalf of userspace. The caller must pass a valid SEV file descriptor
  525. * so that we know that it has access to SEV device.
  526. *
  527. * @filep - SEV device file pointer
  528. * @cmd - command to issue
  529. * @data - command buffer
  530. * @error: SEV command return code
  531. *
  532. * Returns:
  533. * 0 if the SEV successfully processed the command
  534. * -%ENODEV if the SEV device is not available
  535. * -%ENOTSUPP if the SEV does not support SEV
  536. * -%ETIMEDOUT if the SEV command timed out
  537. * -%EIO if the SEV returned a non-zero return code
  538. * -%EINVAL if the SEV file descriptor is not valid
  539. */
  540. int sev_issue_cmd_external_user(struct file *filep, unsigned int id,
  541. void *data, int *error);
  542. /**
  543. * sev_guest_deactivate - perform SEV DEACTIVATE command
  544. *
  545. * @deactivate: sev_data_deactivate structure to be processed
  546. * @sev_ret: sev command return code
  547. *
  548. * Returns:
  549. * 0 if the sev successfully processed the command
  550. * -%ENODEV if the sev device is not available
  551. * -%ENOTSUPP if the sev does not support SEV
  552. * -%ETIMEDOUT if the sev command timed out
  553. * -%EIO if the sev returned a non-zero return code
  554. */
  555. int sev_guest_deactivate(struct sev_data_deactivate *data, int *error);
  556. /**
  557. * sev_guest_activate - perform SEV ACTIVATE command
  558. *
  559. * @activate: sev_data_activate structure to be processed
  560. * @sev_ret: sev command return code
  561. *
  562. * Returns:
  563. * 0 if the sev successfully processed the command
  564. * -%ENODEV if the sev device is not available
  565. * -%ENOTSUPP if the sev does not support SEV
  566. * -%ETIMEDOUT if the sev command timed out
  567. * -%EIO if the sev returned a non-zero return code
  568. */
  569. int sev_guest_activate(struct sev_data_activate *data, int *error);
  570. /**
  571. * sev_guest_df_flush - perform SEV DF_FLUSH command
  572. *
  573. * @sev_ret: sev command return code
  574. *
  575. * Returns:
  576. * 0 if the sev successfully processed the command
  577. * -%ENODEV if the sev device is not available
  578. * -%ENOTSUPP if the sev does not support SEV
  579. * -%ETIMEDOUT if the sev command timed out
  580. * -%EIO if the sev returned a non-zero return code
  581. */
  582. int sev_guest_df_flush(int *error);
  583. /**
  584. * sev_guest_decommission - perform SEV DECOMMISSION command
  585. *
  586. * @decommission: sev_data_decommission structure to be processed
  587. * @sev_ret: sev command return code
  588. *
  589. * Returns:
  590. * 0 if the sev successfully processed the command
  591. * -%ENODEV if the sev device is not available
  592. * -%ENOTSUPP if the sev does not support SEV
  593. * -%ETIMEDOUT if the sev command timed out
  594. * -%EIO if the sev returned a non-zero return code
  595. */
  596. int sev_guest_decommission(struct sev_data_decommission *data, int *error);
  597. void *psp_copy_user_blob(u64 uaddr, u32 len);
  598. #else /* !CONFIG_CRYPTO_DEV_SP_PSP */
  599. static inline int
  600. sev_platform_status(struct sev_user_data_status *status, int *error) { return -ENODEV; }
  601. static inline int sev_platform_init(int *error) { return -ENODEV; }
  602. static inline int
  603. sev_guest_deactivate(struct sev_data_deactivate *data, int *error) { return -ENODEV; }
  604. static inline int
  605. sev_guest_decommission(struct sev_data_decommission *data, int *error) { return -ENODEV; }
  606. static inline int
  607. sev_guest_activate(struct sev_data_activate *data, int *error) { return -ENODEV; }
  608. static inline int sev_guest_df_flush(int *error) { return -ENODEV; }
  609. static inline int
  610. sev_issue_cmd_external_user(struct file *filep, unsigned int id, void *data, int *error) { return -ENODEV; }
  611. static inline void *psp_copy_user_blob(u64 __user uaddr, u32 len) { return ERR_PTR(-EINVAL); }
  612. #endif /* CONFIG_CRYPTO_DEV_SP_PSP */
  613. #endif /* __PSP_SEV_H__ */