mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-03 11:16:48 +07:00
cd4d09ec6f
Move them to a separate header and have the following dependency: x86/cpufeatures.h <- x86/processor.h <- x86/cpufeature.h This makes it easier to use the header in asm code and not include the whole cpufeature.h and add guards for asm. Suggested-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1453842730-28463-5-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
55 lines
947 B
ArmAsm
55 lines
947 B
ArmAsm
#include <linux/linkage.h>
|
|
#include <asm/cpufeatures.h>
|
|
#include <asm/alternative-asm.h>
|
|
|
|
/*
|
|
* Most CPUs support enhanced REP MOVSB/STOSB instructions. It is
|
|
* recommended to use this when possible and we do use them by default.
|
|
* If enhanced REP MOVSB/STOSB is not available, try to use fast string.
|
|
* Otherwise, use original.
|
|
*/
|
|
|
|
/*
|
|
* Zero a page.
|
|
* %rdi - page
|
|
*/
|
|
ENTRY(clear_page)
|
|
|
|
ALTERNATIVE_2 "jmp clear_page_orig", "", X86_FEATURE_REP_GOOD, \
|
|
"jmp clear_page_c_e", X86_FEATURE_ERMS
|
|
|
|
movl $4096/8,%ecx
|
|
xorl %eax,%eax
|
|
rep stosq
|
|
ret
|
|
ENDPROC(clear_page)
|
|
|
|
ENTRY(clear_page_orig)
|
|
|
|
xorl %eax,%eax
|
|
movl $4096/64,%ecx
|
|
.p2align 4
|
|
.Lloop:
|
|
decl %ecx
|
|
#define PUT(x) movq %rax,x*8(%rdi)
|
|
movq %rax,(%rdi)
|
|
PUT(1)
|
|
PUT(2)
|
|
PUT(3)
|
|
PUT(4)
|
|
PUT(5)
|
|
PUT(6)
|
|
PUT(7)
|
|
leaq 64(%rdi),%rdi
|
|
jnz .Lloop
|
|
nop
|
|
ret
|
|
ENDPROC(clear_page_orig)
|
|
|
|
ENTRY(clear_page_c_e)
|
|
movl $4096,%ecx
|
|
xorl %eax,%eax
|
|
rep stosb
|
|
ret
|
|
ENDPROC(clear_page_c_e)
|