On 2/22/23 11:42 AM, Alexander Gordeev wrote: > On Wed, Feb 22, 2023 at 04:55:02PM +0100, Nico Boehr wrote: >> @@ -112,7 +112,7 @@ static int zpci_reset_aipb(u8 nisc) >> return -EINVAL; >> >> aift->sbv = zpci_aif_sbv; >> - aift->gait = (struct zpci_gaite *)zpci_aipb->aipb.gait; >> + aift->gait = phys_to_virt(zpci_aipb->aipb.gait); >> >> return 0; >> } > > With this change aift->gait would never be NULL. Does it work with line 125? aift->gait will get set to NULL when kvm_s390_pci_aen_exit is called, which is called when the kvm module is unloaded. Then kvm_s390_pci_aen_init is called again when kvm module is (re)loaded and is expected to set aift->gait, either for the first time or reset the values using what was stashed (or return on error). kvm_s390_pci_aen_init should not be called more than once for the life of the kvm module, hence the check for aift->gait. > > 120 int kvm_s390_pci_aen_init(u8 nisc) > 121 { > 122 int rc = 0; > 123 > 124 /* If already enabled for AEN, bail out now */ > 125 if (aift->gait || aift->sbv) > 126 return -EPERM; >