Skip to content

Commit

Permalink
ON-16264: Pass evq kernel virt address to enable evq
Browse files Browse the repository at this point in the history
ef10ct and efct used 'phys_to_virt' on the evq dma_addrs to get the
kernel virtual address of the evq. This is not recommended for use on
physical addresses and not allowed for dma bus addresses. Instead,
pass through the virtual address of the evq backing memory we had
already.
  • Loading branch information
ligallag-amd committed Jan 20, 2025
1 parent 5976d98 commit 03a7a56
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/include/ci/efhw/efhw_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ struct efhw_evq_params {
* DMA mapped. Otherwise they are simply physical addresses.
*/
dma_addr_t* dma_addrs;
/* kernel virtual address pointing to same base as dma_addrs */
void *virt_base;
uint n_pages; /* number of entries in dma_addrs */
int wakeup_channel; /* irq or queue to deliver wakeups for this queue */
int flags;
Expand Down
1 change: 1 addition & 0 deletions src/lib/efhw/ef10ct/aux_ef10ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ static int ef10ct_nic_init_shared_evq(struct efhw_nic *nic, int qid)
params.n_pages = 1 << page_order;
params.evq_size = (params.n_pages << PAGE_SHIFT) / sizeof(efhw_event_t);
params.dma_addrs = shared_evq->iopages.dma_addrs;
params.virt_base = shared_evq->iopages.ptr;
/* Wakeup stuff is ignored */
/* Do we care about flags? */

Expand Down
2 changes: 1 addition & 1 deletion src/lib/efhw/ef10ct/ef10ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ ef10ct_nic_event_queue_enable(struct efhw_nic *nic,

if( rc == 0 ) {
ef10ct_evq->nic = nic;
ef10ct_evq->base = phys_to_virt(efhw_params->dma_addrs[0]);
ef10ct_evq->base = efhw_params->virt_base;
ef10ct_evq->capacity = efhw_params->evq_size;
atomic_set(&ef10ct_evq->queues_flushing, 0);
INIT_DELAYED_WORK(&ef10ct_evq->check_flushes, ef10ct_check_for_flushes);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/efhw/efct.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ efct_nic_event_queue_enable(struct efhw_nic *nic,

if( rc == 0 ) {
efct_evq->nic = nic;
efct_evq->base = phys_to_virt(efhw_params->dma_addrs[0]);
efct_evq->base = efhw_params->virt_base;
efct_evq->capacity = efhw_params->evq_size;
atomic_set(&efct_evq->queues_flushing, 0);
INIT_DELAYED_WORK(&efct_evq->check_flushes, efct_check_for_flushes);
Expand Down
1 change: 1 addition & 0 deletions src/lib/efrm/vi_resource_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ efrm_vi_rm_init_dmaq(struct efrm_vi *virs, enum efhw_q_type queue_type,
evq_params.evq = instance;
evq_params.evq_size = q->capacity;
evq_params.dma_addrs = q->dma_addrs;
evq_params.virt_base = q->host_pages.ptr;
evq_params.n_pages = (1 << q->host_page_order) *
EFHW_NIC_PAGES_IN_OS_PAGE;
evq_params.flags = flags;
Expand Down

0 comments on commit 03a7a56

Please sign in to comment.