Messages in this thread | | | Date | Wed, 27 Apr 2022 10:42:07 -0400 | Subject | Re: [PATCH v6 16/21] vfio-pci/zdev: add open/close device hooks | From | Matthew Rosato <> |
| |
On 4/27/22 10:04 AM, Jason Gunthorpe wrote: > On Tue, Apr 26, 2022 at 04:08:37PM -0400, Matthew Rosato wrote: > >> +static int vfio_pci_zdev_group_notifier(struct notifier_block *nb, >> + unsigned long action, void *data) >> +{ >> + struct zpci_dev *zdev = container_of(nb, struct zpci_dev, nb); >> + int (*fn)(struct zpci_dev *zdev, struct kvm *kvm); >> + int rc = NOTIFY_OK; >> + >> + if (action == VFIO_GROUP_NOTIFY_SET_KVM) { >> + if (!zdev) >> + return NOTIFY_DONE; >> + >> + fn = symbol_get(kvm_s390_pci_register_kvm); >> + if (!fn) >> + return NOTIFY_DONE; >> + >> + if (fn(zdev, (struct kvm *)data)) >> + rc = NOTIFY_BAD; >> + >> + symbol_put(kvm_s390_pci_register_kvm); > > Is it possible this function can be in statically linked arch code? > > Or, actually, is zPCI useful anyhow without kvm ie can you just have a > direct dependency here? >
zPCI devices (zpci_dev) exist regardless of whether kvm is configured or not, and you can e.g. bind the associated PCI device to vfio-pci when KVM is not configured (or module not loaded) and get the existing vfio-pci-zdev extensions for that device (extra VFIO_DEVICE_INFO response data). Making a direct dependency on KVM would remove that; this was discussed in a prior version because this extra info is not used today outside of a KVM usecase -- but it could be useful in the future (or we may have other s390-isms that are not specific to kvm that need vfio-pci-zdev).
As far as statically linking in arch... The fundamental (un)registration task being done here -- (dis)associating the guest GISA with the firmware and thus allowing this particular guest to use firmware assists (or turning it off when kvm == 0) -- is only relevant to guest passthrough with kvm and calls a number of different routines that reside in the kvm module during the (un)registration process. Without a direct dependency I think a symbol lookup still has to inevitably happen at some point in the call chain.
| |