Re: [PATCH] hw/riscv: microchip_pfsoc: fix kernel panics due to missing peripherals

2022-08-16 Thread Conor.Dooley
On 16/08/2022 01:40, Philippe Mathieu-Daudé wrote:
> [You don't often get email from f4...@amsat.org. Learn why this is important 
> at https://aka.ms/LearnAboutSenderIdentification ]
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
> content is safe
> 
> Hi Conor,
> 
> On 15/8/22 00:48, conor.doo...@microchip.com wrote:
>> On 14/08/2022 23:08, Alistair Francis wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
>>> content is safe
>>>
>>> On Sat, Aug 13, 2022 at 11:51 PM Conor Dooley  wrote:
 QEMU support for PolarFire SoC seems to be fairly out of date at this
 point. Running with a recent HSS, U-Boot etc doesn't work, partly due
 to the unimplemented cache controller that the HSS tries to read from
 (it needs to know the ways configuration now) and the rest seems to be
 down to 64 bit address DMA to the sd card (not 100% on that yet).
 There's some patches floating around internally that supposedly fixed
 things for QEMU v6.something but I could not replicate & they're fairly
 conflicty at this point. Plan is to clean them up, but no point sitting
 on this patch until then as I have no ETA for that at this point.
>>>
>>> Awesome! It is great to see Microchip supporting open source projects
>>
>> Better late than never ehh..
>> As I said, no ETA yet as I don't know just how far off the sd card stuff
>> is, but it's in the todo pile. In the meantime, I'll keep an eye out here
>> which I am ~certain we haven't been doing so far. I've added QEMU stuff
>> to my build/test scripts now that I've got the direct kernel boot working
>> for me so hopefully once things get fixed, they'll stay that way.
> 
> Please Cc me and Cédric in your future posts regarding SD card, or open
> a GitLab issue describing the problem.

Willdo. Need to do some more digging first :)

Thanks.




Re: [PATCH] hw/riscv: microchip_pfsoc: fix kernel panics due to missing peripherals

2022-08-15 Thread Philippe Mathieu-Daudé via

Hi Conor,

On 15/8/22 00:48, conor.doo...@microchip.com wrote:

On 14/08/2022 23:08, Alistair Francis wrote:

EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
content is safe

On Sat, Aug 13, 2022 at 11:51 PM Conor Dooley  wrote:

QEMU support for PolarFire SoC seems to be fairly out of date at this
point. Running with a recent HSS, U-Boot etc doesn't work, partly due
to the unimplemented cache controller that the HSS tries to read from
(it needs to know the ways configuration now) and the rest seems to be
down to 64 bit address DMA to the sd card (not 100% on that yet).
There's some patches floating around internally that supposedly fixed
things for QEMU v6.something but I could not replicate & they're fairly
conflicty at this point. Plan is to clean them up, but no point sitting
on this patch until then as I have no ETA for that at this point.


Awesome! It is great to see Microchip supporting open source projects


Better late than never ehh..
As I said, no ETA yet as I don't know just how far off the sd card stuff
is, but it's in the todo pile. In the meantime, I'll keep an eye out here
which I am ~certain we haven't been doing so far. I've added QEMU stuff
to my build/test scripts now that I've got the direct kernel boot working
for me so hopefully once things get fixed, they'll stay that way.


Please Cc me and Cédric in your future posts regarding SD card, or open
a GitLab issue describing the problem.

Regards,

Phil.



Re: [PATCH] hw/riscv: microchip_pfsoc: fix kernel panics due to missing peripherals

2022-08-14 Thread Alistair Francis
On Mon, Aug 15, 2022 at 8:48 AM  wrote:
>
> On 14/08/2022 23:08, Alistair Francis wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
> > content is safe
> >
> > On Sat, Aug 13, 2022 at 11:51 PM Conor Dooley  wrote:
> >> QEMU support for PolarFire SoC seems to be fairly out of date at this
> >> point. Running with a recent HSS, U-Boot etc doesn't work, partly due
> >> to the unimplemented cache controller that the HSS tries to read from
> >> (it needs to know the ways configuration now) and the rest seems to be
> >> down to 64 bit address DMA to the sd card (not 100% on that yet).
> >> There's some patches floating around internally that supposedly fixed
> >> things for QEMU v6.something but I could not replicate & they're fairly
> >> conflicty at this point. Plan is to clean them up, but no point sitting
> >> on this patch until then as I have no ETA for that at this point.
> >
> > Awesome! It is great to see Microchip supporting open source projects
>
> Better late than never ehh..
> As I said, no ETA yet as I don't know just how far off the sd card stuff
> is, but it's in the todo pile. In the meantime, I'll keep an eye out here
> which I am ~certain we haven't been doing so far. I've added QEMU stuff
> to my build/test scripts now that I've got the direct kernel boot working
> for me so hopefully once things get fixed, they'll stay that way.

