qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: palmer@dabbelt.com, alistair.francis@wdc.com,
	bin.meng@windriver.com, qemu-riscv@nongnu.org,
	qemu-devel@nongnu.org
Cc: wangjunqiang@iscas.ac.cn, liweiwei <liweiwei@iscas.ac.cn>,
	lazyparser@gmail.com, liweiwei <liweiwei@iscas.ac.cn>
Subject: Re: [RFC PATCH 3/3] target/riscv: add support for svpbmt extension
Date: Tue, 14 Dec 2021 16:01:42 +0100	[thread overview]
Message-ID: <2304988.zUQuKtGZoq@phil> (raw)
In-Reply-To: <20211128135255.22089-4-liweiwei@iscas.ac.cn>

Am Sonntag, 28. November 2021, 14:52:55 CET schrieb liweiwei:
> It uses two PTE bits, but QEMU is sequentially consistent, So it has no effect on QEMU currently.
> 
> Signed-off-by: liweiwei <liweiwei@iscas.ac.cn>
> Signed-off-by: wangjunqiang <wangjunqiang@iscas.ac.cn>

with the Linux svpbmt patchset
Tested-by: Heiko Stuebner <heiko@sntech.de>

Thanks
Heiko

> ---
>  target/riscv/cpu_bits.h   | 4 ++++
>  target/riscv/cpu_helper.c | 9 +++++++--
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h
> index 70391424b0..62713ec37a 100644
> --- a/target/riscv/cpu_bits.h
> +++ b/target/riscv/cpu_bits.h
> @@ -473,7 +473,11 @@ typedef enum {
>  #define PTE_A               0x040 /* Accessed */
>  #define PTE_D               0x080 /* Dirty */
>  #define PTE_SOFT            0x300 /* Reserved for Software */
> +#define PTE_RSVD            0x1FC0000000000000 /* Reserved for future use */
> +#define PTE_PBMT            0x6000000000000000 /* Page-based memory types */
>  #define PTE_N               0x8000000000000000
> +#define PTE_ATTR            0xFFC0000000000000 /* All attributes bits */
> +
>  
>  /* Page table PPN shift amount */
>  #define PTE_PPN_SHIFT       10
> diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
> index e68db3e119..94b01bbf78 100644
> --- a/target/riscv/cpu_helper.c
> +++ b/target/riscv/cpu_helper.c
> @@ -588,13 +588,18 @@ restart:
>              return TRANSLATE_FAIL;
>          }
>  
> -        hwaddr ppn = (pte & ~(target_ulong)PTE_N) >> PTE_PPN_SHIFT;
> +        hwaddr ppn = (pte & ~(target_ulong)PTE_ATTR) >> PTE_PPN_SHIFT;
>  
> -        if (!(pte & PTE_V)) {
> +        if (pte & PTE_RSVD) {
> +            return TRANSLATE_FAIL;
> +        } else if (!(pte & PTE_V)) {
>              /* Invalid PTE */
>              return TRANSLATE_FAIL;
>          } else if (!(pte & (PTE_R | PTE_W | PTE_X))) {
>              /* Inner PTE, continue walking */
> +            if (pte & (PTE_D | PTE_A | PTE_U | PTE_N | PTE_PBMT)) {
> +                return TRANSLATE_FAIL;
> +            }
>              base = ppn << PGSHIFT;
>          } else if ((pte & (PTE_R | PTE_W | PTE_X)) == PTE_W) {
>              /* Reserved leaf PTE flags: PTE_W */
> 






      reply	other threads:[~2021-12-14 15:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-28 13:52 [RFC PATCH 0/3] support subsets of virtual memory extension liweiwei
2021-11-28 13:52 ` [RFC PATCH 1/3] target/riscv: add support for svnapot extension liweiwei
2021-12-14 22:18   ` Alistair Francis
2021-11-28 13:52 ` [RFC PATCH 2/3] target/riscv: add support for svinval extension liweiwei
2021-11-28 13:52 ` [RFC PATCH 3/3] target/riscv: add support for svpbmt extension liweiwei
2021-12-14 15:01   ` Heiko Stuebner [this message]

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=2304988.zUQuKtGZoq@phil \
    --to=heiko@sntech.de \
    --cc=alistair.francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=lazyparser@gmail.com \
    --cc=liweiwei@iscas.ac.cn \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=wangjunqiang@iscas.ac.cn \
    /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;
as well as URLs for NNTP newsgroup(s).