Skip to content

Commit db54dfc

Browse files
steffen-eidenfrankjaa
authored andcommitted
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>
1 parent 78d3326 commit db54dfc

3 files changed

Lines changed: 55 additions & 2 deletions

File tree

arch/s390/boot/uv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ void uv_query_info(void)
4747
uv_info.conf_dump_finalize_len = uvcb.conf_dump_finalize_len;
4848
uv_info.supp_att_req_hdr_ver = uvcb.supp_att_req_hdr_ver;
4949
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;
5054
}
5155

5256
#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST

arch/s390/include/asm/uv.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct uv_cb_qui {
123123
u32 reserved70[3]; /* 0x0070 */
124124
u32 max_num_sec_conf; /* 0x007c */
125125
u64 max_guest_stor_addr; /* 0x0080 */
126-
u8 reserved88[158 - 136]; /* 0x0088 */
126+
u8 reserved88[0x9e - 0x88]; /* 0x0088 */
127127
u16 max_guest_cpu_id; /* 0x009e */
128128
u64 uv_feature_indications; /* 0x00a0 */
129129
u64 reserveda8; /* 0x00a8 */
@@ -135,7 +135,12 @@ struct uv_cb_qui {
135135
u64 reservedd8; /* 0x00d8 */
136136
u64 supp_att_req_hdr_ver; /* 0x00e0 */
137137
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 */
139144
} __packed __aligned(8);
140145

141146
/* Initialize Ultravisor */
@@ -384,6 +389,10 @@ struct uv_info {
384389
unsigned long conf_dump_finalize_len;
385390
unsigned long supp_att_req_hdr_ver;
386391
unsigned long supp_att_pflags;
392+
unsigned long supp_add_secret_req_ver;
393+
unsigned long supp_add_secret_pcf;
394+
unsigned long supp_secret_types;
395+
unsigned short max_secrets;
387396
};
388397

389398
extern struct uv_info uv_info;

arch/s390/kernel/uv.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,42 @@ static ssize_t uv_query_supp_att_pflags(struct kobject *kobj,
579579
static struct kobj_attribute uv_query_supp_att_pflags_attr =
580580
__ATTR(supp_att_pflags, 0444, uv_query_supp_att_pflags, NULL);
581581

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+
582618
static struct attribute *uv_query_attrs[] = {
583619
&uv_query_facilities_attr.attr,
584620
&uv_query_feature_indications_attr.attr,
@@ -592,6 +628,10 @@ static struct attribute *uv_query_attrs[] = {
592628
&uv_query_dump_cpu_len_attr.attr,
593629
&uv_query_supp_att_req_hdr_ver_attr.attr,
594630
&uv_query_supp_att_pflags_attr.attr,
631+
&uv_query_supp_add_secret_req_ver_attr.attr,
632+
&uv_query_supp_add_secret_pcf_attr.attr,
633+
&uv_query_supp_secret_types_attr.attr,
634+
&uv_query_max_secrets_attr.attr,
595635
NULL,
596636
};
597637

0 commit comments

Comments
 (0)