[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN v1] xen/arm: io: Check ESR_EL2.ISV != 0 before searching for a MMIO handler


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxxxxx>
  • Date: Wed, 26 Jan 2022 16:58:27 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TxTQOVcW7JyWAHFkPGvc7fLMrDWuRmKCeDUTObCeilo=; b=azyMwtuKxXhq9iEU8Y2EvMyPhuRlvd9ZSArtBVICedF6ksuGXVXHtbmpx06O7IlbQR+yllzbmpdjAzoKifALKXmHW2ElbY60G9B7BKBjJ1QZVVuJn0VdERmRpb3VPiolemydJAGkcLGCQD1cIadKUcY0TBJWNMZeQ81dNV4jhQD2Cai4Lw58krPNyRMVBY2IlenUXaaYKZh0CmctgYpwWPcBbc1HdPPXr93DInGuRVyjn3XXp1CUgrvaLUzwVYyRnsN4yrFRJwCpTVsa3RnfzFnhV7WjOmXx1wx6QdrQqezGZraRq8WLtjP0/AEXukF0njbfDlUre1BzstZz7kKx8A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gO5IPAuRt00+dbrrmJMjSSt9ayyp5Q7MJpMxSY4F6VUIaufZAGEg41LkWt9QkmD8fbb9MNdD3G/ieYwht2yCF9DgSBmYSGIFV+9FNvAS9bXNnYtBGbmJfWhaBnQjdUcQSghmqTn+LhSVbz0CJbdi1laY4xL0qx4oJmEMgO1IgGSUDQzbnOvG7OQRO4jJNhJqbYPDcOLHAUAugr1+sBR24TxGLnMVuh9tPuYN5bQU+GCwJ371UaWT9IwsUaKbJvWmXCZW8UH74cJI8M7bBusxCyC8+067xsU3iLDFfoecO2asEAcNrKdJYTzPN6RdrYdMexbilIY1GOmCmDx7zw/9gQ==
  • Cc: <sstabellini@xxxxxxxxxx>, <stefanos@xxxxxxxxxx>, <julien@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <bertrand.marquis@xxxxxxx>, Ayan Kumar Halder <ayankuma@xxxxxxxxxx>
  • Delivery-date: Wed, 26 Jan 2022 16:58:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxx>
---

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.