FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6058 Discussions

How to load intel RSU driver using "insmod"?

beam_me_up_scotty
New Contributor I
656 Views

Hi, 

 

This question is slightly related to my question in this thread about Intel Stratix-10 RSU feature.

I have been following the instruction from this official document.

 

Currently, I am trying to load the "intel RSU driver" in Linux on an stratix-10 FPGA board. I have checked and confirmed that the the kernel configuration file sets the "CONFIG_INTEL_STRATIX10_RSU=m". This page of the RSU documentation suggests to use "insmod" to load this module in, but how would I go about this? Do I need a ".ko" file? If you can provide the command, or a link to a more thorough document, that would also be great!

 

I have noticed that the "dev/mtd0", which is the interface for the LIBRSU (RSU_CLIENT) is not mounted. The "/etc/librsu.rc" file has the default values as shown here. However when I try to run the "rsu_client" with any arguments I get the following:

root@board:~# ./rsu_client -c
librsu: librsu_misc_get_devattr(): error: Unable to open device attribute file '/sys/devices/platform/stratix10-rsu.0/spt0_address' [LOW]
librsu: librsu_ll_open_qspi(): error: Unable to open '/dev/mtd0' [LOW]
librsu_init return -2

I assume it at least partially has to do with the fact that the RSU driver is not loaded!

If it is any help, when I run "lsmod" I simply get "not tainted".

Lastly, the documentation mentions "the MTD QSPI partition to be used
by LIBRSU must start at the location of the SPT0, in order for LIBRSU to be able to
determine the flash partitioning information" here ; does this mean that in the device tree, it is not enough to describe the QSPI flash start location and we have to jump over the "BOOT_INFO" and "FACTORY_IMAGE" section in the flash by making a modification inthe device tree? how would one go about this? can this be done without rebuilding the kernel?

 

If there is a reference design/file/sample that'd be great too!

 

Thank you!

0 Kudos
1 Solution
beam_me_up_scotty
New Contributor I
158 Views

I will leave this here in case someone in the future needs to do this.

 

checkout this link for version compatibility:

Remote System Update Compatibility | Documentation | RocketBoards.org

 

What "worked" for me was to compile ATF 2.4.1,  kernel 5.4.114 with RSU and u-boot 2021.01 plus the RSU libraries that needs to be put on the HPS, essentially the exact version they had in their manual.

ATF 2.6.1 crashed when booting into the kernel, with u-boot 2021.01,  Intel does not really support older versions, so performance most likely will regress.

 

Side note:

Updating to u-boot 2021.01 from 2019 also meant that the L3 registers needed to be handled differently, the "sec_reg" driver that they introduced that can touch the L3 registers in the DTS file, only starts to exist from uboot 2021.04 and even then, it does not preserve the values of the RESERVED registers.

 

So for that I had to follow the suggestions at here and recompile ATF with the modification to its source code and add a script in u-boot to set them before booting the kernel.

 

View solution in original post

9 Replies
JingyangTeh
Employee
616 Views

Hello Sir


Instead of compiling it as a loadable module.

Could you try to set the flag to y instead of m.

"CONFIG_INTEL_STRATIX10_RSU=y"

This way you do not need to explicitly insmod the module on boot up.


Regards

Jingyang, Teh


beam_me_up_scotty
New Contributor I
606 Views

Hi, 

 

Yes I will be trying that, but unfortunately the build process and the deployment on our project is a fairly lengthy one and I am hoping to understand the process better or have a workaround until we can try to build this module into the kernel.

 

For that, I have locally also tried setting the config to an "m" in the "defconfig" file and trying to build the modules only with "make modules" but it does not generate a ".ko" file, hoping that I can then use this to load the module on the board. (this older document shows the process for the quartus prime version 19.3 and they do not build the module into the kernel).

 

Would you please advise on how to proceed and my other questions stated before?

Also would you kindly confirm that having this module loaded would automatically result in "/dev/mtd0" to be mounted on boot up? 

 

If you can point me to other documents and guides on the process and the lower level details, I'd appreciate that as well!

 

Thank you!

JingyangTeh
Employee
586 Views

Hi Nicolas


Sorry for the late reply.

After making the modules there is an additional steps to install the module to a desired location.

make -j modules_install INSTALL_MOD_PATH=<PATH>

Once done, you could find the "stratix10-rsu.ko" at the path "modules_install/lib/modules/5.15.30-147098-gfeb06c9cc378/kernel/drivers/firmware"

Please be aware that there are additional steps to build the ZLIB & RSU Client

For more details you could look at the example at section 7.2 at the following document.

https://www.intel.com/content/www/us/en/docs/programmable/683021/21-4/building-rsu-example-binaries-...


The /dev/mtd0 should appear once u make the changes in quartus.

Following the steps here:

https://www.intel.com/content/www/us/en/docs/programmable/683184/21-4/creating-the-initial-flash-ima...


Regards

Jingyang, Teh



JingyangTeh
Employee
570 Views

Hi Nicolas


Any update on this case?


Regards

Jingyang, Teh


beam_me_up_scotty
New Contributor I
559 Views

Hi, 

 

I am waiting for the kernel with the right version and the enabled RSU module to be built so that I can try it on the hardware.

 

Although I did follow the steps to build the initial flash version for "HPS first", the board does not seem to be able to boot without the RSU module loaded/baked/built into the kernel it seems.

 

Will update this thread once I can run it on the hardware soon!

 

Thank you

 

JingyangTeh
Employee
528 Views

Hi


Any update on this forum case?


Regards

Jingyang, Teh


JingyangTeh
Employee
495 Views

Hi


Since there are no feedback for this thread, I shall set this thread to close pending. If you still need further assistance, you are welcome reopen this thread within 20days or open a new thread, someone will be right with you.


If you happened to close this thread you might receive a survey.  If you think you would rank your support experience less than 10 out of 10, please allow me to correct it before closing or if the problem can’t be corrected, please let me know the cause so that I may improve your future service experience.


Regards

Jingyang, Teh


beam_me_up_scotty
New Contributor I
430 Views

Hello, 

 

I finally got the chance to test it on the hardware, I have set the "CONFIG_INTEL_STRATIX10_RSU=y" as suggested and copied the libraries for the RSU to the SD-CARD.

The flash image was built with HPS first, following the instructions for creating multiple section in the flash for the FACTORY_IMAGE and the INITIAL_IMAGE.

 

Trying to boot with this flash image and the RSU enabled, creates the following boot error in u-boot:

Invalid bus 0 (err=-19)
Failed to initialize SPI flash at 0:0 (error -19)
RSU: Remote System Update Status
Current Image   : 0x01000000
Last Fail Image : 0x00000000
State           : 0x00000000
Version         : 0x00000202
Error location  : 0x00000000
Error details   : 0x00000000
Retry counter   : 0x00000000
RSU: Sub-partition table 0 offset 0x00910000
RSU: Sub-partition table 1 offset 0x00918000
Invalid bus 0 (err=-19)
RSU: SPI probe failed.

 The output of the "dm tree" in u-boot (the spi does not seem to be binding/loading):

 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 root         0  [ + ]   root_driver           root_driver
 simple_bus   0  [ + ]   generic_simple_bus    `-- soc
 reset        0  [ + ]   socfpga-reset             |-- rstmgr@ffd11000
 sysreset     0  [   ]   socfpga_sysreset          |   `-- sysreset
 eth          0  [   ]   dwmac_socfpga             |-- ethernet@ff800000
 mmc          0  [ + ]   socfpga_dwmmc             |-- dwmmc0@0xff808000
 blk          0  [ + ]   mmc_blk                   |   `-- dwmmc0@0xff808000.blk
 serial       0  [ + ]   ns16550_serial            |-- serial0@ffc02000
 spi          0  [   ]   cadence_spi               |-- spi@ff8d2000
 i2c          0  [   ]   i2c_designware            |-- i2c@ffc02800
 i2c          1  [   ]   i2c_designware            |-- i2c@ffc02900
 syscon       0  [ + ]   syscon                    `-- sysmgr@ffd12000

for reference, the map file of the flash image is the following:

BOOT_INFO                     0x00000000      0x0010FFFF
FACTORY_IMAGE                 0x00110000      0x0090FFFF (0x0017BFFF)
SPT0                          0x00910000      0x00917FFF
SPT1                          0x00918000      0x0091FFFF
CPB0                          0x00920000      0x00927FFF
CPB1                          0x00928000      0x0092FFFF
P1                            0x01000000      0x01FFFFFF (0x0106BFFF)
P2                            0x02000000      0x02FFFFFF
P3                            0x03000000      0x03FFFFFF

I have searched online for solutions and came across this post with similar error message...

Note that booting with a "normal" flash image (without the RSU feature) still works but of course the original issues still persist:

librsu: librsu_misc_get_devattr(): error: Unable to open device attribute file '/sys/devices/platform/stratix10-rsu.0/spt0_address' [LOW]
librsu: librsu_ll_open_qspi(): error: Unable to open '/dev/mtd0' [LOW]
librsu_init return -2

 Are there other configurations that need to be change to support RSU? maybe u-boot .config file or the device tree?

 

thank you!

beam_me_up_scotty
New Contributor I
159 Views

I will leave this here in case someone in the future needs to do this.

 

checkout this link for version compatibility:

Remote System Update Compatibility | Documentation | RocketBoards.org

 

What "worked" for me was to compile ATF 2.4.1,  kernel 5.4.114 with RSU and u-boot 2021.01 plus the RSU libraries that needs to be put on the HPS, essentially the exact version they had in their manual.

ATF 2.6.1 crashed when booting into the kernel, with u-boot 2021.01,  Intel does not really support older versions, so performance most likely will regress.

 

Side note:

Updating to u-boot 2021.01 from 2019 also meant that the L3 registers needed to be handled differently, the "sec_reg" driver that they introduced that can touch the L3 registers in the DTS file, only starts to exist from uboot 2021.04 and even then, it does not preserve the values of the RESERVED registers.

 

So for that I had to follow the suggestions at here and recompile ATF with the modification to its source code and add a script in u-boot to set them before booting the kernel.

 

Reply