public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: Ruinland ChuanTzu Tsai <ruinland@andestech.com>
To: <linux-riscv@lists.infradead.org>
Cc: <alankao@andestech.com>, <ruinland@andestech.com>
Subject: Re: [RFC patch 4/4] riscv: sifive: apply errata "cip-453" patch
Date: Thu, 11 Mar 2021 03:02:34 +0800	[thread overview]
Message-ID: <20210310190234.GB25175@APC301.andestech.com> (raw)

Hi Vincent,

Thanks for introducing the alternative mechanism to RISC-V, with which
vendors could provide fixes for each erratum in a more elegant way.

Somehow, I'm a bit sketchy about these parts of your proposal :

>     /* Exception vector table */
>  ENTRY(excp_vect_table)
>     RISCV_PTR do_trap_insn_misaligned
> -   RISCV_PTR do_trap_insn_fault
> +   ALTERNATIVE(__stringify(RISCV_PTR do_trap_insn_fault),
> +           __stringify(RISCV_PTR do_trap_insn_fault_trampoline),
> +           SIFIVE_VENDOR_ID, ERRATA_CIP_453, CONFIG_ERRATA_SIFIVE_CIP_453)
>     RISCV_PTR do_trap_insn_illegal
>     RISCV_PTR do_trap_break
>     RISCV_PTR do_trap_load_misaligned
> @@ -461,7 +466,10 @@ ENTRY(excp_vect_table)
>     RISCV_PTR do_trap_ecall_s
>     RISCV_PTR do_trap_unknown
>     RISCV_PTR do_trap_ecall_m
> -   RISCV_PTR do_page_fault   /* instruction page fault */
> +   /* instruciton page fault */
> +   ALTERNATIVE(__stringify(RISCV_PTR do_page_fault),
> +           __stringify(RISCV_PTR do_page_fault_trampoline),
> +           SIFIVE_VENDOR_ID, ERRATA_CIP_453, CONFIG_ERRATA_SIFIVE_CIP_453)
>     RISCV_PTR do_page_fault   /* load page fault */

As far as I can tell, `ALTERNATIVE(...)` seems a bit like a mixture of
ARM's version of ALTERNATIVE and `alternative_insn`. However, ARM's
ALTERNATIVE takes a vardatic macro and yours here doesn't, which makes
me wonder if another vendor needs to patch the same location as yours,
will they be able to multiplex the same probe ?


Secondly, I think it's a bit intrusive to patch directly on exception
vector table here.

I'm not sure about whether it's possible to introduce your alternative
probe inside do_trap_insn_fault() & do_page_fault(), do the inspection
the reason of trap (e.g. instruction/load/store page fault) there and
then, perform the software workaround.

If that's not feasible, maybe we shall make a new macro with a name
like "RISCV_TRAP_ENTRY" which encompass the alternative probes ?

Last but not least, is it possible that in the near future,
`alternative_if` macro family from ARM could be ported to RISC-V ?

Best regards,
Ruinland

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

             reply	other threads:[~2021-03-10 21:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 19:02 Ruinland ChuanTzu Tsai [this message]
2021-03-12  7:45 ` [RFC patch 4/4] riscv: sifive: apply errata "cip-453" patch Vincent Chen
  -- strict thread matches above, loose matches on Subject: below --
2021-03-08  3:58 [RFC patch 0/4] riscv: introduce alternative mechanism to apply errata patches Vincent Chen
2021-03-08  3:58 ` [RFC patch 4/4] riscv: sifive: apply errata "cip-453" patch Vincent Chen
2021-03-10  4:39   ` Palmer Dabbelt
2021-03-12  3:50     ` Vincent Chen

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=20210310190234.GB25175@APC301.andestech.com \
    --to=ruinland@andestech.com \
    --cc=1615175897-23509-5-git-send-email-vincent.chen@sifive.com \
    --cc=alankao@andestech.com \
    --cc=linux-riscv@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox