{
        return CMO_PageSize;
 }
+
+extern long pSeries_enable_reloc_on_exc(void);
+extern long pSeries_disable_reloc_on_exc(void);
+
+#else
+
+#define pSeries_enable_reloc_on_exc()  do {} while (0)
+#define pSeries_disable_reloc_on_exc() do {} while (0)
+
 #endif /* CONFIG_PPC_PSERIES */
 
 #endif /* __ASSEMBLY__ */
 
 #include <asm/kvm_book3s.h>
 #include <asm/mmu_context.h>
 #include <asm/switch_to.h>
+#include <asm/firmware.h>
 #include <linux/gfp.h>
 #include <linux/sched.h>
 #include <linux/vmalloc.h>
 {
 }
 
+static unsigned int kvm_global_user_count = 0;
+static DEFINE_SPINLOCK(kvm_global_user_count_lock);
+
 int kvmppc_core_init_vm(struct kvm *kvm)
 {
 #ifdef CONFIG_PPC64
        INIT_LIST_HEAD(&kvm->arch.spapr_tce_tables);
 #endif
 
+       if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
+               spin_lock(&kvm_global_user_count_lock);
+               if (++kvm_global_user_count == 1)
+                       pSeries_disable_reloc_on_exc();
+               spin_unlock(&kvm_global_user_count_lock);
+       }
        return 0;
 }
 
 #ifdef CONFIG_PPC64
        WARN_ON(!list_empty(&kvm->arch.spapr_tce_tables));
 #endif
+
+       if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
+               spin_lock(&kvm_global_user_count_lock);
+               BUG_ON(kvm_global_user_count == 0);
+               if (--kvm_global_user_count == 0)
+                       pSeries_enable_reloc_on_exc();
+               spin_unlock(&kvm_global_user_count_lock);
+       }
 }
 
 static int kvmppc_book3s_init(void)
 
  * to ever be a problem in practice we can move this into a kernel thread to
  * finish off the process later in boot.
  */
-static int __init pSeries_enable_reloc_on_exc(void)
+long pSeries_enable_reloc_on_exc(void)
 {
        long rc;
        unsigned int delay, total_delay = 0;
                mdelay(delay);
        }
 }
+EXPORT_SYMBOL(pSeries_enable_reloc_on_exc);
 
-#ifdef CONFIG_KEXEC
-static long pSeries_disable_reloc_on_exc(void)
+long pSeries_disable_reloc_on_exc(void)
 {
        long rc;
 
                mdelay(get_longbusy_msecs(rc));
        }
 }
+EXPORT_SYMBOL(pSeries_disable_reloc_on_exc);
 
+#ifdef CONFIG_KEXEC
 static void pSeries_machine_kexec(struct kimage *image)
 {
        long rc;