1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Ultravisor Interfaces 4 * 5 * Copyright IBM Corp. 2019, 2024 6 * 7 * Author(s): 8 * Vasily Gorbik <gor@linux.ibm.com> 9 * Janosch Frank <frankja@linux.ibm.com> 10 */ 11 #ifndef _ASM_S390_UV_H 12 #define _ASM_S390_UV_H 13 14 #include <linux/types.h> 15 #include <linux/errno.h> 16 #include <linux/bug.h> 17 #include <linux/sched.h> 18 #include <asm/page.h> 19 #include <asm/asm.h> 20 21 #define UVC_CC_OK 0 22 #define UVC_CC_ERROR 1 23 #define UVC_CC_BUSY 2 24 #define UVC_CC_PARTIAL 3 25 26 #define UVC_RC_EXECUTED 0x0001 27 #define UVC_RC_INV_CMD 0x0002 28 #define UVC_RC_INV_STATE 0x0003 29 #define UVC_RC_INV_LEN 0x0005 30 #define UVC_RC_NO_RESUME 0x0007 31 #define UVC_RC_MORE_DATA 0x0100 32 #define UVC_RC_NEED_DESTROY 0x8000 33 34 #define UVC_CMD_QUI 0x0001 35 #define UVC_CMD_QUERY_KEYS 0x0002 36 #define UVC_CMD_INIT_UV 0x000f 37 #define UVC_CMD_CREATE_SEC_CONF 0x0100 38 #define UVC_CMD_DESTROY_SEC_CONF 0x0101 39 #define UVC_CMD_DESTROY_SEC_CONF_FAST 0x0102 40 #define UVC_CMD_CREATE_SEC_CPU 0x0120 41 #define UVC_CMD_DESTROY_SEC_CPU 0x0121 42 #define UVC_CMD_CONV_TO_SEC_STOR 0x0200 43 #define UVC_CMD_CONV_FROM_SEC_STOR 0x0201 44 #define UVC_CMD_DESTR_SEC_STOR 0x0202 45 #define UVC_CMD_SET_SEC_CONF_PARAMS 0x0300 46 #define UVC_CMD_UNPACK_IMG 0x0301 47 #define UVC_CMD_VERIFY_IMG 0x0302 48 #define UVC_CMD_CPU_RESET 0x0310 49 #define UVC_CMD_CPU_RESET_INITIAL 0x0311 50 #define UVC_CMD_PREPARE_RESET 0x0320 51 #define UVC_CMD_CPU_RESET_CLEAR 0x0321 52 #define UVC_CMD_CPU_SET_STATE 0x0330 53 #define UVC_CMD_SET_UNSHARE_ALL 0x0340 54 #define UVC_CMD_PIN_PAGE_SHARED 0x0341 55 #define UVC_CMD_UNPIN_PAGE_SHARED 0x0342 56 #define UVC_CMD_DUMP_INIT 0x0400 57 #define UVC_CMD_DUMP_CONF_STOR_STATE 0x0401 58 #define UVC_CMD_DUMP_CPU 0x0402 59 #define UVC_CMD_DUMP_COMPLETE 0x0403 60 #define UVC_CMD_SET_SHARED_ACCESS 0x1000 61 #define UVC_CMD_REMOVE_SHARED_ACCESS 0x1001 62 #define UVC_CMD_RETR_ATTEST 0x1020 63 #define UVC_CMD_ADD_SECRET 0x1031 64 #define UVC_CMD_LIST_SECRETS 0x1033 65 #define UVC_CMD_LOCK_SECRETS 0x1034 66 #define UVC_CMD_RETR_SECRET 0x1035 67 68 /* Bits in installed uv calls */ 69 enum uv_cmds_inst { 70 BIT_UVC_CMD_QUI = 0, 71 BIT_UVC_CMD_INIT_UV = 1, 72 BIT_UVC_CMD_CREATE_SEC_CONF = 2, 73 BIT_UVC_CMD_DESTROY_SEC_CONF = 3, 74 BIT_UVC_CMD_CREATE_SEC_CPU = 4, 75 BIT_UVC_CMD_DESTROY_SEC_CPU = 5, 76 BIT_UVC_CMD_CONV_TO_SEC_STOR = 6, 77 BIT_UVC_CMD_CONV_FROM_SEC_STOR = 7, 78 BIT_UVC_CMD_SET_SHARED_ACCESS = 8, 79 BIT_UVC_CMD_REMOVE_SHARED_ACCESS = 9, 80 BIT_UVC_CMD_SET_SEC_PARMS = 11, 81 BIT_UVC_CMD_UNPACK_IMG = 13, 82 BIT_UVC_CMD_VERIFY_IMG = 14, 83 BIT_UVC_CMD_CPU_RESET = 15, 84 BIT_UVC_CMD_CPU_RESET_INITIAL = 16, 85 BIT_UVC_CMD_CPU_SET_STATE = 17, 86 BIT_UVC_CMD_PREPARE_RESET = 18, 87 BIT_UVC_CMD_CPU_PERFORM_CLEAR_RESET = 19, 88 BIT_UVC_CMD_UNSHARE_ALL = 20, 89 BIT_UVC_CMD_PIN_PAGE_SHARED = 21, 90 BIT_UVC_CMD_UNPIN_PAGE_SHARED = 22, 91 BIT_UVC_CMD_DESTROY_SEC_CONF_FAST = 23, 92 BIT_UVC_CMD_DUMP_INIT = 24, 93 BIT_UVC_CMD_DUMP_CONFIG_STOR_STATE = 25, 94 BIT_UVC_CMD_DUMP_CPU = 26, 95 BIT_UVC_CMD_DUMP_COMPLETE = 27, 96 BIT_UVC_CMD_RETR_ATTEST = 28, 97 BIT_UVC_CMD_ADD_SECRET = 29, 98 BIT_UVC_CMD_LIST_SECRETS = 30, 99 BIT_UVC_CMD_LOCK_SECRETS = 31, 100 BIT_UVC_CMD_RETR_SECRET = 33, 101 BIT_UVC_CMD_QUERY_KEYS = 34, 102 }; 103 104 enum uv_feat_ind { 105 BIT_UV_FEAT_MISC = 0, 106 BIT_UV_FEAT_AIV = 1, 107 BIT_UV_FEAT_AP = 4, 108 BIT_UV_FEAT_AP_INTR = 5, 109 }; 110 111 struct uv_cb_header { 112 u16 len; 113 u16 cmd; /* Command Code */ 114 u16 rc; /* Response Code */ 115 u16 rrc; /* Return Reason Code */ 116 } __packed __aligned(8); 117 118 /* Query Ultravisor Information */ 119 struct uv_cb_qui { 120 struct uv_cb_header header; /* 0x0000 */ 121 u64 reserved08; /* 0x0008 */ 122 u64 inst_calls_list[4]; /* 0x0010 */ 123 u64 reserved30[2]; /* 0x0030 */ 124 u64 uv_base_stor_len; /* 0x0040 */ 125 u64 reserved48; /* 0x0048 */ 126 u64 conf_base_phys_stor_len; /* 0x0050 */ 127 u64 conf_base_virt_stor_len; /* 0x0058 */ 128 u64 conf_virt_var_stor_len; /* 0x0060 */ 129 u64 cpu_stor_len; /* 0x0068 */ 130 u32 reserved70[3]; /* 0x0070 */ 131 u32 max_num_sec_conf; /* 0x007c */ 132 u64 max_guest_stor_addr; /* 0x0080 */ 133 u8 reserved88[0x9e - 0x88]; /* 0x0088 */ 134 u16 max_guest_cpu_id; /* 0x009e */ 135 u64 uv_feature_indications; /* 0x00a0 */ 136 u64 reserveda8; /* 0x00a8 */ 137 u64 supp_se_hdr_versions; /* 0x00b0 */ 138 u64 supp_se_hdr_pcf; /* 0x00b8 */ 139 u64 reservedc0; /* 0x00c0 */ 140 u64 conf_dump_storage_state_len; /* 0x00c8 */ 141 u64 conf_dump_finalize_len; /* 0x00d0 */ 142 u64 reservedd8; /* 0x00d8 */ 143 u64 supp_att_req_hdr_ver; /* 0x00e0 */ 144 u64 supp_att_pflags; /* 0x00e8 */ 145 u64 reservedf0; /* 0x00f0 */ 146 u64 supp_add_secret_req_ver; /* 0x00f8 */ 147 u64 supp_add_secret_pcf; /* 0x0100 */ 148 u64 supp_secret_types; /* 0x0108 */ 149 u16 max_assoc_secrets; /* 0x0110 */ 150 u16 max_retr_secrets; /* 0x0112 */ 151 u8 reserved114[0x120 - 0x114]; /* 0x0114 */ 152 } __packed __aligned(8); 153 154 struct uv_key_hash { 155 u64 dword[4]; 156 } __packed __aligned(8); 157 158 #define UVC_QUERY_KEYS_IDX_HK 0 159 #define UVC_QUERY_KEYS_IDX_BACK_HK 1 160 161 /* Query Ultravisor Keys */ 162 struct uv_cb_query_keys { 163 struct uv_cb_header header; /* 0x0000 */ 164 u64 reserved08[3]; /* 0x0008 */ 165 struct uv_key_hash key_hashes[15]; /* 0x0020 */ 166 } __packed __aligned(8); 167 static_assert(sizeof(struct uv_cb_query_keys) == 0x200); 168 169 /* Initialize Ultravisor */ 170 struct uv_cb_init { 171 struct uv_cb_header header; 172 u64 reserved08[2]; 173 u64 stor_origin; 174 u64 stor_len; 175 u64 reserved28[4]; 176 } __packed __aligned(8); 177 178 /* Create Guest Configuration */ 179 struct uv_cb_cgc { 180 struct uv_cb_header header; 181 u64 reserved08[2]; 182 u64 guest_handle; 183 u64 conf_base_stor_origin; 184 u64 conf_virt_stor_origin; 185 u8 reserved30[6]; 186 union { 187 struct { 188 u16 : 14; 189 u16 ap_instr_intr : 1; 190 u16 ap_allow_instr : 1; 191 }; 192 u16 raw; 193 } flags; 194 u64 guest_stor_origin; 195 u64 guest_stor_len; 196 u64 guest_sca; 197 u64 guest_asce; 198 u64 reserved58[5]; 199 } __packed __aligned(8); 200 201 /* Create Secure CPU */ 202 struct uv_cb_csc { 203 struct uv_cb_header header; 204 u64 reserved08[2]; 205 u64 cpu_handle; 206 u64 guest_handle; 207 u64 stor_origin; 208 u8 reserved30[6]; 209 u16 num; 210 u64 state_origin; 211 u64 reserved40[4]; 212 } __packed __aligned(8); 213 214 /* Convert to Secure */ 215 struct uv_cb_cts { 216 struct uv_cb_header header; 217 u64 reserved08[2]; 218 u64 guest_handle; 219 u64 gaddr; 220 } __packed __aligned(8); 221 222 /* Convert from Secure / Pin Page Shared */ 223 struct uv_cb_cfs { 224 struct uv_cb_header header; 225 u64 reserved08[2]; 226 u64 paddr; 227 } __packed __aligned(8); 228 229 /* Set Secure Config Parameter */ 230 struct uv_cb_ssc { 231 struct uv_cb_header header; 232 u64 reserved08[2]; 233 u64 guest_handle; 234 u64 sec_header_origin; 235 u32 sec_header_len; 236 u32 reserved2c; 237 u64 reserved30[4]; 238 } __packed __aligned(8); 239 240 /* Unpack */ 241 struct uv_cb_unp { 242 struct uv_cb_header header; 243 u64 reserved08[2]; 244 u64 guest_handle; 245 u64 gaddr; 246 u64 tweak[2]; 247 u64 reserved38[3]; 248 } __packed __aligned(8); 249 250 #define PV_CPU_STATE_OPR 1 251 #define PV_CPU_STATE_STP 2 252 #define PV_CPU_STATE_CHKSTP 3 253 #define PV_CPU_STATE_OPR_LOAD 5 254 255 struct uv_cb_cpu_set_state { 256 struct uv_cb_header header; 257 u64 reserved08[2]; 258 u64 cpu_handle; 259 u8 reserved20[7]; 260 u8 state; 261 u64 reserved28[5]; 262 }; 263 264 /* 265 * A common UV call struct for calls that take no payload 266 * Examples: 267 * Destroy cpu/config 268 * Verify 269 */ 270 struct uv_cb_nodata { 271 struct uv_cb_header header; 272 u64 reserved08[2]; 273 u64 handle; 274 u64 reserved20[4]; 275 } __packed __aligned(8); 276 277 /* Destroy Configuration Fast */ 278 struct uv_cb_destroy_fast { 279 struct uv_cb_header header; 280 u64 reserved08[2]; 281 u64 handle; 282 u64 reserved20[5]; 283 } __packed __aligned(8); 284 285 /* Set Shared Access */ 286 struct uv_cb_share { 287 struct uv_cb_header header; 288 u64 reserved08[3]; 289 u64 paddr; 290 u64 reserved28; 291 } __packed __aligned(8); 292 293 /* Retrieve Attestation Measurement */ 294 struct uv_cb_attest { 295 struct uv_cb_header header; /* 0x0000 */ 296 u64 reserved08[2]; /* 0x0008 */ 297 u64 arcb_addr; /* 0x0018 */ 298 u64 cont_token; /* 0x0020 */ 299 u8 reserved28[6]; /* 0x0028 */ 300 u16 user_data_len; /* 0x002e */ 301 u8 user_data[256]; /* 0x0030 */ 302 u32 reserved130[3]; /* 0x0130 */ 303 u32 meas_len; /* 0x013c */ 304 u64 meas_addr; /* 0x0140 */ 305 u8 config_uid[16]; /* 0x0148 */ 306 u32 reserved158; /* 0x0158 */ 307 u32 add_data_len; /* 0x015c */ 308 u64 add_data_addr; /* 0x0160 */ 309 u64 reserved168[4]; /* 0x0168 */ 310 } __packed __aligned(8); 311 312 struct uv_cb_dump_cpu { 313 struct uv_cb_header header; 314 u64 reserved08[2]; 315 u64 cpu_handle; 316 u64 dump_area_origin; 317 u64 reserved28[5]; 318 } __packed __aligned(8); 319 320 struct uv_cb_dump_stor_state { 321 struct uv_cb_header header; 322 u64 reserved08[2]; 323 u64 config_handle; 324 u64 dump_area_origin; 325 u64 gaddr; 326 u64 reserved28[4]; 327 } __packed __aligned(8); 328 329 struct uv_cb_dump_complete { 330 struct uv_cb_header header; 331 u64 reserved08[2]; 332 u64 config_handle; 333 u64 dump_area_origin; 334 u64 reserved30[5]; 335 } __packed __aligned(8); 336 337 /* 338 * A common UV call struct for pv guests that contains a single address 339 * Examples: 340 * Add Secret 341 */ 342 struct uv_cb_guest_addr { 343 struct uv_cb_header header; 344 u64 reserved08[3]; 345 u64 addr; 346 u64 reserved28[4]; 347 } __packed __aligned(8); 348 349 #define UVC_RC_RETR_SECR_BUF_SMALL 0x0109 350 #define UVC_RC_RETR_SECR_STORE_EMPTY 0x010f 351 #define UVC_RC_RETR_SECR_INV_IDX 0x0110 352 #define UVC_RC_RETR_SECR_INV_SECRET 0x0111 353 354 struct uv_cb_retr_secr { 355 struct uv_cb_header header; 356 u64 reserved08[2]; 357 u16 secret_idx; 358 u16 reserved1a; 359 u32 buf_size; 360 u64 buf_addr; 361 u64 reserved28[4]; 362 } __packed __aligned(8); 363 364 struct uv_cb_list_secrets { 365 struct uv_cb_header header; 366 u64 reserved08[2]; 367 u8 reserved18[6]; 368 u16 start_idx; 369 u64 list_addr; 370 u64 reserved28[4]; 371 } __packed __aligned(8); 372 373 enum uv_secret_types { 374 UV_SECRET_INVAL = 0x0, 375 UV_SECRET_NULL = 0x1, 376 UV_SECRET_ASSOCIATION = 0x2, 377 UV_SECRET_PLAIN = 0x3, 378 UV_SECRET_AES_128 = 0x4, 379 UV_SECRET_AES_192 = 0x5, 380 UV_SECRET_AES_256 = 0x6, 381 UV_SECRET_AES_XTS_128 = 0x7, 382 UV_SECRET_AES_XTS_256 = 0x8, 383 UV_SECRET_HMAC_SHA_256 = 0x9, 384 UV_SECRET_HMAC_SHA_512 = 0xa, 385 /* 0x0b - 0x10 reserved */ 386 UV_SECRET_ECDSA_P256 = 0x11, 387 UV_SECRET_ECDSA_P384 = 0x12, 388 UV_SECRET_ECDSA_P521 = 0x13, 389 UV_SECRET_ECDSA_ED25519 = 0x14, 390 UV_SECRET_ECDSA_ED448 = 0x15, 391 }; 392 393 /** 394 * uv_secret_list_item_hdr - UV secret metadata. 395 * @index: Index of the secret in the secret list. 396 * @type: Type of the secret. See `enum uv_secret_types`. 397 * @length: Length of the stored secret. 398 */ 399 struct uv_secret_list_item_hdr { 400 u16 index; 401 u16 type; 402 u32 length; 403 } __packed __aligned(8); 404 405 #define UV_SECRET_ID_LEN 32 406 /** 407 * uv_secret_list_item - UV secret entry. 408 * @hdr: The metadata of this secret. 409 * @id: The ID of this secret, not the secret itself. 410 */ 411 struct uv_secret_list_item { 412 struct uv_secret_list_item_hdr hdr; 413 u64 reserverd08; 414 u8 id[UV_SECRET_ID_LEN]; 415 } __packed __aligned(8); 416 417 /** 418 * uv_secret_list - UV secret-metadata list. 419 * @num_secr_stored: Number of secrets stored in this list. 420 * @total_num_secrets: Number of secrets stored in the UV for this guest. 421 * @next_secret_idx: positive number if there are more secrets available or zero. 422 * @secrets: Up to 85 UV-secret metadata entries. 423 */ 424 struct uv_secret_list { 425 u16 num_secr_stored; 426 u16 total_num_secrets; 427 u16 next_secret_idx; 428 u16 reserved_06; 429 u64 reserved_08; 430 struct uv_secret_list_item secrets[85]; 431 } __packed __aligned(8); 432 static_assert(sizeof(struct uv_secret_list) == PAGE_SIZE); 433 434 static inline int __uv_call(unsigned long r1, unsigned long r2) 435 { 436 int cc; 437 438 asm volatile( 439 " .insn rrf,0xb9a40000,%[r1],%[r2],0,0\n" 440 CC_IPM(cc) 441 : CC_OUT(cc, cc) 442 : [r1] "a" (r1), [r2] "a" (r2) 443 : CC_CLOBBER_LIST("memory")); 444 return CC_TRANSFORM(cc); 445 } 446 447 static inline int uv_call(unsigned long r1, unsigned long r2) 448 { 449 int cc; 450 451 do { 452 cc = __uv_call(r1, r2); 453 } while (cc > 1); 454 return cc; 455 } 456 457 /* Low level uv_call that avoids stalls for long running busy conditions */ 458 static inline int uv_call_sched(unsigned long r1, unsigned long r2) 459 { 460 int cc; 461 462 do { 463 cc = __uv_call(r1, r2); 464 cond_resched(); 465 } while (cc > 1); 466 return cc; 467 } 468 469 /* 470 * special variant of uv_call that only transports the cpu or guest 471 * handle and the command, like destroy or verify. 472 */ 473 static inline int uv_cmd_nodata(u64 handle, u16 cmd, u16 *rc, u16 *rrc) 474 { 475 struct uv_cb_nodata uvcb = { 476 .header.cmd = cmd, 477 .header.len = sizeof(uvcb), 478 .handle = handle, 479 }; 480 int cc; 481 482 WARN(!handle, "No handle provided to Ultravisor call cmd %x\n", cmd); 483 cc = uv_call_sched(0, (u64)&uvcb); 484 *rc = uvcb.header.rc; 485 *rrc = uvcb.header.rrc; 486 return cc ? -EINVAL : 0; 487 } 488 489 /** 490 * uv_list_secrets() - Do a List Secrets UVC. 491 * 492 * @buf: Buffer to write list into; size of one page. 493 * @start_idx: The smallest index that should be included in the list. 494 * For the fist invocation use 0. 495 * @rc: Pointer to store the return code or NULL. 496 * @rrc: Pointer to store the return reason code or NULL. 497 * 498 * This function calls the List Secrets UVC. The result is written into `buf`, 499 * that needs to be at least one page of writable memory. 500 * `buf` consists of: 501 * * %struct uv_secret_list_hdr 502 * * %struct uv_secret_list_item (multiple) 503 * 504 * For `start_idx` use _0_ for the first call. If there are more secrets available 505 * but could not fit into the page then `rc` is `UVC_RC_MORE_DATA`. 506 * In this case use `uv_secret_list_hdr.next_secret_idx` for `start_idx`. 507 * 508 * Context: might sleep. 509 * 510 * Return: The UVC condition code. 511 */ 512 static inline int uv_list_secrets(struct uv_secret_list *buf, u16 start_idx, 513 u16 *rc, u16 *rrc) 514 { 515 struct uv_cb_list_secrets uvcb = { 516 .header.len = sizeof(uvcb), 517 .header.cmd = UVC_CMD_LIST_SECRETS, 518 .start_idx = start_idx, 519 .list_addr = (u64)buf, 520 }; 521 int cc = uv_call_sched(0, (u64)&uvcb); 522 523 if (rc) 524 *rc = uvcb.header.rc; 525 if (rrc) 526 *rrc = uvcb.header.rrc; 527 528 return cc; 529 } 530 531 struct uv_info { 532 unsigned long inst_calls_list[4]; 533 unsigned long uv_base_stor_len; 534 unsigned long guest_base_stor_len; 535 unsigned long guest_virt_base_stor_len; 536 unsigned long guest_virt_var_stor_len; 537 unsigned long guest_cpu_stor_len; 538 unsigned long max_sec_stor_addr; 539 unsigned int max_num_sec_conf; 540 unsigned short max_guest_cpu_id; 541 unsigned long uv_feature_indications; 542 unsigned long supp_se_hdr_ver; 543 unsigned long supp_se_hdr_pcf; 544 unsigned long conf_dump_storage_state_len; 545 unsigned long conf_dump_finalize_len; 546 unsigned long supp_att_req_hdr_ver; 547 unsigned long supp_att_pflags; 548 unsigned long supp_add_secret_req_ver; 549 unsigned long supp_add_secret_pcf; 550 unsigned long supp_secret_types; 551 unsigned short max_assoc_secrets; 552 unsigned short max_retr_secrets; 553 }; 554 555 extern struct uv_info uv_info; 556 557 static inline bool uv_has_feature(u8 feature_bit) 558 { 559 if (feature_bit >= sizeof(uv_info.uv_feature_indications) * 8) 560 return false; 561 return test_bit_inv(feature_bit, &uv_info.uv_feature_indications); 562 } 563 564 extern int prot_virt_guest; 565 566 static inline int is_prot_virt_guest(void) 567 { 568 return prot_virt_guest; 569 } 570 571 static inline int share(unsigned long addr, u16 cmd) 572 { 573 struct uv_cb_share uvcb = { 574 .header.cmd = cmd, 575 .header.len = sizeof(uvcb), 576 .paddr = addr 577 }; 578 579 if (!is_prot_virt_guest()) 580 return -EOPNOTSUPP; 581 /* 582 * Sharing is page wise, if we encounter addresses that are 583 * not page aligned, we assume something went wrong. If 584 * malloced structs are passed to this function, we could leak 585 * data to the hypervisor. 586 */ 587 BUG_ON(addr & ~PAGE_MASK); 588 589 if (!uv_call(0, (u64)&uvcb)) 590 return 0; 591 pr_err("%s UVC failed (rc: 0x%x, rrc: 0x%x), possible hypervisor bug.\n", 592 uvcb.header.cmd == UVC_CMD_SET_SHARED_ACCESS ? "Share" : "Unshare", 593 uvcb.header.rc, uvcb.header.rrc); 594 panic("System security cannot be guaranteed unless the system panics now.\n"); 595 } 596 597 /* 598 * Guest 2 request to the Ultravisor to make a page shared with the 599 * hypervisor for IO. 600 * 601 * @addr: Real or absolute address of the page to be shared 602 */ 603 static inline int uv_set_shared(unsigned long addr) 604 { 605 return share(addr, UVC_CMD_SET_SHARED_ACCESS); 606 } 607 608 /* 609 * Guest 2 request to the Ultravisor to make a page unshared. 610 * 611 * @addr: Real or absolute address of the page to be unshared 612 */ 613 static inline int uv_remove_shared(unsigned long addr) 614 { 615 return share(addr, UVC_CMD_REMOVE_SHARED_ACCESS); 616 } 617 618 int uv_find_secret(const u8 secret_id[UV_SECRET_ID_LEN], 619 struct uv_secret_list *list, 620 struct uv_secret_list_item_hdr *secret); 621 int uv_retrieve_secret(u16 secret_idx, u8 *buf, size_t buf_size); 622 623 extern int prot_virt_host; 624 625 static inline int is_prot_virt_host(void) 626 { 627 return prot_virt_host; 628 } 629 630 int uv_pin_shared(unsigned long paddr); 631 int uv_destroy_folio(struct folio *folio); 632 int uv_destroy_pte(pte_t pte); 633 int uv_convert_from_secure_pte(pte_t pte); 634 int make_hva_secure(struct mm_struct *mm, unsigned long hva, struct uv_cb_header *uvcb); 635 int uv_convert_from_secure(unsigned long paddr); 636 int uv_convert_from_secure_folio(struct folio *folio); 637 638 void setup_uv(void); 639 640 #endif /* _ASM_S390_UV_H */ 641