All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
To: xen-devel@lists.xen.org
Cc: Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Subject: [PATCH v2 2/4] arm: processor: add new struct hsr_smc32 into hsr union
Date: Wed,  9 Aug 2017 22:44:28 +0300	[thread overview]
Message-ID: <1502307870-11317-3-git-send-email-volodymyr_babchuk@epam.com> (raw)
In-Reply-To: <1502307870-11317-1-git-send-email-volodymyr_babchuk@epam.com>

On ARMv8, one of conditional exceptions (SMC that originates
from aarch32 state) have extra field in HCR.ISS encoding:

CCKNOWNPASS, bit [19]
Indicates whether the instruction might have failed its condition
code check.
   0 - The instruction was unconditional, or was conditional and
   passed  its condition code check.
   1 - The instruction was conditional, and might have failed its
   condition code check.
(ARM DDI 0487A.k page D7-1949)

This is instruction specific field, so better to add new structure
to union hsr. This structure describes ISS encoding for an exception
from SMC instruction execution in AArch32 state. But we define this
struct for both ARMv7 and ARMv8. The reason is described in comment
to the structure:

"Nevertheless, we define this encoding for both ARMv7 and ARMv8,
because check_conditional_inst() should properly handle SMC
instruction in all modes: ARMv7, aarch32 and aarch64."

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---

- Created new stucture for HSR_EC_SMC32 instead of extending
  fields in hsr.cond.
- Added references to ARM manual.
- Wrote comment with rationale.

---
 xen/include/asm-arm/processor.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index f640d54..af4a0f7 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -488,6 +488,25 @@ union hsr {
         unsigned long ec:6;     /* Exception Class */
     } cp; /* HSR_EC_CP */
 
+    /*
+     * This encoding is valid only for ARMv8 (ARM DDI 0487A.k pages D7-1949 and
+     * G6-4405). On ARMv7, encoding ISS for EC=0x13 is defined as UNK/SBZP
+     * (ARM DDI 0406C.c page B3-1431). UNK/SBZP means that hardware implements
+     * this field as Read-As-Zero.
+     *
+     * Nevertheless, we define this encoding for both ARMv7 and ARMv8, because
+     * check_conditional_inst() should properly handle SMC instruction in all
+     * modes: ARMv7, aarch32 and aarch64.
+     */
+    struct hsr_smc32 {
+        unsigned long res0:19;  /* Reserved */
+        unsigned long ccknownpass:1; /* Instruction passed conditional check */
+        unsigned long cc:4;    /* Condition Code */
+        unsigned long ccvalid:1;/* CC Valid */
+        unsigned long len:1;   /* Instruction length */
+        unsigned long ec:6;    /* Exception Class */
+    } smc32; /* HSR_EC_SMC32 */
+
 #ifdef CONFIG_ARM_64
     struct hsr_sysreg {
         unsigned long read:1;   /* Direction */
-- 
2.7.4


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

  parent reply	other threads:[~2017-08-09 19:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 19:44 [PATCH v2 0/4] arm: allign check_conditional_instr() with ARMv8 Volodymyr Babchuk
2017-08-09 19:44 ` [PATCH v2 1/4] arm: processor: rename iss to res0 in hsr_cond union Volodymyr Babchuk
2017-08-09 20:25   ` Julien Grall
2017-08-09 19:44 ` Volodymyr Babchuk [this message]
2017-08-09 20:34   ` [PATCH v2 2/4] arm: processor: add new struct hsr_smc32 into hsr union Julien Grall
2017-08-09 21:06     ` Volodymyr Babchuk
2017-08-09 21:22       ` Julien Grall
2017-08-11 13:26         ` Volodymyr Babchuk
2017-08-11 13:43           ` Julien Grall
2017-08-09 19:44 ` [PATCH v2 3/4] arm: traps: handle unknown exceptions in check_conditional_instr() Volodymyr Babchuk
2017-08-09 20:36   ` Julien Grall
2017-08-09 19:44 ` [PATCH v2 4/4] arm: traps: handle SMC32 " Volodymyr Babchuk
2017-08-09 20:42   ` Julien Grall

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=1502307870-11317-3-git-send-email-volodymyr_babchuk@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.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.