Great! That is good to hear :)

Alistair

>
> Thanks,
> Conor.



Re: [PATCH] hw/riscv: microchip_pfsoc: fix kernel panics due to missing peripherals

2022-08-14 Thread Alistair Francis
On Sat, Aug 13, 2022 at 11:51 PM Conor Dooley  wrote:
>
> From: Conor Dooley 
>
> Booting using "Direct Kernel Boot" for PolarFire SoC & skipping u-boot
> entirely is probably not advisable, but it does at least show signs of
> life. Recent Linux kernel versions make use of peripherals that are
> missing definitions in QEMU and lead to kernel panics. These issues
> almost certain rear their head for other methods of booting, but I was
> unable to figure out a suitable HSS version that is recent enough to
> support these peripherals & works with QEMU.
>
> With these peripherals added, booting a kernel with the following hangs
> hangs waiting for the system controller's hwrng, but the kernel no
> longer panics. With the Linux driver for hwrng disabled, it boots to
> console.
>
> qemu-system-riscv64 -M microchip-icicle-kit \
> -m 2G -smp 5 \
> -kernel $(vmlinux_bin) \
> -dtb  $(dtb)\
> -initrd $(initramfs) \
> -display none -serial null \
> -serial stdio
>
> More peripherals are added than strictly required to fix the panics in
> the hopes of avoiding a replication of this problem in the future.
> Some of the peripherals which are in the device tree for recent kernels
> are implemented in the FPGA fabric. The eMMC/SD mux, which exists as
> an unimplemented device is replaced by a wider entry. This updated
> entry covers both the mux & the remainder of the FPGA fabric connected
> to the MSS using Fabric Interrconnect (FIC) 3.
>
> Link: 
> https://github.com/polarfire-soc/icicle-kit-reference-design#fabric-memory-map
> Link: 
> https://ww1.microchip.com/downloads/aemDocuments/documents/FPGA/ProductDocuments/SupportingCollateral/V1_4_Register_Map.zip
> Signed-off-by: Conor Dooley 
> ---
> QEMU support for PolarFire SoC seems to be fairly out of date at this
> point. Running with a recent HSS, U-Boot etc doesn't work, partly due
> to the unimplemented cache controller that the HSS tries to read from
> (it needs to know the ways configuration now) and the rest seems to be
> down to 64 bit address DMA to the sd card (not 100% on that yet).
> There's some patches floating around internally that supposedly fixed
> things for QEMU v6.something but I could not replicate & they're fairly
> conflicty at this point. Plan is to clean them up, but no point sitting
> on this patch until then as I have no ETA for that at this point.
>
> CC: Bin Meng 
> CC: Palmer Dabbelt 
> CC: Alistair Francis 
> CC: Conor Dooley 
> CC: qemu-ri...@nongnu.org
> CC: qemu-devel@nongnu.org

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>  hw/riscv/microchip_pfsoc.c | 67 +++---
>  include/hw/riscv/microchip_pfsoc.h | 14 ++-
>  2 files changed, 74 insertions(+), 7 deletions(-)
>
> diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c
> index 10a5d0e501..eb90a99660 100644
> --- a/hw/riscv/microchip_pfsoc.c
> +++ b/hw/riscv/microchip_pfsoc.c
> @@ -100,8 +100,11 @@ static const MemMapEntry microchip_pfsoc_memmap[] = {
>  [MICROCHIP_PFSOC_L2LIM] =   {  0x800,  0x200 },
>  [MICROCHIP_PFSOC_PLIC] ={  0xc00,  0x400 },
>  [MICROCHIP_PFSOC_MMUART0] = { 0x2000, 0x1000 },
> +[MICROCHIP_PFSOC_WDOG0] =   { 0x20001000, 0x1000 },
>  [MICROCHIP_PFSOC_SYSREG] =  { 0x20002000, 0x2000 },
> +[MICROCHIP_PFSOC_AXISW] =   { 0x20004000, 0x1000 },
>  [MICROCHIP_PFSOC_MPUCFG] =  { 0x20005000, 0x1000 },
> +[MICROCHIP_PFSOC_FMETER] =  { 0x20006000, 0x1000 },
>  [MICROCHIP_PFSOC_DDR_SGMII_PHY] =   { 0x20007000, 0x1000 },
>  [MICROCHIP_PFSOC_EMMC_SD] = { 0x20008000, 0x1000 },
>  [MICROCHIP_PFSOC_DDR_CFG] = { 0x2008,0x4 },
> @@ -109,19 +112,28 @@ static const MemMapEntry microchip_pfsoc_memmap[] = {
>  [MICROCHIP_PFSOC_MMUART2] = { 0x20102000, 0x1000 },
>  [MICROCHIP_PFSOC_MMUART3] = { 0x20104000, 0x1000 },
>  [MICROCHIP_PFSOC_MMUART4] = { 0x20106000, 0x1000 },
> +[MICROCHIP_PFSOC_WDOG1] =   { 0x20101000, 0x1000 },
> +[MICROCHIP_PFSOC_WDOG2] =   { 0x20103000, 0x1000 },
> +[MICROCHIP_PFSOC_WDOG3] =   { 0x20105000, 0x1000 },
> +[MICROCHIP_PFSOC_WDOG4] =   { 0x20106000, 0x1000 },
>  [MICROCHIP_PFSOC_SPI0] ={ 0x20108000, 0x1000 },
>  [MICROCHIP_PFSOC_SPI1] ={ 0x20109000, 0x1000 },
> +[MICROCHIP_PFSOC_I2C0] ={ 0x2010a000, 0x1000 },
>  [MICROCHIP_PFSOC_I2C1] ={ 0x2010b000, 0x1000 },
> +[MICROCHIP_PFSOC_CAN0] ={ 0x2010c000, 0x1000 },
> +[MICROCHIP_PFSOC_CAN1] ={ 0x2010d000, 0x1000 },
>  [MICROCHIP_PFSOC_GEM0] ={ 0x2011, 0x2000 },
>  [MICROCHIP_PFSOC_GEM1] ={ 0x20112000, 0x2000 },
>  [MICROCHIP_PFSOC_GPIO0] =  

Re: [PATCH] hw/riscv: microchip_pfsoc: fix kernel panics due to missing peripherals

2022-08-14 Thread Conor.Dooley
On 14/08/2022 23:08, Alistair Francis wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
> content is safe
> 
> On Sat, Aug 13, 2022 at 11:51 PM Conor Dooley  wrote:
>> QEMU support for PolarFire SoC seems to be fairly out of date at this
>> point. Running with a recent HSS, U-Boot etc doesn't work, partly due
>> to the unimplemented cache controller that the HSS tries to read from
>> (it needs to know the ways configuration now) and the rest seems to be
>> down to 64 bit address DMA to the sd card (not 100% on that yet).
>> There's some patches floating around internally that supposedly fixed
>> things for QEMU v6.something but I could not replicate & they're fairly
>> conflicty at this point. Plan is to clean them up, but no point sitting
>> on this patch until then as I have no ETA for that at this point.
> 
> Awesome! It is great to see Microchip supporting open source projects

Better late than never ehh..
As I said, no ETA yet as I don't know just how far off the sd card stuff
is, but it's in the todo pile. In the meantime, I'll keep an eye out here
which I am ~certain we haven't been doing so far. I've added QEMU stuff
to my build/test scripts now that I've got the direct kernel boot working
for me so hopefully once things get fixed, they'll stay that way.

Thanks,
Conor.


Re: [PATCH] hw/riscv: microchip_pfsoc: fix kernel panics due to missing peripherals

2022-08-14 Thread Alistair Francis
On Sat, Aug 13, 2022 at 11:51 PM Conor Dooley  wrote:
>
> From: Conor Dooley 
>
> Booting using "Direct Kernel Boot" for PolarFire SoC & skipping u-boot
> entirely is probably not advisable, but it does at least show signs of
> life. Recent Linux kernel versions make use of peripherals that are
> missing definitions in QEMU and lead to kernel panics. These issues
> almost certain rear their head for other methods of booting, but I was
> unable to figure out a suitable HSS version that is recent enough to
> support these peripherals & works with QEMU.
>
> With these peripherals added, booting a kernel with the following hangs
> hangs waiting for the system controller's hwrng, but the kernel no
> longer panics. With the Linux driver for hwrng disabled, it boots to
> console.
>
> qemu-system-riscv64 -M microchip-icicle-kit \
> -m 2G -smp 5 \
> -kernel $(vmlinux_bin) \
> -dtb  $(dtb)\
> -initrd $(initramfs) \
> -display none -serial null \
> -serial stdio
>
> More peripherals are added than strictly required to fix the panics in
> the hopes of avoiding a replication of this problem in the future.
> Some of the peripherals which are in the device tree for recent kernels
> are implemented in the FPGA fabric. The eMMC/SD mux, which exists as
> an unimplemented device is replaced by a wider entry. This updated
> entry covers both the mux & the remainder of the FPGA fabric connected
> to the MSS using Fabric Interrconnect (FIC) 3.
>
> Link: 
> https://github.com/polarfire-soc/icicle-kit-reference-design#fabric-memory-map
> Link: 
> https://ww1.microchip.com/downloads/aemDocuments/documents/FPGA/ProductDocuments/SupportingCollateral/V1_4_Register_Map.zip
> Signed-off-by: Conor Dooley 
> ---
> QEMU support for PolarFire SoC seems to be fairly out of date at this
> point. Running with a recent HSS, U-Boot etc doesn't work, partly due
> to the unimplemented cache controller that the HSS tries to read from
> (it needs to know the ways configuration now) and the rest seems to be
> down to 64 bit address DMA to the sd card (not 100% on that yet).
> There's some patches floating around internally that supposedly fixed
> things for QEMU v6.something but I could not replicate & they're fairly
> conflicty at this point. Plan is to clean them up, but no point sitting
> on this patch until then as I have no ETA for that at this point.

Awesome! It is great to see Microchip supporting open source projects

>
> CC: Bin Meng 
> CC: Palmer Dabbelt 
> CC: Alistair Francis 
> CC: Conor Dooley 
> CC: qemu-ri...@nongnu.org
> CC: qemu-devel@nongnu.org

Reviewed-by: Alistair Francis 

Alistair

> ---
>  hw/riscv/microchip_pfsoc.c | 67 +++---
>  include/hw/riscv/microchip_pfsoc.h | 14 ++-
>  2 files changed, 74 insertions(+), 7 deletions(-)
>
> diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c
> index 10a5d0e501..eb90a99660 100644
> --- a/hw/riscv/microchip_pfsoc.c
> +++ b/hw/riscv/microchip_pfsoc.c
> @@ -100,8 +100,11 @@ static const MemMapEntry microchip_pfsoc_memmap[] = {
>  [MICROCHIP_PFSOC_L2LIM] =   {  0x800,  0x200 },
>  [MICROCHIP_PFSOC_PLIC] ={  0xc00,  0x400 },
>  [MICROCHIP_PFSOC_MMUART0] = { 0x2000, 0x1000 },
> +[MICROCHIP_PFSOC_WDOG0] =   { 0x20001000, 0x1000 },
>  [MICROCHIP_PFSOC_SYSREG] =  { 0x20002000, 0x2000 },
> +[MICROCHIP_PFSOC_AXISW] =   { 0x20004000, 0x1000 },
>  [MICROCHIP_PFSOC_MPUCFG] =  { 0x20005000, 0x1000 },
> +[MICROCHIP_PFSOC_FMETER] =  { 0x20006000, 0x1000 },
>  [MICROCHIP_PFSOC_DDR_SGMII_PHY] =   { 0x20007000, 0x1000 },
>  [MICROCHIP_PFSOC_EMMC_SD] = { 0x20008000, 0x1000 },
>  [MICROCHIP_PFSOC_DDR_CFG] = { 0x2008,0x4 },
> @@ -109,19 +112,28 @@ static const MemMapEntry microchip_pfsoc_memmap[] = {
>  [MICROCHIP_PFSOC_MMUART2] = { 0x20102000, 0x1000 },
>  [MICROCHIP_PFSOC_MMUART3] = { 0x20104000, 0x1000 },
>  [MICROCHIP_PFSOC_MMUART4] = { 0x20106000, 0x1000 },
> +[MICROCHIP_PFSOC_WDOG1] =   { 0x20101000, 0x1000 },
> +[MICROCHIP_PFSOC_WDOG2] =   { 0x20103000, 0x1000 },
> +[MICROCHIP_PFSOC_WDOG3] =   { 0x20105000, 0x1000 },
> +[MICROCHIP_PFSOC_WDOG4] =   { 0x20106000, 0x1000 },
>  [MICROCHIP_PFSOC_SPI0] ={ 0x20108000, 0x1000 },
>  [MICROCHIP_PFSOC_SPI1] ={ 0x20109000, 0x1000 },
> +[MICROCHIP_PFSOC_I2C0] ={ 0x2010a000, 0x1000 },
>  [MICROCHIP_PFSOC_I2C1] ={ 0x2010b000, 0x1000 },
> +[MICROCHIP_PFSOC_CAN0] ={ 0x2010c000, 0x1000 },
> +[MICROCHIP_PFSOC_CAN1] ={ 0x2010d000, 0x1000 },
>  [MICROCHIP_PFSOC_GEM0] ={ 0x2011, 0x2000 },
>  [MICROCHIP_PFSOC_GEM1] ={