Re: [kvm-unit-tests PATCH v3 7/7] s390x: Add test for STFLE interpretive execution (format-0)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 20 Jun 2024 16:17:00 +0200
Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx> wrote:

> The STFLE instruction indicates installed facilities.
> SIE can interpretively execute STFLE.
> Use a snippet guest executing STFLE to get the result of
> interpretive execution and check the result.
> 
> Signed-off-by: Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx>


[...]


> +struct guest_stfle_res {
> +	uint16_t len;
> +	uint64_t reg;

you don't really use reg, do you?

> +	unsigned char *mem;
> +};
> +
> +static struct guest_stfle_res run_guest(void)
> +{
> +	struct guest_stfle_res res;
> +	uint64_t guest_stfle_addr;

uint64_t tmp;

> +
> +	sie(&vm);
> +	assert(snippet_is_force_exit_value(&vm));
> +	guest_stfle_addr = snippet_get_force_exit_value(&vm);
> +	res.mem = &vm.guest_mem[guest_stfle_addr];
> +	memcpy(&res.reg, res.mem, sizeof(res.reg));

memcpy(&tmp, res.mem, etc);

> +	res.len = (res.reg & 0xff) + 1;

(tmp & 0xff) + 1

etc 

> +	res.mem += sizeof(res.reg);

(you could just do res.mem++ if you had declared it as uint64_t *
instead of unsigned char *)

> +	return res;
> +}
> +


[...]


> +int main(int argc, char **argv)
> +{
> +	struct args args = parse_args(argc, argv);
> +
> +	if (!sclp_facilities.has_sief2) {
> +		report_skip("SIEF2 facility unavailable");
> +		goto out;
> +	}
> +
> +	report_info("PRNG seed: 0x%lx", args.seed);
> +	prng_s = prng_init(args.seed);
> +	setup_guest();
> +	if (test_facility(7))
> +		test_stfle_format_0();

since STFLE is literally the feature you are testing, maybe you can
just skip, like you did for SIEF2?

> +out:
> +	return report_summary();
> +}
> diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
> index 3a9decc9..f2203069 100644
> --- a/s390x/unittests.cfg
> +++ b/s390x/unittests.cfg
> @@ -392,3 +392,6 @@ file = sie-dat.elf
>  
>  [pv-attest]
>  file = pv-attest.elf
> +
> +[stfle-sie]
> +file = stfle-sie.elf





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux