Re: [PATCH] riscv: sifive_test: Allow 16-bit writes to memory region

2020-09-14 Thread Michael Roth
Quoting Alistair Francis (2020-09-14 11:07:26)
> On Fri, Sep 11, 2020 at 5:26 AM Michael Roth  
> wrote:
> >
> > Quoting Alistair Francis (2020-09-10 13:10:43)
> > > On Thu, Sep 3, 2020 at 2:05 PM Michael Roth  
> > > wrote:
> > > >
> > > > Quoting Alistair Francis (2020-09-01 18:59:29)
> > > > > On Mon, Aug 31, 2020 at 10:59 PM Nathan Chancellor
> > > > >  wrote:
> > > > > >
> > > > > > When shutting down the machine running a mainline Linux kernel, the
> > > > > > following error happens:
> > > > > >
> > > > > > $ build/riscv64-softmmu/qemu-system-riscv64 -bios default -M virt \
> > > > > > -display none -initrd rootfs.cpio -kernel Image -m 512m \
> > > > > > -nodefaults -serial mon:stdio
> > > > > > ...
> > > > > > Requesting system poweroff
> > > > > > [4.999630] reboot: Power down
> > > > > > sbi_trap_error: hart0: trap handler failed (error -2)
> > > > > > sbi_trap_error: hart0: mcause=0x0007 
> > > > > > mtval=0x0010
> > > > > > sbi_trap_error: hart0: mepc=0x8000d4cc 
> > > > > > mstatus=0x1822
> > > > > > sbi_trap_error: hart0: ra=0x8000999e sp=0x80015c78
> > > > > > sbi_trap_error: hart0: gp=0xffe000e76610 tp=0xffe0081b89c0
> > > > > > sbi_trap_error: hart0: s0=0x80015c88 s1=0x0040
> > > > > > sbi_trap_error: hart0: a0=0x a1=0x80004024
> > > > > > sbi_trap_error: hart0: a2=0x80004024 a3=0x80004024
> > > > > > sbi_trap_error: hart0: a4=0x0010 a5=0x
> > > > > > sbi_trap_error: hart0: a6=0x4024 a7=0x80011158
> > > > > > sbi_trap_error: hart0: s2=0x s3=0x80016000
> > > > > > sbi_trap_error: hart0: s4=0x s5=0x
> > > > > > sbi_trap_error: hart0: s6=0x0001 s7=0x
> > > > > > sbi_trap_error: hart0: s8=0x s9=0x
> > > > > > sbi_trap_error: hart0: s10=0x s11=0x0008
> > > > > > sbi_trap_error: hart0: t0=0x t1=0x
> > > > > > sbi_trap_error: hart0: t2=0x t3=0x
> > > > > > sbi_trap_error: hart0: t4=0x t5=0x
> > > > > > sbi_trap_error: hart0: t6=0x
> > > > > >
> > > > > > The kernel does a 16-bit write when powering off the machine, which
> > > > > > was allowed before commit 5d971f9e67 ("memory: Revert "memory: 
> > > > > > accept
> > > > > > mismatching sizes in memory_region_access_valid""). Make 
> > > > > > min_access_size
> > > > > > match reality so that the machine can shut down properly now.
> > > > > >
> > > > > > Cc: qemu-sta...@nongnu.org
> > > > > > Fixes: 88a07990fa ("SiFive RISC-V Test Finisher")
> > > > > > Fixes: 5d971f9e67 ("memory: Revert "memory: accept mismatching 
> > > > > > sizes in memory_region_access_valid"")
> > > > > > Signed-off-by: Nathan Chancellor 
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Applied to riscv-to-apply.next
> > > >
> > > > FYI, I'm hoping to pull this patch into the upcoming 5.0.1 stable
> > > > release. The freeze is scheduled for 2020-09-20, I will apply this if it
> > > > hits master before then.
> > >
> > > I just sent a PR with this patch. Is this still on track to make it into 
> > > 5.0.1?
> >
> > Since it's not likely to invalidate any testing on my end outside of the
> > ones built into QEMU I can probably still slip it in if it hits master
> > by Monday, or maybe just grab it from your tree.
> 
> This is in master now, I hope that's enough time to make it in.

Yes I pulled it in yesterday:

  https://github.com/mdroth/qemu/commits/stable-5.0-staging

> 
> Let me know if you want me to do anything else.

Thanks!

