set_memory_decrypted() now clears the range even when memory encryption
is inactive, so call it unconditionally and remove the separate
memset().

Cc: Paolo Bonzini <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: [email protected]
Signed-off-by: Aneesh Kumar K.V (Arm) <[email protected]>
---
 arch/x86/kernel/kvmclock.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index cb3d0ca1fa22..c7c306275a64 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -16,7 +16,6 @@
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/set_memory.h>
-#include <linux/cc_platform.h>
 
 #include <asm/hypervisor.h>
 #include <asm/timer.h>
@@ -247,18 +246,13 @@ static void __init kvmclock_init_mem(void)
         * hvclock is shared between the guest and the hypervisor, must
         * be mapped decrypted.
         */
-       if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) {
-               r = set_memory_decrypted((unsigned long) hvclock_mem,
-                                        1UL << order);
-               if (r) {
-                       __free_pages(p, order);
-                       hvclock_mem = NULL;
-                       pr_warn("kvmclock: set_memory_decrypted() failed. 
Disabling\n");
-                       return;
-               }
+       r = set_memory_decrypted((unsigned long)hvclock_mem, 1UL << order);
+       if (r) {
+               __free_pages(p, order);
+               hvclock_mem = NULL;
+               pr_warn("kvmclock: set_memory_decrypted() failed. Disabling\n");
+               return;
        }
-
-       memset(hvclock_mem, 0, PAGE_SIZE << order);
 }
 
 static int __init kvm_setup_vsyscall_timeinfo(void)
-- 
2.43.0

Reply via email to