All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: Bin Meng <bmeng.cn@gmail.com>
Cc: "open list:RISC-V" <qemu-riscv@nongnu.org>,
	Bin Meng <bin.meng@windriver.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	LIU Zhiwei <zhiwei_liu@c-sky.com>
Subject: Re: [PATCH] target/riscv: Fix satp write
Date: Thu, 2 Sep 2021 12:49:19 +1000	[thread overview]
Message-ID: <CAKmqyKPy4kDOWAcGHF9At1h__KEahGU8ysRHBBw=69OigQmadg@mail.gmail.com> (raw)
In-Reply-To: <CAEUhbmXULr_mcdfh6x=BGLNcNM5Q7YrFhnHOuLatbrokqP0Taw@mail.gmail.com>

On Thu, Sep 2, 2021 at 11:59 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Thu, Sep 2, 2021 at 9:02 AM LIU Zhiwei <zhiwei_liu@c-sky.com> wrote:
> >
> >
> > On 2021/9/1 下午9:05, Bin Meng wrote:
> > > On Wed, Sep 1, 2021 at 8:51 PM LIU Zhiwei <zhiwei_liu@c-sky.com> wrote:
> > >> These variables should be target_ulong. If truncated to int,
> > >> the bool conditions they indicate will be wrong.
> > >>
> > >> As satp is very important for Linux, this bug almost fails every boot.
> > > Could you please describe which Linux configuration is broken?
> >
> > I use the image from:
> >
> > https://gitlab.com/c-sky/buildroot/-/jobs/1251564514/artifacts/browse/output/images/
> >
> > >   I have
> > > a 64-bit 5.10 kernel and it boots fine.
> >
> > The login is mostly OK for me. But the busybox can't run properly.
>
> Which kernel version is this? Could you please investigate and
> indicate in the commit message?
>
> I just tested current qemu-system-riscv64 can boot to Ubuntu 20.04
> distro user space.

I also have never seen any issues.

Looking at this `vm` is set from a `static const char
valid_vm_1_10_64` so an int is fine.

It probably is a good idea for `mask` and `asid` to be target_ulong as
they are set by bit operations on target_ulong's. I guess if your host
int is 32-bits SATP64_ASID will overflow that.

Anyway with 128-bit RISC-V and maybe the ability to run 64-bit guests
no 32-bit hosts this seems like a good step

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

>
> Regards,
> Bin
>


WARNING: multiple messages have this Message-ID (diff)
From: Alistair Francis <alistair23@gmail.com>
To: Bin Meng <bmeng.cn@gmail.com>
Cc: LIU Zhiwei <zhiwei_liu@c-sky.com>,
	"open list:RISC-V" <qemu-riscv@nongnu.org>,
	 Bin Meng <bin.meng@windriver.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	 "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Alistair Francis <Alistair.Francis@wdc.com>
Subject: Re: [PATCH] target/riscv: Fix satp write
Date: Thu, 2 Sep 2021 12:49:19 +1000	[thread overview]
Message-ID: <CAKmqyKPy4kDOWAcGHF9At1h__KEahGU8ysRHBBw=69OigQmadg@mail.gmail.com> (raw)
In-Reply-To: <CAEUhbmXULr_mcdfh6x=BGLNcNM5Q7YrFhnHOuLatbrokqP0Taw@mail.gmail.com>

On Thu, Sep 2, 2021 at 11:59 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Thu, Sep 2, 2021 at 9:02 AM LIU Zhiwei <zhiwei_liu@c-sky.com> wrote:
> >
> >
> > On 2021/9/1 下午9:05, Bin Meng wrote:
> > > On Wed, Sep 1, 2021 at 8:51 PM LIU Zhiwei <zhiwei_liu@c-sky.com> wrote:
> > >> These variables should be target_ulong. If truncated to int,
> > >> the bool conditions they indicate will be wrong.
> > >>
> > >> As satp is very important for Linux, this bug almost fails every boot.
> > > Could you please describe which Linux configuration is broken?
> >
> > I use the image from:
> >
> > https://gitlab.com/c-sky/buildroot/-/jobs/1251564514/artifacts/browse/output/images/
> >
> > >   I have
> > > a 64-bit 5.10 kernel and it boots fine.
> >
> > The login is mostly OK for me. But the busybox can't run properly.
>
> Which kernel version is this? Could you please investigate and
> indicate in the commit message?
>
> I just tested current qemu-system-riscv64 can boot to Ubuntu 20.04
> distro user space.

I also have never seen any issues.

Looking at this `vm` is set from a `static const char
valid_vm_1_10_64` so an int is fine.

It probably is a good idea for `mask` and `asid` to be target_ulong as
they are set by bit operations on target_ulong's. I guess if your host
int is 32-bits SATP64_ASID will overflow that.

Anyway with 128-bit RISC-V and maybe the ability to run 64-bit guests
no 32-bit hosts this seems like a good step

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

>
> Regards,
> Bin
>


  parent reply	other threads:[~2021-09-02  2:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 12:45 [PATCH] target/riscv: Fix satp write LIU Zhiwei
2021-09-01 12:45 ` LIU Zhiwei
2021-09-01 13:05 ` Bin Meng
2021-09-01 13:05   ` Bin Meng
2021-09-02  1:02   ` LIU Zhiwei
2021-09-02  1:02     ` LIU Zhiwei
2021-09-02  1:59     ` Bin Meng
2021-09-02  1:59       ` Bin Meng
2021-09-02  2:44       ` LIU Zhiwei
2021-09-02  2:44         ` LIU Zhiwei
2021-09-02  2:47         ` Bin Meng
2021-09-02  2:47           ` Bin Meng
2021-09-06  3:23           ` LIU Zhiwei
2021-09-06  3:23             ` LIU Zhiwei
2021-09-06  3:26             ` Bin Meng
2021-09-06  3:26               ` Bin Meng
2021-09-06  5:31               ` LIU Zhiwei
2021-09-06  5:31                 ` LIU Zhiwei
2021-09-02  2:49       ` Alistair Francis [this message]
2021-09-02  2:49         ` Alistair Francis
2021-09-06  5:29 ` Alistair Francis
2021-09-06  5:29   ` Alistair Francis

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='CAKmqyKPy4kDOWAcGHF9At1h__KEahGU8ysRHBBw=69OigQmadg@mail.gmail.com' \
    --to=alistair23@gmail.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=bmeng.cn@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=zhiwei_liu@c-sky.com \
    /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.