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

[XEN v6 0/3] xen/arm64: io: Decode ldr/str post-indexing instruction


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxxxxx>
  • Date: Wed, 2 Feb 2022 17:30:14 +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=q0l0VgEygkT2jSFeBt8xFaCn5y1Wf34uWHniJq3qmLA=; b=RWUtMhtsO0NFtDhHxxcp1wi0BfL9iu8U2QutfdcupTUGq5XRQrWS1ZGoZQDDW+STnh9yI59Eez4WnOdcQU/O9tSBYpp2ZudK2w+3/yPVWjN/mmmdj+5Uullu2AKdtwfrVTi4bFXpAYz2pyp8/vXXW2EkcJlLnlotBkUqNalMgFqCNRWyXcoIsQFzU6x9h1+VCfixvLl3tMvBQPO2H63iH/XsVsetzDKURPv0ZGvZLR+00vfXSPwGbjvD3jB0l68vryCh/sT+dT92yHm/E+1zre9HNjEprZTjfDOkagSz2IAh1eKeIHGUaot7zMFRu9/aCI2p2EETAtZDja+H2fAT1w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jv0yguxRbqIapmtJ/KoNIJKOIeAe1kAR0e6J5Nm5q6Id2uE/Dj9zAQFSoUn6kPcv1VICczaX4TIGl+8gwnuCKdstUXQVsAB/SezFhlNfk1uBPgztdWXDjmrrEzOjyrs71vGMI/Ft6QHb31fvlJGr3UUN7oYgoS8H3X51KR+4VIUtNPI9f9j4i5XRA5szvXWxNJb2xLnP8h3fcJhq/sqxujlwFWEx0m1auRtHQPpQcuHh1N5yhp9K/n5u6yWiw/h5ZnVV3Hy7QxWxUAKuT6h9P/hlAVXoAkosZ3XxZDIonKjuDS6vs9CVSSIYPff637gJI83Yhj2+Ei2uaMx8NAnVfg==
  • Cc: <sstabellini@xxxxxxxxxx>, <stefanos@xxxxxxxxxx>, <julien@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <bertrand.marquis@xxxxxxx>, Ayan Kumar Halder <ayankuma@xxxxxxxxxx>
  • Delivery-date: Wed, 02 Feb 2022 17:30:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi All,

I have split "[XEN v5] xen/arm64: io: Decode ldr/str post-indexing instructions"
into the following three patches :-

Ayan Kumar Halder (3):
  xen/arm64: Decode ldr/str post increment operations
  xen/arm64: io: Support instructions (for which ISS is not valid) on
    emulated MMIO region using MMIO handler
  xen/arm64: io: Support instructions (for which ISS is not valid) on
    emulated MMIO region using ioreq handler

The third patch introduces quite a bit of complexity. So, I decided to keep
it separate to ease the review and help me to understand better.

I haven't tested the patches. I am sending it out to get a feedback to see
if it is going in the correct direction.

 xen/arch/arm/arm32/traps.c       |  6 +++
 xen/arch/arm/arm64/traps.c       | 45 ++++++++++++++++
 xen/arch/arm/decode.c            | 81 +++++++++++++++++++++++++++-
 xen/arch/arm/decode.h            | 48 ++++++++++++++---
 xen/arch/arm/include/asm/mmio.h  | 17 ++++++
 xen/arch/arm/include/asm/traps.h |  2 +
 xen/arch/arm/io.c                | 92 ++++++++++++++++++++++++--------
 xen/arch/arm/ioreq.c             | 13 +++--
 xen/arch/arm/traps.c             | 56 ++++++++++++++++++-
 xen/include/public/hvm/ioreq.h   | 19 +++----
 10 files changed, 333 insertions(+), 46 deletions(-)

Changelog :-
v2 - 1. Updated the rn register after reading from it. (Pointed by Julien,
        Stefano)
     2. Used a union to represent the instruction opcode (Suggestd by Bertrand)
     3. Fixed coding style issues (Pointed by Julien)
     4. In the previous patch, I was updating dabt->sign based on the signedness
        of imm9. This was incorrect. As mentioned in ARMv8 ARM  DDI 0487G.b,
        Page 3221, SSE indicates the signedness of the data item loaded. In our
        case, the data item loaded is always unsigned.

v3- 1. Handled all the variants of ldr/str (ie 64, 32, 16, 8 bit variants).
       Thus, I have removed the check for "instr->code.opc == 0" (Suggested by
       Andre)
    2. Handled the scenario when rn = SP, rt = XZR (Suggested by Jan, Andre)
    3. Added restriction for "rt != rn" (Suggested by Andre)
    4. Moved union ldr_str_instr_class {} to decode.h. This is the header 
included
       by io.c and decode.c (where the union is referred). (Suggested by Jan)
    5. Indentation and typo fixes (Suggested by Jan)

v4- 1. Fixed the patch as per Stefano's comments on v3. They are as follows :-
        1.1 Use macros to determine the fixed values in the instruction opcode
        1.2 Checked if instr != NULL
        1.3 Changed some data types and added #define ARM_64 for AArch64 
specific
            code
        1.4 Moved post_increment_register() to decode.c so that the decoding
            logic is confined to a single file.
        1.5 Moved some checks from post_increment_register() to
            decode_loadstore_postindexing()
        1.6 Removed a duplicate check
    2. Updated the commit message as per Andre's comments.
    3. Changed the names of a label and some comments. *32bit* was erroneously
       mentioned in a label and comments in decode_loadstore_postindexing()
       although the function handled all variants of ldr/str post indexing.

v5- 1. Renamed decode_loadstore_postindexing() to decode_arm64(). The reason
       being this will be extended in future to support more instructions for
       which hsr_badt.isv = 0
    2. Introduce a function try_decode_instruction_invalid_iss() to determine
       if the instruction needs to be decoded before invoking 
decode_instruction().

       It checks :-
       2.1  dabt->s1ptw - Returns IO_UNHANDLED
       2.2  dabt->cache - Returns IO_IGNORED. (new enum instroduced to let the
            caller know that the instruction needs to be ignored by Xen. Thus
            the caller needs to increment the PC and return to the guest.

    3. Invoked try_decode_instruction_invalid_iss() from the following 2 places 
:-
        3.a - try_handle_mmio() - When we have determined that there is a valid
              mmio handler.
        3.b - try_fwd_ioserv()
        When ioserver completes the io request, the acknowledgement is sent via
        handle_ioserv(). Here, we need to increment the register. As there is no
        common data shared between try_fwd_ioserv() and handle_ioserv(), we need
        to decode the instruction again in handle_ioserv() to determine rn, 
imm9.

        (NOTE to Reviewers) - This does not feel correct. However, I could not
        think of a better approach. Please provide your inputs.

    4. Augumented struct hsr_dabt{} with struct hsr_dabt_instr_details{} to hold
       rn and imm9. This is passed to post_increment_register() to update rn.
    5. Other style changes as suggested in v4.

v6 - 1. Split the patch into three parts.
-- 
2.17.1




 


Rackspace

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