From ca270e8775ea8494d63d089778fe4269e4c244e3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 20 Aug 2022 20:27:35 +0200 Subject: [PATCH] drop some kvm powerpc patches as they broke the build --- ...v-remove-virt-mode-checks-from-real-.patch | 393 ------------------ ...-kvm-use-darn-for-h_random-on-power9.patch | 145 ------- queue-5.10/series | 2 - 3 files changed, 540 deletions(-) delete mode 100644 queue-5.10/kvm-ppc-book3s-hv-remove-virt-mode-checks-from-real-.patch delete mode 100644 queue-5.10/powerpc-powernv-kvm-use-darn-for-h_random-on-power9.patch diff --git a/queue-5.10/kvm-ppc-book3s-hv-remove-virt-mode-checks-from-real-.patch b/queue-5.10/kvm-ppc-book3s-hv-remove-virt-mode-checks-from-real-.patch deleted file mode 100644 index 7bfdf86e0c3..00000000000 --- a/queue-5.10/kvm-ppc-book3s-hv-remove-virt-mode-checks-from-real-.patch +++ /dev/null @@ -1,393 +0,0 @@ -From c96fa61695d77d8850634a90c916eb2f9b1c1177 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 28 May 2021 19:07:44 +1000 -Subject: KVM: PPC: Book3S HV: Remove virt mode checks from real mode handlers -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Nicholas Piggin - -[ Upstream commit dcbac73a5b374873bd6dfd8a0ee5d0b7fc844420 ] - -Now that the P7/8 path no longer supports radix, real-mode handlers -do not need to deal with being called in virt mode. - -This change effectively reverts commit acde25726bc6 ("KVM: PPC: Book3S -HV: Add radix checks in real-mode hypercall handlers"). - -It removes a few more real-mode tests in rm hcall handlers, which -allows the indirect ops for the xive module to be removed from the -built-in xics rm handlers. - -kvmppc_h_random is renamed to kvmppc_rm_h_random to be a bit more -descriptive and consistent with other rm handlers. - -Signed-off-by: Nicholas Piggin -Reviewed-by: Cédric Le Goater -Signed-off-by: Michael Ellerman -Link: https://lore.kernel.org/r/20210528090752.3542186-25-npiggin@gmail.com -Signed-off-by: Sasha Levin ---- - arch/powerpc/include/asm/kvm_ppc.h | 10 +-- - arch/powerpc/kvm/book3s.c | 11 +-- - arch/powerpc/kvm/book3s_64_vio_hv.c | 12 ---- - arch/powerpc/kvm/book3s_hv_builtin.c | 91 ++++++------------------- - arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 +- - arch/powerpc/kvm/book3s_xive.c | 18 ----- - arch/powerpc/kvm/book3s_xive.h | 7 -- - arch/powerpc/kvm/book3s_xive_native.c | 10 --- - 8 files changed, 23 insertions(+), 138 deletions(-) - -diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h -index 0a056c64c317..ec18d9b01625 100644 ---- a/arch/powerpc/include/asm/kvm_ppc.h -+++ b/arch/powerpc/include/asm/kvm_ppc.h -@@ -654,8 +654,6 @@ extern int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server, - u32 *priority); - extern int kvmppc_xive_int_on(struct kvm *kvm, u32 irq); - extern int kvmppc_xive_int_off(struct kvm *kvm, u32 irq); --extern void kvmppc_xive_init_module(void); --extern void kvmppc_xive_exit_module(void); - - extern int kvmppc_xive_connect_vcpu(struct kvm_device *dev, - struct kvm_vcpu *vcpu, u32 cpu); -@@ -679,8 +677,6 @@ static inline int kvmppc_xive_enabled(struct kvm_vcpu *vcpu) - extern int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, - struct kvm_vcpu *vcpu, u32 cpu); - extern void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu); --extern void kvmppc_xive_native_init_module(void); --extern void kvmppc_xive_native_exit_module(void); - extern int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu, - union kvmppc_one_reg *val); - extern int kvmppc_xive_native_set_vp(struct kvm_vcpu *vcpu, -@@ -694,8 +690,6 @@ static inline int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server, - u32 *priority) { return -1; } - static inline int kvmppc_xive_int_on(struct kvm *kvm, u32 irq) { return -1; } - static inline int kvmppc_xive_int_off(struct kvm *kvm, u32 irq) { return -1; } --static inline void kvmppc_xive_init_module(void) { } --static inline void kvmppc_xive_exit_module(void) { } - - static inline int kvmppc_xive_connect_vcpu(struct kvm_device *dev, - struct kvm_vcpu *vcpu, u32 cpu) { return -EBUSY; } -@@ -716,8 +710,6 @@ static inline int kvmppc_xive_enabled(struct kvm_vcpu *vcpu) - static inline int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, - struct kvm_vcpu *vcpu, u32 cpu) { return -EBUSY; } - static inline void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu) { } --static inline void kvmppc_xive_native_init_module(void) { } --static inline void kvmppc_xive_native_exit_module(void) { } - static inline int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu, - union kvmppc_one_reg *val) - { return 0; } -@@ -753,7 +745,7 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu, - unsigned long tce_value, unsigned long npages); - long int kvmppc_rm_h_confer(struct kvm_vcpu *vcpu, int target, - unsigned int yield_count); --long kvmppc_h_random(struct kvm_vcpu *vcpu); -+long kvmppc_rm_h_random(struct kvm_vcpu *vcpu); - void kvmhv_commence_exit(int trap); - void kvmppc_realmode_machine_check(struct kvm_vcpu *vcpu); - void kvmppc_subcore_enter_guest(void); -diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c -index 44bf567b6589..1888aedfd410 100644 ---- a/arch/powerpc/kvm/book3s.c -+++ b/arch/powerpc/kvm/book3s.c -@@ -1046,13 +1046,10 @@ static int kvmppc_book3s_init(void) - #ifdef CONFIG_KVM_XICS - #ifdef CONFIG_KVM_XIVE - if (xics_on_xive()) { -- kvmppc_xive_init_module(); - kvm_register_device_ops(&kvm_xive_ops, KVM_DEV_TYPE_XICS); -- if (kvmppc_xive_native_supported()) { -- kvmppc_xive_native_init_module(); -+ if (kvmppc_xive_native_supported()) - kvm_register_device_ops(&kvm_xive_native_ops, - KVM_DEV_TYPE_XIVE); -- } - } else - #endif - kvm_register_device_ops(&kvm_xics_ops, KVM_DEV_TYPE_XICS); -@@ -1062,12 +1059,6 @@ static int kvmppc_book3s_init(void) - - static void kvmppc_book3s_exit(void) - { --#ifdef CONFIG_KVM_XICS -- if (xics_on_xive()) { -- kvmppc_xive_exit_module(); -- kvmppc_xive_native_exit_module(); -- } --#endif - #ifdef CONFIG_KVM_BOOK3S_32_HANDLER - kvmppc_book3s_exit_pr(); - #endif -diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c -index 57af53a6a2d8..5f8573774383 100644 ---- a/arch/powerpc/kvm/book3s_64_vio_hv.c -+++ b/arch/powerpc/kvm/book3s_64_vio_hv.c -@@ -404,10 +404,6 @@ long kvmppc_rm_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn, - /* udbg_printf("H_PUT_TCE(): liobn=0x%lx ioba=0x%lx, tce=0x%lx\n", */ - /* liobn, ioba, tce); */ - -- /* For radix, we might be in virtual mode, so punt */ -- if (kvm_is_radix(vcpu->kvm)) -- return H_TOO_HARD; -- - stt = kvmppc_find_table(vcpu->kvm, liobn); - if (!stt) - return H_TOO_HARD; -@@ -500,10 +496,6 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu, - bool prereg = false; - struct kvmppc_spapr_tce_iommu_table *stit; - -- /* For radix, we might be in virtual mode, so punt */ -- if (kvm_is_radix(vcpu->kvm)) -- return H_TOO_HARD; -- - /* - * used to check for invalidations in progress - */ -@@ -609,10 +601,6 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu, - long i, ret; - struct kvmppc_spapr_tce_iommu_table *stit; - -- /* For radix, we might be in virtual mode, so punt */ -- if (kvm_is_radix(vcpu->kvm)) -- return H_TOO_HARD; -- - stt = kvmppc_find_table(vcpu->kvm, liobn); - if (!stt) - return H_TOO_HARD; -diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c -index 121fca2bcd82..856a04ca833c 100644 ---- a/arch/powerpc/kvm/book3s_hv_builtin.c -+++ b/arch/powerpc/kvm/book3s_hv_builtin.c -@@ -33,21 +33,6 @@ - #include "book3s_xics.h" - #include "book3s_xive.h" - --/* -- * The XIVE module will populate these when it loads -- */ --unsigned long (*__xive_vm_h_xirr)(struct kvm_vcpu *vcpu); --unsigned long (*__xive_vm_h_ipoll)(struct kvm_vcpu *vcpu, unsigned long server); --int (*__xive_vm_h_ipi)(struct kvm_vcpu *vcpu, unsigned long server, -- unsigned long mfrr); --int (*__xive_vm_h_cppr)(struct kvm_vcpu *vcpu, unsigned long cppr); --int (*__xive_vm_h_eoi)(struct kvm_vcpu *vcpu, unsigned long xirr); --EXPORT_SYMBOL_GPL(__xive_vm_h_xirr); --EXPORT_SYMBOL_GPL(__xive_vm_h_ipoll); --EXPORT_SYMBOL_GPL(__xive_vm_h_ipi); --EXPORT_SYMBOL_GPL(__xive_vm_h_cppr); --EXPORT_SYMBOL_GPL(__xive_vm_h_eoi); -- - /* - * Hash page table alignment on newer cpus(CPU_FTR_ARCH_206) - * should be power of 2. -@@ -195,16 +180,9 @@ int kvmppc_hwrng_present(void) - } - EXPORT_SYMBOL_GPL(kvmppc_hwrng_present); - --long kvmppc_h_random(struct kvm_vcpu *vcpu) -+long kvmppc_rm_h_random(struct kvm_vcpu *vcpu) - { -- int r; -- -- /* Only need to do the expensive mfmsr() on radix */ -- if (kvm_is_radix(vcpu->kvm) && (mfmsr() & MSR_IR)) -- r = powernv_get_random_long(&vcpu->arch.regs.gpr[4]); -- else -- r = powernv_get_random_real_mode(&vcpu->arch.regs.gpr[4]); -- if (r) -+ if (powernv_get_random_real_mode(&vcpu->arch.regs.gpr[4])) - return H_SUCCESS; - - return H_HARDWARE; -@@ -557,22 +535,13 @@ static long kvmppc_read_one_intr(bool *again) - } - - #ifdef CONFIG_KVM_XICS --static inline bool is_rm(void) --{ -- return !(mfmsr() & MSR_DR); --} -- - unsigned long kvmppc_rm_h_xirr(struct kvm_vcpu *vcpu) - { - if (!kvmppc_xics_enabled(vcpu)) - return H_TOO_HARD; -- if (xics_on_xive()) { -- if (is_rm()) -- return xive_rm_h_xirr(vcpu); -- if (unlikely(!__xive_vm_h_xirr)) -- return H_NOT_AVAILABLE; -- return __xive_vm_h_xirr(vcpu); -- } else -+ if (xics_on_xive()) -+ return xive_rm_h_xirr(vcpu); -+ else - return xics_rm_h_xirr(vcpu); - } - -@@ -581,13 +550,9 @@ unsigned long kvmppc_rm_h_xirr_x(struct kvm_vcpu *vcpu) - if (!kvmppc_xics_enabled(vcpu)) - return H_TOO_HARD; - vcpu->arch.regs.gpr[5] = get_tb(); -- if (xics_on_xive()) { -- if (is_rm()) -- return xive_rm_h_xirr(vcpu); -- if (unlikely(!__xive_vm_h_xirr)) -- return H_NOT_AVAILABLE; -- return __xive_vm_h_xirr(vcpu); -- } else -+ if (xics_on_xive()) -+ return xive_rm_h_xirr(vcpu); -+ else - return xics_rm_h_xirr(vcpu); - } - -@@ -595,13 +560,9 @@ unsigned long kvmppc_rm_h_ipoll(struct kvm_vcpu *vcpu, unsigned long server) - { - if (!kvmppc_xics_enabled(vcpu)) - return H_TOO_HARD; -- if (xics_on_xive()) { -- if (is_rm()) -- return xive_rm_h_ipoll(vcpu, server); -- if (unlikely(!__xive_vm_h_ipoll)) -- return H_NOT_AVAILABLE; -- return __xive_vm_h_ipoll(vcpu, server); -- } else -+ if (xics_on_xive()) -+ return xive_rm_h_ipoll(vcpu, server); -+ else - return H_TOO_HARD; - } - -@@ -610,13 +571,9 @@ int kvmppc_rm_h_ipi(struct kvm_vcpu *vcpu, unsigned long server, - { - if (!kvmppc_xics_enabled(vcpu)) - return H_TOO_HARD; -- if (xics_on_xive()) { -- if (is_rm()) -- return xive_rm_h_ipi(vcpu, server, mfrr); -- if (unlikely(!__xive_vm_h_ipi)) -- return H_NOT_AVAILABLE; -- return __xive_vm_h_ipi(vcpu, server, mfrr); -- } else -+ if (xics_on_xive()) -+ return xive_rm_h_ipi(vcpu, server, mfrr); -+ else - return xics_rm_h_ipi(vcpu, server, mfrr); - } - -@@ -624,13 +581,9 @@ int kvmppc_rm_h_cppr(struct kvm_vcpu *vcpu, unsigned long cppr) - { - if (!kvmppc_xics_enabled(vcpu)) - return H_TOO_HARD; -- if (xics_on_xive()) { -- if (is_rm()) -- return xive_rm_h_cppr(vcpu, cppr); -- if (unlikely(!__xive_vm_h_cppr)) -- return H_NOT_AVAILABLE; -- return __xive_vm_h_cppr(vcpu, cppr); -- } else -+ if (xics_on_xive()) -+ return xive_rm_h_cppr(vcpu, cppr); -+ else - return xics_rm_h_cppr(vcpu, cppr); - } - -@@ -638,13 +591,9 @@ int kvmppc_rm_h_eoi(struct kvm_vcpu *vcpu, unsigned long xirr) - { - if (!kvmppc_xics_enabled(vcpu)) - return H_TOO_HARD; -- if (xics_on_xive()) { -- if (is_rm()) -- return xive_rm_h_eoi(vcpu, xirr); -- if (unlikely(!__xive_vm_h_eoi)) -- return H_NOT_AVAILABLE; -- return __xive_vm_h_eoi(vcpu, xirr); -- } else -+ if (xics_on_xive()) -+ return xive_rm_h_eoi(vcpu, xirr); -+ else - return xics_rm_h_eoi(vcpu, xirr); - } - #endif /* CONFIG_KVM_XICS */ -diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S -index b1d9afffd841..274d62efa866 100644 ---- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S -+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S -@@ -2535,7 +2535,7 @@ hcall_real_table: - #else - .long 0 /* 0x2fc - H_XIRR_X*/ - #endif -- .long DOTSYM(kvmppc_h_random) - hcall_real_table -+ .long DOTSYM(kvmppc_rm_h_random) - hcall_real_table - .globl hcall_real_table_end - hcall_real_table_end: - -diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c -index a0ebc29f30b2..8dfda8e01ac1 100644 ---- a/arch/powerpc/kvm/book3s_xive.c -+++ b/arch/powerpc/kvm/book3s_xive.c -@@ -2245,21 +2245,3 @@ struct kvm_device_ops kvm_xive_ops = { - .get_attr = xive_get_attr, - .has_attr = xive_has_attr, - }; -- --void kvmppc_xive_init_module(void) --{ -- __xive_vm_h_xirr = xive_vm_h_xirr; -- __xive_vm_h_ipoll = xive_vm_h_ipoll; -- __xive_vm_h_ipi = xive_vm_h_ipi; -- __xive_vm_h_cppr = xive_vm_h_cppr; -- __xive_vm_h_eoi = xive_vm_h_eoi; --} -- --void kvmppc_xive_exit_module(void) --{ -- __xive_vm_h_xirr = NULL; -- __xive_vm_h_ipoll = NULL; -- __xive_vm_h_ipi = NULL; -- __xive_vm_h_cppr = NULL; -- __xive_vm_h_eoi = NULL; --} -diff --git a/arch/powerpc/kvm/book3s_xive.h b/arch/powerpc/kvm/book3s_xive.h -index 382e3a56e789..8504389b130e 100644 ---- a/arch/powerpc/kvm/book3s_xive.h -+++ b/arch/powerpc/kvm/book3s_xive.h -@@ -278,13 +278,6 @@ extern int xive_rm_h_ipi(struct kvm_vcpu *vcpu, unsigned long server, - extern int xive_rm_h_cppr(struct kvm_vcpu *vcpu, unsigned long cppr); - extern int xive_rm_h_eoi(struct kvm_vcpu *vcpu, unsigned long xirr); - --extern unsigned long (*__xive_vm_h_xirr)(struct kvm_vcpu *vcpu); --extern unsigned long (*__xive_vm_h_ipoll)(struct kvm_vcpu *vcpu, unsigned long server); --extern int (*__xive_vm_h_ipi)(struct kvm_vcpu *vcpu, unsigned long server, -- unsigned long mfrr); --extern int (*__xive_vm_h_cppr)(struct kvm_vcpu *vcpu, unsigned long cppr); --extern int (*__xive_vm_h_eoi)(struct kvm_vcpu *vcpu, unsigned long xirr); -- - /* - * Common Xive routines for XICS-over-XIVE and XIVE native - */ -diff --git a/arch/powerpc/kvm/book3s_xive_native.c b/arch/powerpc/kvm/book3s_xive_native.c -index a59a94f02733..4b00d4efb709 100644 ---- a/arch/powerpc/kvm/book3s_xive_native.c -+++ b/arch/powerpc/kvm/book3s_xive_native.c -@@ -1271,13 +1271,3 @@ struct kvm_device_ops kvm_xive_native_ops = { - .has_attr = kvmppc_xive_native_has_attr, - .mmap = kvmppc_xive_native_mmap, - }; -- --void kvmppc_xive_native_init_module(void) --{ -- ; --} -- --void kvmppc_xive_native_exit_module(void) --{ -- ; --} --- -2.35.1 - diff --git a/queue-5.10/powerpc-powernv-kvm-use-darn-for-h_random-on-power9.patch b/queue-5.10/powerpc-powernv-kvm-use-darn-for-h_random-on-power9.patch deleted file mode 100644 index a51eff89a08..00000000000 --- a/queue-5.10/powerpc-powernv-kvm-use-darn-for-h_random-on-power9.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 63536db5817afe3bf26cc8827f2899fb225cf374 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 28 Jul 2022 00:32:18 +1000 -Subject: powerpc/powernv/kvm: Use darn for H_RANDOM on Power9 - -From: Jason A. Donenfeld - -[ Upstream commit 7ef3d06f1bc4a5e62273726f3dc2bd258ae1c71f ] - -The existing logic in KVM to support guests calling H_RANDOM only works -on Power8, because it looks for an RNG in the device tree, but on Power9 -we just use darn. - -In addition the existing code needs to work in real mode, so we have the -special cased powernv_get_random_real_mode() to deal with that. - -Instead just have KVM call ppc_md.get_random_seed(), and do the real -mode check inside of there, that way we use whatever RNG is available, -including darn on Power9. - -Fixes: e928e9cb3601 ("KVM: PPC: Book3S HV: Add fast real-mode H_RANDOM implementation.") -Cc: stable@vger.kernel.org # v4.1+ -Signed-off-by: Jason A. Donenfeld -Tested-by: Sachin Sant -[mpe: Rebase on previous commit, update change log appropriately] -Signed-off-by: Michael Ellerman -Link: https://lore.kernel.org/r/20220727143219.2684192-2-mpe@ellerman.id.au -Signed-off-by: Sasha Levin ---- - arch/powerpc/include/asm/archrandom.h | 5 ---- - arch/powerpc/kvm/book3s_hv_builtin.c | 7 +++--- - arch/powerpc/platforms/powernv/rng.c | 36 ++++++--------------------- - 3 files changed, 12 insertions(+), 36 deletions(-) - -diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h -index 9a53e29680f4..258174304904 100644 ---- a/arch/powerpc/include/asm/archrandom.h -+++ b/arch/powerpc/include/asm/archrandom.h -@@ -38,12 +38,7 @@ static inline bool __must_check arch_get_random_seed_int(unsigned int *v) - #endif /* CONFIG_ARCH_RANDOM */ - - #ifdef CONFIG_PPC_POWERNV --int powernv_hwrng_present(void); - int powernv_get_random_long(unsigned long *v); --int powernv_get_random_real_mode(unsigned long *v); --#else --static inline int powernv_hwrng_present(void) { return 0; } --static inline int powernv_get_random_real_mode(unsigned long *v) { return 0; } - #endif - - #endif /* _ASM_POWERPC_ARCHRANDOM_H */ -diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c -index 856a04ca833c..2f3e8b547f4e 100644 ---- a/arch/powerpc/kvm/book3s_hv_builtin.c -+++ b/arch/powerpc/kvm/book3s_hv_builtin.c -@@ -19,7 +19,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -176,13 +176,14 @@ EXPORT_SYMBOL_GPL(kvmppc_hcall_impl_hv_realmode); - - int kvmppc_hwrng_present(void) - { -- return powernv_hwrng_present(); -+ return ppc_md.get_random_seed != NULL; - } - EXPORT_SYMBOL_GPL(kvmppc_hwrng_present); - - long kvmppc_rm_h_random(struct kvm_vcpu *vcpu) - { -- if (powernv_get_random_real_mode(&vcpu->arch.regs.gpr[4])) -+ if (ppc_md.get_random_seed && -+ ppc_md.get_random_seed(&vcpu->arch.regs.gpr[4])) - return H_SUCCESS; - - return H_HARDWARE; -diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c -index a99033c3dce7..5f81ff9b5265 100644 ---- a/arch/powerpc/platforms/powernv/rng.c -+++ b/arch/powerpc/platforms/powernv/rng.c -@@ -29,15 +29,6 @@ struct powernv_rng { - - static DEFINE_PER_CPU(struct powernv_rng *, powernv_rng); - --int powernv_hwrng_present(void) --{ -- struct powernv_rng *rng; -- -- rng = get_cpu_var(powernv_rng); -- put_cpu_var(rng); -- return rng != NULL; --} -- - static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val) - { - unsigned long parity; -@@ -58,19 +49,6 @@ static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val) - return val; - } - --int powernv_get_random_real_mode(unsigned long *v) --{ -- struct powernv_rng *rng; -- -- rng = raw_cpu_read(powernv_rng); -- if (!rng) -- return 0; -- -- *v = rng_whiten(rng, __raw_rm_readq(rng->regs_real)); -- -- return 1; --} -- - static int powernv_get_random_darn(unsigned long *v) - { - unsigned long val; -@@ -107,12 +85,14 @@ int powernv_get_random_long(unsigned long *v) - { - struct powernv_rng *rng; - -- rng = get_cpu_var(powernv_rng); -- -- *v = rng_whiten(rng, in_be64(rng->regs)); -- -- put_cpu_var(rng); -- -+ if (mfmsr() & MSR_DR) { -+ rng = get_cpu_var(powernv_rng); -+ *v = rng_whiten(rng, in_be64(rng->regs)); -+ put_cpu_var(rng); -+ } else { -+ rng = raw_cpu_read(powernv_rng); -+ *v = rng_whiten(rng, __raw_rm_readq(rng->regs_real)); -+ } - return 1; - } - EXPORT_SYMBOL_GPL(powernv_get_random_long); --- -2.35.1 - diff --git a/queue-5.10/series b/queue-5.10/series index 6812cdb4c31..731bb14a4dd 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -492,8 +492,6 @@ um-seed-rng-using-host-os-rng.patch btrfs-reject-log-replay-if-there-is-unsupported-ro-c.patch btrfs-reset-block-group-chunk-force-if-we-have-to-wa.patch acpi-cppc-do-not-prevent-cppc-from-working-in-the-fu.patch -kvm-ppc-book3s-hv-remove-virt-mode-checks-from-real-.patch -powerpc-powernv-kvm-use-darn-for-h_random-on-power9.patch kvm-vmx-drop-guest-cpuid-check-for-vmxe-in-vmx_set_c.patch kvm-vmx-drop-explicit-nested-check-from-vmx_set_cr4.patch kvm-svm-drop-vmxe-check-from-svm_set_cr4.patch -- 2.47.3