s390x update 2021-26-05
Dear Paolo,
please merge or pull the following changes:
* SCLP feature probing
* SCLP cpu model check
* UV host tests
MERGE:
https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/merge_requests/9
PIPELINE:
https://gitlab.com/frankja/kvm-unit-tests/-/pipelines/309936640
PULL:
The following changes since commit 74ff0e9675ec6d9477f5e98ec7d5d50878fa7ebc:
Merge branch 'arm/queue' into 'master' (2021-05-18 11:07:08 +0000)
are available in the Git repository at:
https://gitlab.com/frankja/kvm-unit-tests.git s390x-pull-2021-26-05
for you to fetch changes up to 21f5f67675830e1c088539656cdc0f63bc18e4e0:
s390x: cpumodel: FMT2 and FMT4 SCLP test (2021-05-26 14:27:09 +0000)
Janosch Frank (9):
s390x: uv-guest: Add invalid share location test
s390x: Add more Ultravisor command structure definitions
s390x: uv: Add UV lib
s390x: Test for share/unshare call support before using them
s390x: uv-guest: Test invalid commands
s390x: Add UV host test
s390x: sclp: Only fetch read info byte 134 if cpu entries are above it
lib: s390x: sclp: Extend feature probing
s390x: cpumodel: FMT2 and FMT4 SCLP test
lib/s390x/asm/uv.h | 152 ++++++++++++- lib/s390x/io.c | 2 + lib/s390x/malloc_io.c | 5 +- lib/s390x/sclp.c | 23 +- lib/s390x/sclp.h | 39 +++- lib/s390x/uv.c | 45 ++++ lib/s390x/uv.h | 10 + s390x/Makefile | 2 + s390x/cpumodel.c | 71 ++++++- s390x/uv-guest.c | 60 +++++- s390x/uv-host.c | 480 ++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 871 insertions(+), 18 deletions(-) create mode 100644 lib/s390x/uv.c create mode 100644 lib/s390x/uv.h create mode 100644 s390x/uv-host.c
Signature · 1 line
2.31.1
[kvm-unit-tests GIT PULL 1/9] s390x: uv-guest: Add invalid share location test
Lets also test sharing unavailable memory.
--- s390x/uv-guest.c | 5 +++++ 1 file changed, 5 insertions(+)
s390x/uv-guest.c +5 -0
@@ -15,6 +15,7 @@#include <asm/interrupt.h> #include <asm/facility.h> #include <asm/uv.h> +#include <sclp.h> static unsigned long page;
@@ -99,6 +100,10 @@ static void test_sharing(void) uvcb.header.len =sizeof (uvcb); cc =uv_call (0 , (u64)&uvcb);report (cc ==0 && uvcb.header.rc ==UVC_RC_EXECUTED ,"share" ); + uvcb.paddr =get_ram_size () +PAGE_SIZE ; + cc =uv_call (0 , (u64)&uvcb); +report (cc ==1 && uvcb.header.rc ==0x101 ,"invalid memory" ); + uvcb.paddr = page;report_prefix_pop ();report_prefix_push ("unshare" );
Signature · 1 line
2.31.1
[kvm-unit-tests GIT PULL 2/9] s390x: Add more Ultravisor command structure definitions
In reply to Janosch FrankThey are needed in the new UV tests.
As we now extend the size of the query struct, we need to set the length in the UV guest query test to a constant instead of using sizeof.
--- lib/s390x/asm/uv.h | 148 ++++++++++++++++++++++++++++++++++++++++++++- s390x/uv-guest.c | 3 +- 2 files changed, 149 insertions(+), 2 deletions(-)
lib/s390x/asm/uv.h +147 -1
@@ -17,16 +17,54 @@#define UVC_RC_INV_STATE 0x0003#define UVC_RC_INV_LEN 0x0005#define UVC_RC_NO_RESUME 0x0007 +#define UVC_RC_INV_GHANDLE 0x0020 +#define UVC_RC_INV_CHANDLE 0x0021#define UVC_CMD_QUI 0x0001 +#define UVC_CMD_INIT_UV 0x000f +#define UVC_CMD_CREATE_SEC_CONF 0x0100 +#define UVC_CMD_DESTROY_SEC_CONF 0x0101 +#define UVC_CMD_CREATE_SEC_CPU 0x0120 +#define UVC_CMD_DESTROY_SEC_CPU 0x0121 +#define UVC_CMD_CONV_TO_SEC_STOR 0x0200 +#define UVC_CMD_CONV_FROM_SEC_STOR 0x0201 +#define UVC_CMD_SET_SEC_CONF_PARAMS 0x0300 +#define UVC_CMD_UNPACK_IMG 0x0301 +#define UVC_CMD_VERIFY_IMG 0x0302 +#define UVC_CMD_CPU_RESET 0x0310 +#define UVC_CMD_CPU_RESET_INITIAL 0x0311 +#define UVC_CMD_PERF_CONF_CLEAR_RESET 0x0320 +#define UVC_CMD_CPU_RESET_CLEAR 0x0321 +#define UVC_CMD_CPU_SET_STATE 0x0330 +#define UVC_CMD_SET_UNSHARED_ALL 0x0340 +#define UVC_CMD_PIN_PAGE_SHARED 0x0341 +#define UVC_CMD_UNPIN_PAGE_SHARED 0x0342#define UVC_CMD_SET_SHARED_ACCESS 0x1000#define UVC_CMD_REMOVE_SHARED_ACCESS 0x1001/* Bits in installed uv calls */ enum uv_cmds_inst {BIT_UVC_CMD_QUI =0 , +BIT_UVC_CMD_INIT_UV =1 , +BIT_UVC_CMD_CREATE_SEC_CONF =2 , +BIT_UVC_CMD_DESTROY_SEC_CONF =3 , +BIT_UVC_CMD_CREATE_SEC_CPU =4 , +BIT_UVC_CMD_DESTROY_SEC_CPU =5 , +BIT_UVC_CMD_CONV_TO_SEC_STOR =6 , +BIT_UVC_CMD_CONV_FROM_SEC_STOR =7 ,BIT_UVC_CMD_SET_SHARED_ACCESS =8 ,BIT_UVC_CMD_REMOVE_SHARED_ACCESS =9 , +BIT_UVC_CMD_SET_SEC_PARMS =11 , +BIT_UVC_CMD_UNPACK_IMG =13 , +BIT_UVC_CMD_VERIFY_IMG =14 , +BIT_UVC_CMD_CPU_RESET =15 , +BIT_UVC_CMD_CPU_RESET_INITIAL =16 , +BIT_UVC_CMD_CPU_SET_STATE =17 , +BIT_UVC_CMD_PREPARE_CLEAR_RESET =18 , +BIT_UVC_CMD_CPU_PERFORM_CLEAR_RESET =19 , +BIT_UVC_CMD_UNSHARE_ALL =20 , +BIT_UVC_CMD_PIN_PAGE_SHARED =21 , +BIT_UVC_CMD_UNPIN_PAGE_SHARED =22 , };struct uv_cb_header {
@@ -36,13 +74,81 @@ struct uv_cb_header {u16 rrc;/* Return Reason Code */ } __attribute__((packed)) __attribute__((aligned(8))); +struct uv_cb_init { +struct uv_cb_header header; +u64 reserved08[2 ]; +u64 stor_origin; +u64 stor_len; +u64 reserved28[4 ]; + +} __attribute__((packed)) __attribute__((aligned(8))); +struct uv_cb_qui {struct uv_cb_header header;u64 reserved08;u64 inst_calls_list[4 ]; -u64 reserved30[15 ]; +u64 reserved30[2 ]; +u64 uv_base_stor_len; +u64 reserved48; +u64 conf_base_phys_stor_len; +u64 conf_base_virt_stor_len; +u64 conf_virt_var_stor_len; +u64 cpu_stor_len; +u32 reserved70[3 ]; +u32 max_num_sec_conf; +u64 max_guest_stor_addr; +u8 reserved88[158 -136 ]; +u16 max_guest_cpus; +u8 reserveda0[200 -160 ]; +} __attribute__((packed)) __attribute__((aligned(8))); + +struct uv_cb_cgc { +struct uv_cb_header header; +u64 reserved08[2 ]; +u64 guest_handle; +u64 conf_base_stor_origin; +u64 conf_var_stor_origin; +u64 reserved30; +u64 guest_stor_origin; +u64 guest_stor_len; +u64 guest_sca; +u64 guest_asce; +u64 reserved60[5 ]; } __attribute__((packed)) __attribute__((aligned(8))); +struct uv_cb_csc { +struct uv_cb_header header; +u64 reserved08[2 ]; +u64 cpu_handle; +u64 guest_handle; +u64 stor_origin; +u8 reserved30[6 ]; +u16 num; +u64 state_origin; +u64 reserved[4 ]; +} __attribute__((packed)) __attribute__((aligned(8))); + +struct uv_cb_unp { +struct uv_cb_header header; +u64 reserved08[2 ]; +u64 guest_handle; +u64 gaddr; +u64 tweak[2 ]; +u64 reserved38[3 ]; +} __attribute__((packed)) __attribute__((aligned(8))); + +/* +* A common UV call struct for the following calls: +* Destroy cpu/config +* Verify +*/ +struct uv_cb_nodata { +struct uv_cb_header header; +u64 reserved08[2 ]; +u64 handle; +u64 reserved20[4 ]; +} __attribute__((packed)) __attribute__((aligned(8))); +struct uv_cb_share {struct uv_cb_header header;u64 reserved08[3 ];
@@ -50,6 +156,32 @@ struct uv_cb_share {u64 reserved28; } __attribute__((packed)) __attribute__((aligned(8))); +/* Convert to Secure */ +struct uv_cb_cts { +struct uv_cb_header header; +u64 reserved08[2 ]; +u64 guest_handle; +u64 gaddr; +} __attribute__((packed)) __attribute__((aligned(8))); + +/* Convert from Secure / Pin Page Shared */ +struct uv_cb_cfs { +struct uv_cb_header header; +u64 reserved08[2 ]; +u64 paddr; +} __attribute__((packed)) __attribute__((aligned(8))); + +/* Set Secure Config Parameter */ +struct uv_cb_ssc { +struct uv_cb_header header; +u64 reserved08[2 ]; +u64 guest_handle; +u64 sec_header_origin; +u32 sec_header_len; +u32 reserved2c; +u64 reserved30[4 ]; +} __attribute__((packed)) __attribute__((aligned(8))); +static inline int uv_call_once (unsigned long r1,unsigned long r2) {int cc;
@@ -118,4 +250,18 @@ static inline int uv_remove_shared(unsigned long addr) return share(addr, UVC_CMD_REMOVE_SHARED_ACCESS); } +struct uv_cb_cpu_set_state { +struct uv_cb_header header; +u64 reserved08[2 ]; +u64 cpu_handle; +u8 reserved20[7 ]; +u8 state; +u64 reserved28[5 ]; +}; + +#define PV_CPU_STATE_OPR 1 +#define PV_CPU_STATE_STP 2 +#define PV_CPU_STATE_CHKSTP 3 +#define PV_CPU_STATE_OPR_LOAD 5 +#endif
s390x/uv-guest.c +2 -1
@@ -59,7 +59,8 @@ static void test_query(void) {struct uv_cb_qui uvcb = { .header.cmd =UVC_CMD_QUI , - .header.len =sizeof (uvcb) -8 , +/* A dword below the minimum length */ + .header.len =0xa0 , };int cc;
Signature · 1 line
2.31.1
[kvm-unit-tests GIT PULL 3/9] s390x: uv: Add UV lib
In reply to Janosch FrankLets add a UV library to make checking the UV feature bit easier. In the future this library file can take care of handling UV initialization and UV guest creation.
--- lib/s390x/asm/uv.h | 4 ++-- lib/s390x/io.c | 2 ++ lib/s390x/uv.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ lib/s390x/uv.h | 10 ++++++++++ s390x/Makefile | 1 + 5 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 lib/s390x/uv.c create mode 100644 lib/s390x/uv.h
lib/s390x/asm/uv.h +2 -2
@@ -9,8 +9,8 @@* This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2. */ -#ifndef UV_H -#define UV_H +#ifndef ASM_S390X_UV_H +#define ASM_S390X_UV_H #define UVC_RC_EXECUTED 0x0001#define UVC_RC_INV_CMD 0x0002
lib/s390x/io.c +2 -0
@@ -14,6 +14,7 @@#include <asm/facility.h> #include <asm/sigp.h> #include "sclp.h" +#include "uv.h" #include "smp.h" extern char ipl_args[];
@@ -38,6 +39,7 @@ void setup(void)sclp_facilities_setup ();sclp_console_setup ();sclp_memory_setup (); +uv_setup ();smp_setup (); }
lib/s390x/uv.c new file +45 -0
45 lines not on this page · raw message
lib/s390x/uv.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef UV_H +#define UV_H + +bool uv_os_is_guest (void ); +bool uv_os_is_host (void ); +bool uv_query_test_call (unsigned int nr); +int uv_setup (void ); + +#endif /* UV_H */
s390x/Makefile +1 -0
@@ -67,6 +67,7 @@ cflatobjs += lib/s390x/vm.o cflatobjs += lib/s390x/css_dump.o cflatobjs += lib/s390x/css_lib.o cflatobjs += lib/s390x/malloc_io.o +cflatobjs += lib/s390x/uv.o OBJDIRS += lib/s390x
Signature · 1 line
2.31.1
[kvm-unit-tests GIT PULL 5/9] s390x: uv-guest: Test invalid commands
In reply to Janosch FrankLets check if the UV calls that should not be available in a protected guest 2 are actually not available. Also lets check if they are falsely indicated to be available.
--- s390x/uv-guest.c | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-)
s390x/uv-guest.c +39 -7
@@ -121,16 +121,48 @@ static void test_sharing(void)report_prefix_pop (); } +static struct { +const char *name; +uint16_t cmd; +uint16_t len; +int call_bit; +} invalid_cmds[] = { + {"bogus" ,0x4242 ,sizeof (struct uv_cb_header ),-1 }, + {"init" ,UVC_CMD_INIT_UV ,sizeof (struct uv_cb_init ),BIT_UVC_CMD_INIT_UV }, + {"create conf" ,UVC_CMD_CREATE_SEC_CONF ,sizeof (struct uv_cb_cgc ),BIT_UVC_CMD_CREATE_SEC_CONF }, + {"destroy conf" ,UVC_CMD_DESTROY_SEC_CONF ,sizeof (struct uv_cb_nodata ),BIT_UVC_CMD_DESTROY_SEC_CONF }, + {"create cpu" ,UVC_CMD_CREATE_SEC_CPU ,sizeof (struct uv_cb_csc ),BIT_UVC_CMD_CREATE_SEC_CPU }, + {"destroy cpu" ,UVC_CMD_DESTROY_SEC_CPU ,sizeof (struct uv_cb_nodata ),BIT_UVC_CMD_DESTROY_SEC_CPU }, + {"conv to" ,UVC_CMD_CONV_TO_SEC_STOR ,sizeof (struct uv_cb_cts ),BIT_UVC_CMD_CONV_TO_SEC_STOR }, + {"conv from" ,UVC_CMD_CONV_FROM_SEC_STOR ,sizeof (struct uv_cb_cfs ),BIT_UVC_CMD_CONV_FROM_SEC_STOR }, + {"set sec conf" ,UVC_CMD_SET_SEC_CONF_PARAMS ,sizeof (struct uv_cb_ssc ),BIT_UVC_CMD_SET_SEC_PARMS }, + {"unpack" ,UVC_CMD_UNPACK_IMG ,sizeof (struct uv_cb_unp ),BIT_UVC_CMD_UNPACK_IMG }, + {"verify" ,UVC_CMD_VERIFY_IMG ,sizeof (struct uv_cb_nodata ),BIT_UVC_CMD_VERIFY_IMG }, + {"cpu reset" ,UVC_CMD_CPU_RESET ,sizeof (struct uv_cb_nodata ),BIT_UVC_CMD_CPU_RESET }, + {"cpu initial reset" ,UVC_CMD_CPU_RESET_INITIAL ,sizeof (struct uv_cb_nodata ),BIT_UVC_CMD_CPU_RESET_INITIAL }, + {"conf clear reset" ,UVC_CMD_PERF_CONF_CLEAR_RESET ,sizeof (struct uv_cb_nodata ),BIT_UVC_CMD_PREPARE_CLEAR_RESET }, + {"cpu clear reset" ,UVC_CMD_CPU_RESET_CLEAR ,sizeof (struct uv_cb_nodata ),BIT_UVC_CMD_CPU_PERFORM_CLEAR_RESET }, + {"cpu set state" ,UVC_CMD_CPU_SET_STATE ,sizeof (struct uv_cb_cpu_set_state ),BIT_UVC_CMD_CPU_SET_STATE }, + {"pin shared" ,UVC_CMD_PIN_PAGE_SHARED ,sizeof (struct uv_cb_cfs ),BIT_UVC_CMD_PIN_PAGE_SHARED }, + {"unpin shared" ,UVC_CMD_UNPIN_PAGE_SHARED ,sizeof (struct uv_cb_cts ),BIT_UVC_CMD_UNPIN_PAGE_SHARED }, + {NULL ,0 ,0 }, +}; +static void test_invalid (void ) { -struct uv_cb_header uvcb = { - .len =16 , - .cmd =0x4242 , - }; -int cc; +struct uv_cb_header *hdr = (void *)page; +int cc, i; - cc =uv_call (0 , (u64)&uvcb); -report (cc ==1 && uvcb.rc ==UVC_RC_INV_CMD ,"invalid command" ); +report_prefix_push ("invalid" ); +for (i =0 ; invalid_cmds[i].name; i++) { + hdr->cmd = invalid_cmds[i].cmd; + hdr->len = invalid_cmds[i].len; + cc =uv_call (0 , (u64 )hdr); +report (cc ==1 && hdr->rc ==UVC_RC_INV_CMD && + (invalid_cmds[i].call_bit ==-1 || !uv_query_test_call (invalid_cmds[i].call_bit)), +"%s" , invalid_cmds[i].name); + } +report_prefix_pop (); }int main (void )
Signature · 1 line
2.31.1
[kvm-unit-tests GIT PULL 4/9] s390x: Test for share/unshare call support before using them
In reply to Janosch FrankTesting for facility only means the UV Call facility is available. The UV will only indicate the share/unshare calls for a protected guest 2, so lets also check that.
--- lib/s390x/malloc_io.c | 5 +++-- s390x/uv-guest.c | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-)
lib/s390x/malloc_io.c +3 -2
@@ -19,6 +19,7 @@#include <alloc_page.h> #include <asm/facility.h> #include <bitops.h> +#include <uv.h> static int share_pages (void *p,int count) {
@@ -47,7 +48,7 @@ void *alloc_io_mem(int size, int flags)assert (size); p =alloc_pages_flags (order,AREA_DMA31 | flags); -if (!p || !test_facility (158 )) +if (!p || !uv_os_is_guest ())return p; n =share_pages (p,1 << order);
@@ -65,7 +66,7 @@ void free_io_mem(void *p, int size)assert (IS_ALIGNED ((uintptr_t )p,PAGE_SIZE )); -if (test_facility (158 )) +if (uv_os_is_guest ())unshare_pages (p,1 << order);free_pages (p); }
s390x/uv-guest.c +6 -0
@@ -16,6 +16,7 @@#include <asm/facility.h> #include <asm/uv.h> #include <sclp.h> +#include <uv.h> static unsigned long page;
@@ -142,6 +143,11 @@ int main(void) goto done; } +if (!uv_os_is_guest ()) { +report_skip ("Not a protected guest" ); + goto done; + } + page = (unsigned long )alloc_page ();test_priv ();test_invalid ();
Signature · 1 line
2.31.1
[kvm-unit-tests GIT PULL 7/9] s390x: sclp: Only fetch read info byte 134 if cpu entries are above it
In reply to Janosch FrankThe cpu offset tells us where the cpu entries are in the sclp read info structure.
--- lib/s390x/sclp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/s390x/sclp.c +2 -1
@@ -138,7 +138,8 @@ void sclp_facilities_setup(void)assert (read_info); cpu =sclp_get_cpu_entries (); - sclp_facilities.has_diag318 = read_info->byte_134_diag318; +if (read_info->offset_cpu >134 ) + sclp_facilities.has_diag318 = read_info->byte_134_diag318;for (i =0 ; i < read_info->entries_cpu; i++, cpu++) {/* * The logic for only reading the facilities from the
Signature · 1 line
2.31.1
[kvm-unit-tests GIT PULL 9/9] s390x: cpumodel: FMT2 and FMT4 SCLP test
In reply to Janosch FrankSCLP is also part of the cpumodel, so we need to make sure that the features indicated via read info / read cpu info are correct.
--- s390x/cpumodel.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-)
s390x/cpumodel.c +70 -1
@@ -2,14 +2,81 @@/* * Test the known dependencies for facilities * -* Copyright 2019 IBM Corp. +* Copyright 2019, 2021 IBM Corp. * * Authors: * Christian Borntraeger <[email protected]> +* Janosch Frank <[email protected]> */ #include <asm/facility.h> #include <vm.h> +#include <sclp.h> +#include <uv.h> +#include <asm/uv.h> + +static void test_sclp_missing_sief2_implications (void ) +{ +/* Virtualization related facilities */ +report (!sclp_facilities.has_64bscao,"!64bscao" ); +report (!sclp_facilities.has_pfmfi,"!pfmfi" ); +report (!sclp_facilities.has_gsls,"!gsls" ); +report (!sclp_facilities.has_cmma,"!cmma" ); +report (!sclp_facilities.has_esca,"!esca" ); +report (!sclp_facilities.has_kss,"!kss" ); +report (!sclp_facilities.has_ibs,"!ibs" ); + +/* Virtualization related facilities reported via CPU entries */ +report (!sclp_facilities.has_sigpif,"!sigpif" ); +report (!sclp_facilities.has_sief2,"!sief2" ); +report (!sclp_facilities.has_skeyi,"!skeyi" ); +report (!sclp_facilities.has_siif,"!siif" ); +report (!sclp_facilities.has_cei,"!cei" ); +report (!sclp_facilities.has_ib,"!ib" ); +} + +static void test_sclp_features_fmt4 (void ) +{ +/* +* STFLE facilities are handled by the Ultravisor but SCLP +* facilities are advertised by the hypervisor. +*/ +report_prefix_push ("PV guest implies" ); + +/* General facilities */ +report (!sclp_facilities.has_diag318,"!diag318" ); + +/* +* Virtualization related facilities, all of which are +* unavailable because there's no virtualization support in a +* protected guest. +*/ +test_sclp_missing_sief2_implications (); + +report_prefix_pop (); +} + +static void test_sclp_features_fmt2 (void ) +{ +if (sclp_facilities.has_sief2) +return ; + +report_prefix_push ("!sief2 implies" ); +test_sclp_missing_sief2_implications (); +report_prefix_pop (); +} + +static void test_sclp_features (void ) +{ +report_prefix_push ("sclp" ); + +if (uv_os_is_guest ()) +test_sclp_features_fmt4 (); +else +test_sclp_features_fmt2 (); + +report_prefix_pop (); +} static struct { int facility;
@@ -60,6 +127,8 @@ int main(void) }report_prefix_pop (); +test_sclp_features (); +report_prefix_pop ();return report_summary (); }
Signature · 1 line
2.31.1
[kvm-unit-tests GIT PULL 8/9] lib: s390x: sclp: Extend feature probing
In reply to Janosch FrankLet's grab more of the feature bits from SCLP read info so we can use them in the cpumodel tests.
--- lib/s390x/sclp.c | 20 ++++++++++++++++++++ lib/s390x/sclp.h | 39 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 3 deletions(-)
lib/s390x/sclp.c +20 -0
@@ -129,6 +129,13 @@ CPUEntry *sclp_get_cpu_entries(void)return (CPUEntry *)(_read_info + read_info->offset_cpu); } +static bool sclp_feat_check (int byte,int bit) +{ +uint8_t *rib = (uint8_t *)read_info; + +return !!(rib[byte] & (0x80 >> bit)); +} +void sclp_facilities_setup (void ) {unsigned short cpu0_addr =stap ();
@@ -140,6 +147,14 @@ void sclp_facilities_setup(void) cpu =sclp_get_cpu_entries ();if (read_info->offset_cpu >134 ) sclp_facilities.has_diag318 = read_info->byte_134_diag318; + sclp_facilities.has_gsls =sclp_feat_check (85 ,SCLP_FEAT_85_BIT_GSLS ); + sclp_facilities.has_kss =sclp_feat_check (98 ,SCLP_FEAT_98_BIT_KSS ); + sclp_facilities.has_cmma =sclp_feat_check (116 ,SCLP_FEAT_116_BIT_CMMA ); + sclp_facilities.has_64bscao =sclp_feat_check (116 ,SCLP_FEAT_116_BIT_64BSCAO ); + sclp_facilities.has_esca =sclp_feat_check (116 ,SCLP_FEAT_116_BIT_ESCA ); + sclp_facilities.has_ibs =sclp_feat_check (117 ,SCLP_FEAT_117_BIT_IBS ); + sclp_facilities.has_pfmfi =sclp_feat_check (117 ,SCLP_FEAT_117_BIT_PFMFI ); +for (i =0 ; i < read_info->entries_cpu; i++, cpu++) {/* * The logic for only reading the facilities from the
@@ -150,6 +165,11 @@ void sclp_facilities_setup(void)*/ if (cpu->address == cpu0_addr) { sclp_facilities.has_sief2 = cpu->feat_sief2; + sclp_facilities.has_skeyi = cpu->feat_skeyi; + sclp_facilities.has_siif = cpu->feat_siif; + sclp_facilities.has_sigpif = cpu->feat_sigpif; + sclp_facilities.has_ib = cpu->feat_ib; + sclp_facilities.has_cei = cpu->feat_cei;break ; } }
lib/s390x/sclp.h +36 -3
@@ -94,9 +94,19 @@ typedef struct CPUEntry {uint8_t reserved0; uint8_t : 4; uint8_t feat_sief2 : 1; + uint8_t feat_skeyi : 1; + uint8_t : 2; + uint8_t : 2; + uint8_t feat_gpere : 1; + uint8_t feat_siif : 1; + uint8_t feat_sigpif : 1; uint8_t : 3; -uint8_t features_res2 [SCCB_CPU_FEATURE_LEN -1 ]; -uint8_t reserved2[6 ]; +uint8_t reserved2[3 ]; + uint8_t : 2; + uint8_t feat_ib : 1; + uint8_t feat_cei : 1; + uint8_t : 4; +uint8_t reserved3[6 ];uint8_t type;uint8_t reserved1; } __attribute__((packed)) CPUEntry;
@@ -105,10 +115,33 @@ extern struct sclp_facilities sclp_facilities;struct sclp_facilities {uint64_t has_sief2 :1 ; +uint64_t has_skeyi :1 ; +uint64_t has_gpere :1 ; +uint64_t has_siif :1 ; +uint64_t has_sigpif :1 ; +uint64_t has_ib :1 ; +uint64_t has_cei :1 ; +uint64_t has_diag318 :1 ; - uint64_t : 62; +uint64_t has_gsls :1 ; +uint64_t has_cmma :1 ; +uint64_t has_64bscao :1 ; +uint64_t has_esca :1 ; +uint64_t has_kss :1 ; +uint64_t has_pfmfi :1 ; +uint64_t has_ibs :1 ; + uint64_t : 64 - 15; }; +/* bit number within a certain byte */ +#define SCLP_FEAT_85_BIT_GSLS 7 +#define SCLP_FEAT_98_BIT_KSS 0 +#define SCLP_FEAT_116_BIT_64BSCAO 7 +#define SCLP_FEAT_116_BIT_CMMA 6 +#define SCLP_FEAT_116_BIT_ESCA 3 +#define SCLP_FEAT_117_BIT_PFMFI 6 +#define SCLP_FEAT_117_BIT_IBS 5 + typedef struct ReadInfo { SCCBHeader h; uint16_t rnmax;
Signature · 1 line
2.31.1
[kvm-unit-tests GIT PULL 6/9] s390x: Add UV host test
In reply to Janosch FrankLets also test the UV host interfaces.
--- s390x/Makefile | 1 + s390x/uv-host.c | 480 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 481 insertions(+) create mode 100644 s390x/uv-host.c
s390x/Makefile +1 -0
@@ -21,6 +21,7 @@ tests += $(TEST_DIR)/css.elf tests += $(TEST_DIR)/uv-guest.elf tests += $(TEST_DIR)/sie.elf tests += $(TEST_DIR)/mvpg.elf +tests += $(TEST_DIR)/uv-host.elf tests_binary = $(patsubst %.elf,%.bin,$(tests)) ifneq ($(HOST_KEY_DOCUMENT),)
s390x/uv-host.c new file +480 -0
480 lines not on this page · raw message
Signature · 1 line
2.31.1
Paolo Bonzini
maintainerQuoted 50 lines · Janosch Frank
Dear Paolo,
please merge or pull the following changes:
* SCLP feature probing
* SCLP cpu model check
* UV host testsMERGE:
https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/merge_requests/9PIPELINE:
https://gitlab.com/frankja/kvm-unit-tests/-/pipelines/309936640PULL:
The following changes since commit74ff0e9675ec6d9477f5e98ec7d5d50878fa7ebc:Merge branch 'arm/queue' into 'master' (2021-05-18 11:07:08 +0000)are available in the Git repository at:
https://gitlab.com/frankja/kvm-unit-tests.git s390x-pull-2021-26-05for you to fetch changes up to
21f5f67675830e1c088539656cdc0f63bc18e4e0:s390x: cpumodel: FMT2 and FMT4 SCLP test (2021-05-26 14:27:09 +0000)Janosch Frank (9):
s390x: uv-guest: Add invalid share location test
s390x: Add more Ultravisor command structure definitions
s390x: uv: Add UV lib
s390x: Test for share/unshare call support before using them
s390x: uv-guest: Test invalid commands
s390x: Add UV host test
s390x: sclp: Only fetch read info byte 134 if cpu entries are above it
lib: s390x: sclp: Extend feature probing
s390x: cpumodel: FMT2 and FMT4 SCLP testlib/s390x/asm/uv.h | 152 ++++++++++++- lib/s390x/io.c | 2 + lib/s390x/malloc_io.c | 5 +- lib/s390x/sclp.c | 23 +- lib/s390x/sclp.h | 39 +++- lib/s390x/uv.c | 45 ++++ lib/s390x/uv.h | 10 + s390x/Makefile | 2 + s390x/cpumodel.c | 71 ++++++- s390x/uv-guest.c | 60 +++++- s390x/uv-host.c | 480 ++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 871 insertions(+), 18 deletions(-)
Quoted 4 lines
create mode 100644
lib/s390x/uv.c
create mode 100644lib/s390x/uv.h
create mode 100644s390x/uv-host.c
Pulled, thanks!
Paolo