All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: xen-devel@lists.xenproject.org
Cc: Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	andrii.anisov@gmail.com
Subject: [Xen-devel] [PATCH RFC for-4.13 01/10] xen/arm64: entry: Introduce a macro to generate guest vector and use it
Date: Thu, 26 Sep 2019 19:37:59 +0100	[thread overview]
Message-ID: <20190926183808.11630-2-julien.grall@arm.com> (raw)
In-Reply-To: <20190926183808.11630-1-julien.grall@arm.com>

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>
---
 xen/arch/arm/arm64/entry.S | 84 ++++++++++++++++------------------------------
 1 file changed, 28 insertions(+), 56 deletions(-)

diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
index 2d9a2713a1..8665d2844a 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -157,6 +157,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
  *-----------------
@@ -290,36 +314,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, #6
-        mov     x0, sp
-        bl      do_trap_guest_sync
-1:
-        exit    hyp=0, compat=0
+        guest_vector compat=0, iflags=6, 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, #4
-        mov     x0, sp
-        bl      do_trap_irq
-1:
-        exit    hyp=0, compat=0
+        guest_vector compat=0, iflags=4, trap=irq
 
 guest_fiq_invalid:
         entry   hyp=0, compat=0
@@ -333,36 +331,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, #6
-        mov     x0, sp
-        bl      do_trap_guest_sync
-1:
-        exit    hyp=0, compat=1
+        guest_vector compat=1, iflags=6, 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, #4
-        mov     x0, sp
-        bl      do_trap_irq
-1:
-        exit    hyp=0, compat=1
+        guest_vector compat=1, iflags=4, trap=irq
 
 guest_fiq_invalid_compat:
         entry   hyp=0, compat=1
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-09-26 18:38 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 18:37 [Xen-devel] [PATCH RFC for-4.13 00/10] xen/arm: XSA-201 and XSA-263 fixes Julien Grall
2019-09-26 18:37 ` Julien Grall [this message]
2019-09-27 11:34   ` [Xen-devel] [PATCH RFC for-4.13 01/10] xen/arm64: entry: Introduce a macro to generate guest vector and use it Volodymyr Babchuk
2019-10-01 19:53     ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 02/10] xen/arm64: head: Check if an SError is pending when receiving a vSError Julien Grall
2019-09-27 11:35   ` Volodymyr Babchuk
2019-10-01 19:58     ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 03/10] xen/arm: traps: Rework entry/exit from the guest path Julien Grall
2019-09-27 11:45   ` Volodymyr Babchuk
2019-09-27 12:16     ` Julien Grall
2019-09-27 12:27       ` Volodymyr Babchuk
2019-09-27 12:44         ` Julien Grall
2019-09-27 12:49           ` Volodymyr Babchuk
2019-10-01 20:12   ` Stefano Stabellini
2019-10-01 21:06     ` Julien Grall
2019-10-02  0:16       ` Stefano Stabellini
2019-10-02  9:12         ` Julien Grall
2019-10-02 12:41         ` Stefano Stabellini
2019-10-02 12:47           ` Julien Grall
2019-10-02 22:26             ` Stefano Stabellini
2019-10-03 10:24               ` Julien Grall
2019-10-03 17:48                 ` Stefano Stabellini
2019-10-03 17:53                   ` Julien Grall
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 04/10] xen/arm: Ensure the SSBD workaround is re-enabled right after exiting a guest Julien Grall
2019-09-27 11:56   ` Volodymyr Babchuk
2019-09-27 12:22     ` Julien Grall
2019-09-27 12:39       ` Volodymyr Babchuk
2019-09-27 13:16         ` Julien Grall
2019-09-27 13:33           ` Volodymyr Babchuk
2019-09-27 14:11             ` Julien Grall
2019-09-27 14:21               ` Volodymyr Babchuk
2019-09-27 16:24                 ` Julien Grall
2019-09-27 17:58                   ` Volodymyr Babchuk
2019-09-27 20:31                     ` Julien Grall
2019-09-30 12:14   ` Volodymyr Babchuk
2019-09-30 12:15     ` Julien Grall
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 05/10] xen/arm: alternative: Remove unused parameter for alternative_if_not_cap Julien Grall
2019-09-27 11:50   ` Volodymyr Babchuk
2019-10-01 20:55     ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 06/10] xen/arm: Move ARCH_PATCH_INSN_SIZE out of the header livepatch.h Julien Grall
2019-09-27 11:51   ` Volodymyr Babchuk
2019-09-27 11:59   ` Ross Lagerwall
2019-10-01 20:57   ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 07/10] xen/arm: Allow insn.h to be called from assembly Julien Grall
2019-09-27 11:52   ` Volodymyr Babchuk
2019-10-01 21:00   ` Stefano Stabellini
2019-10-21 16:43     ` Julien Grall
2019-10-21 17:23       ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 08/10] xen/arm: alternative: add auto-nop infrastructure Julien Grall
2019-09-27 15:34   ` Volodymyr Babchuk
2019-10-01 22:08     ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 09/10] xen/arm: asm: Replace use of ALTERNATIVE with alternative_if Julien Grall
2019-09-27 12:11   ` Volodymyr Babchuk
2019-09-27 12:34     ` Julien Grall
2019-09-27 12:46       ` Volodymyr Babchuk
2019-10-01 22:19   ` Stefano Stabellini
2019-10-01 22:44     ` Julien Grall
2019-10-01 22:52       ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 10/10] xen/arm64: entry: Ensure the guest state is synced when receiving a vSError Julien Grall
2019-09-27 15:30   ` Volodymyr Babchuk
2019-10-02  0:50   ` Stefano Stabellini
2019-09-27  4:17 ` [Xen-devel] [PATCH RFC for-4.13 00/10] xen/arm: XSA-201 and XSA-263 fixes Jürgen Groß

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190926183808.11630-2-julien.grall@arm.com \
    --to=julien.grall@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrii.anisov@gmail.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.