msm: kgsl: Do inline gmu and rgmu snapshot

This helps in ultimately getting rid of gmu_core_snapshot.

Change-Id: Ie72f851ddec6ddb70d3dfa763b6c638c2f0f8775
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
This commit is contained in:
Harshdeep Dhatt 2020-04-25 17:26:28 -06:00
commit 97a10b9133
5 changed files with 33 additions and 12 deletions

View file

@ -1644,7 +1644,6 @@ static inline int adreno_perfcntr_active_oob_get(
if (!ret) {
ret = gmu_core_dev_oob_set(device, oob_perfcntr);
if (ret) {
gmu_core_snapshot(device);
adreno_set_gpu_fault(adreno_dev,
ADRENO_GMU_FAULT_SKIP_SNAPSHOT);
adreno_dispatcher_schedule(device);

View file

@ -444,6 +444,7 @@ static int a6xx_gmu_device_start(struct adreno_device *adreno_dev)
A6XX_GMU_CM3_DTCM_START + (0x3fdc >> 2), &val);
dev_err(&gmu->pdev->dev, "GMU doesn't boot: 0x%x\n", val);
a6xx_gmu_snapshot(device);
return -ETIMEDOUT;
}
@ -467,6 +468,7 @@ static int a6xx_gmu_hfi_start(struct adreno_device *adreno_dev)
GMU_START_TIMEOUT,
BIT(0))) {
dev_err(&gmu->pdev->dev, "GMU HFI init failed\n");
a6xx_gmu_snapshot(device);
return -ETIMEDOUT;
}
@ -743,6 +745,7 @@ static int a6xx_gmu_oob_set(struct kgsl_device *device,
if (timed_poll_check(device, A6XX_GMU_GMU2HOST_INTR_INFO, check,
GPU_START_TIMEOUT, check)) {
ret = -ETIMEDOUT;
a6xx_gmu_snapshot(device);
WARN(1, "OOB request %s timed out\n", oob_to_str(req));
}
@ -897,6 +900,7 @@ int a6xx_gmu_sptprac_enable(struct adreno_device *adreno_dev)
SPTPRAC_CTRL_TIMEOUT,
SPTPRAC_POWERON_STATUS_MASK)) {
dev_err(&gmu->pdev->dev, "power on SPTPRAC fail\n");
a6xx_gmu_snapshot(device);
return -ETIMEDOUT;
}
@ -1926,7 +1930,7 @@ static irqreturn_t a6xx_gmu_irq_handler(int irq, void *data)
}
static void a6xx_gmu_snapshot(struct kgsl_device *device)
void a6xx_gmu_snapshot(struct kgsl_device *device)
{
struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);

View file

@ -287,5 +287,10 @@ void a6xx_enable_gpu_irq(struct adreno_device *adreno_dev);
*/
void a6xx_disable_gpu_irq(struct adreno_device *adreno_dev);
/**
* a6xx_gmu_snapshot - Send nmi to gmu and take snapshot
* @device: Pointer to the kgsl device
*
*/
void a6xx_gmu_snapshot(struct kgsl_device *device);
#endif

View file

