Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85c1f013 authored by Carter Cooper's avatar Carter Cooper
Browse files

msm: kgsl: Only look at enabled HFI queues



No need to try and read/write from disabled HFI queues.
Update the HFI queue status at init to correctly reflect if
the queue is open for business.

Change-Id: Id23e5d61e73a2e5885bea92b98b52f5cfe964506
Signed-off-by: default avatarCarter Cooper <ccooper@codeaurora.org>
parent 12d2aa76
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@ static int hfi_queue_read(struct gmu_device *gmu, uint32_t queue_idx,
	uint32_t size;
	int result = 0;

	if (hdr->status == HFI_QUEUE_STATUS_DISABLED)
		return -EINVAL;

	if (hdr->read_index == hdr->write_index) {
		hdr->rx_req = 1;
		return -ENODATA;
@@ -113,7 +116,7 @@ static int hfi_queue_write(struct gmu_device *gmu, uint32_t queue_idx,
	uint32_t size = MSG_HDR_GET_SIZE(*msg);
	uint32_t id = MSG_HDR_GET_ID(*msg);

	if (hdr->enabled == 0)
	if (hdr->status == HFI_QUEUE_STATUS_DISABLED)
		return -EINVAL;

	if (size > HFI_MAX_MSG_SIZE) {
@@ -188,11 +191,12 @@ void hfi_init(struct kgsl_hfi *hfi, struct gmu_memdesc *mem_addr,
	struct {
		unsigned int idx;
		unsigned int pri;
		unsigned int status;
	} queue[HFI_QUEUE_MAX] = {
		{ HFI_CMD_ID, HFI_CMD_PRI },
		{ HFI_MSG_ID, HFI_MSG_PRI },
		{ HFI_DBG_ID, HFI_DBG_PRI },
		{ HFI_DSP_ID_0, HFI_DSP_PRI_0 },
		{ HFI_CMD_IDX, HFI_CMD_PRI, HFI_QUEUE_STATUS_ENABLED },
		{ HFI_MSG_IDX, HFI_MSG_PRI, HFI_QUEUE_STATUS_ENABLED },
		{ HFI_DBG_IDX, HFI_DBG_PRI, HFI_QUEUE_STATUS_ENABLED },
		{ HFI_DSP_IDX_0, HFI_DSP_PRI_0, HFI_QUEUE_STATUS_DISABLED },
	};

	/* Fill Table Header */
@@ -209,7 +213,7 @@ void hfi_init(struct kgsl_hfi *hfi, struct gmu_memdesc *mem_addr,
		hdr = &tbl->qhdr[i];
		hdr->start_addr = GMU_QUEUE_START_ADDR(mem_addr, i);
		hdr->type = QUEUE_HDR_TYPE(queue[i].idx, queue[i].pri, 0,  0);
		hdr->enabled = 0x1;
		hdr->status = queue[i].status;
		hdr->queue_size = queue_sz_bytes >> 2; /* convert to dwords */
		hdr->msg_size = 0;
		hdr->drop_cnt = 0;
@@ -703,6 +707,8 @@ void hfi_stop(struct gmu_device *gmu)
	/* Flush HFI queues */
	for (i = 0; i < HFI_QUEUE_MAX; i++) {
		hdr = &tbl->qhdr[i];
		if (hdr->status == HFI_QUEUE_STATUS_DISABLED)
			continue;

		if (hdr->read_index != hdr->write_index)
			dev_err(&gmu->pdev->dev,
+5 −2
Original line number Diff line number Diff line
@@ -38,6 +38,9 @@
#define HFI_DSP_IDX_BASE 3
#define HFI_DSP_IDX_0 3

#define HFI_QUEUE_STATUS_DISABLED 0
#define HFI_QUEUE_STATUS_ENABLED  1

/* HTOF queue priority, 1 is highest priority */
#define HFI_CMD_PRI 10
#define HFI_MSG_PRI 10
@@ -128,7 +131,7 @@ struct hfi_queue_table_header {

/**
 * struct hfi_queue_header - HFI queue header structure
 * @enabled: active: 1; inactive: 0
 * @status: active: 1; inactive: 0
 * @start_addr: starting address of the queue in GMU VA space
 * @type: queue type encoded the priority, ID and send/recevie types
 * @queue_size: size of the queue
@@ -143,7 +146,7 @@ struct hfi_queue_table_header {
 * @write_index: write index of the queue
 */
struct hfi_queue_header {
	uint32_t enabled;
	uint32_t status;
	uint32_t start_addr;
	uint32_t type;
	uint32_t queue_size;