xen/arm64: entry: Introduce a macro to generate guest vector and use it

Most of the guest vectors are using the same pattern. This makes fairly
tedious to alter the pattern and risk introducing mistakes when updating
each path.

A new macro is introduced to generate the guest vectors and now use it
in the one that use the open-code version.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Release-acked-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
Julien Grall committed 2019-11-01 13:57:43 +00:00
1 parent 38533d900a
commit 32e195645c
1 file changed
+28 -56
+28 -56
View File
@@ -175,6 +175,30 @@
.endm
/*
* Generate a guest vector.
*
* iflags: Correspond to the list of interrupts to unmask
* save_x0_x1: See the description on top of the macro 'entry'
*/
.macro guest_vector compat, iflags, trap, save_x0_x1=1
entry hyp=0, compat=\compat, save_x0_x1=\save_x0_x1
/*
* The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
* is not set. If a vSError took place, the initial exception will be
* skipped. Exit ASAP
*/
ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
"nop; nop",
SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT)
msr daifclr, \iflags
mov x0, sp
bl do_trap_\trap
1:
exit hyp=0, compat=\compat
.endm
/*
* Bad Abort numbers
*-----------------
@@ -347,36 +371,10 @@ guest_sync_slowpath:
* x0/x1 may have been scratch by the fast path above, so avoid
* to save them.
*/
entry hyp=0, compat=0, save_x0_x1=0
/*
* The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
* is not set. If a vSError took place, the initial exception will be
* skipped. Exit ASAP
*/
ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
"nop; nop",
SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT)
msr daifclr, #IFLAGS__AI_
mov x0, sp
bl do_trap_guest_sync
1:
exit hyp=0, compat=0
guest_vector compat=0, iflags=IFLAGS__AI_, trap=guest_sync, save_x0_x1=0
guest_irq:
entry hyp=0, compat=0
/*
* The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
* is not set. If a vSError took place, the initial exception will be
* skipped. Exit ASAP
*/
ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
"nop; nop",
SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT)
msr daifclr, #IFLAGS__A__
mov x0, sp
bl do_trap_irq
1:
exit hyp=0, compat=0
guest_vector compat=0, iflags=IFLAGS__A__, trap=irq
guest_fiq_invalid:
entry hyp=0, compat=0
@@ -390,36 +388,10 @@ guest_error:
exit hyp=0, compat=0
guest_sync_compat:
entry hyp=0, compat=1
/*
* The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
* is not set. If a vSError took place, the initial exception will be
* skipped. Exit ASAP
*/
ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
"nop; nop",
SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT)
msr daifclr, #IFLAGS__AI_
mov x0, sp
bl do_trap_guest_sync
1:
exit hyp=0, compat=1
guest_vector compat=1, iflags=IFLAGS__AI_, trap=guest_sync
guest_irq_compat:
entry hyp=0, compat=1
/*
* The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
* is not set. If a vSError took place, the initial exception will be
* skipped. Exit ASAP
*/
ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
"nop; nop",
SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT)
msr daifclr, #IFLAGS__A__
mov x0, sp
bl do_trap_irq
1:
exit hyp=0, compat=1
guest_vector compat=1, iflags=IFLAGS__A__, trap=irq
guest_fiq_invalid_compat:
entry hyp=0, compat=1
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.