Skip to content

Commit 58ce49d

Browse files
jaeyoon-choibsdimp
authored andcommitted
ufshci: reserve one queue entry for an admin request
This patch reduces num_entries by 1 to reserve a admin slot. It resolves the issue where admin requests cannot be executed during QD32 because all queue entries are used. It also resolve the issue of accessing the queue before it is created by moving the queue construct point to before interrupt enable. Sponsored by: Samsung Electronic Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51894
1 parent 7d748c5 commit 58ce49d

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

sys/dev/ufshci/ufshci_ctrlr.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,16 @@ ufshci_ctrlr_construct(struct ufshci_controller *ctrlr, device_t dev)
146146
return (ENXIO);
147147
}
148148

149+
/* Allocate and initialize UTP Task Management Request List. */
150+
error = ufshci_utmr_req_queue_construct(ctrlr);
151+
if (error)
152+
return (error);
153+
154+
/* Allocate and initialize UTP Transfer Request List or SQ/CQ. */
155+
error = ufshci_utr_req_queue_construct(ctrlr);
156+
if (error)
157+
return (error);
158+
149159
/* Enable additional interrupts by programming the IE register. */
150160
ie = ufshci_mmio_read_4(ctrlr, ie);
151161
ie |= UFSHCIM(UFSHCI_IE_REG_UTRCE); /* UTR Completion */
@@ -160,19 +170,12 @@ ufshci_ctrlr_construct(struct ufshci_controller *ctrlr, device_t dev)
160170

161171
/* TODO: Initialize interrupt Aggregation Control Register (UTRIACR) */
162172

163-
/* Allocate and initialize UTP Task Management Request List. */
164-
error = ufshci_utmr_req_queue_construct(ctrlr);
165-
if (error)
166-
return (error);
167-
168-
/* Allocate and initialize UTP Transfer Request List or SQ/CQ. */
169-
error = ufshci_utr_req_queue_construct(ctrlr);
170-
if (error)
171-
return (error);
172-
173173
/* TODO: Separate IO and Admin slot */
174-
/* max_hw_pend_io is the number of slots in the transfer_req_queue */
175-
ctrlr->max_hw_pend_io = ctrlr->transfer_req_queue.num_entries;
174+
/*
175+
* max_hw_pend_io is the number of slots in the transfer_req_queue.
176+
* Reduce num_entries by one to reserve an admin slot.
177+
*/
178+
ctrlr->max_hw_pend_io = ctrlr->transfer_req_queue.num_entries - 1;
176179

177180
return (0);
178181
}

0 commit comments

Comments
 (0)