Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/uv: Update query for secret-UVCs

Update the query struct such that secret-UVC related
information can be parsed.
Add sysfs files for these new values.

'supp_add_secret_req_ver' notes the supported versions for the
Add Secret UVC. Bit 0 indicates that version 0x100 is supported,
bit 1 indicates 0x200, and so on.

'supp_add_secret_pcf' notes the supported plaintext flags for
the Add Secret UVC.

'supp_secret_types' notes the supported types of secrets.
Bit 0 indicates secret type 1, bit 1 indicates type 2, and so on.

'max_secrets' notes the maximum amount of secrets the secret store can
store per pv guest.

Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20230615100533.3996107-8-seiden@linux.ibm.com
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Message-Id: <20230615100533.3996107-8-seiden@linux.ibm.com>

authored by

Steffen Eiden and committed by
Janosch Frank
db54dfc9 78d3326e

+55 -2
+4
arch/s390/boot/uv.c
··· 47 47 uv_info.conf_dump_finalize_len = uvcb.conf_dump_finalize_len; 48 48 uv_info.supp_att_req_hdr_ver = uvcb.supp_att_req_hdr_ver; 49 49 uv_info.supp_att_pflags = uvcb.supp_att_pflags; 50 + uv_info.supp_add_secret_req_ver = uvcb.supp_add_secret_req_ver; 51 + uv_info.supp_add_secret_pcf = uvcb.supp_add_secret_pcf; 52 + uv_info.supp_secret_types = uvcb.supp_secret_types; 53 + uv_info.max_secrets = uvcb.max_secrets; 50 54 } 51 55 52 56 #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
+11 -2
arch/s390/include/asm/uv.h
··· 123 123 u32 reserved70[3]; /* 0x0070 */ 124 124 u32 max_num_sec_conf; /* 0x007c */ 125 125 u64 max_guest_stor_addr; /* 0x0080 */ 126 - u8 reserved88[158 - 136]; /* 0x0088 */ 126 + u8 reserved88[0x9e - 0x88]; /* 0x0088 */ 127 127 u16 max_guest_cpu_id; /* 0x009e */ 128 128 u64 uv_feature_indications; /* 0x00a0 */ 129 129 u64 reserveda8; /* 0x00a8 */ ··· 135 135 u64 reservedd8; /* 0x00d8 */ 136 136 u64 supp_att_req_hdr_ver; /* 0x00e0 */ 137 137 u64 supp_att_pflags; /* 0x00e8 */ 138 - u8 reservedf0[256 - 240]; /* 0x00f0 */ 138 + u64 reservedf0; /* 0x00f0 */ 139 + u64 supp_add_secret_req_ver; /* 0x00f8 */ 140 + u64 supp_add_secret_pcf; /* 0x0100 */ 141 + u64 supp_secret_types; /* 0x0180 */ 142 + u16 max_secrets; /* 0x0110 */ 143 + u8 reserved112[0x120 - 0x112]; /* 0x0112 */ 139 144 } __packed __aligned(8); 140 145 141 146 /* Initialize Ultravisor */ ··· 389 384 unsigned long conf_dump_finalize_len; 390 385 unsigned long supp_att_req_hdr_ver; 391 386 unsigned long supp_att_pflags; 387 + unsigned long supp_add_secret_req_ver; 388 + unsigned long supp_add_secret_pcf; 389 + unsigned long supp_secret_types; 390 + unsigned short max_secrets; 392 391 }; 393 392 394 393 extern struct uv_info uv_info;
+40
arch/s390/kernel/uv.c
··· 579 579 static struct kobj_attribute uv_query_supp_att_pflags_attr = 580 580 __ATTR(supp_att_pflags, 0444, uv_query_supp_att_pflags, NULL); 581 581 582 + static ssize_t uv_query_supp_add_secret_req_ver(struct kobject *kobj, 583 + struct kobj_attribute *attr, char *buf) 584 + { 585 + return sysfs_emit(buf, "%lx\n", uv_info.supp_add_secret_req_ver); 586 + } 587 + 588 + static struct kobj_attribute uv_query_supp_add_secret_req_ver_attr = 589 + __ATTR(supp_add_secret_req_ver, 0444, uv_query_supp_add_secret_req_ver, NULL); 590 + 591 + static ssize_t uv_query_supp_add_secret_pcf(struct kobject *kobj, 592 + struct kobj_attribute *attr, char *buf) 593 + { 594 + return sysfs_emit(buf, "%lx\n", uv_info.supp_add_secret_pcf); 595 + } 596 + 597 + static struct kobj_attribute uv_query_supp_add_secret_pcf_attr = 598 + __ATTR(supp_add_secret_pcf, 0444, uv_query_supp_add_secret_pcf, NULL); 599 + 600 + static ssize_t uv_query_supp_secret_types(struct kobject *kobj, 601 + struct kobj_attribute *attr, char *buf) 602 + { 603 + return sysfs_emit(buf, "%lx\n", uv_info.supp_secret_types); 604 + } 605 + 606 + static struct kobj_attribute uv_query_supp_secret_types_attr = 607 + __ATTR(supp_secret_types, 0444, uv_query_supp_secret_types, NULL); 608 + 609 + static ssize_t uv_query_max_secrets(struct kobject *kobj, 610 + struct kobj_attribute *attr, char *buf) 611 + { 612 + return sysfs_emit(buf, "%d\n", uv_info.max_secrets); 613 + } 614 + 615 + static struct kobj_attribute uv_query_max_secrets_attr = 616 + __ATTR(max_secrets, 0444, uv_query_max_secrets, NULL); 617 + 582 618 static struct attribute *uv_query_attrs[] = { 583 619 &uv_query_facilities_attr.attr, 584 620 &uv_query_feature_indications_attr.attr, ··· 628 592 &uv_query_dump_cpu_len_attr.attr, 629 593 &uv_query_supp_att_req_hdr_ver_attr.attr, 630 594 &uv_query_supp_att_pflags_attr.attr, 595 + &uv_query_supp_add_secret_req_ver_attr.attr, 596 + &uv_query_supp_add_secret_pcf_attr.attr, 597 + &uv_query_supp_secret_types_attr.attr, 598 + &uv_query_max_secrets_attr.attr, 631 599 NULL, 632 600 }; 633 601