diff mbox series

[kvm-unit-tests,3/6] s390x: uv-host: Test uv immediate parameter

Message ID 20220513095017.16301-4-frankja@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: uv-host: Access check extensions and improvements | expand

Commit Message

Janosch Frank May 13, 2022, 9:50 a.m. UTC
Let's check if we get a specification PGM exception if we set a
non-zero i3 when doing a UV call.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/uv-host.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Steffen Eiden May 17, 2022, 8:29 a.m. UTC | #1
Hey Janosch,

On 5/13/22 11:50, Janosch Frank wrote:
> Let's check if we get a specification PGM exception if we set a
> non-zero i3 when doing a UV call.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>   s390x/uv-host.c | 23 +++++++++++++++++++++++
>   1 file changed, 23 insertions(+)
> 
> diff --git a/s390x/uv-host.c b/s390x/uv-host.c
> index f846fc42..fcb82d24 100644
> --- a/s390x/uv-host.c
> +++ b/s390x/uv-host.c
> @@ -64,6 +64,28 @@ static struct cmd_list cmds[] = {
>   	{ NULL, 0, 0 },
>   };
>   
> +static void test_i3(void)
> +{
> +	struct uv_cb_header uvcb = {
> +		.cmd = UVC_CMD_INIT_UV,
> +		.len = sizeof(struct uv_cb_init),
> +	};
> +	unsigned long r1 = 0;
Did you forgot 'r2' or is it missing for a reason?

> +	int cc;
> +
> +	report_prefix_push("i3");
> +	expect_pgm_int();
> +	asm volatile(
> +		"0:	.insn rrf,0xB9A40000,%[r1],%[r2],4,2\n"
> +		"		ipm	%[cc]\n"
> +		"		srl	%[cc],28\n"
> +		: [cc] "=d" (cc)
> +		: [r1] "a" (r1), [r2] "a" (&uvcb)
> +		: "memory", "cc");
> +	check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
> +	report_prefix_pop();
> +}
> +
>   static void test_priv(void)
>   {
>   	struct uv_cb_header uvcb = {};
> @@ -585,6 +607,7 @@ int main(void)
>   		goto done;
>   	}
>   
> +	test_i3();
>   	test_priv();
>   	test_invalid();
>   	test_uv_uninitialized();
Janosch Frank May 17, 2022, 9:03 a.m. UTC | #2
On 5/17/22 10:29, Steffen Eiden wrote:
> Hey Janosch,
> 
> On 5/13/22 11:50, Janosch Frank wrote:
>> Let's check if we get a specification PGM exception if we set a
>> non-zero i3 when doing a UV call.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>    s390x/uv-host.c | 23 +++++++++++++++++++++++
>>    1 file changed, 23 insertions(+)
>>
>> diff --git a/s390x/uv-host.c b/s390x/uv-host.c
>> index f846fc42..fcb82d24 100644
>> --- a/s390x/uv-host.c
>> +++ b/s390x/uv-host.c
>> @@ -64,6 +64,28 @@ static struct cmd_list cmds[] = {
>>    	{ NULL, 0, 0 },
>>    };
>>    
>> +static void test_i3(void)
>> +{
>> +	struct uv_cb_header uvcb = {
>> +		.cmd = UVC_CMD_INIT_UV,
>> +		.len = sizeof(struct uv_cb_init),
>> +	};
>> +	unsigned long r1 = 0;
> Did you forgot 'r2' or is it missing for a reason?

The uvcb is the r2, have a look at the clobbers below

> 
>> +	int cc;
>> +
>> +	report_prefix_push("i3");
>> +	expect_pgm_int();
>> +	asm volatile(
>> +		"0:	.insn rrf,0xB9A40000,%[r1],%[r2],4,2\n"
>> +		"		ipm	%[cc]\n"
>> +		"		srl	%[cc],28\n"
>> +		: [cc] "=d" (cc)
>> +		: [r1] "a" (r1), [r2] "a" (&uvcb)
>> +		: "memory", "cc");
>> +	check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
>> +	report_prefix_pop();
>> +}
>> +
>>    static void test_priv(void)
>>    {
>>    	struct uv_cb_header uvcb = {};
>> @@ -585,6 +607,7 @@ int main(void)
>>    		goto done;
>>    	}
>>    
>> +	test_i3();
>>    	test_priv();
>>    	test_invalid();
>>    	test_uv_uninitialized();
Steffen Eiden May 17, 2022, 9:04 a.m. UTC | #3
On 5/17/22 11:03, Janosch Frank wrote:
> On 5/17/22 10:29, Steffen Eiden wrote:
>> Hey Janosch,
>>
>> On 5/13/22 11:50, Janosch Frank wrote:
>>> Let's check if we get a specification PGM exception if we set a
>>> non-zero i3 when doing a UV call.
>>>
>>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>>> ---
>>>    s390x/uv-host.c | 23 +++++++++++++++++++++++
>>>    1 file changed, 23 insertions(+)
>>>
>>> diff --git a/s390x/uv-host.c b/s390x/uv-host.c
>>> index f846fc42..fcb82d24 100644
>>> --- a/s390x/uv-host.c
>>> +++ b/s390x/uv-host.c
>>> @@ -64,6 +64,28 @@ static struct cmd_list cmds[] = {
>>>        { NULL, 0, 0 },
>>>    };
>>> +static void test_i3(void)
>>> +{
>>> +    struct uv_cb_header uvcb = {
>>> +        .cmd = UVC_CMD_INIT_UV,
>>> +        .len = sizeof(struct uv_cb_init),
>>> +    };
>>> +    unsigned long r1 = 0;
>> Did you forgot 'r2' or is it missing for a reason?
> 
> The uvcb is the r2, have a look at the clobbers below

Oh right, my bad; Sorry.
> 
>>
>>> +    int cc;
>>> +
>>> +    report_prefix_push("i3");
>>> +    expect_pgm_int();
>>> +    asm volatile(
>>> +        "0:    .insn rrf,0xB9A40000,%[r1],%[r2],4,2\n"
>>> +        "        ipm    %[cc]\n"
>>> +        "        srl    %[cc],28\n"
>>> +        : [cc] "=d" (cc)
>>> +        : [r1] "a" (r1), [r2] "a" (&uvcb)
>>> +        : "memory", "cc");
>>> +    check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
>>> +    report_prefix_pop();
>>> +}
>>> +
>>>    static void test_priv(void)
>>>    {
>>>        struct uv_cb_header uvcb = {};
>>> @@ -585,6 +607,7 @@ int main(void)
>>>            goto done;
>>>        }
>>> +    test_i3();
>>>        test_priv();
>>>        test_invalid();
>>>        test_uv_uninitialized();
>
diff mbox series

