Re: [kvm-unit-tests PATCH v6 3/8] s390x: sie: switch to home space mode before entering SIE

Thomas Huth
2023-09-04T11:41:30Z

On 04/09/2023 13.07, Nico Boehr wrote:
> Quoting Thomas Huth (2023-09-04 11:59:30)
> [...]
>> If we want tests to be able in other modes in the future...
>>
>>> + */
>>> + old_cr13 = stctg(13);
>>> + lctlg(13, stctg(1));
>>> +
>>> + /* switch to home space so guest tables can be different from host */
>>> + psw_mask_set_bits(PSW_MASK_HOME);
>>> +
>>> + /* also handle all interruptions in home space while in SIE */
>>> + irq_set_dat_mode(true, AS_HOME);
>>> +
>>> while (vm->sblk->icptcode == 0) {
>>> sie64a(vm->sblk, &vm->save_area);
>>> sie_handle_validity(vm);
>>> @@ -66,6 +86,12 @@ void sie(struct vm *vm)
>>> vm->save_area.guest.grs[14] = vm->sblk->gg14;
>>> vm->save_area.guest.grs[15] = vm->sblk->gg15;
>>>
>>> + irq_set_dat_mode(true, AS_PRIM);
>>> + psw_mask_clear_bits(PSW_MASK_HOME);
>>
>> ... we should maybe restore the previous mode here instead of switching
>> always to primary mode?
>
> I don't want to add untested "should work" code, so I'd much prefer if we'd
> have a proper test which uses multiple address spaces - and that seems out
> of scope for this series to me.
>
>> Anyway, could be done later, but you might want to update your comment.
>
> Yep, agree, I'd prefer to do this later.
>
> Pardon if I'm not getting it but the comment IMO makes sufficiently clear
> that multiple AS are for future extensions. If you have any suggestion on
> how this could be clearer, I'd be happy to incorporate.

I guess it's ok for now. I was thinking of something like:

+ * - switching every time makes it easier to extend this in the future,
+ * for example to allow tests to run in whatever space they want
+ * (this still needs some modification to return to the previous mode below)

... but it's maybe too verbose already. So just keep your
patch the way it currently is.

Thomas