> 
> Alistair
> 
> >
> > >
> > > Alistair
> > >
> > > >
> > > > >
> > > > > Alistair
> > > > >
> > > > > > ---
> > > > > >
> > > > > > Please let me know if the tags are wrong or inappropriate, this is 
> > > > > > my
> > > > > > first QEMU patch.
> > > > > >
> > > > > >  hw/riscv/sifive_test.c | 2 +-
> > > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
> > > > > > index 0c78fb2c93..8c70dd69df 100644
> > > > > > --- a/hw/riscv/sifive_test.c
> > > > > > +++ b/hw/riscv/sifive_test.c
> > > > > > @@ -59,7 +59,7 @@ static const MemoryRegionOps sifive_test_ops = {
> > > > > >  .write = sifive_test_write,
> > > > > >  .endianness = DEVICE_NATIVE_ENDIAN,
> > > > > >  .valid = {
> > > > > > -.min_access_size = 4,
> > > > > > +.min_access_size = 2,
> > > > > >  .max_access_size = 4
> > > > > >  }
> > > > > >  };
> > > > > >
> > > > > > base-commit: 2f4c51c0f384d7888a04b4815861e6d5fd244d75
> > > > > > --
> > > > > > 2.28.0
> > > > > >
> > > > > >
> > > > >



Re: [PATCH] riscv: sifive_test: Allow 16-bit writes to memory region

2020-09-14 Thread Alistair Francis
On Fri, Sep 11, 2020 at 5:26 AM Michael Roth  wrote:
>
> Quoting Alistair Francis (2020-09-10 13:10:43)
> > On Thu, Sep 3, 2020 at 2:05 PM Michael Roth  
> > wrote:
> > >
> > > Quoting Alistair Francis (2020-09-01 18:59:29)
> > > > On Mon, Aug 31, 2020 at 10:59 PM Nathan Chancellor
> > > >  wrote:
> > > > >
> > > > > When shutting down the machine running a mainline Linux kernel, the
> > > > > following error happens:
> > > > >
> > > > > $ build/riscv64-softmmu/qemu-system-riscv64 -bios default -M virt \
> > > > > -display none -initrd rootfs.cpio -kernel Image -m 512m \
> > > > > -nodefaults -serial mon:stdio
> > > > > ...
> > > > > Requesting system poweroff
> > > > > [4.999630] reboot: Power down
> > > > > sbi_trap_error: hart0: trap handler failed (error -2)
> > > > > sbi_trap_error: hart0: mcause=0x0007 
> > > > > mtval=0x0010
> > > > > sbi_trap_error: hart0: mepc=0x8000d4cc 
> > > > > mstatus=0x1822
> > > > > sbi_trap_error: hart0: ra=0x8000999e sp=0x80015c78
> > > > > sbi_trap_error: hart0: gp=0xffe000e76610 tp=0xffe0081b89c0
> > > > > sbi_trap_error: hart0: s0=0x80015c88 s1=0x0040
> > > > > sbi_trap_error: hart0: a0=0x a1=0x80004024
> > > > > sbi_trap_error: hart0: a2=0x80004024 a3=0x80004024
> > > > > sbi_trap_error: hart0: a4=0x0010 a5=0x
> > > > > sbi_trap_error: hart0: a6=0x4024 a7=0x80011158
> > > > > sbi_trap_error: hart0: s2=0x s3=0x80016000
> > > > > sbi_trap_error: hart0: s4=0x s5=0x
> > > > > sbi_trap_error: hart0: s6=0x0001 s7=0x
> > > > > sbi_trap_error: hart0: s8=0x s9=0x
> > > > > sbi_trap_error: hart0: s10=0x s11=0x0008
> > > > > sbi_trap_error: hart0: t0=0x t1=0x
> > > > > sbi_trap_error: hart0: t2=0x t3=0x
> > > > > sbi_trap_error: hart0: t4=0x t5=0x
> > > > > sbi_trap_error: hart0: t6=0x
> > > > >
> > > > > The kernel does a 16-bit write when powering off the machine, which
> > > > > was allowed before commit 5d971f9e67 ("memory: Revert "memory: accept
> > > > > mismatching sizes in memory_region_access_valid""). Make 
> > > > > min_access_size
> > > > > match reality so that the machine can shut down properly now.
> > > > >
> > > > > Cc: qemu-sta...@nongnu.org
> > > > > Fixes: 88a07990fa ("SiFive RISC-V Test Finisher")
> > > > > Fixes: 5d971f9e67 ("memory: Revert "memory: accept mismatching sizes 
> > > > > in memory_region_access_valid"")
> > > > > Signed-off-by: Nathan Chancellor 
> > > >
> > > > Thanks!
> > > >
> > > > Applied to riscv-to-apply.next
> > >
> > > FYI, I'm hoping to pull this patch into the upcoming 5.0.1 stable
> > > release. The freeze is scheduled for 2020-09-20, I will apply this if it
> > > hits master before then.
> >
> > I just sent a PR with this patch. Is this still on track to make it into 
> > 5.0.1?
>
> Since it's not likely to invalidate any testing on my end outside of the
> ones built into QEMU I can probably still slip it in if it hits master
> by Monday, or maybe just grab it from your tree.

