mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
arm64: gicv3: Allow GICv3 compilation with older binutils
GICv3 introduces new system registers accessible with the full msr/mrs syntax (e.g. mrs x0, Sop0_op1_CRm_CRn_op2). However, only recent binutils understand the new syntax. This patch introduces msr_s/mrs_s assembly macros which generate the equivalent instructions above and converts the existing GICv3 code (both drivers/irqchip/ and arch/arm64/kernel/). Signed-off-by: Catalin Marinas <[email protected]> Reported-by: Olof Johansson <[email protected]> Tested-by: Olof Johansson <[email protected]> Suggested-by: Mark Rutland <[email protected]> Acked-by: Mark Rutland <[email protected]> Acked-by: Jason Cooper <[email protected]> Cc: Will Deacon <[email protected]> Cc: Marc Zyngier <[email protected]>
This commit is contained in:
parent
ecb3c2bbf2
commit
72c5839515
4 changed files with 93 additions and 31 deletions
60
arch/arm64/include/asm/sysreg.h
Normal file
60
arch/arm64/include/asm/sysreg.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Macros for accessing system registers with older binutils.
|
||||
*
|
||||
* Copyright (C) 2014 ARM Ltd.
|
||||
* Author: Catalin Marinas <catalin.marinas@arm.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_SYSREG_H
|
||||
#define __ASM_SYSREG_H
|
||||
|
||||
#define sys_reg(op0, op1, crn, crm, op2) \
|
||||
((((op0)-2)<<19)|((op1)<<16)|((crn)<<12)|((crm)<<8)|((op2)<<5))
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
|
||||
.irp num,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
|
||||
.equ __reg_num_x\num, \num
|
||||
.endr
|
||||
.equ __reg_num_xzr, 31
|
||||
|
||||
.macro mrs_s, rt, sreg
|
||||
.inst 0xd5300000|(\sreg)|(__reg_num_\rt)
|
||||
.endm
|
||||
|
||||
.macro msr_s, sreg, rt
|
||||
.inst 0xd5100000|(\sreg)|(__reg_num_\rt)
|
||||
.endm
|
||||
|
||||
#else
|
||||
|
||||
asm(
|
||||
" .irp num,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30\n"
|
||||
" .equ __reg_num_x\\num, \\num\n"
|
||||
" .endr\n"
|
||||
" .equ __reg_num_xzr, 31\n"
|
||||
"\n"
|
||||
" .macro mrs_s, rt, sreg\n"
|
||||
" .inst 0xd5300000|(\\sreg)|(__reg_num_\\rt)\n"
|
||||
" .endm\n"
|
||||
"\n"
|
||||
" .macro msr_s, sreg, rt\n"
|
||||
" .inst 0xd5100000|(\\sreg)|(__reg_num_\\rt)\n"
|
||||
" .endm\n"
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_SYSREG_H */
|
||||
|
|
@ -297,12 +297,12 @@ CPU_LE( bic x0, x0, #(3 << 24) ) // Clear the EE and E0E bits for EL1
|
|||
cmp x0, #1
|
||||
b.ne 3f
|
||||
|
||||
mrs x0, ICC_SRE_EL2
|
||||
mrs_s x0, ICC_SRE_EL2
|
||||
orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1
|
||||
orr x0, x0, #ICC_SRE_EL2_ENABLE // Set ICC_SRE_EL2.Enable==1
|
||||
msr ICC_SRE_EL2, x0
|
||||
msr_s ICC_SRE_EL2, x0
|
||||
isb // Make sure SRE is now set
|
||||
msr ICH_HCR_EL2, xzr // Reset ICC_HCR_EL2 to defaults
|
||||
msr_s ICH_HCR_EL2, xzr // Reset ICC_HCR_EL2 to defaults
|
||||
|
||||
3:
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue