msm: kgsl: Log context type in case of GPU faults

Log context type in case of GPU page faults or GPU faults.
Also add Vulkan context type to distinguish it from GL.

Change-Id: I7b93bf645b80abe82f2d6aa379296b2fffceb684
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
This commit is contained in:
Rajesh Kemisetti 2018-09-17 11:34:08 +05:30
parent 3e15f887cf
commit de5400e150
6 changed files with 32 additions and 19 deletions

View file

@ -1710,8 +1710,9 @@ static void adreno_fault_header(struct kgsl_device *device,
ib2base, ib2sz, drawctxt->rb->id);
pr_fault(device, drawobj,
"gpu fault ctx %d ts %d status %8.8X rb %4.4x/%4.4x ib1 %16.16llX/%4.4x ib2 %16.16llX/%4.4x\n",
drawobj->context->id, drawobj->timestamp, status,
"gpu fault ctx %d ctx_type %s ts %d status %8.8X rb %4.4x/%4.4x ib1 %16.16llX/%4.4x ib2 %16.16llX/%4.4x\n",
drawobj->context->id, get_api_type_str(drawctxt->type),
drawobj->timestamp, status,
rptr, wptr, ib1base, ib1sz, ib2base, ib2sz);
if (rb != NULL)

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2002,2007-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2002,2007-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -138,4 +138,16 @@ void adreno_drawctxt_invalidate(struct kgsl_device *device,
void adreno_drawctxt_dump(struct kgsl_device *device,
struct kgsl_context *context);
static struct adreno_context_type ctxt_type_table[] = {KGSL_CONTEXT_TYPES};
static inline const char *get_api_type_str(unsigned int type)
{
int i;
for (i = 0; i < ARRAY_SIZE(ctxt_type_table); i++) {
if (ctxt_type_table[i].type == type)
return ctxt_type_table[i].str;
}
return "UNKNOWN";
}
#endif /* __ADRENO_DRAWCTXT_H */

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2016, 2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -78,18 +78,6 @@
#define SIZE_PIPE_ENTRY(cnt) (50 + (cnt) * 62)
#define SIZE_LOG_ENTRY(cnt) (6 + (cnt) * 5)
static struct adreno_context_type ctxt_type_table[] = {KGSL_CONTEXT_TYPES};
static const char *get_api_type_str(unsigned int type)
{
int i;
for (i = 0; i < ARRAY_SIZE(ctxt_type_table) - 1; i++) {
if (ctxt_type_table[i].type == type)
return ctxt_type_table[i].str;
}
return "UNKNOWN";
}
static inline uint _ib_start(struct adreno_device *adreno_dev,
unsigned int *cmds)
{

View file

@ -87,7 +87,8 @@ enum kgsl_event_results {
{ KGSL_CONTEXT_TYPE_GL, "GL" }, \
{ KGSL_CONTEXT_TYPE_CL, "CL" }, \
{ KGSL_CONTEXT_TYPE_C2D, "C2D" }, \
{ KGSL_CONTEXT_TYPE_RS, "RS" }
{ KGSL_CONTEXT_TYPE_RS, "RS" }, \
{ KGSL_CONTEXT_TYPE_VK, "VK" }
#define KGSL_CONTEXT_ID(_context) \
((_context != NULL) ? (_context)->id : KGSL_MEMSTORE_GLOBAL)

View file

@ -870,11 +870,21 @@ static int kgsl_iommu_fault_handler(struct iommu_domain *domain,
no_page_fault_log = kgsl_mmu_log_fault_addr(mmu, ptbase, addr);
if (!no_page_fault_log && __ratelimit(&_rs)) {
const char *api_str;
if (context != NULL) {
struct adreno_context *drawctxt =
ADRENO_CONTEXT(context);
api_str = get_api_type_str(drawctxt->type);
} else
api_str = "UNKNOWN";
KGSL_MEM_CRIT(ctx->kgsldev,
"GPU PAGE FAULT: addr = %lX pid= %d\n", addr, ptname);
KGSL_MEM_CRIT(ctx->kgsldev,
"context=%s TTBR0=0x%llx CIDR=0x%x (%s %s fault)\n",
ctx->name, ptbase, contextidr,
"context=%s ctx_type=%s TTBR0=0x%llx CIDR=0x%x (%s %s fault)\n",
ctx->name, api_str, ptbase, contextidr,
write ? "write" : "read", fault_type);
/* Don't print the debug if this is a permissions fault */

View file

@ -65,6 +65,7 @@
#define KGSL_CONTEXT_TYPE_CL 2
#define KGSL_CONTEXT_TYPE_C2D 3
#define KGSL_CONTEXT_TYPE_RS 4
#define KGSL_CONTEXT_TYPE_VK 5
#define KGSL_CONTEXT_TYPE_UNKNOWN 0x1E
#define KGSL_CONTEXT_INVALIDATE_ON_FAULT 0x10000000