Commit e43f5762 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: s390: Move hardware setup/unsetup to init/exit

Now that kvm_arch_hardware_setup() is called immediately after
kvm_arch_init(), fold the guts of kvm_arch_hardware_(un)setup() into
kvm_arch_{init,exit}() as a step towards dropping one of the hooks.

No functional change intended.
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Reviewed-by: default avatarEric Farman <farman@linux.ibm.com>
Message-Id: <20221130230934.1014142-7-seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent b801ef42
...@@ -331,21 +331,12 @@ static struct notifier_block kvm_clock_notifier = { ...@@ -331,21 +331,12 @@ static struct notifier_block kvm_clock_notifier = {
int kvm_arch_hardware_setup(void *opaque) int kvm_arch_hardware_setup(void *opaque)
{ {
gmap_notifier.notifier_call = kvm_gmap_notifier;
gmap_register_pte_notifier(&gmap_notifier);
vsie_gmap_notifier.notifier_call = kvm_s390_vsie_gmap_notifier;
gmap_register_pte_notifier(&vsie_gmap_notifier);
atomic_notifier_chain_register(&s390_epoch_delta_notifier,
&kvm_clock_notifier);
return 0; return 0;
} }
void kvm_arch_hardware_unsetup(void) void kvm_arch_hardware_unsetup(void)
{ {
gmap_unregister_pte_notifier(&gmap_notifier);
gmap_unregister_pte_notifier(&vsie_gmap_notifier);
atomic_notifier_chain_unregister(&s390_epoch_delta_notifier,
&kvm_clock_notifier);
} }
static void allow_cpu_feat(unsigned long nr) static void allow_cpu_feat(unsigned long nr)
...@@ -525,6 +516,13 @@ int kvm_arch_init(void *opaque) ...@@ -525,6 +516,13 @@ int kvm_arch_init(void *opaque)
if (rc) if (rc)
goto err_gib; goto err_gib;
gmap_notifier.notifier_call = kvm_gmap_notifier;
gmap_register_pte_notifier(&gmap_notifier);
vsie_gmap_notifier.notifier_call = kvm_s390_vsie_gmap_notifier;
gmap_register_pte_notifier(&vsie_gmap_notifier);
atomic_notifier_chain_register(&s390_epoch_delta_notifier,
&kvm_clock_notifier);
return 0; return 0;
err_gib: err_gib:
...@@ -541,6 +539,11 @@ int kvm_arch_init(void *opaque) ...@@ -541,6 +539,11 @@ int kvm_arch_init(void *opaque)
void kvm_arch_exit(void) void kvm_arch_exit(void)
{ {
gmap_unregister_pte_notifier(&gmap_notifier);
gmap_unregister_pte_notifier(&vsie_gmap_notifier);
atomic_notifier_chain_unregister(&s390_epoch_delta_notifier,
&kvm_clock_notifier);
kvm_s390_gib_destroy(); kvm_s390_gib_destroy();
if (IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM)) if (IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM))
kvm_s390_pci_exit(); kvm_s390_pci_exit();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment