All of lore.kernel.org
 help / color / mirror / Atom feed
* [XEN v1] xen/arm: io: Check ESR_EL2.ISV != 0 before searching for a MMIO handler
@ 2022-01-26 16:58 Ayan Kumar Halder
  2022-01-26 17:22 ` Julien Grall
  0 siblings, 1 reply; 19+ messages in thread
From: Ayan Kumar Halder @ 2022-01-26 16:58 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, stefanos, julien, Volodymyr_Babchuk,
	bertrand.marquis, Ayan Kumar Halder

Refer to Armv8 ARM DDI 0487G.b, Page D13-3219 "ISS encoding for an exception
from a Data Abort" :-
ISV - ISS[23:14] holds a valid instruction syndrome

When the ISV is 0, the instruction could not be decoded by the hardware (ie ISS
is invalid). One should immediately return an error to the caller with an
appropriate error message. There is no use of the MMIO handler. This is the
reason why one should check for ISV before attempting to find a MMIO handler.

Signed-off-by: Ayan Kumar Halder <ayankuma@xilinx.com>
---

Suggested by Julien Grall in https://lists.xenproject.org/archives/html/xen-devel/2022-01/msg01245.html

 xen/arch/arm/io.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c
index 729287e37c..14d39222f2 100644
--- a/xen/arch/arm/io.c
+++ b/xen/arch/arm/io.c
@@ -109,6 +109,13 @@ enum io_state try_handle_mmio(struct cpu_user_regs *regs,
 
     ASSERT(hsr.ec == HSR_EC_DATA_ABORT_LOWER_EL);
 
+    /* All the instructions used on emulated MMIO region should be valid */
+    if ( !dabt.valid )
+    {
+        gprintk(XENLOG_DEBUG, "No valid instruction syndrome for data abort\n");
+        return IO_ABORT;
+    }
+
     handler = find_mmio_handler(v->domain, info.gpa);
     if ( !handler )
     {
@@ -121,10 +128,6 @@ enum io_state try_handle_mmio(struct cpu_user_regs *regs,
         return rc;
     }
 
-    /* All the instructions used on emulated MMIO region should be valid */
-    if ( !dabt.valid )
-        return IO_ABORT;
-
     /*
      * Erratum 766422: Thumb store translation fault to Hypervisor may
      * not have correct HSR Rt value.
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2022-01-31 19:42 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 16:58 [XEN v1] xen/arm: io: Check ESR_EL2.ISV != 0 before searching for a MMIO handler Ayan Kumar Halder
2022-01-26 17:22 ` Julien Grall
2022-01-26 17:55   ` Ayan Kumar Halder
2022-01-27  0:10     ` Julien Grall
2022-01-27 13:20       ` Ayan Kumar Halder
2022-01-27 13:57         ` Julien Grall
2022-01-27 15:48           ` Ayan Kumar Halder
2022-01-27 20:27             ` Julien Grall
2022-01-27 22:40               ` Stefano Stabellini
2022-01-27 23:05                 ` Julien Grall
2022-01-27 23:06                   ` Julien Grall
2022-01-28  1:20                     ` Stefano Stabellini
2022-01-28  9:46                       ` Julien Grall
2022-01-28 12:08                         ` Ayan Kumar Halder
2022-01-28 20:30                           ` Stefano Stabellini
2022-01-29 17:36                             ` Julien Grall
2022-01-28 20:23                         ` Stefano Stabellini
2022-01-29 17:40                           ` Julien Grall
2022-01-31 19:41                             ` Ayan Kumar Halder

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.