This is in master now, I hope that's enough time to make it in.

Let me know if you want me to do anything else.

Alistair

>
> >
> > Alistair
> >
> > >
> > > >
> > > > Alistair
> > > >
> > > > > ---
> > > > >
> > > > > Please let me know if the tags are wrong or inappropriate, this is my
> > > > > first QEMU patch.
> > > > >
> > > > >  hw/riscv/sifive_test.c | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
> > > > > index 0c78fb2c93..8c70dd69df 100644
> > > > > --- a/hw/riscv/sifive_test.c
> > > > > +++ b/hw/riscv/sifive_test.c
> > > > > @@ -59,7 +59,7 @@ static const MemoryRegionOps sifive_test_ops = {
> > > > >  .write = sifive_test_write,
> > > > >  .endianness = DEVICE_NATIVE_ENDIAN,
> > > > >  .valid = {
> > > > > -.min_access_size = 4,
> > > > > +.min_access_size = 2,
> > > > >  .max_access_size = 4
> > > > >  }
> > > > >  };
> > > > >
> > > > > base-commit: 2f4c51c0f384d7888a04b4815861e6d5fd244d75
> > > > > --
> > > > > 2.28.0
> > > > >
> > > > >
> > > >



Re: [PATCH] riscv: sifive_test: Allow 16-bit writes to memory region

2020-09-11 Thread Michael Roth
Quoting Alistair Francis (2020-09-10 13:10:43)
> On Thu, Sep 3, 2020 at 2:05 PM Michael Roth  wrote:
> >
> > Quoting Alistair Francis (2020-09-01 18:59:29)
> > > On Mon, Aug 31, 2020 at 10:59 PM Nathan Chancellor
> > >  wrote:
> > > >
> > > > When shutting down the machine running a mainline Linux kernel, the
> > > > following error happens:
> > > >
> > > > $ build/riscv64-softmmu/qemu-system-riscv64 -bios default -M virt \
> > > > -display none -initrd rootfs.cpio -kernel Image -m 512m \
> > > > -nodefaults -serial mon:stdio
> > > > ...
> > > > Requesting system poweroff
> > > > [4.999630] reboot: Power down
> > > > sbi_trap_error: hart0: trap handler failed (error -2)
> > > > sbi_trap_error: hart0: mcause=0x0007 
> > > > mtval=0x0010
> > > > sbi_trap_error: hart0: mepc=0x8000d4cc 
> > > > mstatus=0x1822
> > > > sbi_trap_error: hart0: ra=0x8000999e sp=0x80015c78
> > > > sbi_trap_error: hart0: gp=0xffe000e76610 tp=0xffe0081b89c0
> > > > sbi_trap_error: hart0: s0=0x80015c88 s1=0x0040
> > > > sbi_trap_error: hart0: a0=0x a1=0x80004024
> > > > sbi_trap_error: hart0: a2=0x80004024 a3=0x80004024
> > > > sbi_trap_error: hart0: a4=0x0010 a5=0x
> > > > sbi_trap_error: hart0: a6=0x4024 a7=0x80011158
> > > > sbi_trap_error: hart0: s2=0x s3=0x80016000
> > > > sbi_trap_error: hart0: s4=0x s5=0x
> > > > sbi_trap_error: hart0: s6=0x0001 s7=0x
> > > > sbi_trap_error: hart0: s8=0x s9=0x
> > > > sbi_trap_error: hart0: s10=0x s11=0x0008
> > > > sbi_trap_error: hart0: t0=0x t1=0x
> > > > sbi_trap_error: hart0: t2=0x t3=0x
> > > > sbi_trap_error: hart0: t4=0x t5=0x
> > > > sbi_trap_error: hart0: t6=0x
> > > >
> > > > The kernel does a 16-bit write when powering off the machine, which
> > > > was allowed before commit 5d971f9e67 ("memory: Revert "memory: accept
> > > > mismatching sizes in memory_region_access_valid""). Make min_access_size
> > > > match reality so that the machine can shut down properly now.
> > > >
> > > > Cc: qemu-sta...@nongnu.org
> > > > Fixes: 88a07990fa ("SiFive RISC-V Test Finisher")
> > > > Fixes: 5d971f9e67 ("memory: Revert "memory: accept mismatching sizes in 
> > > > memory_region_access_valid"")
> > > > Signed-off-by: Nathan Chancellor 
> > >
> > > Thanks!
> > >
> > > Applied to riscv-to-apply.next
> >
> > FYI, I'm hoping to pull this patch into the upcoming 5.0.1 stable
> > release. The freeze is scheduled for 2020-09-20, I will apply this if it
> > hits master before then.
> 
> I just sent a PR with this patch. Is this still on track to make it into 
> 5.0.1?

