Skip to content

Commit f18d802

Browse files
committed
EDMA: Limit the number of queues and events to 1
Change-Id: I73496a10725f7cd6a0fb08e9bbdb552f28129d17
1 parent 52b2a3a commit f18d802

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

sdk/linux_kernel_drivers/edma/edma_backend_xdma.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#define XDMA_WORKER_STOPPED_ON_REQUEST_BIT (2)
2424
#define PCI_VENDOR_ID_AMAZON (0x1d0f)
2525
#define PCI_DEVICE_ID_FPGA (0xf001)
26-
#define XMDA_NUMBER_OF_USER_EVENTS (16)
26+
#define XMDA_NUMBER_OF_USER_EVENTS (1)
27+
#define XDMA_LIMIT_NUMBER_OF_QUEUES (1)
2728
#define CLASS_NAME "edma"
2829

2930
struct class* edma_class;
@@ -145,17 +146,15 @@ static int edma_xdma_probe(struct pci_dev *pdev, const struct pci_device_id *id)
145146
pci_save_state(pdev);
146147

147148
number_of_xdma_channels = xdma_device_open(pdev, &channel_list);
148-
if(number_of_xdma_channels < 0) {
149-
ret = number_of_xdma_channels;
150-
goto done;
151-
}
152-
153149
if(unlikely(number_of_xdma_channels < 0)){
154150
ret = number_of_xdma_channels;
155151
goto done;
156152
}
157153

158-
dev_info(dev, "xdma opened %d channels\n", number_of_xdma_channels);
154+
if(number_of_xdma_channels > XDMA_LIMIT_NUMBER_OF_QUEUES)
155+
number_of_xdma_channels = XDMA_LIMIT_NUMBER_OF_QUEUES;
156+
157+
dev_info(dev, "DMA backend opened %d channels\n", number_of_xdma_channels);
159158

160159
command_queue = (command_queue_t*)kzalloc(
161160
number_of_xdma_channels * sizeof(command_queue_t),
@@ -451,14 +450,15 @@ int edma_backend_stop(void *q_handle)
451450
!test_bit(XDMA_WORKER_STOPPED_ON_TIMEOUT_BIT, &command_queue->thread_status))
452451
BUG();
453452

454-
for(i = 0; i < edma_queue_depth; i++)
455-
{
453+
for(i = 0; i < edma_queue_depth; i++) {
456454
memset(&(queue[i]), 0, sizeof(command_t));
457455
}
458456

459457
command_queue->head = 0;
460458
command_queue->tail = 0;
461459
command_queue->next_to_recycle = 0;
460+
command_queue->worker_thread = NULL;
461+
command_queue->thread_status = 0;
462462

463463
return 0;
464464
}

sdk/linux_kernel_drivers/edma/edma_dev.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,26 +133,26 @@ static void edma_dev_release_resources( struct emda_buffer_control_structure* eb
133133

134134
BUG_ON(!ebcs);
135135

136-
vfree(ebcs->request);
137-
ebcs->request = NULL;
136+
if(ebcs->request) {
137+
vfree(ebcs->request);
138+
ebcs->request = NULL;
139+
}
138140

139-
for(i = 0; i < (ebcs->transient_buffer.size_in_pages); i++)
140-
{
141-
if(ebcs->transient_buffer.page_array[i].phys_base_addr != 0)
141+
for(i = 0; i < (ebcs->transient_buffer.size_in_pages); i++){
142+
if(ebcs->transient_buffer.page_array[i].phys_base_addr != 0) {
142143
dma_free_coherent(NULL, PAGE_SIZE,
143-
ebcs->transient_buffer.page_array[i].virt_buffer,
144-
ebcs->transient_buffer.page_array[i].phys_base_addr);
144+
ebcs->transient_buffer.page_array[i].virt_buffer,
145+
ebcs->transient_buffer.page_array[i].phys_base_addr);
145146

146-
ebcs->transient_buffer.page_array[i].virt_buffer = NULL;
147-
ebcs->transient_buffer.page_array[i].phys_base_addr = 0;
147+
ebcs->transient_buffer.page_array[i].virt_buffer = NULL;
148+
ebcs->transient_buffer.page_array[i].phys_base_addr = 0;
149+
}
148150
}
149151

150-
if(ebcs->transient_buffer.page_array)
152+
if(ebcs->transient_buffer.page_array) {
151153
vfree(ebcs->transient_buffer.page_array);
152-
153-
ebcs->transient_buffer.page_array = NULL;
154-
155-
ebcs = NULL;
154+
ebcs->transient_buffer.page_array = NULL;
155+
}
156156
}
157157

158158
static void edma_dev_initialize_read_ebcs(struct emda_buffer_control_structure* ebcs)

0 commit comments

Comments
 (0)