Page MenuHomeFreeBSD

Support single core Zynq devices (MiniZed).
ClosedPublic

Authored by skibo on Feb 18 2018, 7:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 5:10 AM
Unknown Object (File)
Mar 19 2024, 1:32 AM
Unknown Object (File)
Mar 19 2024, 1:32 AM
Unknown Object (File)
Mar 19 2024, 1:32 AM
Unknown Object (File)
Feb 9 2024, 4:40 AM
Unknown Object (File)
Jan 14 2024, 2:44 AM
Unknown Object (File)
Jan 8 2024, 3:35 PM
Unknown Object (File)
Jan 8 2024, 3:35 PM
Subscribers

Details

Summary

On Zynq platforms, get the CPU count from the SCU_CONFIG register. This is necessary to boot on Xilinx' new single core chips (such as on the MiniZed). I don't have access to MiniZed yet but I have been debugging on Xilinx' port of qemu which acts like a single core Zynq so I have been using this patch for a while.

Test Plan

Tested on Zedboard and qemu.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Minor style tweaks and whitespace clean-up.

Thanks, I'll look at committing this. I have a Cora Z7 that needs this.

jmg requested changes to this revision.May 19 2020, 9:10 AM

I just tested this on my Cora Z7-07S board, and it looks like there's a hardware bug that prevents this patch from working.

I added a printf to dump mp_maxid and mp_ncpus, and I get 1 and 2 respectively, which per the TRM indicates that it's suppose to have 2 cpus instead of 1.

This revision now requires changes to proceed.May 19 2020, 9:10 AM
In D14429#548354, @jmg wrote:

I just tested this on my Cora Z7-07S board, and it looks like there's a hardware bug that prevents this patch from working.

I added a printf to dump mp_maxid and mp_ncpus, and I get 1 and 2 respectively, which per the TRM indicates that it's suppose to have 2 cpus instead of 1.

Crud. I guess the number of CPUs isn't properly represented in the SCU config register. Do you know the value of the entire register? From the u-boot prompt,
type "md 0xf8f00004 1". Another idea is to key off the device field of the SLCR's PSS_IDCODE register at 0xf8000530. Can you get that value too?
It also shows up in a sysctl under "hw.zynq.pss_idcode".

In D14429#548354, @jmg wrote:

I just tested this on my Cora Z7-07S board, and it looks like there's a hardware bug that prevents this patch from working.

I added a printf to dump mp_maxid and mp_ncpus, and I get 1 and 2 respectively, which per the TRM indicates that it's suppose to have 2 cpus instead of 1.

Crud. I guess the number of CPUs isn't properly represented in the SCU config register. Do you know the value of the entire register? From the u-boot prompt,
type "md 0xf8f00004 1". Another idea is to key off the device field of the SLCR's PSS_IDCODE register at 0xf8000530. Can you get that value too?
It also shows up in a sysctl under "hw.zynq.pss_idcode".

Thanks, tried to do this from FreeBSD, but couldn't figure out how to dump the entire register:

Zynq> md 0xf8f00004 1
f8f00004: 00000511                               ....
Zynq> md 0xf8000530 1
f8000530: 13723093                               .0r.

Hmm.. that sysctl didn't work, but there was pssid:

freebsd@generic:~ % sysctl hw.zynq.pssid
hw.zynq.pssid: 0x13723093: manufacturer: 0x49 device: 0x3 family: 0x1b sub-family: 0x9 rev: 0x1

Check SLCR.PSS_IDCODE to determine if this is a single-core Zynq chip.

In D14429#548577, @jmg wrote:

Thanks, tried to do this from FreeBSD, but couldn't figure out how to dump the entire register:

Zynq> md 0xf8f00004 1
f8f00004: 00000511                               ....
Zynq> md 0xf8000530 1
f8000530: 13723093                               .0r.

Hmm.. that sysctl didn't work, but there was pssid:

freebsd@generic:~ % sysctl hw.zynq.pssid
hw.zynq.pssid: 0x13723093: manufacturer: 0x49 device: 0x3 family: 0x1b sub-family: 0x9 rev: 0x1

I found some interesting reading on the S series Zynq chips. They just blow a fuse in the chip that disables the second core.
Fortunately, it looks like they do update the device ID in the pssid register so I have updated this diff to check that register first.

This booted on my 07S board w/o me having to set hw.ncpu in loader!

I assume you tested w/ your boards as well? Any other changes you want in?

sys/arm/xilinx/zy7_mp.c
2 ↗(On Diff #72006)

Probably should update copyright year. I can do this when I commit.

This revision is now accepted and ready to land.May 20 2020, 12:32 AM
sys/arm/xilinx/zy7_mp.c
82 ↗(On Diff #72006)

What are these magic numbers?

jmg requested changes to this revision.May 20 2020, 7:42 AM

Sorry, got a bit excited that things worked.

sys/arm/xilinx/zy7_mp.c
82 ↗(On Diff #72006)

Yes, please make these into defines. Also, very useful to include the document name/number and section/table information for various defines/magic numbers. Example is that the TRM I have (UG585, v1.12.2) doesn't have these defined in them, so if they are defined in a different doc, it'd be nice to know.

Thanks.

This revision now requires changes to proceed.May 20 2020, 7:42 AM
sys/arm/xilinx/zy7_mp.c
82 ↗(On Diff #72006)

I think I am going to put these defines in zy7_slcr.h and include it here. That also means doing some style and white-space clean-up to zy7_slcr.h while I'm at it. I'll put it up as soon as I've retested it.

Add device id definitions to zy7_slcr.h and clean up style and white-spaces.

Tested and working.

Thanks.

This revision is now accepted and ready to land.May 21 2020, 6:33 AM