Since it's not likely to invalidate any testing on my end outside of the
ones built into QEMU I can probably still slip it in if it hits master
by Monday, or maybe just grab it from your tree.

> 
> Alistair
> 
> >
> > >
> > > Alistair
> > >
> > > > ---
> > > >
> > > > Please let me know if the tags are wrong or inappropriate, this is my
> > > > first QEMU patch.
> > > >
> > > >  hw/riscv/sifive_test.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
> > > > index 0c78fb2c93..8c70dd69df 100644
> > > > --- a/hw/riscv/sifive_test.c
> > > > +++ b/hw/riscv/sifive_test.c
> > > > @@ -59,7 +59,7 @@ static const MemoryRegionOps sifive_test_ops = {
> > > >  .write = sifive_test_write,
> > > >  .endianness = DEVICE_NATIVE_ENDIAN,
> > > >  .valid = {
> > > > -.min_access_size = 4,
> > > > +.min_access_size = 2,
> > > >  .max_access_size = 4
> > > >  }
> > > >  };
> > > >
> > > > base-commit: 2f4c51c0f384d7888a04b4815861e6d5fd244d75
> > > > --
> > > > 2.28.0
> > > >
> > > >
> > >



Re: [PATCH] riscv: sifive_test: Allow 16-bit writes to memory region

2020-09-10 Thread Alistair Francis
On Thu, Sep 3, 2020 at 2:05 PM Michael Roth  wrote:
>
> Quoting Alistair Francis (2020-09-01 18:59:29)
> > On Mon, Aug 31, 2020 at 10:59 PM Nathan Chancellor
> >  wrote:
> > >
> > > When shutting down the machine running a mainline Linux kernel, the
> > > following error happens:
> > >
> > > $ build/riscv64-softmmu/qemu-system-riscv64 -bios default -M virt \
> > > -display none -initrd rootfs.cpio -kernel Image -m 512m \
> > > -nodefaults -serial mon:stdio
> > > ...
> > > Requesting system poweroff
> > > [4.999630] reboot: Power down
> > > sbi_trap_error: hart0: trap handler failed (error -2)
> > > sbi_trap_error: hart0: mcause=0x0007 mtval=0x0010
> > > sbi_trap_error: hart0: mepc=0x8000d4cc mstatus=0x1822
> > > sbi_trap_error: hart0: ra=0x8000999e sp=0x80015c78
> > > sbi_trap_error: hart0: gp=0xffe000e76610 tp=0xffe0081b89c0
> > > sbi_trap_error: hart0: s0=0x80015c88 s1=0x0040
> > > sbi_trap_error: hart0: a0=0x a1=0x80004024
> > > sbi_trap_error: hart0: a2=0x80004024 a3=0x80004024
> > > sbi_trap_error: hart0: a4=0x0010 a5=0x
> > > sbi_trap_error: hart0: a6=0x4024 a7=0x80011158
> > > sbi_trap_error: hart0: s2=0x s3=0x80016000
> > > sbi_trap_error: hart0: s4=0x s5=0x
> > > sbi_trap_error: hart0: s6=0x0001 s7=0x
> > > sbi_trap_error: hart0: s8=0x s9=0x
> > > sbi_trap_error: hart0: s10=0x s11=0x0008
> > > sbi_trap_error: hart0: t0=0x t1=0x
> > > sbi_trap_error: hart0: t2=0x t3=0x
> > > sbi_trap_error: hart0: t4=0x t5=0x
> > > sbi_trap_error: hart0: t6=0x
> > >
> > > The kernel does a 16-bit write when powering off the machine, which
> > > was allowed before commit 5d971f9e67 ("memory: Revert "memory: accept
> > > mismatching sizes in memory_region_access_valid""). Make min_access_size
> > > match reality so that the machine can shut down properly now.
> > >
> > > Cc: qemu-sta...@nongnu.org
> > > Fixes: 88a07990fa ("SiFive RISC-V Test Finisher")
> > > Fixes: 5d971f9e67 ("memory: Revert "memory: accept mismatching sizes in 
> > > memory_region_access_valid"")
> > > Signed-off-by: Nathan Chancellor 
> >
> > Thanks!
> >
> > Applied to riscv-to-apply.next
>
> FYI, I'm hoping to pull this patch into the upcoming 5.0.1 stable
> release. The freeze is scheduled for 2020-09-20, I will apply this if it
> hits master before then.

I just sent a PR with this patch. Is this still on track to make it into 5.0.1?