@ -40,7 +40,7 @@ struct hfi_queue_table {
#define MSG_HDR_GET_TYPE(hdr) (((hdr) >> 16) & 0xF)
#define MSG_HDR_GET_SEQNUM(hdr) (((hdr) >> 20) & 0xFFF)
static void a6xx_hfi_process_queue(struct a6xx_gmu_device *gmu,
static int a6xx_hfi_process_queue(struct a6xx_gmu_device *gmu,
uint32_t queue_idx, struct pending_cmd *ret_cmd);
/* Size in below functions are in unit of dwords */
@ -241,7 +241,7 @@ int a6xx_hfi_init(struct adreno_device *adreno_dev)
#define HDR_CMP_SEQNUM(out_hdr, in_hdr) \
(MSG_HDR_GET_SEQNUM(out_hdr) == MSG_HDR_GET_SEQNUM(in_hdr))
static void receive_ack_cmd(struct a6xx_gmu_device *gmu, void *rcvd,
static int receive_ack_cmd(struct a6xx_gmu_device *gmu, void *rcvd,
struct pending_cmd *ret_cmd)
{
struct adreno_device *adreno_dev = a6xx_gmu_to_adreno(gmu);
@ -250,7 +250,7 @@ static void receive_ack_cmd(struct a6xx_gmu_device *gmu, void *rcvd,
uint32_t req_hdr = ack[1];
if (ret_cmd == NULL)
return;
return -EINVAL;
trace_kgsl_hfi_receive(MSG_HDR_GET_ID(req_hdr),
MSG_HDR_GET_SIZE(req_hdr),
@ -258,7 +258,7 @@ static void receive_ack_cmd(struct a6xx_gmu_device *gmu, void *rcvd,
if (HDR_CMP_SEQNUM(ret_cmd->sent_hdr, req_hdr)) {
memcpy(&ret_cmd->results, ack, MSG_HDR_GET_SIZE(hdr) << 2);
return;
return 0;
}
/* Didn't find the sender, list the waiter */
@ -266,8 +266,9 @@ static void receive_ack_cmd(struct a6xx_gmu_device *gmu, void *rcvd,
"HFI ACK: Cannot find sender for 0x%8.8x Waiter: 0x%8.8x\n",
req_hdr, ret_cmd->sent_hdr);
adreno_set_gpu_fault(adreno_dev, ADRENO_GMU_FAULT);
adreno_dispatcher_schedule(KGSL_DEVICE(adreno_dev));
a6xx_gmu_snapshot(KGSL_DEVICE(adreno_dev));
return -ENODEV;
}
#define MSG_HDR_SET_SEQNUM(hdr, num) \
@ -328,6 +329,7 @@ static int a6xx_hfi_send_cmd(struct adreno_device *adreno_dev,
HFI_IRQ_MSGQ_MASK, HFI_IRQ_MSGQ_MASK, HFI_RSP_TIMEOUT);
if (rc) {
a6xx_gmu_snapshot(KGSL_DEVICE(adreno_dev));
dev_err(&gmu->pdev->dev,
"Timed out waiting on ack for 0x%8.8x (id %d, sequence %d)\n",
cmd[0], MSG_HDR_GET_ID(*cmd), MSG_HDR_GET_SEQNUM(*cmd));
@ -338,7 +340,7 @@ static int a6xx_hfi_send_cmd(struct adreno_device *adreno_dev,
adreno_write_gmureg(adreno_dev, ADRENO_REG_GMU_GMU2HOST_INTR_CLR,
HFI_IRQ_MSGQ_MASK);
a6xx_hfi_process_queue(gmu, HFI_MSG_ID, ret_cmd);
rc = a6xx_hfi_process_queue(gmu, HFI_MSG_ID, ret_cmd);
return rc;
}
@ -358,6 +360,7 @@ static int a6xx_hfi_send_generic_req(struct adreno_device *adreno_dev,
if (!rc && ret_cmd.results[2] == HFI_ACK_ERROR) {
struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
a6xx_gmu_snapshot(KGSL_DEVICE(adreno_dev));
dev_err(&gmu->pdev->dev, "HFI ACK failure: Req 0x%8.8X\n",
ret_cmd.results[1]);
return -EINVAL;
@ -550,7 +553,7 @@ static void a6xx_hfi_v1_receiver(struct a6xx_gmu_device *gmu, uint32_t *rcvd,
}
}
static void a6xx_hfi_process_queue(struct a6xx_gmu_device *gmu,
static int a6xx_hfi_process_queue(struct a6xx_gmu_device *gmu,
uint32_t queue_idx, struct pending_cmd *ret_cmd)
{
uint32_t rcvd[MAX_RCVD_SIZE];
@ -564,7 +567,10 @@ static void a6xx_hfi_process_queue(struct a6xx_gmu_device *gmu,
/* V2 ACK Handler */
if (MSG_HDR_GET_TYPE(rcvd[0]) == HFI_MSG_ACK) {
receive_ack_cmd(gmu, rcvd, ret_cmd);
int ret = receive_ack_cmd(gmu, rcvd, ret_cmd);
if (ret)
return ret;
continue;
}
@ -583,6 +589,8 @@ static void a6xx_hfi_process_queue(struct a6xx_gmu_device *gmu,
break;
}
}
return 0;
}
static int a6xx_hfi_verify_fw_version(struct adreno_device *adreno_dev)

View file

@ -42,6 +42,8 @@ static const unsigned int a6xx_rgmu_registers[] = {
0x26000, 0x26002,
};
static void a6xx_rgmu_snapshot(struct kgsl_device *device);
static struct a6xx_rgmu_device *to_a6xx_rgmu(struct adreno_device *adreno_dev)
{
struct a6xx_device *a6xx_dev = container_of(adreno_dev,
@ -165,6 +167,7 @@ static int a6xx_rgmu_oob_set(struct kgsl_device *device,
dev_err(&rgmu->pdev->dev,
"Timed out while setting OOB req:%s status:0x%x\n",
oob_to_str(req), status);
a6xx_rgmu_snapshot(device);
return ret;
}
@ -353,6 +356,7 @@ static int a6xx_rgmu_wait_for_lowest_idle(struct adreno_device *adreno_dev)
reg[7], reg[8], reg[9]);
WARN_ON(1);
a6xx_rgmu_snapshot(device);
return -ETIMEDOUT;
}
@ -436,6 +440,7 @@ static int a6xx_rgmu_fw_start(struct adreno_device *adreno_dev,
gmu_core_regread(device, A6XX_RGMU_CX_PCC_DEBUG, &status);
dev_err(&rgmu->pdev->dev,
"rgmu boot Failed. status:%08x\n", status);
a6xx_rgmu_snapshot(device);
return -ETIMEDOUT;
}