• 龙芯S-2K2000板卡测试记录,安装loongnix系统已知问题及DPDK


    S-2K2000板卡已知问题

    1. 安装系统时PMON需要使用acpi传参
    2. pmon下USB键盘不支持热插拔
    3. pmon下插入部分USB键盘 进pmon特别慢,兼容性问题,后续统一解决
    4. 不支持emmc,等待更新pmon

    S-2K2000板卡手动引导USB命令

    load  (usb0,0)/boot/vmlinuz.
    initrd  (usb0,0)/boot/initrd.gz
    g console=ttyS0,115200
    
    • 1
    • 2
    • 3

    PMON编译方法

    1. 安装ubuntu20.04系统
    2. 解压龙芯交叉编译工具到/opt目录
    tar xvf loongarch64-linux-gnu-2021-06-19-vector.tar.gz -C /opt/
    
    • 1
    1. 修改ACPI传参。 文件路径:PMON下的Targets/ls2k2000/conf/ls.2k2000;配置文件:ls_anpk.2k2000,可以覆盖。修改内容为ACPI的三个选项,取消注释
    #
    #  Define target endian
    #
    makeoptions     ENDIAN=EL               # Little endian version.
    
    option          SMBIOS_SUPPORT
    option          ACPI_SUPPORT   //取消注释
    select          acpi_support    //取消注释
    option          LS_STR     //取消注释
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    1. 编译pmon,执行cmd.sh
    cd zloader.ls2k2000
    make cfg all tgt=rom ARCH=loongarch CROSS_COMPILE=/opt/loongarch64-linux-gnu-2021-06-19-vector/bin/loongarch64-linux-gnu- DEBUG=-g
    make dtb ARCH=loongarch CROSS_COMPILE=/opt/loongarch64-linux-gnu-2021-06-19-vector/bin/loongarch64-linux-gnu-
    
    • 1
    • 2
    • 3

    S-2K2000安装系统的步骤

    1. 更新GPU_FUSE pmon
    2. 执行fuse_write升级GPU固件,并check
    3. 更新ACPI传参pmon
    4. 安装系统(2个版本均可)
    5. 替换内核
    6. 修改boot.cfg
    7. 更新正式pmon

    龙芯2K2000 GPU固件升级

    1. 烧录gpufuse固件 (pmon_2k2000_gpufuse_nuc.bin)
    2. pmon下执行fuse_write–》重启板卡–》pmon下执行fuse_check
    3. 重启确认显示正常
    4. 烧录回旧pmon(目前nuc固件不支持USB,需要通过tftp烧录)

    TFTP烧录pmon的方法

    1. 启动到pmon命令行下,开机时按c进入pmon
    2. 查看设备列表devls
    PMON> devls
    Device name  Type
    syn0         IFNET
    syn1         IFNET
    syn2         IFNET
    wd0          DISK
    ngbe0        IFNET
    ngbe1        IFNET
    ngbe2        IFNET
    ngbe3        IFNET
    ngbe4        IFNET
    ngbe5        IFNET
    ngbe6        IFNET
    ngbe7        IFNET
    ngbe8        IFNET
    ngbe9        IFNET
    PMON> 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    1. 配置ip
      ifconfig syn0 10.50.122.1
    2. 测试网络
      ping 10.50.122.10
    3. 准备TFTP服务器,推荐用Windows tftd64软件
    4. TFTP烧录pmon
      fload tftp://10.10.10.10/gzrom-gpu.bin
      TFTP烧录pmon

    支持的操作系统(已实测安装)

    1. 龙芯嵌入式系统 Loongnix-Embedded-20.1.rc3-loongarch64-DVD-1。
      已知问题:没有网络源。
    2. 龙芯loongnix系统 Loongnix-20.5.livecd.loongarch64.iso。
      已知问题:找不到I2C设备,需要替换内核。不支持DTS传参。

    龙芯系统替换内核的方法

    loongnix系统更换为anntec内核后需要改为DTS传参,注销ACPI选项后重新编译PMON,并更新到板卡。

    1. 挂载分区2
      mount /dev/sda2 /mnt
    2. 修改boot.cfg 增加一个内核选项
      vim /mnt/boot.cfg
    3. 拷贝已经适配过的anntec内核vminuz文件到分区2
      cp vminuz /mnt/
    4. 卸载分区2
      umount /mnt

    修改dmi显示的modle name方法:

    1. 默认显示的model_name是 Loongson-2K2000-EVB-V1.0
    root@test-pc:~# lscpu
    Architecture:          loongarch64
      Byte Order:          Little Endian
    CPU(s):                2
      On-line CPU(s) list: 0,1
    BIOS Vendor ID:        Loongson-2K2000-EVB-V1.0
    Model name:            Loongson-2K2000-EVB-V1.0
      BIOS Model name:     Loongson-2K2000-EVB-V1.0  CPU @ 1.2GHz
      BIOS CPU family:     1
      CPU family:          Loongson-64bit
      Thread(s) per core:  1
      Core(s) per socket:  2
      Socket(s):           1
      BogoMIPS:            2400.00
      Flags:               cpucfg lam ual fpu lsx crc32 lbt_x86 lbt_arm lbt_mips
    Caches (sum of all):   
      L1d:                 128 KiB (2 instances)
      L1i:                 128 KiB (2 instances)
      L2:                  2 MiB (1 instance)
    NUMA:                  
      NUMA node(s):        1
      NUMA node0 CPU(s):   0,1
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    1. pmon目录下执行grep -rn "board_name"找到对应的文件路径/pmon/common/smbios/smbios.c
    2. 修改对应的值后重新编译
    #elif defined(LOONGSON_2K2000)
            sprintf(board_name, "S-%s-V1.0", "2K2000");
    
    
    • 1
    • 2
    • 3
    1. 更新pmon后测试,已经修改了原先的
    root@test-pc:~# dmidecode -t2
    # dmidecode 3.2
    Getting SMBIOS data from sysfs.
    SMBIOS 2.6 present.
    
    Handle 0x0002, DMI type 2, 17 bytes
    Base Board Information
    	Manufacturer: Anntec.cn S-2K2000-V1.0
    	Product Name: 1.0
    	Version: <BAD INDEX>
    	Serial Number: Not Specified
    	Asset Tag: Not Specified
    	Features:
    		Board is a hosting board
    		Board is replaceable
    	Location In Chassis: Not Specified
    	Chassis Handle: 0x0000
    	Type: Motherboard
    	Contained Object Handles: 0
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

    DPDK的测试方法前面文章已有讲述,记录一些注意事项

    1. NAS上传的dpdk-l2fwd程序版本为21.11 ,启动命令需要加一个参数-P
      ./l2fwd -l 1 --proc-type auto --socket-mem 1024 --file-prefix lwd0 -- -q 2 -p 0x3 -T 5 --no-mac-updating -P ./l2fwd -l 1 --proc-type auto --socket-mem 1024 --file-prefix lwd0 -- -q 4 -p 0xf -T 5 --no-mac-updating -P ./l2fwd -l 1 -- -q2 -p3 -T0 --no-mac-updating -r 128 -t 256 -P
    2. 目前测试丢包较多,修改boot.cfg添加了isolcpus=1,使用core1来跑,稍有改善。龙芯认为是系统干扰严重,推荐用buildroot测试,等待更新。

    i2c操作bypass命令

    1. 关闭bypass
      i2cset -f -y 0 0x2f 0x21 0x00
    2. 保存设置
      i2cset -f -y 0 0x2f 0x19 0xaa

    Buildroot制作,工具U-start 已上传NAS,步骤如下

    1. 运行build.sh

    2. 选中U盘路径执行

    root@ubuntu:~/U-start# ./build.sh 
    保证U盘没有重要文件,U盘会全部格式化
    您的磁盘为
    sda		60G
    sdb		29.6G
    请输入您想分区的盘,格式为/dev/磁盘名称 (如 /dev/sda) :
    /dev/sdb
    /dev/sdb磁盘大小为29G,小于300G,可以正常使用
    您想分区的磁盘名称为/dev/sdb, 确认请输入y,否则退出
    请谨慎输入 (y,N)  y
    确认
    umount: /dev/sdb1: no mount point specified.
    umount: /dev/sdb2: no mount point specified.
    umount: /dev/sdb3: no mount point specified.
    umount: /dev/sdb4: not mounted.
    umount: /dev/sdb5: no mount point specified.
    
    Welcome to fdisk (util-linux 2.34).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    
    Command (m for help): Partition number (1,2, default 2): 
    Partition 2 has been deleted.
    
    Command (m for help): Selected partition 1
    Partition 1 has been deleted.
    
    Command (m for help): Partition type
       p   primary (0 primary, 0 extended, 4 free)
       e   extended (container for logical partitions)
    Select (default p): Partition number (1-4, default 1): First sector (2048-62115839, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-62115839, default 62115839): 
    Created a new partition 1 of type 'Linux' and of size 1000 MiB.
    
    Command (m for help): Partition type
       p   primary (1 primary, 0 extended, 3 free)
       e   extended (container for logical partitions)
    Select (default p): Partition number (2-4, default 2): First sector (2050048-62115839, default 2050048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2050048-62115839, default 62115839): 
    Created a new partition 2 of type 'Linux' and of size 20 MiB.
    
    Command (m for help): The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Re-reading the partition table failed.: Device or resource busy
    
    The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
    
    /dev/sdb分区完成
    ############################################
    /dev/sdb1正在进行格式化
    mke2fs 1.45.5 (07-Jan-2020)
    Creating filesystem with 256000 4k blocks and 64000 inodes
    Filesystem UUID: 01668611-43eb-4819-af87-1c2728429910
    Superblock backups stored on blocks: 
    	32768, 98304, 163840, 229376
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Writing superblocks and filesystem accounting information: done
    
    /dev/sdb1格式化完成
    /dev/sdb2正在进行格式化
    mkfs.fat 4.1 (2017-01-24)
    /dev/sdb2格式化完成
    正在拷贝文件,请勿移动U盘
    拷贝完成
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    1. 将制作好的U盘插入被测板卡启动(支持3A5000,2K2000,2K1000,2K1500处理器),root登录,空密码,ls查看有以下目录
    Welcome to Buildroot
    buildroot login: root
    No mail.
    # ls
    2k0500	2k1500	3a5000	      dpdk-l2fwd    hugepage.sh
    2k1000	2k2000	dpdk-bind.sh  dpdk-testpmd  setmrs.sh
    说明:
    //CPU型号目录下存放对应的igb_uio文件
    //uio已经编译到内核
    //hugepage.sh 设置大页内存
    //setmrs.sh 无需设置
    //dpdk-bin.sh 用于绑定接口
    //dpdk-l2fwd,dpdk-testpmd 为测试程序
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    1. 运行步骤
    # 
    # insmod 2k2000/igb_uio.ko 
    [   33.543679] igb_uio: loading out-of-tree module taints kernel.
    [   33.561711] igb_uio: Use MSIX interrupt by default
    # ./hugepage.sh 
    # ./dpdk-bind.sh -b igb_uio 04:00.0
    [   51.039073] igb_uio 0000:04:00.0: mapping 1K dma=0x1a5c000 host=00000000f48b8029
    [   51.046452] igb_uio 0000:04:00.0: unmapping 1K dma=0x1a5c000 host=00000000f48b8029
    [   51.054242] pcieport 0000:00:0c.0: can't derive routing for PCI INT B
    [   51.060668] igb_uio 0000:04:00.1: PCI INT B: no GSI
    [   51.065656] igb_uio 0000:04:00.1: mapping 1K dma=0x1a5c000 host=00000000f48b8029
    [   51.073031] igb_uio 0000:04:00.1: unmapping 1K dma=0x1a5c000 host=00000000f48b8029
    # ./dpdk-bind.sh -b igb_uio 04:00.1
    [   53.200501] pcieport 0000:00:0c.0: can't derive routing for PCI INT B
    [   53.206934] igb_uio 0000:04:00.1: PCI INT B: no GSI
    [   53.212105] igb_uio 0000:04:00.1: mapping 1K dma=0x1a5c000 host=00000000f48b8029
    [   53.219470] igb_uio 0000:04:00.1: unmapping 1K dma=0x1a5c000 host=00000000f48b8029
    # ./dpdk-bind.sh -s
    0000:00:08.0 drivers ahci
    0000:04:00.0 drivers igb_uio
    0000:04:00.1 drivers igb_uio
    0000:00:16.0 drivers ls-spi-pci
    0000:00:09.0 drivers pcieport
    0000:00:0a.0 drivers pcieport
    0000:00:0b.0 drivers pcieport
    0000:00:0c.0 drivers pcieport
    0000:00:0d.0 drivers pcieport
    0000:00:0f.0 drivers pcieport
    0000:00:03.0 drivers stmmaceth
    0000:00:03.1 drivers stmmaceth
    0000:00:03.2 drivers stmmaceth
    0000:00:04.0 drivers xhci_hcd
    0000:00:19.0 drivers xhci_hcd
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    1. 运行测试程序
    # ./dpdk-testpmd -l 0,1 -- -i
    EAL: Detected CPU lcores: 2
    EAL: Detected NUMA nodes: 1
    EAL: Detected static linkage of DPDK
    EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
    EAL: Selected IOVA mode 'PA'
    [  123.025759] igb_uio 0000:04:00.0: uio device registered with irq 45
    EAL: Probe PCI driver: net_ngbe (8088:101) device: 0000:04:00.0 (socket 0)
    [  123.172799] igb_uio 0000:04:00.1: uio device registered with irq 46
    EAL: Probe PCI driver: net_ngbe (8088:101) device: 0000:04:00.1 (socket 0)
    TELEMETRY: No legacy callbacks, legacy socket not created
    Interactive-mode selected
    testpmd: create a new mbuf pool <mb_pool_0>: n=155456, size=2176, socket=0
    testpmd: preferred mempool ops selected: ring_mp_mc
    Configuring Port 0 (socket 0)
    Port 0: 8C:1C:DA:46:BF:00
    Configuring Port 1 (socket 0)
    Port 1: 8C:1C:DA:46:BF:01
    Checking link statuses...
    Done
    testpmd> start
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
  • 相关阅读:
    【javaEE】网络原理(传输层Part3)
    15 个实用的 Linux find 命令示例
    别把对象当Map
    Session基础与编程
    Glide源码解析二---into方法
    navicat创建MySql定时任务
    STM32单片机中国象棋TFT触摸屏小游戏
    基于ssm的计算机类考研资源平台管理系统(idea+spring+springmvc+mybatis+jsp)(前端+后端)
    2023年中国人防服务需求现状及行业市场规模前景分析[图]
    闪烁霓虹灯文字动画
  • 原文地址:https://blog.csdn.net/weixin_42414349/article/details/133912339