Alistair

>
> >
> > Alistair
> >
> > > ---
> > >
> > > Please let me know if the tags are wrong or inappropriate, this is my
> > > first QEMU patch.
> > >
> > >  hw/riscv/sifive_test.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
> > > index 0c78fb2c93..8c70dd69df 100644
> > > --- a/hw/riscv/sifive_test.c
> > > +++ b/hw/riscv/sifive_test.c
> > > @@ -59,7 +59,7 @@ static const MemoryRegionOps sifive_test_ops = {
> > >  .write = sifive_test_write,
> > >  .endianness = DEVICE_NATIVE_ENDIAN,
> > >  .valid = {
> > > -.min_access_size = 4,
> > > +.min_access_size = 2,
> > >  .max_access_size = 4
> > >  }
> > >  };
> > >
> > > base-commit: 2f4c51c0f384d7888a04b4815861e6d5fd244d75
> > > --
> > > 2.28.0
> > >
> > >
> >



Re: [PATCH] riscv: sifive_test: Allow 16-bit writes to memory region

2020-09-03 Thread Michael Roth
Quoting Alistair Francis (2020-09-01 18:59:29)
> On Mon, Aug 31, 2020 at 10:59 PM Nathan Chancellor
>  wrote:
> >
> > When shutting down the machine running a mainline Linux kernel, the
> > following error happens:
> >
> > $ build/riscv64-softmmu/qemu-system-riscv64 -bios default -M virt \
> > -display none -initrd rootfs.cpio -kernel Image -m 512m \
> > -nodefaults -serial mon:stdio
> > ...
> > Requesting system poweroff
> > [4.999630] reboot: Power down
> > sbi_trap_error: hart0: trap handler failed (error -2)
> > sbi_trap_error: hart0: mcause=0x0007 mtval=0x0010
> > sbi_trap_error: hart0: mepc=0x8000d4cc mstatus=0x1822
> > sbi_trap_error: hart0: ra=0x8000999e sp=0x80015c78
> > sbi_trap_error: hart0: gp=0xffe000e76610 tp=0xffe0081b89c0
> > sbi_trap_error: hart0: s0=0x80015c88 s1=0x0040
> > sbi_trap_error: hart0: a0=0x a1=0x80004024
> > sbi_trap_error: hart0: a2=0x80004024 a3=0x80004024
> > sbi_trap_error: hart0: a4=0x0010 a5=0x
> > sbi_trap_error: hart0: a6=0x4024 a7=0x80011158
> > sbi_trap_error: hart0: s2=0x s3=0x80016000
> > sbi_trap_error: hart0: s4=0x s5=0x
> > sbi_trap_error: hart0: s6=0x0001 s7=0x
> > sbi_trap_error: hart0: s8=0x s9=0x
> > sbi_trap_error: hart0: s10=0x s11=0x0008
> > sbi_trap_error: hart0: t0=0x t1=0x
> > sbi_trap_error: hart0: t2=0x t3=0x
> > sbi_trap_error: hart0: t4=0x t5=0x
> > sbi_trap_error: hart0: t6=0x
> >
> > The kernel does a 16-bit write when powering off the machine, which
> > was allowed before commit 5d971f9e67 ("memory: Revert "memory: accept
> > mismatching sizes in memory_region_access_valid""). Make min_access_size
> > match reality so that the machine can shut down properly now.
> >
> > Cc: qemu-sta...@nongnu.org
> > Fixes: 88a07990fa ("SiFive RISC-V Test Finisher")
> > Fixes: 5d971f9e67 ("memory: Revert "memory: accept mismatching sizes in 
> > memory_region_access_valid"")
> > Signed-off-by: Nathan Chancellor 
> 
> Thanks!
> 
> Applied to riscv-to-apply.next

FYI, I'm hoping to pull this patch into the upcoming 5.0.1 stable
release. The freeze is scheduled for 2020-09-20, I will apply this if it
hits master before then.

> 
> Alistair
> 
> > ---
> >
> > Please let me know if the tags are wrong or inappropriate, this is my
> > first QEMU patch.
> >
> >  hw/riscv/sifive_test.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
> > index 0c78fb2c93..8c70dd69df 100644
> > --- a/hw/riscv/sifive_test.c
> > +++ b/hw/riscv/sifive_test.c
> > @@ -59,7 +59,7 @@ static const MemoryRegionOps sifive_test_ops = {
> >  .write = sifive_test_write,
> >  .endianness = DEVICE_NATIVE_ENDIAN,
> >  .valid = {
> > -.min_access_size = 4,
> > +.min_access_size = 2,
> >  .max_access_size = 4
> >  }
> >  };
> >
> > base-commit: 2f4c51c0f384d7888a04b4815861e6d5fd244d75
> > --
> > 2.28.0
> >
> >
> 