Patch

diff --git a/s390x/uv-host.c b/s390x/uv-host.c
index f846fc42..fcb82d24 100644
--- a/s390x/uv-host.c
+++ b/s390x/uv-host.c
@@ -64,6 +64,28 @@  static struct cmd_list cmds[] = {
 	{ NULL, 0, 0 },
 };
 
+static void test_i3(void)
+{
+	struct uv_cb_header uvcb = {
+		.cmd = UVC_CMD_INIT_UV,
+		.len = sizeof(struct uv_cb_init),
+	};
+	unsigned long r1 = 0;
+	int cc;
+
+	report_prefix_push("i3");
+	expect_pgm_int();
+	asm volatile(
+		"0:	.insn rrf,0xB9A40000,%[r1],%[r2],4,2\n"
+		"		ipm	%[cc]\n"
+		"		srl	%[cc],28\n"
+		: [cc] "=d" (cc)
+		: [r1] "a" (r1), [r2] "a" (&uvcb)
+		: "memory", "cc");
+	check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
+	report_prefix_pop();
+}
+
 static void test_priv(void)
 {
 	struct uv_cb_header uvcb = {};
@@ -585,6 +607,7 @@  int main(void)
 		goto done;
 	}
 
+	test_i3();
 	test_priv();
 	test_invalid();
 	test_uv_uninitialized();