Re: [PATCH v6 16/21] vfio-pci/zdev: add open/close device hooks

Jason Gunthorpe
2022-04-27T14:04:20Z

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?

Jason