Re: [PATCH] riscv: sifive_test: Allow 16-bit writes to memory region

2020-09-01 Thread Alistair Francis
On Mon, Aug 31, 2020 at 10:59 PM Nathan Chancellor
 wrote:
>
> When shutting down the machine running a mainline Linux kernel, the
> following error happens:
>
> $ build/riscv64-softmmu/qemu-system-riscv64 -bios default -M virt \
> -display none -initrd rootfs.cpio -kernel Image -m 512m \
> -nodefaults -serial mon:stdio
> ...
> Requesting system poweroff
> [4.999630] reboot: Power down
> sbi_trap_error: hart0: trap handler failed (error -2)
> sbi_trap_error: hart0: mcause=0x0007 mtval=0x0010
> sbi_trap_error: hart0: mepc=0x8000d4cc mstatus=0x1822
> sbi_trap_error: hart0: ra=0x8000999e sp=0x80015c78
> sbi_trap_error: hart0: gp=0xffe000e76610 tp=0xffe0081b89c0
> sbi_trap_error: hart0: s0=0x80015c88 s1=0x0040
> sbi_trap_error: hart0: a0=0x a1=0x80004024
> sbi_trap_error: hart0: a2=0x80004024 a3=0x80004024
> sbi_trap_error: hart0: a4=0x0010 a5=0x
> sbi_trap_error: hart0: a6=0x4024 a7=0x80011158
> sbi_trap_error: hart0: s2=0x s3=0x80016000
> sbi_trap_error: hart0: s4=0x s5=0x
> sbi_trap_error: hart0: s6=0x0001 s7=0x
> sbi_trap_error: hart0: s8=0x s9=0x
> sbi_trap_error: hart0: s10=0x s11=0x0008
> sbi_trap_error: hart0: t0=0x t1=0x
> sbi_trap_error: hart0: t2=0x t3=0x
> sbi_trap_error: hart0: t4=0x t5=0x
> sbi_trap_error: hart0: t6=0x
>
> The kernel does a 16-bit write when powering off the machine, which
> was allowed before commit 5d971f9e67 ("memory: Revert "memory: accept
> mismatching sizes in memory_region_access_valid""). Make min_access_size
> match reality so that the machine can shut down properly now.
>
> Cc: qemu-sta...@nongnu.org
> Fixes: 88a07990fa ("SiFive RISC-V Test Finisher")
> Fixes: 5d971f9e67 ("memory: Revert "memory: accept mismatching sizes in 
> memory_region_access_valid"")
> Signed-off-by: Nathan Chancellor 

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>
> Please let me know if the tags are wrong or inappropriate, this is my
> first QEMU patch.
>
>  hw/riscv/sifive_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
> index 0c78fb2c93..8c70dd69df 100644
> --- a/hw/riscv/sifive_test.c
> +++ b/hw/riscv/sifive_test.c
> @@ -59,7 +59,7 @@ static const MemoryRegionOps sifive_test_ops = {
>  .write = sifive_test_write,
>  .endianness = DEVICE_NATIVE_ENDIAN,
>  .valid = {
> -.min_access_size = 4,
> +.min_access_size = 2,
>  .max_access_size = 4
>  }
>  };
>
> base-commit: 2f4c51c0f384d7888a04b4815861e6d5fd244d75
> --
> 2.28.0
>
>



Re: [PATCH] riscv: sifive_test: Allow 16-bit writes to memory region

2020-09-01 Thread Alistair Francis
On Mon, Aug 31, 2020 at 10:59 PM Nathan Chancellor
 wrote:
