mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	dmaengine: add verification of DMA_INTERRUPT capability for dmatest
Looks like I forgot to add DMA_INTERRUPT cap setting to the idxd driver and dmatest is still working regardless of this mistake. Add an explicit check of DMA_INTERRUPT capability for dmatest to make sure the DMA device being used actually supports interrupt before the test is launched and also that the driver is programmed correctly. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/164978679251.2361020.5856734256126725993.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
		
							parent
							
								
									e335de6ba5
								
							
						
					
					
						commit
						a8facc7b98
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
					@ -675,10 +675,16 @@ static int dmatest_func(void *data)
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * src and dst buffers are freed by ourselves below
 | 
						 * src and dst buffers are freed by ourselves below
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (params->polled)
 | 
						if (params->polled) {
 | 
				
			||||||
		flags = DMA_CTRL_ACK;
 | 
							flags = DMA_CTRL_ACK;
 | 
				
			||||||
	else
 | 
						} else {
 | 
				
			||||||
 | 
							if (dma_has_cap(DMA_INTERRUPT, dev->cap_mask)) {
 | 
				
			||||||
			flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
 | 
								flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								pr_err("Channel does not support interrupt!\n");
 | 
				
			||||||
 | 
								goto err_pq_array;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ktime = ktime_get();
 | 
						ktime = ktime_get();
 | 
				
			||||||
	while (!(kthread_should_stop() ||
 | 
						while (!(kthread_should_stop() ||
 | 
				
			||||||
| 
						 | 
					@ -906,6 +912,7 @@ static int dmatest_func(void *data)
 | 
				
			||||||
	runtime = ktime_to_us(ktime);
 | 
						runtime = ktime_to_us(ktime);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = 0;
 | 
						ret = 0;
 | 
				
			||||||
 | 
					err_pq_array:
 | 
				
			||||||
	kfree(dma_pq);
 | 
						kfree(dma_pq);
 | 
				
			||||||
err_srcs_array:
 | 
					err_srcs_array:
 | 
				
			||||||
	kfree(srcs);
 | 
						kfree(srcs);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue