Giter Site home page Giter Site logo

dma_ip_drivers's Introduction

Xilinx DMA IP Reference drivers

Xilinx QDMA

The Xilinx PCI Express Multi Queue DMA (QDMA) IP provides high-performance direct memory access (DMA) via PCI Express. The PCIe QDMA can be implemented in UltraScale+ devices.

Both the linux kernel driver and the DPDK driver can be run on a PCI Express root port host PC to interact with the QDMA endpoint IP via PCI Express.

Getting Started

Xilinx-VSEC (XVSEC)

Xilinx-VSEC (XVSEC) are Xilinx supported VSECs. The XVSEC Driver helps creating and deploying designs that may include the Xilinx VSEC PCIe Features.

VSEC (Vendor Specific Extended Capability) is a feature of PCIe.

The VSEC itself is implemented in the PCIe extended capability register in the FPGA hardware (as either soft or hard IP). The drivers and SW are created to interface with and use this hardware implemented feature.

The XVSEC driver currently include the MCAP VSEC, but will be expanded to include the XVC VSEC and NULL VSEC.

Getting Started

Support

Refer to Xilinx PCIe Forum for any queries/issues/support required w.r.t Xilinx's DMA IP Reference Drivers

Note: Issues are disabled in github for these drivers. All the queries shall be redirected through Xilinx PCIe Forum link given below.

dma_ip_drivers's People

Contributors

bhathaway avatar devegali avatar jberaud avatar jrtc27 avatar karenx-xilinx avatar lmu-silicom avatar mattsnow-amd avatar mmiglio avatar pankajdarak-xlnx avatar prasadp-xlnx avatar raghusha-xlnx avatar riggy2013 avatar schouleu avatar ssangani-xlnx avatar sujathabanoth avatar sujathabanoth-xlnx avatar thippeswamyh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dma_ip_drivers's Issues

XDMA: Driver won't compile in Ubuntu 19.04

Driver won't compile under Ubuntu 19.04 (kernel 5.0.0-29).

root@sim-pc:/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma# sudo make install
Makefile:10: XVC_FLAGS: .
make -C /lib/modules/5.0.0-29-generic/build M=/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma modules
make[1]: Entering directory '/usr/src/linux-headers-5.0.0-29-generic'
/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/Makefile:10: XVC_FLAGS: .
  CC [M]  /home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.o
/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.c: In function ‘engine_service_shutdown’:
/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.c:671:2: error: implicit declaration of function ‘swake_up’; did you mean ‘wake_up’? [-Werror=implicit-function-declaration]
  swake_up(&engine->shutdown_wq);
  ^~~~~~~~
  wake_up
/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.c: In function ‘xdma_xfer_submit’:
/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.c:3127:4: error: implicit declaration of function ‘swait_event_interruptible_timeout’; did you mean ‘wait_event_interruptible_timeout’? [-Werror=implicit-function-declaration]
    swait_event_interruptible_timeout(xfer->wq,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    wait_event_interruptible_timeout
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:286: /home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.o] Error 1
make[1]: *** [Makefile:1606: _module_/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.0.0-29-generic'
make: *** [Makefile:27: all] Error 2

used the latest version of the repository.

XDMA: timeouts/signal delivery during xdma_xfer_submit breaks subsequent dma.

I have a custom driver which pulls in libxdma. If I happen to interrupt a xdma_xfer_submit while it's blocked blocked on the transfer wait queue / swait queue (xfer->wq), I'm not able to submit any more DMAs until the driver is reloaded.

I'm fairly confident what the issue is, less so in the fix. After a xdma_xfer_submit times out/gets a signal, the driver immediately:

(1) engine_status_read(engine, 0, 1);
(2) transfer_abort(engine, xfer);
(3) xdma_engine_stop(engine);

Part (3) above seems to asynchronously stop the engine hw after it finishes the current descriptor it's working on. However, the software state representing whether or not the engine is running ( engine->running), is not set to zero. This means that all future dmas assume the engine is running, and queue their transfers. The engine isn't running though, so they all time out until the driver is reloaded.

My quick but likely incorrect fix is to set engine->running = 0 after xdma_engine_stop(engine), but it's unclear to me if this is safe, given that the engine stop is asynchronous. Hoping that someone with more context can provide the correct resolution.

XDMA unknown wait queue function used in sgdma.c

/xdma/cdev_sgdma.c now contains the following code:

#if	LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
        init_swait_queue_head(&engine->xdma_perf_wq);
#else
        init_waitqueue_head(&engine->xdma_perf_wq);
#endif

But there does not seem to be a function init_swait_queue_head available in Linux 5.0, nor can I find any mention of it online. Is this for a different flavour of Linux other than mainstream (E.g. PetaLinux, perhaps?)

xdma driver 512 error

I am using 1 stream interface with xdma configured as gen2x2, with vcu1525

i have instaled drivers and performed loopback test etc, works fine,

However, when i run my design initially it works well, but after some time it gives error 512,

my linux kernal version is, 5.4.45-050445-generic

here is the dmesg log

[Wed Jul 8 04:16:53 2020] xdma:xdma_mod_init: Xilinx XDMA Reference Driver xdma v2019.2.51
[Wed Jul 8 04:16:53 2020] xdma:xdma_mod_init: desc_blen_max: 0xfffffff/268435455, sgdma_timeout: 10 sec.
[Wed Jul 8 04:16:53 2020] xdma:xdma_threads_create: xdma_threads_create
[Wed Jul 8 04:16:53 2020] xdma:xdma_device_open: xdma device 0000:0b:00.0, 0x000000005e92819d.
[Wed Jul 8 04:16:53 2020] xdma:map_single_bar: BAR0 at 0xfce00000 mapped at 0x0000000055943a4f, length=65536(/65536)
[Wed Jul 8 04:16:53 2020] xdma:map_bars: config bar 0, pos 0.
[Wed Jul 8 04:16:53 2020] xdma:identify_bars: 1 BARs: config 0, user -1, bypass -1.
[Wed Jul 8 04:16:53 2020] xdma:probe_one: 0000:0b:00.0 xdma0, pdev 0x000000005e92819d, xdev 0x0000000075c79a4a, 0x000000008d1118f1, usr 16, ch 1,1.
[Wed Jul 8 04:23:21 2020] xdma:xdma_xfer_submit: xfer 0x00000000ae8f65d9,32, s 0x1 timed out, ep 0x20.
[Wed Jul 8 04:23:21 2020] xdma:engine_reg_dump: 0-C2H0-ST: ioread32(0x000000003470a31b) = 0xffffffff (id).
[Wed Jul 8 04:23:21 2020] xdma:engine_reg_dump: 0-C2H0-ST: engine id missing, 0xfff00000 exp. & 0xfff00000 = 0x1fc00000
[Wed Jul 8 04:23:21 2020] xdma:engine_status_read: Failed to dump register
[Wed Jul 8 04:23:21 2020] xdma:xdma_xfer_submit: Failed to read engine status

xdma_thread.h missing

Running "make install" in the linux-kernel/xdma folder doesn't work with the latest commit due to a missing file "xdma_thread.h". Sample error:

/path/to/XDMA/linux-kernel/xdma/libxdma.c:33:10: fatal error: xdma_thread.h: No such file or directory
 #include "xdma_thread.h"

qdata->xcdev can be destroyed even if the queue isn't removed

spin_lock(&xpdev->cdev_lock);
qdata->xcdev->dir_init &= ~(1 << (c2h ? 1 : 0));
if (qdata->xcdev && !qdata->xcdev->dir_init)
qdma_cdev_destroy(qdata->xcdev);
spin_unlock(&xpdev->cdev_lock);
if (qdata->qhndl != QDMA_QUEUE_IDX_INVALID)
rv = qdma_queue_remove(xpdev->dev_hndl, qdata->qhndl,

in the case that removing the device false (say the queue was still in the "start" state) the qdata->xcdev can be freed.

[  111.122426] qdma:qdma_cdev_destroy: destroying cdev 00000000495e0073
[  111.122640] qdma:qdma_device_get_pair_descq_by_id: qdma01000-p0000:01:00.0, idx 0x0, q 0x00000000abafbfce state invalid.
[  111.122644] qdma:qdma_queue_remove: queue qdma01000-MM-0, id 0 cannot be deleted. Invalid q state
[  111.122649] qdma:xnl_q_del: xpdev_queue_delete() failed: -8
[  116.347548] qdma:xnl_dump_attrs: snd_seq 0x5ce33d9f, portid 0x29c009c5.
[  116.347554] qdma:xnl_dump_attrs: nlhdr: len 28, type 29, flags 0x1, seq 0x5ce33d9f, pid 700451269.
[  116.347555] qdma:xnl_dump_attrs: genlhdr: cmd 0x1 DEV_INFO, version 0, reserved 0x0.
[  116.347557] qdma:xnl_dump_attrs: attr DEV_IDX, u32 0x1000.
[  116.347576] qdma:xnl_dump_attrs: snd_seq 0x5ce33da0, portid 0x29c009c5.
[  116.347578] qdma:xnl_dump_attrs: nlhdr: len 52, type 29, flags 0x1, seq 0x5ce33da0, pid 700451269.
[  116.347579] qdma:xnl_dump_attrs: genlhdr: cmd 0xb Q_DEL, version 0, reserved 0x0.
[  116.347580] qdma:xnl_dump_attrs: attr DEV_IDX, u32 0x1000.
[  116.347581] qdma:xnl_dump_attrs: attr CMPT_CNTR_IDX, u32 0x0.
[  116.347583] qdma:xnl_dump_attrs: attr CMPT_TRIG_MODE, u32 0x1.
[  116.347583] qdma:xnl_dump_attrs: attr RANGE_START, u32 0x4.
[  116.347588] qdma:qdma_cdev_destroy: destroying cdev 00000000495e0073
[  116.347625] ------------[ cut here ]------------
[  116.347626] kernel BUG at /build/linux-3btXxq/linux-4.15.0/mm/slub.c:296!
[  116.347632] invalid opcode: 0000 [#1] SMP PTI
[  116.347634] Modules linked in: uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core videodev snd_usb_audio snd_usbmidi_lib media nls_iso8859_1 snd_hda_codec_hdmi intel_rapl snd_hda_codec_realtek x86_pkg_temp_thermal snd_hda_codec_generic intel_powerclamp coretemp snd_hda_intel kvm_intel snd_hda_codec kvm snd_hda_core snd_hwdep irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_pcm pcbc snd_seq_midi snd_seq_midi_event snd_rawmidi aesni_intel aes_x86_64 snd_seq crypto_simd glue_helper cryptd intel_cstate input_leds joydev snd_seq_device intel_rapl_perf snd_timer cdc_acm qdma(OE) i915 snd soundcore qdma_vf(OE) drm_kms_helper lpc_ich wmi drm i2c_algo_bit fb_sys_fops syscopyarea ie31200_edac sysfillrect sysimgblt mei_me shpchp mei mac_hid intel_smartconnect video sch_fq_codel
[  116.347677]  parport_pc ppdev lp parport ip_tables x_tables autofs4 hid_generic usbhid hid ahci r8169 libahci mii
[  116.347697] CPU: 0 PID: 2501 Comm: dmactl Tainted: G           OE    4.15.0-50-generic #54-Ubuntu
[  116.347698] Hardware name: MSI MS-7758/Z77A-G43 (MS-7758), BIOS V2.13 03/07/2014
[  116.347712] RIP: 0010:__slab_free+0x17a/0x2c0
[  116.347714] RSP: 0018:ffffadc7099bf7a0 EFLAGS: 00010246
[  116.347717] RAX: ffff92b4b92fe900 RBX: ffff92b4b92fe900 RCX: 0000000180100004
[  116.347719] RDX: ffff92b4b92fe900 RSI: ffffd49ddfe4bf80 RDI: ffff92b4bec03200
[  116.347721] RBP: ffffadc7099bf840 R08: 0000000000000001 R09: ffffffffc06920fb
[  116.347723] R10: ffffadc7099bf858 R11: 0000000000000004 R12: ffff92b4bec03200
[  116.347725] R13: ffffd49ddfe4bf80 R14: ffff92b4b92fe900 R15: ffff92b4b6f60060
[  116.347727] FS:  00007f0f12987f40(0000) GS:ffff92b4df200000(0000) knlGS:0000000000000000
[  116.347730] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  116.347732] CR2: 0000564551570000 CR3: 0000000782070001 CR4: 00000000001606f0
[  116.347734] Call Trace:
[  116.347739]  ? invalid_op+0x1b/0x40
[  116.347750]  ? qdma_cdev_destroy+0x5b/0x80 [qdma]
[  116.347754]  kfree+0x165/0x180
[  116.347757]  ? kfree+0x165/0x180
[  116.347763]  qdma_cdev_destroy+0x5b/0x80 [qdma]
[  116.347770]  xpdev_queue_delete+0x119/0x130 [qdma]
[  116.347776]  xnl_q_del.part.12+0x163/0x260 [qdma]
[  116.347781]  ? skb_queue_tail+0x43/0x50
[  116.347785]  ? __netlink_sendskb+0x44/0x70
[  116.347788]  ? netlink_unicast+0x20c/0x240
[  116.347795]  ? xnl_dev_info+0x236/0x300 [qdma]
[  116.347802]  xnl_q_del+0x16/0x20 [qdma]
[  116.347805]  genl_family_rcv_msg+0x1fe/0x3f0
[  116.347808]  ? __netlink_sendskb+0x44/0x70
[  116.347812]  genl_rcv_msg+0x4c/0x90
[  116.347814]  ? genl_family_rcv_msg+0x3f0/0x3f0
[  116.347818]  netlink_rcv_skb+0x54/0x130
[  116.347821]  genl_rcv+0x28/0x40
[  116.347824]  netlink_unicast+0x19e/0x240
[  116.347827]  netlink_sendmsg+0x2d1/0x3d0
[  116.347831]  sock_sendmsg+0x3e/0x50
[  116.347835]  ___sys_sendmsg+0x2a0/0x2f0
[  116.347840]  ? lru_cache_add_active_or_unevictable+0x36/0xb0
[  116.347844]  ? handle_pte_fault+0x4f7/0xce0
[  116.347848]  ? __handle_mm_fault+0x478/0x5c0
[  116.347852]  __sys_sendmsg+0x54/0x90
[  116.347855]  ? __sys_sendmsg+0x54/0x90
[  116.347859]  SyS_sendmsg+0x12/0x20
[  116.347863]  do_syscall_64+0x73/0x130
[  116.347866]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[  116.347869] RIP: 0033:0x7f0f12085d04
[  116.347871] RSP: 002b:00007fff6137e568 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
[  116.347874] RAX: ffffffffffffffda RBX: 000056455156d990 RCX: 00007f0f12085d04
[  116.347876] RDX: 0000000000000000 RSI: 00007fff6137e5a0 RDI: 0000000000000003
[  116.347877] RBP: 000056455156dc20 R08: 0000000000000014 R09: 000056455156ed20
[  116.347879] R10: 000056455156d010 R11: 0000000000000246 R12: 000056455156d8a0
[  116.347881] R13: 00007fff6137e5a0 R14: 0000000000000000 R15: 0000000000000000
[  116.347884] Code: 0f 84 ee fe ff ff 44 0f b6 7d 8b 80 7d ab 00 79 05 45 84 ff 74 61 48 83 c4 70 5b 41 5a 41 5c 41 5d 41 5e 41 5f 5d 49 8d 62 f8 c3 <0f> 0b 4c 89 d0 4c 89 d7 45 89 fa 48 85 c0 44 0f b6 7d 8b 74 cb 
[  116.347923] RIP: __slab_free+0x17a/0x2c0 RSP: ffffadc7099bf7a0
[  116.347933] ---[ end trace f34e0c4b49b7dff0 ]---

dmactl returns 0 even upon failure

(base) mark@mark-MS-7758:~/git/dma_ip_drivers/QDMA/linux-kernel/user$ ./dmactl qdma01000 q start idx 0 dir h2c idx_ringsz 5

qdma01000-MM-0 invalid state, q_state 2.

(base) mark@mark-MS-7758:~/git/dma_ip_drivers/QDMA/linux-kernel/user$ echo $?
0

invalid state seems to imply failure, but the return code of dmactl is still 0

I thought it was due to the fact that recv_nl_msg ignored the return value of recv_attrs but that doesn't seem to be the case.

From 6d54ab0f91c49f1c8a6d01c99ec37ad8347e7afd Mon Sep 17 00:00:00 2001
From: Mark Harfouche <[email protected]>
Date: Tue, 14 May 2019 17:55:36 -0400
Subject: [PATCH] return recv_attrs if it failes.

---
 QDMA/linux-kernel/user/cli/nl_user.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/QDMA/linux-kernel/user/cli/nl_user.c b/QDMA/linux-kernel/user/cli/nl_user.c
index 24746df..8335119 100644
--- a/QDMA/linux-kernel/user/cli/nl_user.c
+++ b/QDMA/linux-kernel/user/cli/nl_user.c
@@ -327,7 +327,9 @@ static int recv_nl_msg(struct xnl_hdr *hdr, struct xcmd_info *xcmd)
 	unsigned int op = hdr->g.cmd;
 	unsigned int usr_bar;
 
-	recv_attrs(hdr, xcmd);
+	int rv = recv_attrs(hdr, xcmd);
+	if (rv)
+		return rv;
 
 	switch(op) {
 	case XNL_CMD_DEV_LIST:

Thoughts?

Potential erroneous freeing of resources in qdma_queue_start

Hey sorry for posting so many issues

rv = qdma_descq_config_complete(descq);
if (rv < 0) {
pr_err("%s 0x%x setup failed.\n",
descq->conf.name, descq->qidx_hw);
if (buf && buflen) {
int l = strlen(buf);
l += snprintf(buf + l, buflen,
"%s config failed.\n", descq->conf.name);
buf[l] = '\0';
}
goto free_resource;
}

This statement goes to free_resources but "resources" are allocated below in the call to

/** allocate the queue resources*/
rv = qdma_descq_alloc_resource(descq);

It seems like it should just return immediately right???

Could be related to #13

QDMA 2019.1 : Unable to add AXIMM H2C and AXIMM C2H Queues and additional issues as mentioned below

Board: Alveo- U50DD
Environment details:
Machine Make and Model : x3650 M4
Operating System: Red Hat Enterprise Linux Server release 7.6 (Maipo)
Kernel version: 3.10.0-957.el7.x86_64

After make , make install and make install-mods , we attempted to add AXI-MM C2H and AXI-MM H2C Queues. However the queues did not get added with output as below .
dmactl qdma8b000 q add idx 0 mode mm dir h2c
Zero Qs

On checking dmactl dev list below was the output.
qdma8b000 0000:8b:00.0 max QP: 0, -~-
However the output should be:
qdma82000 0000:82:00.0 max QP: 512, 0~511

On debugging further below are the observations:

  1. root@ XXX.XX.XXX.XX: /sys/bus/pci/devices/0000:8b:00.0/qdma
    $ cat qmax
    0

    This should have been automatically populated to 512.
    We manually updated the same as 'echo 512 > qmax based on the article.
    https://forums.xilinx.com/t5/PCIe-and-CPM/QDMA-dmactl-can-not-create-queue/td-p/1078463
    After that we again attempted to add a queue. However that did not work as well as the other fs fles need to be populated as well.
  2. On further look we could see qdma error in dmesg as below:
    "qdma:qdma_csr_read: Hardware Feature not supported"

Then taking a deep dive into qdma driver code 2019.1 version we could see the below code in qdma_access.c line number 1943.
if (dev_cap->st_en || dev_cap->mm_cmpt_en)
qdma_read_csr_values(dev_hndl, QDMA_OFFSET_C2H_TIMER_CNT, index,
count, glbl_tmr_cnt);

However when I look at the qdma_ip version 3.0 on Vivado 2019.2 I can see that theres no support for AXI-MM with completion infact that option is not available in the main menu.
Attempting to fix the issue I've modified the above check to
if (dev_cap->st_en || dev_cap->mm_en) in all the qdma code locally.
Seems to fix the issues we were facing and the H2C and C2H are up and running. Having said that the
dmactl qdma8b000 q list is not yet showing the C2H queue.
However need to know if this is the correct direction of the fix as the qdma-driver doesn't seem to be reflecting what the QDMA IP features. By that what I mean is if AXI-MM with completion is not supported by the QDMA IP 3.0 Vivado 2019.1 in hardware how can the code check for the mm_cmpt_en.

Below is the diff of the code fix ive applied locally. Please ignore the Makefile changes.
_$ git diff
diff --git a/QDMA/linux-kernel/Makefile b/QDMA/linux-kernel/Makefile
index 8ffc4c4..62cf6e3 100644
--- a/QDMA/linux-kernel/Makefile
+++ b/QDMA/linux-kernel/Makefile
@@ -21,6 +21,10 @@ grep = grep 2>/dev/null

ALL subdirectories

ALLSUBDIRS := drv
DRIVER_SRC_DIR := drv
+#DEBUG := 1
+#DEBUGFS := 1
+# DEBUG_THREADS := 1
+# ERR_DEBUG := 1

subdirectories to be build

SUBDIRS := $(ALLSUBDIRS)
diff --git a/QDMA/linux-kernel/libqdma/qdma_access/qdma_access.c b/QDMA/linux-kernel/libqdma/qdma_access/qdma_access.c
index cd7aee0..0fc29af 100644
--- a/QDMA/linux-kernel/libqdma/qdma_access/qdma_access.c
+++ b/QDMA/linux-kernel/libqdma/qdma_access/qdma_access.c
@@ -1805,7 +1805,7 @@ int qdma_set_default_global_csr(void *dev_hndl)
qdma_write_csr_values(dev_hndl, QDMA_OFFSET_GLBL_RNG_SZ, 0,
QDMA_NUM_RING_SIZES, rng_sz);

  •   if (dev_cap->st_en || dev_cap->mm_cmpt_en) {
    
  •   if (dev_cap->st_en || dev_cap->mm_en) {
              /* Counter thresholds */
              qdma_write_csr_values(dev_hndl, QDMA_OFFSET_C2H_CNT_TH, 0,
                              QDMA_NUM_C2H_COUNTERS, cnt_th);
    

@@ -1918,7 +1918,7 @@ int qdma_set_global_timer_count(void *dev_hndl, uint8_t index, uint8_t count,

    qdma_get_device_attr(dev_hndl, &dev_cap);
  •   if (dev_cap->st_en || dev_cap->mm_cmpt_en)
    
  •   if (dev_cap->st_en || dev_cap->mm_en)
              qdma_write_csr_values(dev_hndl, QDMA_OFFSET_C2H_TIMER_CNT,
                              index, count, glbl_tmr_cnt);
      else
    

@@ -1940,7 +1940,7 @@ int qdma_get_global_timer_count(void *dev_hndl, uint8_t index, uint8_t count,

    qdma_get_device_attr(dev_hndl, &dev_cap);
  •   if (dev_cap->st_en || dev_cap->mm_cmpt_en)
    
  •   if (dev_cap->st_en || dev_cap->mm_en)
              qdma_read_csr_values(dev_hndl, QDMA_OFFSET_C2H_TIMER_CNT, index,
                              count, glbl_tmr_cnt);
      else
    

@@ -1962,7 +1962,7 @@ int qdma_set_global_counter_threshold(void *dev_hndl, uint8_t index,

    qdma_get_device_attr(dev_hndl, &dev_cap);
  •   if (dev_cap->st_en || dev_cap->mm_cmpt_en)
    
  •   if (dev_cap->st_en || dev_cap->mm_en)
              qdma_write_csr_values(dev_hndl, QDMA_OFFSET_C2H_CNT_TH, index,
                              count, glbl_cnt_th);
      else
    

@@ -1984,7 +1984,7 @@ int qdma_get_global_counter_threshold(void *dev_hndl, uint8_t index,

    qdma_get_device_attr(dev_hndl, &dev_cap);
  •   if (dev_cap->st_en || dev_cap->mm_cmpt_en)
    
  •   if (dev_cap->st_en || dev_cap->mm_en)
              qdma_read_csr_values(dev_hndl, QDMA_OFFSET_C2H_CNT_TH, index,_
    

QDMA_Linux: bug in qdma_cdev_destroy???

Not too sure how I got this to happen. But this is the basic history that I think can help recreate it.

All of this is being run as my own user, (with the fixed up udev rules).

I think there are a few timing bugs in the dmautils app, which is why while qdma01000-MM-0 was created, it claims it can't find it, and just shuts down.

$ ./dmautils -c config/dmautils_config/mm-bi/mm_1_1/bi_mm_1_1_64                                                                                      
dmactl qdma01000 q add idx 0 mode mm dir h2c

qdma01000-MM-0 H2C added.
Added 1 Queues.

dmactl qdma01000 q start idx 0 dir h2c idx_ringsz 5

1 Queues started, idx 0 ~ 0.

Error: Cannot find /dev/qdma01000-MM-0
mark@mark-MS-7758 ~/g/d/Q/l/tools human_readable_error_message|+2⚑ 1                                                                                  
$ dmactl qdma01000 q del idx 0 mode mm dir h2c                                                                                                        

queue qdma01000-MM-0, id 0 cannot be deleted. Invalid q state

dmactl: Warn: Ignoring attr: mode
mark@mark-MS-7758 ~/g/d/Q/l/tools human_readable_error_message|+2⚑ 1                                                                                  
$ dmactl qdma01000 q stop idx 0 mode mm dir h2c                                                                                                       

Stopped Queues 0 -> 0.

dmactl: Warn: Ignoring attr: mode
mark@mark-MS-7758 ~/g/d/Q/l/tools human_readable_error_message|+2⚑ 1                                                                                  
$ dmactl qdma01000 q del idx 0 mode mm dir h2c                                                                                                        
dmactl: Warn: Ignoring attr: mode
Segmentation fault (core dumped)
mark@mark-MS-7758 ~/g/d/Q/l/tools human_readable_error_message|+2⚑ 1                                                                                  
$ dmactl qdma01000 q del idx 0 mode mm dir h2c                                                                                                        
dmactl: Warn: Ignoring attr: mode
^C^C^C^C^C^C^C^C^C^C^C
[   56.515057] qdma:xnl_q_start: qdma_queue_reconfig() failed: -8
[   58.630003] qdma:qdma_queue_reconfig: qdma01000-MM-0 invalid state, q_state 2.
[   58.630006] qdma:xnl_q_start: qdma_queue_reconfig() failed: -8
[   59.211169] qdma:qdma_queue_reconfig: qdma01000-MM-0 invalid state, q_state 2.
[   59.211172] qdma:xnl_q_start: qdma_queue_reconfig() failed: -8
[   59.638692] qdma:qdma_queue_reconfig: qdma01000-MM-0 invalid state, q_state 2.
[   59.638695] qdma:xnl_q_start: qdma_queue_reconfig() failed: -8
[ 1133.315622] qdma:xnl_q_del: xpdev_queue_delete() failed: -8
[ 1139.733050] ------------[ cut here ]------------
[ 1139.733054] kernel BUG at /build/linux-fkZVDM/linux-4.15.0/mm/slub.c:296!
[ 1139.733057] invalid opcode: 0000 [#1] SMP PTI
[ 1139.733059] Modules linked in: nls_iso8859_1 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm snd_hda_intel snd_hda_codec snd_hda_core irqbypass snd_hwdep crct10dif_pclmul snd_pcm crc32_pclmul ghash_clmulni_intel pcbc snd_seq_midi snd_seq_midi_event aesni_intel joydev input_leds aes_x86_64 crypto_simd glue_helper snd_rawmidi cryptd intel_cstate i915 intel_rapl_perf snd_seq snd_seq_device qdma(OE) snd_timer drm_kms_helper qdma_vf(OE) wmi snd drm i2c_algo_bit fb_sys_fops syscopyarea sysfillrect soundcore sysimgblt lpc_ich mei_me shpchp mac_hid mei video ie31200_edac intel_smartconnect sch_fq_codel parport_pc ppdev lp parport ip_tables x_tables autofs4 hid_generic usbhid hid r8169 ahci libahci mii
[ 1139.733113] CPU: 3 PID: 3413 Comm: dmactl Tainted: G           OE    4.15.0-48-generic #51-Ubuntu
[ 1139.733115] Hardware name: MSI MS-7758/Z77A-G43 (MS-7758), BIOS V2.13 03/07/2014
[ 1139.733123] RIP: 0010:__slab_free+0x17a/0x2c0
[ 1139.733126] RSP: 0018:ffffbbbc8a35b890 EFLAGS: 00010246
[ 1139.733129] RAX: ffff990f29366100 RBX: ffff990f29366100 RCX: 0000000180100002
[ 1139.733131] RDX: ffff990f29366100 RSI: fffff11e1ca4d980 RDI: ffff990ffec03200
[ 1139.733133] RBP: ffffbbbc8a35b930 R08: 0000000000000001 R09: ffffffffc0464fbe
[ 1139.733136] R10: ffffbbbc8a35b950 R11: 0000000000000100 R12: ffff990ffec03200
[ 1139.733138] R13: fffff11e1ca4d980 R14: ffff990f29366100 R15: 0000000000000100
[ 1139.733141] FS:  00007ff92a6aa500(0000) GS:ffff99101f380000(0000) knlGS:0000000000000000
[ 1139.733144] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1139.733146] CR2: 0000564938c8a000 CR3: 0000000794dbe002 CR4: 00000000001606e0
[ 1139.733149] Call Trace:
[ 1139.733156]  ? invalid_op+0x1b/0x40
[ 1139.733169]  ? qdma_cdev_destroy+0x3e/0x80 [qdma]
[ 1139.733173]  kfree+0x165/0x180
[ 1139.733177]  ? kfree+0x165/0x180
[ 1139.733184]  qdma_cdev_destroy+0x3e/0x80 [qdma]
[ 1139.733192]  xpdev_queue_delete+0xef/0x130 [qdma]
[ 1139.733199]  xnl_q_del.part.12+0x158/0x250 [qdma]
[ 1139.733205]  ? skb_queue_tail+0x43/0x50
[ 1139.733210]  ? __netlink_sendskb+0x44/0x70
[ 1139.733214]  ? netlink_unicast+0x20c/0x240
[ 1139.733221]  ? xnl_dev_info+0x22e/0x300 [qdma]
[ 1139.733229]  xnl_q_del+0x16/0x20 [qdma]
[ 1139.733233]  genl_family_rcv_msg+0x1fe/0x3f0
[ 1139.733238]  ? get_page_from_freelist+0xf16/0x1400
[ 1139.733242]  ? enqueue_task_fair+0xa1/0x7f0
[ 1139.733247]  genl_rcv_msg+0x4c/0x90
[ 1139.733250]  ? genl_family_rcv_msg+0x3f0/0x3f0
[ 1139.733254]  netlink_rcv_skb+0x54/0x130
[ 1139.733258]  genl_rcv+0x28/0x40
[ 1139.733261]  netlink_unicast+0x19e/0x240
[ 1139.733265]  netlink_sendmsg+0x2d1/0x3d0
[ 1139.733271]  sock_sendmsg+0x3e/0x50
[ 1139.733275]  SYSC_sendto+0x13f/0x180
[ 1139.733282]  ? __do_page_fault+0x270/0x4d0
[ 1139.733286]  SyS_sendto+0xe/0x10
[ 1139.733292]  do_syscall_64+0x73/0x130
[ 1139.733295]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[ 1139.733299] RIP: 0033:0x7ff92a1cada7
[ 1139.733301] RSP: 002b:00007ffc3878b638 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
[ 1139.733304] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ff92a1cada7
[ 1139.733307] RDX: 0000000000000034 RSI: 0000564938c88380 RDI: 0000000000000003
[ 1139.733309] RBP: 00007ffc3878b670 R08: 00007ffc3878b65c R09: 000000000000000c
[ 1139.733311] R10: 0000000000000000 R11: 0000000000000246 R12: 00005649384ab320
[ 1139.733313] R13: 00007ffc3878b950 R14: 0000000000000000 R15: 0000000000000000
[ 1139.733316] Code: 0f 84 ee fe ff ff 44 0f b6 7d 8b 80 7d ab 00 79 05 45 84 ff 74 61 48 83 c4 70 5b 41 5a 41 5c 41 5d 41 5e 41 5f 5d 49 8d 62 f8 c3 <0f> 0b 4c 89 d0 4c 89 d7 45 89 fa 48 85 c0 44 0f b6 7d 8b 74 cb 
[ 1139.733363] RIP: __slab_free+0x17a/0x2c0 RSP: ffffbbbc8a35b890
[ 1139.733366] ---[ end trace e8a14e9bc0d62286 ]---

QDMA_DPDK: Compile error on CentOS 7.6

The DPDK version 17.11.1 used has one bug if compiling on CentOS 7.6 (other versions might have same issue). You need to modify the kni_net.c file, find "ndo_change_mtu" and change it to "ndo_change_mtu_rh74". Basically this field must be the same as /usr/src/kernels/xx/include/linux/netdevice.h

non-root access?

Are you accepting PRs that would enable non-root access to the device driver?

Seems like we should be able to setup a rule with udev to assign the devices to belong to a certain group.

QDMA: potential mishandling of error in xnl_rcv_check_xpdev if string buffer is too small

Whats supposed to happen here?

if (!info->attrs[XNL_ATTR_DEV_IDX]) {
rv = snprintf(err, sizeof(err),
"command %s missing attribute XNL_ATTR_DEV_IDX",
xnl_op_str[info->genlhdr->cmd]);
if (rv <= 0)
return NULL;
goto respond_error;
}

If the error buffer is too small, it doesn't follow through to goto respond_error; which doesn't sound like a good idea????

lowlatency kernel cannot use XDMA driver properly

When I load the XDMA driver with a low-latency kernel on Ubuntu1604, a segmentation fault occurs when running run_test.sh. At this time, I can see the following information through dmesg:
BUG: scheduling while atomic: dma_from_device / 3266 / 0x00000000

potential index out of bounds error in qdma_device_get_descq_by_id

int len = snprintf(buf, buflen,
"%s, q idx too big 0x%lx > 0x%x.\n",
xdev->conf.name, idx, qdev->qmax);
buf[len] = '\0';
buflen -= (len + 1);
}
return NULL;

len is actually the length of the string if it would have been written with the full text. Therefore it buf[len] can point outside buf. snprintf is guaranteed to null terminate, so we don't need to null-terminate it ourselves. Finally because of the return statement immediately after the snprintf statement, there is no need to update buflen

missing 'libaio.h' file

[root@localhost linux-kernel]# make
"distro=RHEL, dmajor=7 dminor=6 "
3.10.0-957.el7.x86_64: RHEL,7,6, -I/lib/modules/3.10.0-957.el7.x86_64/source/arch/x86/include/generated -DRHEL7SP6 -DRHEL7
CROSS_COMPILE_FLAG = .
ARCH = x86_64.
#######################

user

#######################
make -C user
make[1]: 进入目录“/home/u50/dma_ip_drivers-master/QDMA/linux-kernel/user”
cc -g -c -std=c99 -o cli/cmd_parse.o cli/cmd_parse.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE
cc -g -c -std=c99 -o cli/main.o cli/main.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE
cc -g -c -std=c99 -o ../qdmautils/qdmactl.o ../qdmautils/qdmactl.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE
cc -g -c -std=c99 -o ../qdmautils/qdmactl_reg.o ../qdmautils/qdmactl_reg.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE
cc -g -c -std=c99 -o ../qdmautils/qdmautils.o ../qdmautils/qdmautils.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE
cc -g -c -std=c99 -o ../qdmautils/dmaxfer.o ../qdmautils/dmaxfer.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE
../qdmautils/dmaxfer.c:34:20: 致命错误:libaio.h:没有那个文件或目录
#include <libaio.h>
^
编译中断。
make[1]: *** [../qdmautils/dmaxfer.o] 错误 1
make[1]: 离开目录“/home/u50/dma_ip_drivers-master/QDMA/linux-kernel/user”
make: *** [user] 错误 2

XDMA performance causes CPU to reboot

Everytime I would run performance tool the CPU in uTCA crate reboots.
XDMA bitfile is loaded onto AMC with Ultrascale FPGA.

Running ./performance -d /dev/xdma0_h2c_0 -c 1 -s 64 in one terminal, and checking tail -f /var/log/messages in another.

hinxx@obzen ~ $ ssh dev@bd-cpu06

[dev@bd-cpu06 ~]$ 
[dev@bd-cpu06 ~]$ 
[dev@bd-cpu06 ~]$ tail -f /var/log/messages

[dev@bd-cpu06 ~]$ sudo tail -f /var/log/messages
[sudo] password for dev: 
Jun 19 16:30:30 bd-cpu06 kdumpctl: kexec: loaded kdump kernel
Jun 19 16:30:30 bd-cpu06 kdumpctl: Starting kdump: [OK]
Jun 19 16:30:30 bd-cpu06 systemd: Started Crash recovery kernel arming.
Jun 19 16:30:30 bd-cpu06 systemd: Startup finished in 603ms (kernel) + 2.316s (initrd) + 11.022s (userspace) = 13.942s.
Jun 19 16:30:31 bd-cpu06 kernel: random: crng init done
Jun 19 16:30:59 bd-cpu06 systemd: Starting Stop Read-Ahead Data Collection...
Jun 19 16:30:59 bd-cpu06 systemd: Started Stop Read-Ahead Data Collection.
Jun 19 16:31:31 bd-cpu06 systemd: Created slice User Slice of dev.
Jun 19 16:31:31 bd-cpu06 systemd-logind: New session 1 of user dev.
Jun 19 16:31:31 bd-cpu06 systemd: Started Session 1 of user dev.


Jun 19 16:31:54 bd-cpu06 systemd-logind: New session 2 of user dev.
Jun 19 16:31:54 bd-cpu06 systemd: Started Session 2 of user dev.
Jun 19 16:32:13 bd-cpu06 kernel: ------------[ cut here ]------------
Jun 19 16:32:13 bd-cpu06 kernel: WARNING: CPU: 2 PID: 20 at lib/list_debug.c:62 __list_del_entry+0x82/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: list_del corruption. next->prev should be ffff8db0017d1300, but was           (null)
Jun 19 16:32:13 bd-cpu06 kernel: Modules linked in: iTCO_wdt iTCO_vendor_support intel_powerclamp coretemp intel_rapl kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd sg pcspkr cdc_acm mrf(OE) uio parport xdma(OE) snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore i2c_i801 mei_me mei lpc_ich ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic ata_generic pata_acpi i915 crct10dif_pclmul crct10dif_common crc32c_intel ata_piix libata serio_raw igb dca i2c_algo_bit iosf_mbi drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm e1000e video ptp pps_core drm_panel_orientation_quirks dm_mirror dm_region_hash dm_log dm_mod
Jun 19 16:32:13 bd-cpu06 kernel: CPU: 2 PID: 20 Comm: kworker/2:0 Kdump: loaded Tainted: G           OE  ------------   3.10.0-957.12.1.el7.x86_64 #1
Jun 19 16:32:13 bd-cpu06 kernel: Hardware name: Concurrent Technologies   AM900/x/AM 90X/X1X, BIOS 3.09.01 21/02/2017
Jun 19 16:32:13 bd-cpu06 kernel: Workqueue: events engine_service_work [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: Call Trace:
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7163021>] dump_stack+0x19/0x1b
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a97688>] __warn+0xd8/0x100
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a9770f>] warn_slowpath_fmt+0x5f/0x80
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d950e2>] __list_del_entry+0x82/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d9513d>] list_del+0xd/0x30
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ea73>] engine_service_final_transfer+0x93/0x240 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ed12>] engine_service+0xf2/0x250 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063f87a>] engine_service_work+0xba/0xc0 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ab9d8f>] process_one_work+0x17f/0x440
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abae26>] worker_thread+0x126/0x3c0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abad00>] ? manage_workers.isra.25+0x2a0/0x2a0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1c71>] kthread+0xd1/0xe0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7175bf7>] ret_from_fork_nospec_begin+0x21/0x21
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: ---[ end trace 782aec7c1eaf1173 ]---
Jun 19 16:32:13 bd-cpu06 kernel: xdma:engine_service_resume: re-started 0-H2C0-MM engine with pending xfer 0xffff8db0017d1300
Jun 19 16:32:13 bd-cpu06 kernel: ------------[ cut here ]------------
Jun 19 16:32:13 bd-cpu06 kernel: WARNING: CPU: 3 PID: 62 at lib/list_debug.c:53 __list_del_entry+0x63/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: list_del corruption, ffff8db0017d1300->next is LIST_POISON1 (dead000000000100)
Jun 19 16:32:13 bd-cpu06 kernel: Modules linked in: iTCO_wdt iTCO_vendor_support intel_powerclamp coretemp intel_rapl kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd sg pcspkr cdc_acm mrf(OE) uio parport xdma(OE) snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore i2c_i801 mei_me mei lpc_ich ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic ata_generic pata_acpi i915 crct10dif_pclmul crct10dif_common crc32c_intel ata_piix libata serio_raw igb dca i2c_algo_bit iosf_mbi drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm e1000e video ptp pps_core drm_panel_orientation_quirks dm_mirror dm_region_hash dm_log dm_mod
Jun 19 16:32:13 bd-cpu06 kernel: CPU: 3 PID: 62 Comm: kworker/3:1 Kdump: loaded Tainted: G        W  OE  ------------   3.10.0-957.12.1.el7.x86_64 #1
Jun 19 16:32:13 bd-cpu06 kernel: Hardware name: Concurrent Technologies   AM900/x/AM 90X/X1X, BIOS 3.09.01 21/02/2017
Jun 19 16:32:13 bd-cpu06 kernel: Workqueue: events engine_service_work [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: Call Trace:
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7163021>] dump_stack+0x19/0x1b
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a97688>] __warn+0xd8/0x100
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a9770f>] warn_slowpath_fmt+0x5f/0x80
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d950c3>] __list_del_entry+0x63/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d9513d>] list_del+0xd/0x30
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ea73>] engine_service_final_transfer+0x93/0x240 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ed12>] engine_service+0xf2/0x250 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063f87a>] engine_service_work+0xba/0xc0 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ab9d8f>] process_one_work+0x17f/0x440
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abae26>] worker_thread+0x126/0x3c0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abad00>] ? manage_workers.isra.25+0x2a0/0x2a0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1c71>] kthread+0xd1/0xe0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7175bf7>] ret_from_fork_nospec_begin+0x21/0x21
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: ---[ end trace 782aec7c1eaf1174 ]---
Jun 19 16:32:13 bd-cpu06 kernel: xdma:engine_service_resume: re-started 0-H2C0-MM engine with pending xfer 0xffff8db0017d1300
Jun 19 16:32:13 bd-cpu06 kernel: ------------[ cut here ]------------
Jun 19 16:32:13 bd-cpu06 kernel: WARNING: CPU: 3 PID: 62 at lib/list_debug.c:53 __list_del_entry+0x63/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: list_del corruption, ffff8db0017d1300->next is LIST_POISON1 (dead000000000100)
Jun 19 16:32:13 bd-cpu06 kernel: Modules linked in: iTCO_wdt iTCO_vendor_support intel_powerclamp coretemp intel_rapl kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd sg pcspkr cdc_acm mrf(OE) uio parport xdma(OE) snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore i2c_i801 mei_me mei lpc_ich ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic ata_generic pata_acpi i915 crct10dif_pclmul crct10dif_common crc32c_intel ata_piix libata serio_raw igb dca i2c_algo_bit iosf_mbi drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm e1000e video ptp pps_core drm_panel_orientation_quirks dm_mirror dm_region_hash dm_log dm_mod
Jun 19 16:32:13 bd-cpu06 kernel: CPU: 3 PID: 62 Comm: kworker/3:1 Kdump: loaded Tainted: G        W  OE  ------------   3.10.0-957.12.1.el7.x86_64 #1
Jun 19 16:32:13 bd-cpu06 kernel: Hardware name: Concurrent Technologies   AM900/x/AM 90X/X1X, BIOS 3.09.01 21/02/2017
Jun 19 16:32:13 bd-cpu06 kernel: Workqueue: events engine_service_work [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: Call Trace:
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7163021>] dump_stack+0x19/0x1b
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a97688>] __warn+0xd8/0x100
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a9770f>] warn_slowpath_fmt+0x5f/0x80
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d950c3>] __list_del_entry+0x63/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d9513d>] list_del+0xd/0x30
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ea73>] engine_service_final_transfer+0x93/0x240 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ed12>] engine_service+0xf2/0x250 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063f87a>] engine_service_work+0xba/0xc0 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ab9d8f>] process_one_work+0x17f/0x440
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abae26>] worker_thread+0x126/0x3c0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abad00>] ? manage_workers.isra.25+0x2a0/0x2a0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1c71>] kthread+0xd1/0xe0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7175bf7>] ret_from_fork_nospec_begin+0x21/0x21
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: ---[ end trace 782aec7c1eaf1175 ]---
Jun 19 16:32:13 bd-cpu06 kernel: xdma:engine_service_resume: re-started 0-H2C0-MM engine with pending xfer 0xffff8db0017d1300
Jun 19 16:32:13 bd-cpu06 kernel: ------------[ cut here ]------------
Jun 19 16:32:13 bd-cpu06 kernel: WARNING: CPU: 2 PID: 20 at lib/list_debug.c:53 __list_del_entry+0x63/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: list_del corruption, ffff8db0017d1300->next is LIST_POISON1 (dead000000000100)
Jun 19 16:32:13 bd-cpu06 kernel: Modules linked in: iTCO_wdt iTCO_vendor_support intel_powerclamp coretemp intel_rapl kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd sg pcspkr cdc_acm mrf(OE) uio parport xdma(OE) snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore i2c_i801 mei_me mei lpc_ich ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic ata_generic pata_acpi i915 crct10dif_pclmul crct10dif_common crc32c_intel ata_piix libata serio_raw igb dca i2c_algo_bit iosf_mbi drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm e1000e video ptp pps_core drm_panel_orientation_quirks dm_mirror dm_region_hash dm_log dm_mod
Jun 19 16:32:13 bd-cpu06 kernel: CPU: 2 PID: 20 Comm: kworker/2:0 Kdump: loaded Tainted: G        W  OE  ------------   3.10.0-957.12.1.el7.x86_64 #1
Jun 19 16:32:13 bd-cpu06 kernel: Hardware name: Concurrent Technologies   AM900/x/AM 90X/X1X, BIOS 3.09.01 21/02/2017
Jun 19 16:32:13 bd-cpu06 kernel: Workqueue: events engine_service_work [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: Call Trace:
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7163021>] dump_stack+0x19/0x1b
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a97688>] __warn+0xd8/0x100
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a9770f>] warn_slowpath_fmt+0x5f/0x80
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d950c3>] __list_del_entry+0x63/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d9513d>] list_del+0xd/0x30
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ea73>] engine_service_final_transfer+0x93/0x240 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ed12>] engine_service+0xf2/0x250 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063f87a>] engine_service_work+0xba/0xc0 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ab9d8f>] process_one_work+0x17f/0x440
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abae26>] worker_thread+0x126/0x3c0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abad00>] ? manage_workers.isra.25+0x2a0/0x2a0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1c71>] kthread+0xd1/0xe0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7175bf7>] ret_from_fork_nospec_begin+0x21/0x21
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: ---[ end trace 782aec7c1eaf1176 ]---
Jun 19 16:32:13 bd-cpu06 kernel: xdma:engine_service_resume: re-started 0-H2C0-MM engine with pending xfer 0xffff8db0017d1300
Jun 19 16:32:13 bd-cpu06 kernel: ------------[ cut here ]------------
Jun 19 16:32:13 bd-cpu06 kernel: WARNING: CPU: 0 PID: 177 at lib/list_debug.c:53 __list_del_entry+0x63/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: list_del corruption, ffff8db0017d1300->next is LIST_POISON1 (dead000000000100)
Jun 19 16:32:13 bd-cpu06 kernel: Modules linked in: iTCO_wdt iTCO_vendor_support intel_powerclamp coretemp intel_rapl kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd sg pcspkr cdc_acm mrf(OE) uio parport xdma(OE) snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore i2c_i801 mei_me mei lpc_ich ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic ata_generic pata_acpi i915 crct10dif_pclmul crct10dif_common crc32c_intel ata_piix libata serio_raw igb dca i2c_algo_bit iosf_mbi drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm e1000e video ptp pps_core drm_panel_orientation_quirks dm_mirror dm_region_hash dm_log dm_mod
Jun 19 16:32:13 bd-cpu06 kernel: CPU: 0 PID: 177 Comm: kworker/0:2 Kdump: loaded Tainted: G        W  OE  ------------   3.10.0-957.12.1.el7.x86_64 #1
Jun 19 16:32:13 bd-cpu06 kernel: Hardware name: Concurrent Technologies   AM900/x/AM 90X/X1X, BIOS 3.09.01 21/02/2017
Jun 19 16:32:13 bd-cpu06 kernel: Workqueue: events engine_service_work [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: Call Trace:
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7163021>] dump_stack+0x19/0x1b
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a97688>] __warn+0xd8/0x100
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a9770f>] warn_slowpath_fmt+0x5f/0x80
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d950c3>] __list_del_entry+0x63/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d9513d>] list_del+0xd/0x30
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ea73>] engine_service_final_transfer+0x93/0x240 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ed12>] engine_service+0xf2/0x250 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063f87a>] engine_service_work+0xba/0xc0 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ab9d8f>] process_one_work+0x17f/0x440
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abae26>] worker_thread+0x126/0x3c0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abad00>] ? manage_workers.isra.25+0x2a0/0x2a0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1c71>] kthread+0xd1/0xe0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7175bf7>] ret_from_fork_nospec_begin+0x21/0x21
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: ---[ end trace 782aec7c1eaf1177 ]---
Jun 19 16:32:13 bd-cpu06 kernel: xdma:engine_service_resume: re-started 0-H2C0-MM engine with pending xfer 0xffff8db0017d1300
Jun 19 16:32:13 bd-cpu06 kernel: ------------[ cut here ]------------
Jun 19 16:32:13 bd-cpu06 kernel: WARNING: CPU: 1 PID: 2942 at lib/list_debug.c:53 __list_del_entry+0x63/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: list_del corruption, ffff8db0017d1300->next is LIST_POISON1 (dead000000000100)
Jun 19 16:32:13 bd-cpu06 kernel: Modules linked in: iTCO_wdt iTCO_vendor_support intel_powerclamp coretemp intel_rapl kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd sg pcspkr cdc_acm mrf(OE) uio parport xdma(OE) snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore i2c_i801 mei_me mei lpc_ich ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic ata_generic pata_acpi i915 crct10dif_pclmul crct10dif_common crc32c_intel ata_piix libata serio_raw igb dca i2c_algo_bit iosf_mbi drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm e1000e video ptp pps_core drm_panel_orientation_quirks dm_mirror dm_region_hash dm_log dm_mod
Jun 19 16:32:13 bd-cpu06 kernel: CPU: 1 PID: 2942 Comm: kworker/1:2 Kdump: loaded Tainted: G        W  OE  ------------   3.10.0-957.12.1.el7.x86_64 #1
Jun 19 16:32:13 bd-cpu06 kernel: Hardware name: Concurrent Technologies   AM900/x/AM 90X/X1X, BIOS 3.09.01 21/02/2017
Jun 19 16:32:13 bd-cpu06 kernel: Workqueue: events engine_service_work [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: Call Trace:
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7163021>] dump_stack+0x19/0x1b
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a97688>] __warn+0xd8/0x100
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6a9770f>] warn_slowpath_fmt+0x5f/0x80
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7168b4e>] ? __schedule+0x5de/0x890
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d950c3>] __list_del_entry+0x63/0xd0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6d9513d>] list_del+0xd/0x30
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ea73>] engine_service_final_transfer+0x93/0x240 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063ed12>] engine_service+0xf2/0x250 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffc063f87a>] engine_service_work+0xba/0xc0 [xdma]
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ab9d8f>] process_one_work+0x17f/0x440
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abae26>] worker_thread+0x126/0x3c0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6abad00>] ? manage_workers.isra.25+0x2a0/0x2a0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1c71>] kthread+0xd1/0xe0
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa7175bf7>] ret_from_fork_nospec_begin+0x21/0x21
Jun 19 16:32:13 bd-cpu06 kernel: [<ffffffffa6ac1ba0>] ? insert_kthread_work+0x40/0x40
Jun 19 16:32:13 bd-cpu06 kernel: ---[ end trace 782aec7c1eaf1178 ]---
Jun 19 16:32:13 bd-cpu06 kernel: xdma:engine_service_resume: re-started 0-H2C0-MM engine with pending xfer 0xffff8db0017d1300
Jun 19 16:32:13 bd-cpu06 kernel: ------------[ cut here ]------------

...

The log gets quite long..

Reproducible every time the performance is called.

uname -a:

Linux bd-cpu06 3.10.0-957.12.1.el7.x86_64 #1 SMP Mon Apr 29 14:59:59 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

QDMA driver crashes Linux if MSI-X not available

The QDMA driver creates a warning and crashes Linux if MSI-X is not available or the system or in the QDMA IP.

From Linux version 3.14, pci_msix_vec_count() returns -EINVAL when there is no MSI-X support or (MSI-X is disabled in the QDMA IP), but the driver checks for 0. The following kzalloc() tries to allocate (size_t)-EINVAL structs, i.e. all available memory, triggering a WARN_ON and crashing the kernel.

num_vecs = pci_msix_vec_count(xdev->conf.pdev);
pr_debug("dev %s, xdev->num_vecs = %d\n",
dev_name(&xdev->conf.pdev->dev), xdev->num_vecs);
if (num_vecs == 0) {
pr_warn("MSI-X not supported, running in polled mode\n");
return 0;
}

invalid user buffer can cause incorrect error handling in qdma_queue_add

#ifndef __QDMA_VF__
if (xdev->conf.qdma_drv_mode == LEGACY_INTR_MODE) {
rv = intr_legacy_setup(descq);
if ((rv > 0) && buf && buflen) {
/** support only 1 queue in legacy interrupt mode */
intr_legacy_clear(descq);
descq->q_state = Q_STATE_DISABLED;
pr_debug("qdma%05x - Q%u - No free queues %u/%u.\n",
xdev->conf.bdf, descq->conf.qidx,
rv, 1);
rv = -EINVAL;
cur += snprintf(cur, end - cur,
"qdma%05x No free queues %u/%u.\n",
xdev->conf.bdf, qcnt, 1);
goto rewind_qcnt;
} else if ((rv < 0) && buf && buflen) {
rv = -EINVAL;
descq->q_state = Q_STATE_DISABLED;
pr_debug("qdma%05x Legacy interrupt setup failed.\n",
xdev->conf.bdf);
cur += snprintf(cur, end - cur,
"qdma%05x Legacy interrupt setup failed.\n",
xdev->conf.bdf);
goto rewind_qcnt;
}
}

qdma_queue_add seems to need to handle non-zero return values (both positive and negative) from intr_legacy_setup

That said, if the user passes a null buffer, then this error handling is simply ignored and rv is assumed to be OK.

PS: while not document in the doc string, intr_legacy_setup seems to return 1 if

	req_irq = list_empty(&legacy_intr_q_list);
	rv = req_irq ? 0 : 1;
        [...]
        return rv;

is satisfied

QDMA 2019.2 fails on Ubuntu 20.04

When trying to load the kernel driver, dmesg reports the following:

09:12 $ dmesg | grep qdma
[  539.111014] qdma: module verification failed: signature and/or required key missing - tainting kernel
[  539.111871] qdma:qdma_mod_init: Xilinx QDMA PF Reference Driver v2019.2.125.213.
[  539.112579] qdma:probe_one: 0000:0a:00.0: func 0x0/0x4, p/v 0/0,0x0000000017f6a75d.
[  539.112581] qdma:probe_one: Configuring '0a:00:0' as master pf
[  539.112581] qdma:probe_one: Driver is loaded in auto(0) mode
[  539.112583] qdma:qdma_device_open: qdma_pf, 0a:00.00, pdev 0x00000000b1bc043b, 0x10ee:0x903f.
[  539.112593] qdma_pf 0000:0a:00.0: enabling device (0000 -> 0002)
[  539.314438] qdma_get_device_type: invalid device type(3), err:-1
[  539.314440] qdma_get_versal_ip_type: inv versal_ip_type(2), err:-1
[  539.516157] qdma_get_device_type: invalid device type(3), err:-1
[  539.516158] qdma_get_versal_ip_type: inv versal_ip_type(2), err:-1
[  540.323550] qdma:qdma_device_attributes_get: qdma0a000-p0000:0a:00.0: num_pfs:4, num_qs:4095, flr_present:1, st_en:1, mm_en:1, mm_cmpt_en:1, mailbox_en:1, mm_channel_max:1, qid2vec_ctx:0, cmpt_ovf_chk_dis:1, mailbox_intr:1, sw_desc_64b:1, cmpt_desc_64b:1, dynamic_bar:1, legacy_intr:1, cmpt_trig_count_timer:1
[  540.323564] qdma:qdma_device_open: Vivado version = 
[  540.727272] qdma:xdev_identify_bars: User BAR 0.
[  540.929001] qdma_dev_entry_create: Created the dev entry successfully
[  542.139486] qdma:intr_setup: Error enabling MSI-X (-12)
[  542.139492] qdma:qdma_device_online: Failed to setup interrupts, err -12
[  542.139493] qdma:qdma_device_open: Failed to set the dma device  online, err = -22
[  542.543949] qdma_pf: probe of 0000:0a:00.0 failed with error -22
09:12 $ uname -a
Linux sparrow 5.4.0-33-generic #37-Ubuntu SMP Thu May 21 12:53:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

When compiling from the 2019.1 sources on ubuntu 18.04 with kernel 4.X, the driver loads as expected.

QDMA Driver timeout during C2H and H2C Requests

While operating in MM Mode for both C2H and H2C 1 queue each with the ring and buffer size as 4096 we see these errors in the kernel.
[Tue Jun 16 20:58:04 2020] qdma:qdma_request_wait_for_cmpl: qdma82000-MM-1: req 0xffff9cb0da3bbdf8, R,256,0/256,0x0, done 0, err 0, tm 10000.
[Tue Jun 16 20:58:04 2020] qdma:qdma_descq_dump: qdma82000-MM-1: 0x1/0x1, desc sz 4096/4056, pidx 1783, cidx 1744_
A deeper dive into the kernel code shows that this occurs due to a timeout at this place in the code
https://github.com/Xilinx/dma_ip_drivers/blob/2018.3/QDMA/linux-kernel/libqdma/libqdma_export.c#L79
Due to this the file descriptor returns with an error -5. This issue occurs for both directions C2H and H2C above being an example of C2H.
We see this issue on 2018.3 driver code , however have not ascertained if the same issue is seen on the 2019.2 driver code.
We are using the linux driver.
Any help would be appreciated towards the resolution of this issue as its a showstopper for us.

[XDMA] always get IRQ by calling poll() /dev/xdma0_event_0 even when no IRQ occurs

With this code, poll() function will return even when no IRQ occurs.

struct pollfd pfd;
pfd.fd = open("/dev/xdma0_events_0", O_RDONLY);
if (pfd.fd == -1) {
	perror("open event file:");
	exit(EXIT_FAILURE);
}
pfd.events = POLLIN | POLLRDNORM;

while (1) {
	ret = poll(&pfd, 1, 2000); /*Timeout: 2000 ms*/
	if (ret == -1) {
		perror("poll:");
		break;
	}
	if (!ret) {
		printf("timeout %d\n", irq_prof->id);
		break;
	}
	if ((pfd.revents & POLLRDNORM) || (pfd.revents & POLLIN)) {
		hw_counter = *(usr_int_ptr + 4 * irq_prof->id + 3);
		irq_counter++;
		printf("IRQ%d, %d, %d, %d\n", \
			irq_prof->id, hw_counter, irq_counter, hw_counter - irq_counter);
	}
}

So to fix this issue, we add a line to poll() in cdev_events.c.

spin_lock_irqsave(&user_irq->events_lock, flags);
if (user_irq->events_irq)
	mask = POLLIN | POLLRDNORM;	/* readable */
user_irq->events_irq = 0; /*new*/
spin_unlock_irqrestore(&user_irq->events_lock, flags);

XDMA Build fails because of changes to libxdma

This version of the code appears to try to use a separately built libxdma. The files libxdma.c and libxdma.h are no longer present in the /xdma directory.

However, I don't think the Makefile has been updated in order to perform this build. I had to revert to placing the files in /xdma; it then compiled.

I also tried to build libxdma by executing make in /libxdma. This failed also.

Required connections on `dsc_crdt_in`???

I have a little design that connects a BRAM to both an AXI lite and the AXI MM interface on the QDMA.

I do not have any connections on the user_irq, dsc_crdt_in, st_rx_msg, nort the tm_dsc_sts interfaces.

The soft_reset_n is left unconnected.
The sys_rst_n is connected to pcie_perst_n.

The QDMA driver identifies the device, and starts to initialize the contexts, but always freezes at sel = 2 (QDMA_CTXT_SEL_HW_C2H).

Are there any required connections to those 4 interfaces?

relevant output of dmesg (let me know if you need any more)

[    2.265727] qdma_vf:qdma_mod_init: Xilinx QDMA VF Reference Driver v2018.3.97.161.
[    2.286150] qdma:qdma_mod_init: Xilinx QDMA PF Reference Driver v2018.3.97.161.
[    2.303268] qdma:probe_one: 0000:01:00.0: func 0x0/0x4, p/v 0/0,0x          (null).
[    2.303269] qdma:probe_one: Configuring '01:00:0' as master pf
[    2.303270] qdma:probe_one: Driver is loaded in auto mode
[    2.303271] qdma:qdma_device_open: qdma_pf, 01:00.00, pdev 0x        (ptrval), 0x10ee:0x903f.
[    2.303278] qdma_pf 0000:01:00.0: enabling device (0000 -> 0002)
[    2.303356] qdma:xdev_identify_bars: QDMA Config BAR passed by the user matches with the identifier register value(0x1fd30000)
[    2.303358] qdma:xdev_identify_bars: User BAR 2.
[    2.303363] qdma:qdma_device_attributes_get: qdma01000-p0000:01:00.0: present flr 0, mm 1, st 0.
[    2.303364] qdma:qdma_device_init: qdma01000-p0000:01:00.0 master PF clearing memory.
[    2.802001] qdma:hw_indirect_ctext_prog: qdma01000-p0000:01:00.0, Q 0x0, op 0x0, sel 0x2, timeout.
[    2.802008] qdma:qdma_device_online: qdma_device_init failed -16.

XDMA: read file: Unknown error 512 when start 1MB C2H transfer(stream mode) on Ubuntu 18.04.1(4.15.0-88-generic)

The detailed description is https://forums.xilinx.com/t5/PCIe-and-CPM/XDMA-linux-driver-from-git-C2H-transfor-1MB-fail-crash-in-Stream/m-p/1087752#M16120.

Ubuntu18.04.1 , x64 OS, Vivado 2018.3.1

I git the master branch code at 2020-03-17 from the respoitory. My XDMA was used in AXI-Stream mode.
The test cmd is './dma_from_device -d /dev/xdma0_c2h_0 -f data/output_file.bin -s transfersize -c 1'

If I transfer 4KB(transfersize ) one time, the driver work correctly.

When I transfer 1MB(transfersize ) one time, the driver return error.

I read the libxdma.h and found that some parameters would be related to the transfersize: XDMA_TRANSFER_MAX_DESC and CYCLIC_RX_PAGES_MAX.

I changed XDMA_TRANSFER_MAX_DESC to 4096 and CYCLIC_RX_PAGES_MAX to 1024, then I test the transfer of 1MB but the error still exist:

/dev/xdma0_c2h_0, R off 0x0, 0xffffffffffffffff != 0x100000.
read file: Unknown error 512

XDMA: missing 'System.map' file

Hello!

I am trying to install the driver following the procedure in the readme file but I get the following output when running make install:

