2023-06-06 18:11:51

by Steffen Eiden

[permalink] [raw]
Subject: [PATCH v4 6/6] 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 <[email protected]>
---
arch/s390/boot/uv.c | 4 ++++
arch/s390/include/asm/uv.h | 13 +++++++++++--
arch/s390/kernel/uv.c | 40 ++++++++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/arch/s390/boot/uv.c b/arch/s390/boot/uv.c
index 0a077c0a2056..cdffc395f1cd 100644
--- a/arch/s390/boot/uv.c
+++ b/arch/s390/boot/uv.c
@@ -47,6 +47,10 @@ void uv_query_info(void)
uv_info.conf_dump_finalize_len = uvcb.conf_dump_finalize_len;
uv_info.supp_att_req_hdr_ver = uvcb.supp_att_req_hdr_ver;
uv_info.supp_att_pflags = uvcb.supp_att_pflags;
+ uv_info.supp_add_secret_req_ver = uvcb.supp_add_secret_req_ver;
+ uv_info.supp_add_secret_pcf = uvcb.supp_add_secret_pcf;
+ uv_info.supp_secret_types = uvcb.supp_secret_types;
+ uv_info.max_secrets = uvcb.max_secrets
}

#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
diff --git a/arch/s390/include/asm/uv.h b/arch/s390/include/asm/uv.h
index 3203ffbdde6b..d6bb2f4f78d1 100644
--- a/arch/s390/include/asm/uv.h
+++ b/arch/s390/include/asm/uv.h
@@ -123,7 +123,7 @@ struct uv_cb_qui {
u32 reserved70[3]; /* 0x0070 */
u32 max_num_sec_conf; /* 0x007c */
u64 max_guest_stor_addr; /* 0x0080 */
- u8 reserved88[158 - 136]; /* 0x0088 */
+ u8 reserved88[0x9e - 0x88]; /* 0x0088 */
u16 max_guest_cpu_id; /* 0x009e */
u64 uv_feature_indications; /* 0x00a0 */
u64 reserveda8; /* 0x00a8 */
@@ -135,7 +135,12 @@ struct uv_cb_qui {
u64 reservedd8; /* 0x00d8 */
u64 supp_att_req_hdr_ver; /* 0x00e0 */
u64 supp_att_pflags; /* 0x00e8 */
- u8 reservedf0[256 - 240]; /* 0x00f0 */
+ u64 reservedf0; /* 0x00f0 */
+ u64 supp_add_secret_req_ver; /* 0x00f8 */
+ u64 supp_add_secret_pcf; /* 0x0100 */
+ u64 supp_secret_types; /* 0x0180 */
+ u16 max_secrets; /* 0x0110 */
+ u8 reserved112[0x120 - 0x112]; /* 0x0112 */
} __packed __aligned(8);

/* Initialize Ultravisor */
@@ -384,6 +389,10 @@ struct uv_info {
unsigned long conf_dump_finalize_len;
unsigned long supp_att_req_hdr_ver;
unsigned long supp_att_pflags;
+ unsigned long supp_add_secret_req_ver;
+ unsigned long supp_add_secret_pcf;
+ unsigned long supp_secret_types;
+ unsigned short max_secrets;
};

extern struct uv_info uv_info;
diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
index 23fa2f2e90fc..d8b25cda5471 100644
--- a/arch/s390/kernel/uv.c
+++ b/arch/s390/kernel/uv.c
@@ -571,6 +571,42 @@ static ssize_t uv_query_supp_att_pflags(struct kobject *kobj,
static struct kobj_attribute uv_query_supp_att_pflags_attr =
__ATTR(supp_att_pflags, 0444, uv_query_supp_att_pflags, NULL);

+static ssize_t uv_query_supp_add_secret_req_ver(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "%lx\n", uv_info.supp_add_secret_req_ver);
+}
+
+static struct kobj_attribute uv_query_supp_add_secret_req_ver_attr =
+ __ATTR(supp_add_secret_req_ver, 0444, uv_query_supp_add_secret_req_ver, NULL);
+
+static ssize_t uv_query_supp_add_secret_pcf(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "%lx\n", uv_info.supp_add_secret_pcf);
+}
+
+static struct kobj_attribute uv_query_supp_add_secret_pcf_attr =
+ __ATTR(supp_add_secret_pcf, 0444, uv_query_supp_add_secret_pcf, NULL);
+
+static ssize_t uv_query_supp_secret_types(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "%lx\n", uv_info.supp_secret_types);
+}
+
+static struct kobj_attribute uv_query_supp_secret_types_attr =
+ __ATTR(supp_secret_types, 0444, uv_query_supp_secret_types, NULL);
+
+static ssize_t uv_query_max_secrets(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "%d\n", uv_info.max_secrets);
+}
+
+static struct kobj_attribute uv_query_max_secrets_attr =
+ __ATTR(max_secrets, 0444, uv_query_max_secrets, NULL);
+
static struct attribute *uv_query_attrs[] = {
&uv_query_facilities_attr.attr,
&uv_query_feature_indications_attr.attr,
@@ -584,6 +620,10 @@ static struct attribute *uv_query_attrs[] = {
&uv_query_dump_cpu_len_attr.attr,
&uv_query_supp_att_req_hdr_ver_attr.attr,
&uv_query_supp_att_pflags_attr.attr,
+ &uv_query_supp_add_secret_req_ver_attr.attr,
+ &uv_query_supp_add_secret_pcf_attr.attr,
+ &uv_query_supp_secret_types_attr.attr,
+ &uv_query_max_secrets_attr.attr,
NULL,
};

--
2.40.1



2023-06-07 07:17:13

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v4 6/6] s390/uv: Update query for secret-UVCs

