sunbory
sunbory

Reputation: 1

how can I config virtio-net-pci to emulate a big endian linux for qemu-system-aarch64 running at a little endian

I emulate big endian linux by qemu-system-aarch64 with '-device virtio-net-pci' running at a little endian, and get the following error when i run dpdk l3fwd example.

#./examples/dpdk-l3fwd --log-level=pmd,8 -l 0 -- -p 0xf -L --config="(0,0,0)" --parse-ptype
EAL: Detected CPU lcores: 8
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'
EAL: Probe PCI driver: net_virtio (1af4:1000) device: 0000:00:02.0 (socket 0)
[  150.096996] igb_uio 0000:00:02.0: uio device registered with irq 44
virtio_read_caps(): [98] skipping non VNDR cap id: 11
virtio_read_caps(): [84] cfg type: 5, bar: 0, offset: 0000, len: 0
virtio_read_caps(): [70] cfg type: 2, bar: 4, offset: 300000, len: 1048576
get_cfg_addr(): invalid cap: overflows bar space: 4194304 > 16384
virtio_read_caps(): [60] cfg type: 4, bar: 4, offset: 200000, len: 1048576
get_cfg_addr(): invalid cap: overflows bar space: 3145728 > 16384
virtio_read_caps(): [50] cfg type: 3, bar: 4, offset: 100000, len: 1048576
get_cfg_addr(): invalid cap: overflows bar space: 2097152 > 16384
virtio_read_caps(): [40] cfg type: 1, bar: 4, offset: 0000, len: 1048576
get_cfg_addr(): invalid cap: overflows bar space: 1048576 > 16384
virtio_read_caps(): no modern virtio pci device found.
vtpci_init(): trying with legacy virtio pci.
EAL: Cannot mmap IO port resource: No such device
eth_virtio_pci_init(): Failed to init PCI device
EAL: Requested device 0000:00:02.0 cannot be used
EAL: Probe PCI driver: net_virtio (1af4:1000) device: 0000:00:03.0 (socket 0)
virtio_read_caps(): failed to map pci device!
vtpci_init(): trying with legacy virtio pci.
vtpci_init(): skip kernel managed virtio device.
eth_virtio_pci_init(): Failed to init PCI device
EAL: Requested device 0000:00:03.0 cannot be used
TELEMETRY: No legacy callbacks, legacy socket not created
soft parse-ptype is enabled
L3FWD: Missing 1 or more rule files, using default instead
port 0 is not present on the board
EAL: Error - exiting with code: 1
  Cause: check_port_config failed

I find that it read config with following code in function virtio_read_caps

        ret = rte_pci_read_config(pci_dev, &cap, sizeof(cap), pos);
        if (ret != sizeof(cap)) {
            PMD_INIT_LOG(DEBUG,
                     "failed to read pci cap at pos: %x ret %d",
                     pos, ret);
            break;
        }

with definition of virtio_pci_cap as follows,

struct virtio_pci_cap {
    uint8_t cap_vndr;       /* Generic PCI field: PCI_CAP_ID_VNDR */
    uint8_t cap_next;       /* Generic PCI field: next ptr. */
    uint8_t cap_len;        /* Generic PCI field: capability length */
    uint8_t cfg_type;       /* Identifies the structure. */
    uint8_t bar;            /* Where to find it. */
    uint8_t padding[3];     /* Pad to full dword. */
    uint32_t offset;        /* Offset within bar. */
    uint32_t length;        /* Length of the structure, in bytes. */
};

so the offset and length is big-endian. but in virtio-v1.1-cs01 section 2.4, i get

Note: The device configuration space uses the little-endian format for multi-byte fields.

I guess that causes the problem, but there's no further information when i google it. It confuses me. Is it true that dpdk net/virtio driver does't support big-endian?

Upvotes: 0

Views: 803

Answers (1)

Vipin Varghese
Vipin Varghese

Reputation: 4798

there is option listed in QEMU for changing the endianness. Please refer

VHOST_USER_SET_VRING_ENDIAN
id: 23
equivalent ioctl:
    VHOST_SET_VRING_ENDIAN
master payload: vring state description
Set the endianness of a VQ for legacy devices. Little-endian is indicated with state.num set to 0 and big-endian is indicated with state.num set to 1. Other values are invalid.

This request should be sent only when VHOST_USER_PROTOCOL_F_CROSS_ENDIAN has been negotiated. Backends that negotiated this feature should handle both endiannesses and expect this message once (per VQ) during device configuration (ie. before the master starts the VQ).

Note: I am not aware of the setting to be passed in KVM-QEMU (libxml) achieve the same.

Upvotes: 0

Related Questions