Makefile:10: XVC_FLAGS: .
make -C /lib/modules/5.3.0-40-generic/build M=/home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma modules
make[1]: Entering directory '/usr/src/linux-headers-5.3.0-40-generic'
/home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/Makefile:10: XVC_FLAGS: .
CC [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.o
CC [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/xdma_cdev.o
CC [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_ctrl.o
CC [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_events.o
CC [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_sgdma.o
CC [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_xvc.o
CC [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_bypass.o
CC [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/xdma_mod.o
CC [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/xdma_thread.o
LD [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/xdma.o
Building modules, stage 2.
/home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/Makefile:10: XVC_FLAGS: .
MODPOST 1 modules
CC /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/xdma.mod.o
LD [M] /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/xdma.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.3.0-40-generic'
make -C /lib/modules/5.3.0-40-generic/build M=/home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma modules_install
make[1]: Entering directory '/usr/src/linux-headers-5.3.0-40-generic'
INSTALL /home/samuel/dma_ip_drivers/XDMA/linux-kernel/xdma/xdma.ko
DEPMOD 5.3.0-40-generic
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make[1]: Leaving directory '/usr/src/linux-headers-5.3.0-40-generic'

Is there any way to solve that issue? I have tried a lot of things but it doesn't work. I am running on Ubuntu 19.10

Thanks in advance!

XDMA Changelog?

I just noticed that you uploaded the XDMA Driver.
The one on AR65444 has a different version number.

Can you speak a little bit about the changes that were made? I've already noticed that one bug that I had found was fixed.

AR65444 has version 2017.1.47 while as of this post, the version number on XDMA is 2018.3.50

xdma中断

环境 centos7.6 ,i7cpu ,我们通过ipcore 中断方式采集数据,正常。
换成 至强cpu 中断开机后如果有就一直有,如果没有就一直没有,不稳定。

XDMA: Driver hangs during streaming test got a block size larger than 1 MB

driver becomes non responsive. terminating the program and restarting the application does not work as the drivers fail to do anything after wards

I have made a workaround by commenting out the cyclic bugger, but I presume there is a better solution to the problem

index 029d0d3..654b44f 100644
--- a/XDMA/linux-kernel/xdma/cdev_sgdma.c
+++ b/XDMA/linux-kernel/xdma/cdev_sgdma.c
@@ -312,13 +312,13 @@ static ssize_t char_sgdma_read(struct file *file, char __user *buf,
 
        engine = xcdev->engine;
 
-       if (engine->streaming && engine->dir == DMA_FROM_DEVICE) {
-               rv = xdma_cyclic_transfer_setup(engine);
-               if (rv < 0 && rv != -EBUSY)
-                       return rv;
-               /* 600 sec. timeout */
-               return xdma_engine_read_cyclic(engine, buf, count, 600000);
-       }
+       //if (engine->streaming && engine->dir == DMA_FROM_DEVICE) {
+       //      rv = xdma_cyclic_transfer_setup(engine);
+       //      if (rv < 0 && rv != -EBUSY)
+       //              return rv;
+       //       /* 600 sec. timeout */
+       //      return xdma_engine_read_cyclic(engine, buf, count, 600000);
+       //}
 
         return char_sgdma_read_write(file, (char *)buf, count, pos, 0);
 }

XDMA: Number of DMA channels <-> number of xdma_threads

Hi,
I was having an issue while trying to use this driver and the corresponding Xilinx IP. In the IP, I specified that I wanted only 1 C2H and 1 H2C DMA channels. When I tried to insert the driver (insmod), I was having an OOPS fault (unable to handle page fault, supervisor read access in kernel mode ...).

Then I saw issue #51 and I found that "xdma_threads_create(8);" in xdma/xdma_cdev.c file was related to 8 channels thus 4 C2H and 4 H2C. This seems pretty obvious now but I think this should be passed as a parameter, maybe from some sort of configuration file, because it's quite difficult to debug kernel OOPSs.

I changed it to "xdma_threads_create(2);" and it solved my issue, so I'm opening this one for anyone in trouble !

BTW I used Vivado 2018.1 and Ubuntu 18.4 (kernel version 5.3.0-53).

XDMA: Kernel module does not compile correctly for Linux Kernel versions >= 5.0

When trying to make xdma on a system that has a Kernel version 5.0, the compile fails twice with error messages like:

xdma_drv_linux/xdma/cdev_ctrl.c: In function ‘char_ctrl_ioctl’:
xdma_drv_linux/xdma/cdev_ctrl.c:138:19: error: macro "access_ok" passed 3 arguments, but takes just 2
     _IOC_SIZE(cmd));
                   ^

I think this is because kernel 5.0 and onwards have dropped the first argument in the access_ok macro. So I think lines like:

		result = !access_ok(VERIFY_READ, (void __user *)arg,

should be changed to:

		result = !access_ok((void __user *)arg,

If I change the two offending lines in this way, make succeeds, as does the load_driver.sh script.

XDMA: PCIE to thunderbolt

Hi,
I can use xdma to communicate with FPGA now.
But for our application, we need to use the external PCIE slut (Razer Core X).
Does there have any drivers can support it?
Thanks

Current GIT XDMA tree fails to build on ubuntu 18.0.4.3

The kernel rev is: 5.0.0-37-generic
following the instructions in /dma_ip_drivers/XDMA/linux-kernel/readme.txt:
Usage:

  • Change directory to the driver directory.
    cd xdma
  • Compile and install the kernel module driver.
    make install
    GIT/dma_ip_drivers/XDMA/linux-kernel$ cd xdma
    ryzendev@ryzen2:~/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma$ make install
    Makefile:10: XVC_FLAGS: .
    make -C /lib/modules/5.0.0-37-generic/build M=/home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma modules
    make[1]: Entering directory '/usr/src/linux-headers-5.0.0-37-generic'
    /home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma/Makefile:10: XVC_FLAGS: .
    CC [M] /home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.o
    /home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.c: In function ‘engine_service_shutdown’:
    /home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.c:742:2: error: implicit declaration of function ‘swake_up’; did you mean ‘wake_up’? [-Werror=implicit-function-declaration]
    swake_up(&engine->shutdown_wq);
    ^~~~~~~~
    wake_up
    /home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.c: In function ‘xdma_xfer_submit’:
    /home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.c:3580:4: error: implicit declaration of function ‘swait_event_interruptible_timeout’; did you mean ‘wait_event_interruptible_timeout’? [-Werror=implicit-function-declaration]
    swait_event_interruptible_timeout(
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    wait_event_interruptible_timeout
    cc1: some warnings being treated as errors
    scripts/Makefile.build:284: recipe for target '/home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.o' failed
    make[2]: *** [/home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma/libxdma.o] Error 1
    Makefile:1614: recipe for target 'module/home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma' failed
    make[1]: *** [module/home/ryzendev/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma] Error 2
    make[1]: Leaving directory '/usr/src/linux-headers-5.0.0-37-generic'
    Makefile:27: recipe for target 'all' failed
    make: *** [all] Error 2

XDMA: SSL error when compile xdma

when do the step "cd xdma, sudo make install", it reports below. I use Ubuntu 18.04.

make[1]: Entering directory '/usr/src/linux-headers-5.0.0-23-generic'
INSTALL /home/my/Desktop/dma_ip_drivers-master/XDMA/linux-kernel/xdma/xdma.ko
At main.c:160:

  • SSL error:02001002:system library:fopen:No such file or directory: ../crypto/bio/bss_file.c:72
  • SSL error:2006D080:BIO routines:BIO_new_file:no such file: ../crypto/bio/bss_file.c:79
    sign-file: certs/signing_key.pem: No such file or directory
    DEPMOD 5.0.0-23-generic
    Warning: modules_install: missing 'System.map' file. Skipping depmod.
    make[1]: Leaving directory '/usr/src/linux-headers-5.0.0-23-generic'

runtime error on ubuntu 18.04.2 LTS: ./qdma_run_stress_test.sh: line 302: echo: write error: Invalid argument

root@super-poe:~/dma_ip_drivers/QDMA/linux-kernel/scripts# ./stress_test_top.sh 02000
#######################

user

#######################
make -C user clean;
make[1]: Entering directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/user'
make[1]: Leaving directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/user'
#######################

tools

#######################
make -C tools clean;
make[1]: Entering directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/tools'
rm -rf *.o *.bin dma_to_device dma_from_device dma_from_device_w_udd dmautils
make[1]: Leaving directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/tools'
#######################

drv

#######################
make[1]: Entering directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv'
srcdir = /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel.
KSRC = .
VF = .
EXTRA_FLAGS = .
ccflags-y = -D__GENL_REG_FAMILY_OPS_FUNC__ -D__READ_ONCE_DEFINED__.
make[1]: Leaving directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv'
"distro=, dmajor= dminor= "
4.15.184.15.0-47-generic: GIT,,, -DGITSP -DGIT
#######################

user

#######################
make -C user
make[1]: Entering directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/user'
cc -g -I. -I../include -c -o cli/reg_cmd.o cli/reg_cmd.c
cc -g -I. -I../include -c -o cli/cmd_parse.o cli/cmd_parse.c
cc -g -I. -I../include -c -o cli/nl_user.o cli/nl_user.c
cc -g -I. -I../include -c -o cli/main.o cli/main.c
cc cli/reg_cmd.o cli/cmd_parse.o cli/nl_user.o cli/main.o -o dmactl
make[1]: Leaving directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/user'
#######################

tools

#######################
make -C tools
make[1]: Entering directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/tools'
cc -g -c -std=c99 -o dma_to_device.o dma_to_device.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE
cc -lrt -o dma_to_device dma_to_device.o -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE
cc -g -c -std=c99 -o dma_from_device.o dma_from_device.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE
cc -lrt -o dma_from_device dma_from_device.o -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE
cc -g -c -std=c99 -o dma_from_device_w_udd.o dma_from_device_w_udd.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE
cc -lrt -o dma_from_device_w_udd dma_from_device_w_udd.o -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE
cc -g -c -std=c99 -o dmautils.o dmautils.c -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE -D_AIO_AIX_SOURCE
cc -pthread -lrt -o dmautils dmautils.o -laio -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGE_FILE_SOURCE
make[1]: Leaving directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/tools'
#######################

PF drv

#######################
make[1]: Entering directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv'
srcdir = /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel.
KSRC = /lib/modules/4.15.0-47-generic/build.
VF = 0.
EXTRA_FLAGS = .
ccflags-y = -D__READ_ONCE_DEFINED__.
make[2]: Entering directory '/usr/src/linux-headers-4.15.0-47-generic'
srcdir = /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel.
KSRC = /lib/modules/4.15.0-47-generic/build.
VF = 0.
EXTRA_FLAGS = .
ccflags-y = -D__READ_ONCE_DEFINED__.
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/nl.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/cdev.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/qdma_mod.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_mbox.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_intr.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_st_c2h.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_thread.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/libqdma_export.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_device.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_sriov.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_descq.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_regs.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_debugfs_queue.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_debugfs.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_debugfs_dev.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_qconf_mgr.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/libqdma_config.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_context.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/xdev.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/thread.o
LD [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/qdma.o
Building modules, stage 2.
srcdir = /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel.
KSRC = /lib/modules/4.15.0-47-generic/build.
VF = 0.
EXTRA_FLAGS = .
ccflags-y = -D__READ_ONCE_DEFINED__.
MODPOST 1 modules
CC /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/qdma.mod.o
LD [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/qdma.ko
make[2]: Leaving directory '/usr/src/linux-headers-4.15.0-47-generic'
make[1]: Leaving directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv'
#######################

VF drv

#######################
make[1]: Entering directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv'
srcdir = /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel.
KSRC = /lib/modules/4.15.0-47-generic/build.
VF = 1.
EXTRA_FLAGS = -D__QDMA_VF__.
ccflags-y = -D__READ_ONCE_DEFINED__.
make[2]: Entering directory '/usr/src/linux-headers-4.15.0-47-generic'
srcdir = /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel.
KSRC = /lib/modules/4.15.0-47-generic/build.
VF = 1.
EXTRA_FLAGS = -D__QDMA_VF__.
ccflags-y = -D__READ_ONCE_DEFINED__.
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/qdma.mod.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/nl.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/cdev.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/qdma_mod.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_mbox.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_intr.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_st_c2h.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_thread.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/libqdma_export.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_device.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_sriov.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_descq.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_debugfs_queue.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_debugfs.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_debugfs_dev.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_qconf_mgr.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/libqdma_config.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_context.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/xdev.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/thread.o
CC [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_regs.o
LD [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/qdma_vf.o
Building modules, stage 2.
srcdir = /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel.
KSRC = /lib/modules/4.15.0-47-generic/build.
VF = 1.
EXTRA_FLAGS = -D__QDMA_VF__.
ccflags-y = -D__READ_ONCE_DEFINED__.
MODPOST 1 modules
CC /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/qdma_vf.mod.o
LD [M] /home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv/qdma_vf.ko
make[2]: Leaving directory '/usr/src/linux-headers-4.15.0-47-generic'
make[1]: Leaving directory '/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/drv'
"distro=, dmajor= dminor= "
4.15.184.15.0-47-generic: GIT,,, -DGITSP -DGIT
installing user tools to /usr/local/sbin ...
removed '/usr/local/sbin/dmactl'
'build/dmactl' -> '/usr/local/sbin/dmactl'
removed '/usr/local/sbin/dma_from_device'
'tools/dma_from_device' -> '/usr/local/sbin/dma_from_device'
removed '/usr/local/sbin/dma_to_device'
'tools/dma_to_device' -> '/usr/local/sbin/dma_to_device'
removed '/usr/local/sbin/dmautils'
'tools/dmautils' -> '/usr/local/sbin/dmautils'
MAN PAGES:
removed '/usr/share/man/man8/dmactl.8.gz'
'docs/dmactl.8.gz' -> '/usr/share/man/man8/dmactl.8.gz'
02000
qdma02000, 02:00.00, bar#2, reg 0xa0 -> 0x1, read back 0x1.
/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/scripts
/home/mcoyle/dma_ip_drivers/QDMA/linux-kernel/scripts
setting up environment
echo 2040 > /sys/bus/pci/devices/0000:02:00.0/qdma/qmax_vfs
echo 8 > /sys/bus/pci/devices/0000:02:00.0/sriov_numvfs
echo 4 > /sys/bus/pci/devices/0000:02:00.1/sriov_numvfs
echo 4 > /sys/bus/pci/devices/0000:02:00.2/sriov_numvfs
echo 4 > /sys/bus/pci/devices/0000:02:00.3/sriov_numvfs
./qdma_run_stress_test.sh: line 302: echo: write error: Invalid argument
./qdma_run_stress_test.sh: line 302: echo: write error: Invalid argument
./qdma_run_stress_test.sh: line 302: echo: write error: Invalid argument
./qdma_run_stress_test.sh: line 302: echo: write error: Invalid argument

./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.0/virtfn0/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.0/virtfn1/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.0/virtfn2/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.0/virtfn3/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.0/virtfn4/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.0/virtfn5/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.0/virtfn6/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.0/virtfn7/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.1/virtfn0/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.1/virtfn1/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.1/virtfn2/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.1/virtfn3/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.2/virtfn0/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.2/virtfn1/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.2/virtfn2/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.2/virtfn3/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.3/virtfn0/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.3/virtfn1/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.3/virtfn2/qdma/qmax: No such file or directory
./qdma_run_stress_test.sh: line 323: /sys/bus/pci/devices/0000:02:00.3/virtfn3/qdma/qmax: No such file or directory

qdma02000 0000:02:00.0 max QP: 2, 01
qdma02001 0000:02:00.1 max QP: 2, 2
3
qdma02002 0000:02:00.2 max QP: 2, 45
qdma02003 0000:02:00.3 max QP: 2, 6
7

setting up qdma02003-mm-101
transfer tests will run for 14400 secs
starting transfers
cmp: EOF on /tmp/out_mm02000_1 which is empty
cmp: /tmp/out_mm02000_3: No such file or directory
cmp: /tmp/out_mm02000_5: No such file or directory
cmp: /tmp/out_mm02000_7: No such file or directory
cmp: /tmp/out_mm02000_9: No such file or directory
cmp: /tmp/out_mm02000_11: No such file or directory
cmp: /tmp/out_mm02000_13: No such file or directory
cmp: /tmp/out_mm02000_15: No such file or directory
cmp: /tmp/out_mm02000_17: No such file or directory
cmp: /tmp/out_mm02000_19: No such file or directory
cmp: /tmp/out_mm02000_21: No such file or directory
cmp: /tmp/out_mm02000_23: No such file or directory
cmp: /tmp/out_mm02000_25: No such file or directory
cmp: /tmp/out_mm02000_27: No such file or directory
cmp: /tmp/out_mm02000_29: No such file or directory
cmp: /tmp/out_mm02000_31: No such file or directory
cmp: /tmp/out_mm02000_33: No such file or directory
cmp: /tmp/out_mm02000_35: No such file or directory
cmp: /tmp/out_mm02000_37: No such file or directory
cmp: /tmp/out_mm02000_39: No such file or directory
cmp: /tmp/out_mm02000_41: No such file or directory
cmp: /tmp/out_mm02000_43: No such file or directory
cmp: /tmp/out_mm02000_45: No such file or directory
cmp: /tmp/out_mm02000_47: No such file or directory
cmp: /tmp/out_mm02000_49: No such file or directory
cmp: /tmp/out_mm02000_51: No such file or directory
cmp: /tmp/out_mm02000_53: No such file or directory
cmp: /tmp/out_mm02000_55: No such file or directory
cmp: /tmp/out_mm02000_57: No such file or directory
cmp: /tmp/out_mm02000_59: No such file or directory
cmp: /tmp/out_mm02000_61: No such file or directory
cmp: /tmp/out_mm02000_63: No such file or directory
cmp: /tmp/out_mm02000_65: No such file or directory
cmp: /tmp/out_mm02000_67: No such file or directory
cmp: /tmp/out_mm02000_69: No such file or directory
cmp: /tmp/out_mm02000_71: No such file or directory
cmp: /tmp/out_mm02000_73: No such file or directory
cmp: /tmp/out_mm02000_75: No such file or directory
cmp: /tmp/out_mm02000_77: No such file or directory
cmp: /tmp/out_mm02000_79: No such file or directory
cmp: /tmp/out_mm02000_81: No such file or directory
cmp: /tmp/out_mm02000_83: No such file or directory
cmp: /tmp/out_mm02000_85: No such file or directory
cmp: /tmp/out_mm02000_87: No such file or directory
cmp: /tmp/out_mm02000_89: No such file or directory
cmp: /tmp/out_mm02000_91: No such file or directory
cmp: /tmp/out_mm02000_93: No such file or directory
cmp: /tmp/out_mm02000_95: No such file or directory
cmp: /tmp/out_mm02000_97: No such file or directory
cmp: /tmp/out_mm02000_99: No such file or directory
cmp: /tmp/out_mm02000_101: No such file or directory
cmp: EOF on /tmp/out_mm02001_1 which is empty
cmp: /tmp/out_mm02001_3: No such file or directory
cmp: /tmp/out_mm02001_5: No such file or directory
cmp: /tmp/out_mm02001_7: No such file or directory
cmp: /tmp/out_mm02001_9: No such file or directory
cmp: /tmp/out_mm02001_11: No such file or directory
cmp: /tmp/out_mm02001_13: No such file or directory
cmp: /tmp/out_mm02001_15: No such file or directory
cmp: /tmp/out_mm02001_17: No such file or directory
cmp: /tmp/out_mm02001_19: No such file or directory
cmp: /tmp/out_mm02001_21: No such file or directory
cmp: /tmp/out_mm02001_23: No such file or directory
cmp: /tmp/out_mm02001_25: No such file or directory
cmp: /tmp/out_mm02001_27: No such file or directory
cmp: /tmp/out_mm02001_29: No such file or directory
cmp: /tmp/out_mm02001_31: No such file or directory
cmp: /tmp/out_mm02001_33: No such file or directory
cmp: /tmp/out_mm02001_35: No such file or directory
cmp: /tmp/out_mm02001_37: No such file or directory
cmp: /tmp/out_mm02001_39: No such file or directory
cmp: /tmp/out_mm02001_41: No such file or directory
cmp: /tmp/out_mm02001_43: No such file or directory
cmp: /tmp/out_mm02001_45: No such file or directory
cmp: /tmp/out_mm02001_47: No such file or directory
cmp: /tmp/out_mm02001_49: No such file or directory
cmp: /tmp/out_mm02001_51: No such file or directory
cmp: /tmp/out_mm02001_53: No such file or directory
cmp: /tmp/out_mm02001_55: No such file or directory
cmp: /tmp/out_mm02001_57: No such file or directory
cmp: /tmp/out_mm02001_59: No such file or directory
cmp: /tmp/out_mm02001_61: No such file or directory
cmp: /tmp/out_mm02001_63: No such file or directory
cmp: /tmp/out_mm02001_65: No such file or directory
cmp: /tmp/out_mm02001_67: No such file or directory
cmp: /tmp/out_mm02001_69: No such file or directory
cmp: /tmp/out_mm02001_71: No such file or directory
cmp: /tmp/out_mm02001_73: No such file or directory
cmp: /tmp/out_mm02001_75: No such file or directory
cmp: /tmp/out_mm02001_77: No such file or directory
cmp: /tmp/out_mm02001_79: No such file or directory
cmp: /tmp/out_mm02001_81: No such file or directory
cmp: /tmp/out_mm02001_83: No such file or directory
cmp: /tmp/out_mm02001_85: No such file or directory
cmp: /tmp/out_mm02001_87: No such file or directory
cmp: /tmp/out_mm02001_89: No such file or directory
cmp: /tmp/out_mm02001_91: No such file or directory
cmp: /tmp/out_mm02001_93: No such file or directory
cmp: /tmp/out_mm02001_95: No such file or directory
cmp: /tmp/out_mm02001_97: No such file or directory
cmp: /tmp/out_mm02001_99: No such file or directory
cmp: /tmp/out_mm02001_101: No such file or directory
cmp: EOF on /tmp/out_mm02002_1 which is empty
cmp: /tmp/out_mm02002_3: No such file or directory
cmp: /tmp/out_mm02002_5: No such file or directory
cmp: /tmp/out_mm02002_7: No such file or directory
cmp: /tmp/out_mm02002_9: No such file or directory
cmp: /tmp/out_mm02002_11: No such file or directory
cmp: /tmp/out_mm02002_13: No such file or directory
cmp: /tmp/out_mm02002_15: No such file or directory
cmp: /tmp/out_mm02002_17: No such file or directory
cmp: /tmp/out_mm02002_19: No such file or directory
cmp: /tmp/out_mm02002_21: No such file or directory
cmp: /tmp/out_mm02002_23: No such file or directory
cmp: /tmp/out_mm02002_25: No such file or directory
cmp: /tmp/out_mm02002_27: No such file or directory
cmp: /tmp/out_mm02002_29: No such file or directory
cmp: /tmp/out_mm02002_31: No such file or directory
cmp: /tmp/out_mm02002_33: No such file or directory
cmp: /tmp/out_mm02002_35: No such file or directory
cmp: /tmp/out_mm02002_37: No such file or directory
cmp: /tmp/out_mm02002_39: No such file or directory
cmp: /tmp/out_mm02002_41: No such file or directory
cmp: /tmp/out_mm02002_43: No such file or directory
cmp: /tmp/out_mm02002_45: No such file or directory
cmp: /tmp/out_mm02002_47: No such file or directory
cmp: /tmp/out_mm02002_49: No such file or directory
cmp: /tmp/out_mm02002_51: No such file or directory
cmp: /tmp/out_mm02002_53: No such file or directory
cmp: /tmp/out_mm02002_55: No such file or directory
cmp: /tmp/out_mm02002_57: No such file or directory
cmp: /tmp/out_mm02002_59: No such file or directory
cmp: /tmp/out_mm02002_61: No such file or directory
cmp: /tmp/out_mm02002_63: No such file or directory
cmp: /tmp/out_mm02002_65: No such file or directory
cmp: /tmp/out_mm02002_67: No such file or directory
cmp: /tmp/out_mm02002_69: No such file or directory
cmp: /tmp/out_mm02002_71: No such file or directory
cmp: /tmp/out_mm02002_73: No such file or directory
cmp: /tmp/out_mm02002_75: No such file or directory
cmp: /tmp/out_mm02002_77: No such file or directory
cmp: /tmp/out_mm02002_79: No such file or directory
cmp: /tmp/out_mm02002_81: No such file or directory
cmp: /tmp/out_mm02002_83: No such file or directory
cmp: /tmp/out_mm02002_85: No such file or directory
cmp: /tmp/out_mm02002_87: No such file or directory
cmp: /tmp/out_mm02002_89: No such file or directory
cmp: /tmp/out_mm02002_91: No such file or directory
cmp: /tmp/out_mm02002_93: No such file or directory
cmp: /tmp/out_mm02002_95: No such file or directory
cmp: /tmp/out_mm02002_97: No such file or directory
cmp: /tmp/out_mm02002_99: No such file or directory
cmp: /tmp/out_mm02002_101: No such file or directory
cmp: EOF on /tmp/out_mm02003_1 which is empty
cmp: /tmp/out_mm02003_3: No such file or directory
cmp: /tmp/out_mm02003_5: No such file or directory
cmp: /tmp/out_mm02003_7: No such file or directory
cmp: /tmp/out_mm02003_9: No such file or directory
cmp: /tmp/out_mm02003_11: No such file or directory
cmp: /tmp/out_mm02003_13: No such file or directory
cmp: /tmp/out_mm02003_15: No such file or directory
cmp: /tmp/out_mm02003_17: No such file or directory
cmp: /tmp/out_mm02003_19: No such file or directory
cmp: /tmp/out_mm02003_21: No such file or directory
cmp: /tmp/out_mm02003_23: No such file or directory
cmp: /tmp/out_mm02003_25: No such file or directory
cmp: /tmp/out_mm02003_27: No such file or directory
cmp: /tmp/out_mm02003_29: No such file or directory
cmp: /tmp/out_mm02003_31: No such file or directory
cmp: /tmp/out_mm02003_33: No such file or directory
cmp: /tmp/out_mm02003_35: No such file or directory
cmp: /tmp/out_mm02003_37: No such file or directory
cmp: /tmp/out_mm02003_39: No such file or directory
cmp: /tmp/out_mm02003_41: No such file or directory
cmp: /tmp/out_mm02003_43: No such file or directory
cmp: /tmp/out_mm02003_45: No such file or directory
cmp: /tmp/out_mm02003_47: No such file or directory
cmp: /tmp/out_mm02003_49: No such file or directory
cmp: /tmp/out_mm02003_51: No such file or directory
cmp: /tmp/out_mm02003_53: No such file or directory
cmp: /tmp/out_mm02003_55: No such file or directory
cmp: /tmp/out_mm02003_57: No such file or directory
cmp: /tmp/out_mm02003_59: No such file or directory
cmp: /tmp/out_mm02003_61: No such file or directory
cmp: /tmp/out_mm02003_63: No such file or directory
cmp: /tmp/out_mm02003_65: No such file or directory
cmp: /tmp/out_mm02003_67: No such file or directory
cmp: /tmp/out_mm02003_69: No such file or directory
cmp: /tmp/out_mm02003_71: No such file or directory
cmp: /tmp/out_mm02003_73: No such file or directory
cmp: /tmp/out_mm02003_75: No such file or directory
cmp: /tmp/out_mm02003_77: No such file or directory
cmp: /tmp/out_mm02003_79: No such file or directory
cmp: /tmp/out_mm02003_81: No such file or directory
cmp: /tmp/out_mm02003_83: No such file or directory
cmp: /tmp/out_mm02003_85: No such file or directory
cmp: /tmp/out_mm02003_87: No such file or directory
cmp: /tmp/out_mm02003_89: No such file or directory
cmp: /tmp/out_mm02003_91: No such file or directory
cmp: /tmp/out_mm02003_93: No such file or directory
cmp: /tmp/out_mm02003_95: No such file or directory
cmp: /tmp/out_mm02003_97: No such file or directory
cmp: /tmp/out_mm02003_99: No such file or directory
cmp: /tmp/out_mm02003_101: No such file or directory

XDMA xdma/Makefile attempts to reference a directory that does not exist in dma_ip_drivers tree

the Makefile located in GIT/dma_ip_drivers/XDMA/linux-kernel/xdma/ tries to find it's toplevel directory and assign it to a variable named topdir on line 12 of said Makefile

topdir := $(shell cd $(src)/.. && pwd)

since there is no variable named 'src' in the Makefile then topdir evaluates to '/'

topdir := $(shell cd $(src)/.. && pwd)
$(warning topdir: $(topdir)) <-- added warning statement for debugging purposes

/GIT/dma_ip_drivers/XDMA/linux-kernel/xdma$ make
Makefile:10: XVC_FLAGS: .
Makefile:13: topdir: / <-- result of extra warning statement.

Please remediate this as quickly as reasonably possible.

Tnx!

johnu

return value of snprintf not checked in qdbg_parse_ctxt_to_buf

len += snprintf(buf + len, buflen - len,
"\t%-47s %#-10x %u\n",
entries[i].name, v, v);
}
len += snprintf(buf + len, buflen - len, "\n");
return len;
}

Proposed patch

diff --git a/QDMA/linux-kernel/libqdma/qdma_debugfs_queue.c b/QDMA/linux-kernel/libqdma/qdma_debugfs_queue.c
index 62c59ed..b623731 100644
--- a/QDMA/linux-kernel/libqdma/qdma_debugfs_queue.c
+++ b/QDMA/linux-kernel/libqdma/qdma_debugfs_queue.c
@@ -629,9 +629,16 @@ int qdbg_parse_ctxt_to_buf(u32 *ctxt,
                len += snprintf(buf + len, buflen - len,
                                "\t%-47s %#-10x %u\n",
                                entries[i].name, v, v);
+               if (len >= buflen){
+                       // Not enough memory
+                       return buflen - len;
+               }
        }
        len += snprintf(buf + len, buflen - len, "\n");
-
+       if (len >= buflen){
+               // Not enough memory
+               return buflen - len;
+       }
        return len;
 }

xdma_kthread_start error

I am using vcu118 xdma IP,xdma driver can be install successfully。But,when insmod xdma.ko ,error appears as follows:
ERROR INFO:
xdma:xdma_threads_create: xdma_threads_create
BUG: unable to handle kernel NULL pointer dereference at 0000000000000009
IP: [] get_partial_node.isra.62+0x10/0x1f0
PGD 0
Oops: 0000 [#1] SMPxdma:xdma_kthread_start: kthread cmpl_status_th6, create task failed: 0x1

OS INFO:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
Linux ubuntu 4.4.0-170-generic #199-Ubuntu SMP Thu Nov 14 01:45:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

queue might not be rewinded correctly in qdma_queue_add in case buffer too short

In the snippet below, an error message is passed to the user.
However, if they provide a buffer that is too small, the queue doesn't get rewound correctly.

if (buf && buflen) {
cur += snprintf(cur, end - cur,
"qdma%05x no %s QP, %u.\n",
xdev->conf.bdf,
qconf->st ? "ST" : "MM", qdev->qmax);
if (cur >= end)
goto handle_truncation;
}
goto rewind_qcnt;

rewind_qcnt:
spin_lock(&qdev->lock);
if (qconf->c2h)
qdev->c2h_qcnt--;
else
qdev->h2c_qcnt--;
spin_unlock(&qdev->lock);
return rv;
handle_truncation:
*buf = '\0';
return rv;
}

XDMA insmod: ERROR: could not insert module xdma.ko: Invalid module format

The kernel module can be successfully built, but could not load.
insmod: ERROR: could not insert module xdma.ko: Invalid module format

I'm running Ubuntu 18.04.3 LTS, with kernel version 4.15.0-76-generic. The server has also installed xocl, not sure if that's the reason

And in dmesg I found:
xdma: version magic '4.15.0-74-generic SMP mod_unload ' should be '4.15.0-76-generic SMP mod_unload '
xdma: exports duplicate symbol enable_perf (owned by xocl)

modinfo xdma.ko gives:

filename: XXXXX/dma_ip_drivers/XDMA/linux-kernel/xdma/xdma.ko
license: Dual BSD/GPL
version: 2019.2.51
description: Xilinx XDMA Reference Driver
author: Xilinx, Inc.
srcversion: FFEB4E4118387E6F5CB784B
alias: pci:v000010EEd00002808svsdbcsci*
alias: pci:v000010EEd00004B28svsdbcsci*
alias: pci:v000010EEd00004A28svsdbcsci*
alias: pci:v000010EEd00004908svsdbcsci*
alias: pci:v000010EEd00004828svsdbcsci*
alias: pci:v000010EEd00004808svsdbcsci*
alias: pci:v000010EEd00006D30svsdbcsci*
alias: pci:v000010EEd00006A30svsdbcsci*
alias: pci:v000010EEd00006A28svsdbcsci*
alias: pci:v000010EEd00006930svsdbcsci*
alias: pci:v000010EEd00006928svsdbcsci*
alias: pci:v000010EEd00006830svsdbcsci*
alias: pci:v000010EEd00006828svsdbcsci*
alias: pci:v000010EEd00007038svsdbcsci*
alias: pci:v000010EEd00007034svsdbcsci*
alias: pci:v000010EEd00007032svsdbcsci*
alias: pci:v000010EEd00007031svsdbcsci*
alias: pci:v000010EEd00007028svsdbcsci*
alias: pci:v000010EEd00007024svsdbcsci*
alias: pci:v000010EEd00007022svsdbcsci*
alias: pci:v000010EEd00007021svsdbcsci*
alias: pci:v000010EEd00007018svsdbcsci*
alias: pci:v000010EEd00007014svsdbcsci*
alias: pci:v000010EEd00007012svsdbcsci*
alias: pci:v000010EEd00007011svsdbcsci*
alias: pci:v000010EEd00008038svsdbcsci*
alias: pci:v000010EEd00008034svsdbcsci*
alias: pci:v000010EEd00008032svsdbcsci*
alias: pci:v000010EEd00008031svsdbcsci*
alias: pci:v000010EEd00008028svsdbcsci*
alias: pci:v000010EEd00008024svsdbcsci*
alias: pci:v000010EEd00008022svsdbcsci*
alias: pci:v000010EEd00008021svsdbcsci*
alias: pci:v000010EEd00008018svsdbcsci*
alias: pci:v000010EEd00008014svsdbcsci*
alias: pci:v000010EEd00008012svsdbcsci*
alias: pci:v000010EEd00008011svsdbcsci*
alias: pci:v000010EEd00009011svsdbcsci*
alias: pci:v000010EEd00009021svsdbcsci*
alias: pci:v000010EEd00009031svsdbcsci*
alias: pci:v000010EEd00009012svsdbcsci*
alias: pci:v000010EEd00009022svsdbcsci*
alias: pci:v000010EEd00009032svsdbcsci*
alias: pci:v000010EEd00009014svsdbcsci*
alias: pci:v000010EEd00009024svsdbcsci*
alias: pci:v000010EEd00009034svsdbcsci*
alias: pci:v000010EEd00009018svsdbcsci*
alias: pci:v000010EEd00009028svsdbcsci*
alias: pci:v000010EEd00009038svsdbcsci*
alias: pci:v000010EEd0000903Fsvsdbcsci*
depends:
retpoline: Y
name: xdma
vermagic: 4.15.0-76-generic SMP mod_unload
parm: sgdma_timeout:timeout in seconds for sgdma, default is 10 sec. (uint)
parm: poll_mode:Set 1 for hw polling, default is 0 (interrupts) (uint)
parm: interrupt_mode:0 - MSI-x , 1 - MSI, 2 - Legacy (uint)
parm: enable_credit_mp:Set 0 to disable credit feature, default is 1 ( credit control enabled) (uint)
parm: desc_blen_max:per descriptor max. buffer length, default is (1 << 28) - 1 (uint)

Can anyone help with this error? Thanks a lot! T.T

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.