Re: [PATCH v6 11/13] KVM: s390: add functions to (un)register GISC with GISA

From: Halil Pasic
Date: Mon Jan 28 2019 - 13:12:53 EST


On Thu, 24 Jan 2019 13:59:37 +0100
Michael Mueller <mimu@xxxxxxxxxxxxx> wrote:

> Add the Interruption Alert Mask (IAM) to the architecture specific
> kvm struct. This mask in the GISA is used to define for which ISC
> a GIB alert will be issued.
>
> The functions kvm_s390_gisc_register() and kvm_s390_gisc_unregister()
> are used to (un)register a GISC (guest ISC) with a virtual machine and
> its GISA.
>
> Upon successful completion, kvm_s390_gisc_register() returns the
> ISC to be used for GIB alert interruptions. A negative return code
> indicates an error during registration.
>
> Theses functions will be used by other adapter types like AP and PCI to
> request pass-through interruption support.


I'm not sure this interface is going to to fit PCI that well. But IMHO
no reason to delay the whole series -- we can think about zPCI later.
Same goes for some of the names.

Another idea for later would be to sanity check in gisa destroy that
alert.mask is back to all zero -- to catch any corresponding driver
bugs.

Acked-by: Halil Pasic <pasic@xxxxxxxxxxxxx>

>
> Signed-off-by: Michael Mueller <mimu@xxxxxxxxxxxxx>

[..]

> static inline void gisa_set_ipm_gisc(struct kvm_s390_gisa *gisa, u32 gisc)
> {
> set_bit_inv(IPM_BIT_OFFSET + gisc, (unsigned long *) gisa);
> @@ -2911,6 +2938,8 @@ void kvm_s390_gisa_init(struct kvm *kvm)
> if (!css_general_characteristics.aiv)
> return;
> gi->origin = &kvm->arch.sie_page2->gisa;
> + gi->alert.mask = 0;

I don't think this is necessary. Otherwise you would need to
zero the alert.ref[] too, or?

Regards,
Halil

> + spin_lock_init(&gi->alert.ref_lock);
> kvm_s390_gisa_clear(kvm);
> VM_EVENT(kvm, 3, "gisa 0x%pK initialized", gi->origin);
> }