>
> When shutting down the machine running a mainline Linux kernel, the
> following error happens:
>
> $ build/riscv64-softmmu/qemu-system-riscv64 -bios default -M virt \
> -display none -initrd rootfs.cpio -kernel Image -m 512m \
> -nodefaults -serial mon:stdio
> ...
> Requesting system poweroff
> [4.999630] reboot: Power down
> sbi_trap_error: hart0: trap handler failed (error -2)
> sbi_trap_error: hart0: mcause=0x0007 mtval=0x0010
> sbi_trap_error: hart0: mepc=0x8000d4cc mstatus=0x1822
> sbi_trap_error: hart0: ra=0x8000999e sp=0x80015c78
> sbi_trap_error: hart0: gp=0xffe000e76610 tp=0xffe0081b89c0
> sbi_trap_error: hart0: s0=0x80015c88 s1=0x0040
> sbi_trap_error: hart0: a0=0x a1=0x80004024
> sbi_trap_error: hart0: a2=0x80004024 a3=0x80004024
> sbi_trap_error: hart0: a4=0x0010 a5=0x
> sbi_trap_error: hart0: a6=0x4024 a7=0x80011158
> sbi_trap_error: hart0: s2=0x s3=0x80016000
> sbi_trap_error: hart0: s4=0x s5=0x
> sbi_trap_error: hart0: s6=0x0001 s7=0x
> sbi_trap_error: hart0: s8=0x s9=0x
> sbi_trap_error: hart0: s10=0x s11=0x0008
> sbi_trap_error: hart0: t0=0x t1=0x
> sbi_trap_error: hart0: t2=0x t3=0x
> sbi_trap_error: hart0: t4=0x t5=0x
> sbi_trap_error: hart0: t6=0x
>
> The kernel does a 16-bit write when powering off the machine, which
> was allowed before commit 5d971f9e67 ("memory: Revert "memory: accept
> mismatching sizes in memory_region_access_valid""). Make min_access_size
> match reality so that the machine can shut down properly now.
>
> Cc: qemu-sta...@nongnu.org
> Fixes: 88a07990fa ("SiFive RISC-V Test Finisher")
> Fixes: 5d971f9e67 ("memory: Revert "memory: accept mismatching sizes in 
> memory_region_access_valid"")
> Signed-off-by: Nathan Chancellor 

Reviewed-by: Alistair Francis 

Alistair

> ---
>
> Please let me know if the tags are wrong or inappropriate, this is my
> first QEMU patch.
>
>  hw/riscv/sifive_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
> index 0c78fb2c93..8c70dd69df 100644
> --- a/hw/riscv/sifive_test.c
> +++ b/hw/riscv/sifive_test.c
> @@ -59,7 +59,7 @@ static const MemoryRegionOps sifive_test_ops = {
>  .write = sifive_test_write,
>  .endianness = DEVICE_NATIVE_ENDIAN,
>  .valid = {
> -.min_access_size = 4,
> +.min_access_size = 2,
>  .max_access_size = 4
>  }
>  };
>
> base-commit: 2f4c51c0f384d7888a04b4815861e6d5fd244d75
> --
> 2.28.0
>
>



Re: [PATCH] riscv: sifive_test: Allow 16-bit writes to memory region

2020-09-01 Thread Michael S. Tsirkin
On Tue, Sep 01, 2020 at 07:08:34AM -0400, Michael S. Tsirkin wrote:
> On Mon, Aug 31, 2020 at 10:58:23PM -0700, Nathan Chancellor wrote:
> > When shutting down the machine running a mainline Linux kernel, the
> > following error happens:
> > 
> > $ build/riscv64-softmmu/qemu-system-riscv64 -bios default -M virt \
> > -display none -initrd rootfs.cpio -kernel Image -m 512m \
> > -nodefaults -serial mon:stdio
> > ...
> > Requesting system poweroff
> > [4.999630] reboot: Power down
> > sbi_trap_error: hart0: trap handler failed (error -2)
> > sbi_trap_error: hart0: mcause=0x0007 mtval=0x0010
> > sbi_trap_error: hart0: mepc=0x8000d4cc mstatus=0x1822
> > sbi_trap_error: hart0: ra=0x8000999e sp=0x80015c78
> > sbi_trap_error: hart0: gp=0xffe000e76610 tp=0xffe0081b89c0
> > sbi_trap_error: hart0: s0=0x80015c88 s1=0x0040
> > sbi_trap_error: hart0: a0=0x a1=0x80004024
> > sbi_trap_error: hart0: a2=0x80004024 a3=0x80004024
> > sbi_trap_error: hart0: a4=0x0010 a5=0x
> > sbi_trap_error: hart0: a6=0x4024 a7=0x80011158
> > sbi_trap_error: hart0: s2=0x s3=0x80016000
> > sbi_trap_error: hart0: s4=0x s5=0x
> > sbi_trap_error: hart0: s6=0x0001 s7=0x
> > sbi_trap_error: hart0: s8=0x s9=0x
> > sbi_trap_error: hart0: s10=0x s11=0x0008
> > sbi_trap_error: hart0: t0=0x t1=0x
> > sbi_trap_error: hart0: t2=0x t3=0x
> > sbi_trap_error: hart0: t4=0x t5=0x
> > sbi_trap_error: hart0: t6=0x
> > 
> > The kernel does a 16-bit write when powering off the machine, which
> > was allowed before commit 5d971f9e67 ("memory: Revert "memory: accept
> > mismatching sizes in memory_region_access_valid""). Make min_access_size
> > match reality so that the machine can shut down properly now.
> > 
> > Cc: qemu-sta...@nongnu.org
> > Fixes: 88a07990fa ("SiFive RISC-V Test Finisher")
> > Fixes: 5d971f9e67 ("memory: Revert "memory: accept mismatching sizes in 
> > memory_region_access_valid"")
> > Signed-off-by: Nathan Chancellor 
> > ---
> > 
> > Please let me know if the tags are wrong or inappropriate, this is my
> > first QEMU patch.
> > 
> >  hw/riscv/sifive_test.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
> > index 0c78fb2c93..8c70dd69df 100644
> > --- a/hw/riscv/sifive_test.c
> > +++ b/hw/riscv/sifive_test.c
> > @@ -59,7 +59,7 @@ static const MemoryRegionOps sifive_test_ops = {
> >  .write = sifive_test_write,
> >  .endianness = DEVICE_NATIVE_ENDIAN,
> 
> 
> Apropos, why is this native endian?
> The write handler seems to ignore target endian-ness,
> looks like a bug ...


patch itself looks fine

Acked-by: Michael S. Tsirkin 

> >  .valid = {
> > -.min_access_size = 4,
> > +.min_access_size = 2,
> >  .max_access_size = 4
> >  }
> >  };
> > 
> > base-commit: 2f4c51c0f384d7888a04b4815861e6d5fd244d75
> > -- 
> > 2.28.0




