Shared EMAC

From LinuxC6xWiki

Jump to: navigation, search

Contents

Overview

  • Shared EMAC is supported in linux-c6x-0.7.1 and later releases.
  • This feature effectively demonstrates a system where we can run multiple Linux instances on a multicore DSP
  • This feature is not supported on C66x devices yet

How and where to use this feature

  • We will need to build multiple kernels for the device. We thus provide separate kernel configuration files.
  • We can use this feature only in multicore DSPs like the C6474 and the C6472
  • We will have to do some memory partitioning

What changes are required?

  • After downloading our entire software, please go to ~/my-linux-c6x/linux-c6x-project/kbuilds directory. There you will find separate configuration files for the C6474 and C6472 to run multiple instances of Linux. For example, for the C6474 we will have evmc6474-A.mk, evmc6474-B.mk and evmc6474-C.mk. The evmc6474-B.mk and evmc6474-C.mk configurations invoke patches that are in the patches/ directory to change the kernel configuration for the second and third instances of Linux.
  • If you want to change the default memory configuration of these Linux instances, you need to appropriately change CONFIG_PAGE_OFFSET in the patch and also change the "mem=" option in the kernel command line.
  • In the case of the C6474 each SOC has a total memory of 128 MB, so we give 32 MB to each core, the last 32MB is spare memory.
  • In order to share the EMAC driver, the Linux kernels is configured with the "emac_shared" option in the kernel command line. This option is not set for the first kernel (the kernel which will boot first on CORE0) but only for the other kernels (CORE1 to COREn).
  • Other drivers like sRIO, I2C, UART are disabled in the kernel configurations for CORE1 to COREn.
  • The NFS root filesystem is shared but set as "ro" (read-only) instead of "rw" (read-write) in the kernel command line for CORE1 to COREn.

Building kernels

To build the kernels, modify the setenv script

For the C6474, please change the EXTRA_KERNELS_TO_BUILD in the setenv script

export EXTRA_KERNELS_TO_BUILD=“evmc6474-A evmc6474-B evmc6474-C”

Similarly for C6472

export EXTRA_KERNELS_TO_BUILD=“evmc6472-A evmc6472-B evmc6472-C evmc6472-D evmc6472-E evmc6472-F”

- evmc6474-A is for core 0 and evmc6474-B for core 1 and so forth on EVM6474 with shared EMAC (sRIO and EDMA are disabled for core 1 & 2)

- evmc6472-A is for core 0 and evmc6472-B for core 1 and so forth on EVM6472 with shared EMAC (I2C, NAND, sRIO, and EDMA are disabled for core 1-5)

Then issue the "make" command and pick up the kernels from the product directory (e.g: vmlinux-2.6.34-evmc6474.el-20101108-A, vmlinux-2.6.34-evmc6474.el-20101108-B).

Steps to load the multiple kernels

  • The kernel image naming convention is suffix "-A" for CORE0, suffix "-B" for CORE1 and so forth.
  • Please load the first kernel (with suffix "-A") in CORE0 and run the kernel from CCS.
  • You should be able to telnet into the EVM
  • Then load the second kernel (with suffix "-B") in CORE1 and run the kernel from CCS. Please observe the console output to note the EMAC address and the IP address for the second instance of linux
  • Repeat this for other cores.
  • You will not be able to telnet into the EVM without doing one of the following
    • To telnet the second Linux instance, issue the telnet command from the NFS server itself on the linux host
    • OR, if using Windows, you can use arp -s command to attach the IP address of the second core Linux to the EMAC address of the second core and then issue telnet command
  • The illustration below shows the Linux instances running on three different cores of the C6474

File:Shared-emac.JPG

Communicating with other Linux instances using Virtio Net

You can communicate with TCP/IP to other Linux instances (kernels running on the other cores) using the Virtio Net kernel feature. It provides a virtual network interface that is connected to the other Linux instances using IPC mechanisms.

The feature is set by default in the configuration files provided in example. For info, this is set by activating the CONFIG_IPC, CONFIG_VIRTIO_IPC, CONFIG_VIRTIO, CONFIG_VIRTIO_RING and CONFIG_VIRTIO_NET features.

Warning: When these kernel features are enabled, you can no more use the SysLink feature.

To activate and use the Virtio net interfaces, you must execute the "ifconfig -a" on each Linux instance.

You will get the following interfaces:

eth0      Link encap:Ethernet  HWaddr 00:24:BA:3A:37:F8
          inet addr:137.167.34.21  Bcast:137.167.34.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4258 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2030 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1694440 (1.6 MiB)  TX bytes:306759 (299.5 KiB)
          Interrupt:6

eth1      Link encap:Ethernet  HWaddr 00:01:00:01:00:00
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth2      Link encap:Ethernet  HWaddr 00:01:01:00:00:00
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:87 errors:0 dropped:0 overruns:0 frame:0
          TX packets:53 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5825 (5.6 KiB)  TX bytes:8265 (8.0 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

The Virtio Net interfaces have a 00:01:01:00:xx:xx MAC address (HWaddr). In the previous example it is the eth2 interface.

You only have to set tis interface up with an associated IP address:

# ifconfig eth2 192.168.0.1

You need to do the same on the other core. For example on the second Linux instance:

# ifconfig eth1 192.168.0.2

Then you can ping or telnet from a Linux instance to another one.

For example when logged on the first Linux instance:

/root # cat /proc/cpuinfo
CPU:            C64x+
Core revision:  0x5
Core voltage:   1.2
Core id:        0
SoC cores:      3
MMU:            none
FPU:            none
Silicon rev:    2.1
Clocking:       1000MHz
BogoMips:       999.42
Calibration:    1998848 loops
/root # ping 192.168.0.2
PING 192.168.0.2 (192.168.0.2): 56 data bytes
64 bytes from 192.168.0.2: seq=0 ttl=64 time=0.221 ms
64 bytes from 192.168.0.2: seq=1 ttl=64 time=0.117 ms
64 bytes from 192.168.0.2: seq=2 ttl=64 time=0.120 ms
^C
--- 192.168.0.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.117/0.152/0.221 ms
/root #
/root # telnet 192.168.0.2

Entering character mode
Escape character is '^]'.

localhost login: root
/root # cat /proc/cpuinfo
CPU:            C64x+
Core revision:  0x5
Core voltage:   1.2
Core id:        1
SoC cores:      3
MMU:            none
FPU:            none
Silicon rev:    2.1
Clocking:       1000MHz
BogoMips:       999.42
Calibration:    1998848 loops
/root #
Personal tools
Create a book