xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Julien Grall <julien.grall@citrix.com>,
	ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com
Subject: [RFC 09/10] xen/arm: Remove the C version of do_trap_hypercall
Date: Tue, 15 Dec 2015 17:52:07 +0000	[thread overview]
Message-ID: <1450201928-4928-10-git-send-email-julien.grall@citrix.com> (raw)
In-Reply-To: <1450201928-4928-1-git-send-email-julien.grall@citrix.com>

This has been fully implemented in assembly so it's not necessary to
keep it anymore.

Signed-off-by: Julien Grall <julien.grall@citrix.com>

---

    It's possible to factorize the code to handle HVC32/HVC64, but this will
    be done in the next patch.
---
 xen/arch/arm/traps.c | 74 ++++++----------------------------------------------
 1 file changed, 8 insertions(+), 66 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index cc67d23..3cd8992 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1335,70 +1335,6 @@ static void do_trap_psci(struct cpu_user_regs *regs)
     }
 }
 
-#ifdef CONFIG_ARM_64
-#define HYPERCALL_RESULT_REG(r) (r)->x0
-#define HYPERCALL_ARG1(r) (r)->x0
-#define HYPERCALL_ARG2(r) (r)->x1
-#define HYPERCALL_ARG3(r) (r)->x2
-#define HYPERCALL_ARG4(r) (r)->x3
-#define HYPERCALL_ARG5(r) (r)->x4
-#define HYPERCALL_ARGS(r) (r)->x0, (r)->x1, (r)->x2, (r)->x3, (r)->x4
-#else
-#define HYPERCALL_RESULT_REG(r) (r)->r0
-#define HYPERCALL_ARG1(r) (r)->r0
-#define HYPERCALL_ARG2(r) (r)->r1
-#define HYPERCALL_ARG3(r) (r)->r2
-#define HYPERCALL_ARG4(r) (r)->r3
-#define HYPERCALL_ARG5(r) (r)->r4
-#define HYPERCALL_ARGS(r) (r)->r0, (r)->r1, (r)->r2, (r)->r3, (r)->r4
-#endif
-
-static void do_trap_hypercall(struct cpu_user_regs *regs, register_t *nr,
-                              unsigned long iss)
-{
-#ifndef NDEBUG
-    register_t orig_pc = regs->pc;
-#endif
-
-    if ( iss != XEN_HYPERCALL_TAG )
-        domain_crash_synchronous();
-
-    if ( *nr >= NR_hypercalls )
-    {
-        perfc_incr(invalid_hypercalls);
-        HYPERCALL_RESULT_REG(regs) = -ENOSYS;
-        return;
-    }
-
-    perfc_incra(hypercalls, *nr);
-
-    HYPERCALL_RESULT_REG(regs) = do_dispatch_hypercall(HYPERCALL_ARGS(regs),
-                                                       *nr);
-
-#ifndef NDEBUG
-    /*
-     * Clobber argument registers only if pc is unchanged, otherwise
-     * this is a hypercall continuation.
-     */
-    if ( orig_pc == regs->pc )
-    {
-        switch ( hypercall_args_table[*nr] ) {
-        case 5: HYPERCALL_ARG5(regs) = 0xDEADBEEF;
-        case 4: HYPERCALL_ARG4(regs) = 0xDEADBEEF;
-        case 3: HYPERCALL_ARG3(regs) = 0xDEADBEEF;
-        case 2: HYPERCALL_ARG2(regs) = 0xDEADBEEF;
-        case 1: /* Don't clobber x0/r0 -- it's the return value */
-            break;
-        case 0:
-            ASSERT(hypercall_table[*nr] == do_ni_hypercall);
-            break;
-        default: BUG();
-        }
-        *nr = 0xDEADBEEF;
-    }
-#endif
-}
-
 static bool_t check_multicall_32bit_clean(struct multicall_entry *multi)
 {
     int i;
@@ -2476,7 +2412,10 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
 #endif
         if ( hsr.iss == 0 )
             return do_trap_psci(regs);
-        do_trap_hypercall(regs, (register_t *)&regs->r12, hsr.iss);
+
+        /* The ISS is not supported */
+        domain_crash_synchronous();
+
         break;
 #ifdef CONFIG_ARM_64
     case HSR_EC_HVC64:
@@ -2488,7 +2427,10 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
 #endif
         if ( hsr.iss == 0 )
             return do_trap_psci(regs);
-        do_trap_hypercall(regs, &regs->x16, hsr.iss);
+
+        /* The ISS is not supported */
+        domain_crash_synchronous();
+
         break;
     case HSR_EC_SMC64:
         /*
-- 
2.1.4

  parent reply	other threads:[~2015-12-15 17:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15 17:51 [RFC 00/10] xen/arm: Implement the hypercall handling in assembly Julien Grall
2015-12-15 17:51 ` [RFC 01/10] xen/arm: move lr, push and pop in a separate header Julien Grall
2015-12-15 17:52 ` [RFC 02/10] xen/arm: Drop unused defines in asm/bug.h Julien Grall
2015-12-15 17:52 ` [RFC 03/10] xen/arm: Implement assembly version of WARN/BUG/ASSERT_FAILED Julien Grall
2015-12-15 17:52 ` [RFC 04/10] xen/arm64: Add an assembly macro for perf counter Julien Grall
2015-12-15 17:52 ` [RFC 05/10] xen/arm: gic_inject: Introduce a local variable to store current Julien Grall
2015-12-15 17:52 ` [RFC 06/10] xen/arm: gic: Allow the LRs to be cleared lazily Julien Grall
2015-12-15 17:52 ` [RFC 07/10] xen/arm: Implement the code to dispatch the hypercall in assembly Julien Grall
2015-12-15 17:52 ` [RFC 08/10] xen/arm64: Implement the hypercall handing fully " Julien Grall
2015-12-15 17:52 ` Julien Grall [this message]
2015-12-15 17:52 ` [RFC 10/10] xen/arm: Factorize the C code to dispatch HVC Julien Grall
2015-12-15 18:33 ` [RFC 00/10] xen/arm: Implement the hypercall handling in assembly Andrew Cooper
2015-12-16 11:19   ` Ian Campbell

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=1450201928-4928-10-git-send-email-julien.grall@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).