Hi Steffen,

kernel test robot noticed the following build errors:

[auto build test ERROR on kvms390/next]
[also build test ERROR on s390/features mst-vhost/linux-next linus/master v6.4-rc5 next-20230607]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Steffen-Eiden/s390-uvdevice-Add-info-IOCTL/20230607-021159
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git next
patch link: https://lore.kernel.org/r/20230606180817.3019077-7-seiden%40linux.ibm.com
patch subject: [PATCH v4 6/6] s390/uv: Update query for secret-UVCs
config: s390-defconfig (https://download.01.org/0day-ci/archive/20230607/[email protected]/config)
compiler: s390-linux-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add kvms390 https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
git fetch kvms390 next
git checkout kvms390/next
b4 shazam https://lore.kernel.org/r/[email protected]
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=s390 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

arch/s390/boot/uv.c: In function 'uv_query_info':
>> arch/s390/boot/uv.c:53:55: error: expected ';' before '}' token
53 | uv_info.max_secrets = uvcb.max_secrets
| ^
| ;
54 | }
| ~


vim +53 arch/s390/boot/uv.c

18
19 void uv_query_info(void)
20 {
21 struct uv_cb_qui uvcb = {
22 .header.cmd = UVC_CMD_QUI,
23 .header.len = sizeof(uvcb)
24 };
25
26 if (!test_facility(158))
27 return;
28
29 /* rc==0x100 means that there is additional data we do not process */
30 if (uv_call(0, (uint64_t)&uvcb) && uvcb.header.rc != 0x100)
31 return;
32
33 if (IS_ENABLED(CONFIG_KVM)) {
34 memcpy(uv_info.inst_calls_list, uvcb.inst_calls_list, sizeof(uv_info.inst_calls_list));
35 uv_info.uv_base_stor_len = uvcb.uv_base_stor_len;
36 uv_info.guest_base_stor_len = uvcb.conf_base_phys_stor_len;
37 uv_info.guest_virt_base_stor_len = uvcb.conf_base_virt_stor_len;
38 uv_info.guest_virt_var_stor_len = uvcb.conf_virt_var_stor_len;
39 uv_info.guest_cpu_stor_len = uvcb.cpu_stor_len;
40 uv_info.max_sec_stor_addr = ALIGN(uvcb.max_guest_stor_addr, PAGE_SIZE);
41 uv_info.max_num_sec_conf = uvcb.max_num_sec_conf;
42 uv_info.max_guest_cpu_id = uvcb.max_guest_cpu_id;
43 uv_info.uv_feature_indications = uvcb.uv_feature_indications;
44 uv_info.supp_se_hdr_ver = uvcb.supp_se_hdr_versions;
45 uv_info.supp_se_hdr_pcf = uvcb.supp_se_hdr_pcf;
46 uv_info.conf_dump_storage_state_len = uvcb.conf_dump_storage_state_len;
47 uv_info.conf_dump_finalize_len = uvcb.conf_dump_finalize_len;
48 uv_info.supp_att_req_hdr_ver = uvcb.supp_att_req_hdr_ver;
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
54 }
55

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-06-07 12:47:49

by Janosch Frank

[permalink] [raw]
Subject: Re: [PATCH v4 6/6] s390/uv: Update query for secret-UVCs

On 6/6/23 20:08, Steffen Eiden wrote:
> 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 <[email protected]>
> ---
> arch/s390/boot/uv.c | 4 ++++
> arch/s390/include/asm/uv.h | 13 +++++++++++--
> arch/s390/kernel/uv.c | 40 ++++++++++++++++++++++++++++++++++++++
> 3 files changed, 55 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/boot/uv.c b/arch/s390/boot/uv.c
> index 0a077c0a2056..cdffc395f1cd 100644
> --- a/arch/s390/boot/uv.c
> +++ b/arch/s390/boot/uv.c
> @@ -47,6 +47,10 @@ void uv_query_info(void)
> uv_info.conf_dump_finalize_len = uvcb.conf_dump_finalize_len;
> uv_info.supp_att_req_hdr_ver = uvcb.supp_att_req_hdr_ver;
> uv_info.supp_att_pflags = uvcb.supp_att_pflags;
> + uv_info.supp_add_secret_req_ver = uvcb.supp_add_secret_req_ver;
> + uv_info.supp_add_secret_pcf = uvcb.supp_add_secret_pcf;
> + uv_info.supp_secret_types = uvcb.supp_secret_types;
> + uv_info.max_secrets = uvcb.max_secrets

Apart from this:
Reviewed-by: Janosch Frank <[email protected]>

But we can add the ";" when picking.