Re: [PATCH] riscv: sifive_test: Allow 16-bit writes to memory region

2020-09-01 Thread Michael S. Tsirkin
On Mon, Aug 31, 2020 at 10:58:23PM -0700, Nathan Chancellor wrote:
> When shutting down the machine running a mainline Linux kernel, the
> following error happens:
> 
> $ build/riscv64-softmmu/qemu-system-riscv64 -bios default -M virt \
> -display none -initrd rootfs.cpio -kernel Image -m 512m \
> -nodefaults -serial mon:stdio
> ...
> Requesting system poweroff
> [4.999630] reboot: Power down
> sbi_trap_error: hart0: trap handler failed (error -2)
> sbi_trap_error: hart0: mcause=0x0007 mtval=0x0010
> sbi_trap_error: hart0: mepc=0x8000d4cc mstatus=0x1822
> sbi_trap_error: hart0: ra=0x8000999e sp=0x80015c78
> sbi_trap_error: hart0: gp=0xffe000e76610 tp=0xffe0081b89c0
> sbi_trap_error: hart0: s0=0x80015c88 s1=0x0040
> sbi_trap_error: hart0: a0=0x a1=0x80004024
> sbi_trap_error: hart0: a2=0x80004024 a3=0x80004024
> sbi_trap_error: hart0: a4=0x0010 a5=0x
> sbi_trap_error: hart0: a6=0x4024 a7=0x80011158
> sbi_trap_error: hart0: s2=0x s3=0x80016000
> sbi_trap_error: hart0: s4=0x s5=0x
> sbi_trap_error: hart0: s6=0x0001 s7=0x
> sbi_trap_error: hart0: s8=0x s9=0x
> sbi_trap_error: hart0: s10=0x s11=0x0008
> sbi_trap_error: hart0: t0=0x t1=0x
> sbi_trap_error: hart0: t2=0x t3=0x
> sbi_trap_error: hart0: t4=0x t5=0x
> sbi_trap_error: hart0: t6=0x
> 
> The kernel does a 16-bit write when powering off the machine, which
> was allowed before commit 5d971f9e67 ("memory: Revert "memory: accept
> mismatching sizes in memory_region_access_valid""). Make min_access_size
> match reality so that the machine can shut down properly now.
> 
> Cc: qemu-sta...@nongnu.org
> Fixes: 88a07990fa ("SiFive RISC-V Test Finisher")
> Fixes: 5d971f9e67 ("memory: Revert "memory: accept mismatching sizes in 
> memory_region_access_valid"")
> Signed-off-by: Nathan Chancellor 
> ---
> 
> Please let me know if the tags are wrong or inappropriate, this is my
> first QEMU patch.
> 
>  hw/riscv/sifive_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
> index 0c78fb2c93..8c70dd69df 100644
> --- a/hw/riscv/sifive_test.c
> +++ b/hw/riscv/sifive_test.c
> @@ -59,7 +59,7 @@ static const MemoryRegionOps sifive_test_ops = {
>  .write = sifive_test_write,
>  .endianness = DEVICE_NATIVE_ENDIAN,


Apropos, why is this native endian?
The write handler seems to ignore target endian-ness,
looks like a bug ...

>  .valid = {
> -.min_access_size = 4,
> +.min_access_size = 2,
>  .max_access_size = 4
>  }
>  };
> 
> base-commit: 2f4c51c0f384d7888a04b4815861e6d5fd244d75
> -- 
> 2.28.0