All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ayan Kumar Halder <ayan.kumar.halder@xilinx.com>
To: Julien Grall <julien@xen.org>,
	Ayan Kumar Halder <ayan.kumar.halder@xilinx.com>,
	<xen-devel@lists.xenproject.org>
Cc: <sstabellini@kernel.org>, <stefanos@xilinx.com>,
	<Volodymyr_Babchuk@epam.com>, <bertrand.marquis@arm.com>
Subject: Re: [XEN v8 2/2] xen/arm64: io: Support instructions (for which ISS is not valid) on emulated MMIO region using MMIO/ioreq handler
Date: Mon, 21 Feb 2022 21:10:58 +0000	[thread overview]
Message-ID: <8c45a34c-9e54-1a9b-d894-f05f41412657@xilinx.com> (raw)
In-Reply-To: <96610d30-0de2-96e9-e838-504acf83a8d8@xen.org>

Hi Julien,

On 21/02/2022 19:13, Julien Grall wrote:
>
>
> On 21/02/2022 19:05, Ayan Kumar Halder wrote:
>> If we (ie Xen) didn't decode the instruction manually, then 
>> check_p2m() has not been invoked yet.  This is because of the 
>> following (info.dabt.valid == True) :-
>>
>>          if ( !is_data || !info.dabt.valid )
>>          {
>>
>>                  ...
>>
>>                  if ( check_p2m(is_data, gpa) )
>>                      return;
>>
>>                  ...
>>
>>          }
>>
>> So, in this scenario ( !info.dabt.valid), it would not be necessary 
>> to invoke check_p2m() after try_handle_mmio().
>>
>> However, if we havenot decoded the instruction manually (ie 
>> info.dabt.valid == True), and try_handle_mmio() returns IO_UNHANDLED, 
>> then it will be necessary to invoke "check_p2m(is_data, gpa)"
>
> Hmmm you are right. But this doesn't seem to match the code you wrote 
> below. What did I miss?

My code was not correct.  I have rectified it as below. Please let me 
know if it looks sane.

<snip>

     case FSC_FLT_TRANS:
     {
         info.gpa = gpa;
         info.dabt = hsr.dabt;

         /*
          * Assumption :- Most of the times when we get a data abort and 
the ISS
          * is invalid or an instruction abort, the underlying cause is 
that the
          * page tables have not been set up correctly.
          */
         if ( !is_data || !info.dabt.valid )
         {
             if ( check_p2m(is_data, gpa) )
                 return;

             /*
              * If the instruction abort could not be resolved by 
setting the
              * appropriate bits in the translation table, then Xen should
              * forward the abort to the guest.
              */
             if ( !is_data )
                 goto inject_abt;

             try_decode_instruction(regs, &info);

             /*
              * If Xen could not decode the instruction or encountered 
an error
              * while decoding, then it should forward the abort to the 
guest.
              */
             if ( info.dabt_instr.state == INSTR_ERROR )
                 goto inject_abt;
         }

         state = try_handle_mmio(regs, &info);

         switch ( state )
         {
             case IO_ABORT:
                 goto inject_abt;
             case IO_HANDLED:
                 /*
                  * If the instruction was decoded and has executed 
successfully
                  * on the MMIO region, then Xen should execute the next 
part of
                  * the instruction. (for eg increment the rn if it is a
                  * post-indexing instruction.
                  */
                 post_increment_register(&info.dabt_instr);
                 advance_pc(regs, hsr);
                 return;
             case IO_RETRY:
                 /* finish later */
                 return;
             case IO_UNHANDLED:
                 /* IO unhandled, try another way to handle it. */
                 break;
         }

         /*
          * If the instruction was valid but Xen could not emulate the 
instruction
          * then it should configure the page tables to set the correct 
page table
          * entry corresponding to the faulting address. If it was 
successful, it
          * should return to the guest to retry the instruction (hoping 
that the
          * instruction will not be trapped to Xen again).
          * However, if Xen was not successful in setting the page 
tables, then
          * it should forward the abort to the guest.
          */
         if ( info.dabt.valid && check_p2m(is_data, gpa) )
             return;

         break;
     }
     default:

<snip>

- Ayan

>
> Cheers,
>


  reply	other threads:[~2022-02-21 21:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-12 23:34 [XEN v8 0/2] xen/arm64: io: Decode ldr/str post-indexing instruction Ayan Kumar Halder
2022-02-12 23:34 ` [XEN v8 1/2] xen/arm64: Decode ldr/str post increment operations Ayan Kumar Halder
2022-02-12 23:34 ` [XEN v8 2/2] xen/arm64: io: Support instructions (for which ISS is not valid) on emulated MMIO region using MMIO/ioreq handler Ayan Kumar Halder
2022-02-13 12:19   ` Julien Grall
2022-02-21 17:05     ` Ayan Kumar Halder
2022-02-21 17:57       ` Julien Grall
2022-02-21 19:05         ` Ayan Kumar Halder
2022-02-21 19:13           ` Julien Grall
2022-02-21 21:10             ` Ayan Kumar Halder [this message]
2022-02-23 19:19               ` 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=8c45a34c-9e54-1a9b-d894-f05f41412657@xilinx.com \
    --to=ayan.kumar.halder@xilinx.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=stefanos@xilinx.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 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.