On Fri, Dec 13, 2024, at 07:25, Christophe Leroy wrote: > Le 12/12/2024 à 22:08, Arnd Bergmann a écrit : > > So yes it is used on e5500/e6500 but only when they run a 32 bits kernel > built with CONFIG_PPC_85xx. Isn't it what you want to get rid of with > this patch ? > > Am I missing something ? I think I mixed up CONFIG_PPC_E500 and CONFIG_PPC_85xx and hadn't realized that we use CONFIG_PPC_BOOK3E_64 instead of PPC_85xx for the 64-bit mode. I found a few more things that can be removed now and folded in the patch below, which includes your suggestions. Arnd diff --git a/arch/powerpc/kernel/head_85xx.S b/arch/powerpc/kernel/head_85xx.S index f9a73fae6464..661903d31b54 100644 --- a/arch/powerpc/kernel/head_85xx.S +++ b/arch/powerpc/kernel/head_85xx.S @@ -425,16 +425,10 @@ interrupt_base: mtspr SPRN_SPRG_WSCRATCH0, r10 /* Save some working registers */ mfspr r10, SPRN_SPRG_THREAD stw r11, THREAD_NORMSAVE(0)(r10) -#ifdef CONFIG_KVM_BOOKE_HV -BEGIN_FTR_SECTION - mfspr r11, SPRN_SRR1 -END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV) -#endif stw r12, THREAD_NORMSAVE(1)(r10) stw r13, THREAD_NORMSAVE(2)(r10) mfcr r13 stw r13, THREAD_NORMSAVE(3)(r10) - DO_KVM BOOKE_INTERRUPT_DTLB_MISS SPRN_SRR1 START_BTB_FLUSH_SECTION mfspr r11, SPRN_SRR1 andi. r10,r11,MSR_PR @@ -517,16 +511,10 @@ END_BTB_FLUSH_SECTION mtspr SPRN_SPRG_WSCRATCH0, r10 /* Save some working registers */ mfspr r10, SPRN_SPRG_THREAD stw r11, THREAD_NORMSAVE(0)(r10) -#ifdef CONFIG_KVM_BOOKE_HV -BEGIN_FTR_SECTION - mfspr r11, SPRN_SRR1 -END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV) -#endif stw r12, THREAD_NORMSAVE(1)(r10) stw r13, THREAD_NORMSAVE(2)(r10) mfcr r13 stw r13, THREAD_NORMSAVE(3)(r10) - DO_KVM BOOKE_INTERRUPT_ITLB_MISS SPRN_SRR1 START_BTB_FLUSH_SECTION mfspr r11, SPRN_SRR1 andi. r10,r11,MSR_PR @@ -660,8 +648,6 @@ END_BTB_FLUSH_SECTION DEBUG_DEBUG_EXCEPTION DEBUG_CRIT_EXCEPTION - GUEST_DOORBELL_EXCEPTION - CRITICAL_EXCEPTION(0, GUEST_DBELL_CRIT, CriticalGuestDoorbell, \ unknown_exception) diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h index 0b5c1993809e..d1ffef4d05b5 100644 --- a/arch/powerpc/kernel/head_booke.h +++ b/arch/powerpc/kernel/head_booke.h @@ -3,8 +3,6 @@ #define __HEAD_BOOKE_H__ #include <asm/ptrace.h> /* for STACK_FRAME_REGS_MARKER */ -#include <asm/kvm_asm.h> -#include <asm/kvm_booke_hv_asm.h> #include <asm/thread_info.h> /* for THREAD_SHIFT */ #ifdef __ASSEMBLY__ @@ -52,7 +50,6 @@ END_BTB_FLUSH_SECTION stw r13, THREAD_NORMSAVE(2)(r10); \ mfcr r13; /* save CR in r13 for now */\ mfspr r11, SPRN_SRR1; \ - DO_KVM BOOKE_INTERRUPT_##intno SPRN_SRR1; \ andi. r11, r11, MSR_PR; /* check whether user or kernel */\ LOAD_REG_IMMEDIATE(r11, MSR_KERNEL); \ mtmsr r11; \ @@ -114,25 +111,7 @@ END_BTB_FLUSH_SECTION .macro SYSCALL_ENTRY trapno intno srr1 mfspr r10, SPRN_SPRG_THREAD -#ifdef CONFIG_KVM_BOOKE_HV -BEGIN_FTR_SECTION - mtspr SPRN_SPRG_WSCRATCH0, r10 - stw r11, THREAD_NORMSAVE(0)(r10) - stw r13, THREAD_NORMSAVE(2)(r10) - mfcr r13 /* save CR in r13 for now */ - mfspr r11, SPRN_SRR1 - mtocrf 0x80, r11 /* check MSR[GS] without clobbering reg */ - bf 3, 1975f - b kvmppc_handler_\intno\()_\srr1 -1975: - mr r12, r13 - lwz r13, THREAD_NORMSAVE(2)(r10) -FTR_SECTION_ELSE mfcr r12 -ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV) -#else - mfcr r12 -#endif mfspr r9, SPRN_SRR1 BOOKE_CLEAR_BTB(r11) mr r11, r1 @@ -198,7 +177,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV) stw r11,GPR11(r8); \ stw r9,_CCR(r8); /* save CR on stack */\ mfspr r11,exc_level_srr1; /* check whether user or kernel */\ - DO_KVM BOOKE_INTERRUPT_##intno exc_level_srr1; \ BOOKE_CLEAR_BTB(r10) \ andi. r11,r11,MSR_PR; \ LOAD_REG_IMMEDIATE(r11, MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)); \ @@ -272,23 +250,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV) EXC_LEVEL_EXCEPTION_PROLOG(MC, trapno+4, MACHINE_CHECK, \ SPRN_MCSRR0, SPRN_MCSRR1) -/* - * Guest Doorbell -- this is a bit odd in that uses GSRR0/1 despite - * being delivered to the host. This exception can only happen - * inside a KVM guest -- so we just handle up to the DO_KVM rather - * than try to fit this into one of the existing prolog macros. - */ -#define GUEST_DOORBELL_EXCEPTION \ - START_EXCEPTION(GuestDoorbell); \ - mtspr SPRN_SPRG_WSCRATCH0, r10; /* save one register */ \ - mfspr r10, SPRN_SPRG_THREAD; \ - stw r11, THREAD_NORMSAVE(0)(r10); \ - mfspr r11, SPRN_SRR1; \ - stw r13, THREAD_NORMSAVE(2)(r10); \ - mfcr r13; /* save CR in r13 for now */\ - DO_KVM BOOKE_INTERRUPT_GUEST_DBELL SPRN_GSRR1; \ - trap - /* * Exception vectors. */