[{"id":1777851,"web_url":"http://patchwork.ozlabs.org/comment/1777851/","msgid":"<0e8d5867-f689-a4fe-9460-cf3642e90545@gmail.com>","list_archive_url":null,"date":"2017-09-30T02:44:13","subject":"Re: [PATCH v3 4/6] gpu: host1x: Disassemble more instructions","submitter":{"id":18124,"url":"http://patchwork.ozlabs.org/api/people/18124/","name":"Dmitry Osipenko","email":"digetx@gmail.com"},"content":"On 28.09.2017 15:50, Mikko Perttunen wrote:\n> The disassembler for debug dumps was missing some newer host1x opcodes.\n> Add disassembly support for these.\n> \n> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>\n> ---\n\nReviewed-by: Dmitry Osipenko <digetx@gmail.com>\n\nAnd for older Tegra's:\n\nTested-by: Dmitry Osipenko <digetx@gmail.com>\n\n\n>  drivers/gpu/host1x/hw/debug_hw.c      | 59 ++++++++++++++++++++++++++++++++---\n>  drivers/gpu/host1x/hw/debug_hw_1x01.c |  2 +-\n>  drivers/gpu/host1x/hw/debug_hw_1x06.c |  3 +-\n>  3 files changed, 58 insertions(+), 6 deletions(-)\n> \n> diff --git a/drivers/gpu/host1x/hw/debug_hw.c b/drivers/gpu/host1x/hw/debug_hw.c\n> index 1e67667e308c..989476801f9d 100644\n> --- a/drivers/gpu/host1x/hw/debug_hw.c\n> +++ b/drivers/gpu/host1x/hw/debug_hw.c\n> @@ -30,6 +30,13 @@ enum {\n>  \tHOST1X_OPCODE_IMM\t= 0x04,\n>  \tHOST1X_OPCODE_RESTART\t= 0x05,\n>  \tHOST1X_OPCODE_GATHER\t= 0x06,\n> +\tHOST1X_OPCODE_SETSTRMID = 0x07,\n> +\tHOST1X_OPCODE_SETAPPID  = 0x08,\n> +\tHOST1X_OPCODE_SETPYLD   = 0x09,\n> +\tHOST1X_OPCODE_INCR_W    = 0x0a,\n> +\tHOST1X_OPCODE_NONINCR_W = 0x0b,\n> +\tHOST1X_OPCODE_GATHER_W  = 0x0c,\n> +\tHOST1X_OPCODE_RESTART_W = 0x0d,\n>  \tHOST1X_OPCODE_EXTEND\t= 0x0e,\n>  };\n>  \n> @@ -38,11 +45,16 @@ enum {\n>  \tHOST1X_OPCODE_EXTEND_RELEASE_MLOCK\t= 0x01,\n>  };\n>  \n> -static unsigned int show_channel_command(struct output *o, u32 val)\n> +#define INVALID_PAYLOAD\t\t\t\t0xffffffff\n> +\n> +static unsigned int show_channel_command(struct output *o, u32 val,\n> +\t\t\t\t\t u32 *payload)\n>  {\n> -\tunsigned int mask, subop, num;\n> +\tunsigned int mask, subop, num, opcode;\n> +\n> +\topcode = val >> 28;\n>  \n> -\tswitch (val >> 28) {\n> +\tswitch (opcode) {\n>  \tcase HOST1X_OPCODE_SETCLASS:\n>  \t\tmask = val & 0x3f;\n>  \t\tif (mask) {\n> @@ -97,6 +109,44 @@ static unsigned int show_channel_command(struct output *o, u32 val)\n>  \t\t\t\t    val >> 14 & 0x1, val & 0x3fff);\n>  \t\treturn 1;\n>  \n> +#if HOST1X_HW >= 6\n> +\tcase HOST1X_OPCODE_SETSTRMID:\n> +\t\thost1x_debug_cont(o, \"SETSTRMID(offset=%06x)\\n\",\n> +\t\t\t\t  val & 0x3fffff);\n> +\t\treturn 0;\n> +\n> +\tcase HOST1X_OPCODE_SETAPPID:\n> +\t\thost1x_debug_cont(o, \"SETAPPID(appid=%02x)\\n\", val & 0xff);\n> +\t\treturn 0;\n> +\n> +\tcase HOST1X_OPCODE_SETPYLD:\n> +\t\t*payload = val & 0xffff;\n> +\t\thost1x_debug_cont(o, \"SETPYLD(data=%04x)\\n\", *payload);\n> +\t\treturn 0;\n> +\n> +\tcase HOST1X_OPCODE_INCR_W:\n> +\tcase HOST1X_OPCODE_NONINCR_W:\n> +\t\thost1x_debug_cont(o, \"%s(offset=%06x, \",\n> +\t\t\t\t  opcode == HOST1X_OPCODE_INCR_W ?\n> +\t\t\t\t\t\"INCR_W\" : \"NONINCR_W\",\n> +\t\t\t\t  val & 0x3fffff);\n> +\t\tif (*payload == 0) {\n> +\t\t\thost1x_debug_cont(o, \"[])\\n\");\n> +\t\t\treturn 0;\n> +\t\t} else if (*payload == INVALID_PAYLOAD) {\n> +\t\t\thost1x_debug_cont(o, \"unknown)\\n\");\n> +\t\t\treturn 0;\n> +\t\t} else {\n> +\t\t\thost1x_debug_cont(o, \"[\");\n> +\t\t\treturn *payload;\n> +\t\t}\n> +\n> +\tcase HOST1X_OPCODE_GATHER_W:\n> +\t\thost1x_debug_cont(o, \"GATHER_W(count=%04x, addr=[\",\n> +\t\t\t\t  val & 0x3fff);\n> +\t\treturn 2;\n> +#endif\n> +\n>  \tcase HOST1X_OPCODE_EXTEND:\n>  \t\tsubop = val >> 24 & 0xf;\n>  \t\tif (subop == HOST1X_OPCODE_EXTEND_ACQUIRE_MLOCK)\n> @@ -122,6 +172,7 @@ static void show_gather(struct output *o, phys_addr_t phys_addr,\n>  \t/* Map dmaget cursor to corresponding mem handle */\n>  \tu32 offset = phys_addr - pin_addr;\n>  \tunsigned int data_count = 0, i;\n> +\tu32 payload = INVALID_PAYLOAD;\n>  \n>  \t/*\n>  \t * Sometimes we're given different hardware address to the same\n> @@ -139,7 +190,7 @@ static void show_gather(struct output *o, phys_addr_t phys_addr,\n>  \n>  \t\tif (!data_count) {\n>  \t\t\thost1x_debug_output(o, \"%08x: %08x: \", addr, val);\n> -\t\t\tdata_count = show_channel_command(o, val);\n> +\t\t\tdata_count = show_channel_command(o, val, &payload);\n>  \t\t} else {\n>  \t\t\thost1x_debug_cont(o, \"%08x%s\", val,\n>  \t\t\t\t\t    data_count > 1 ? \", \" : \"])\\n\");\n> diff --git a/drivers/gpu/host1x/hw/debug_hw_1x01.c b/drivers/gpu/host1x/hw/debug_hw_1x01.c\n> index 09e1aa7bb5dd..8790d5fd5f20 100644\n> --- a/drivers/gpu/host1x/hw/debug_hw_1x01.c\n> +++ b/drivers/gpu/host1x/hw/debug_hw_1x01.c\n> @@ -112,7 +112,7 @@ static void host1x_debug_show_channel_fifo(struct host1x *host,\n>  \n>  \t\tif (!data_count) {\n>  \t\t\thost1x_debug_output(o, \"%08x: \", val);\n> -\t\t\tdata_count = show_channel_command(o, val);\n> +\t\t\tdata_count = show_channel_command(o, val, NULL);\n>  \t\t} else {\n>  \t\t\thost1x_debug_cont(o, \"%08x%s\", val,\n>  \t\t\t\t\t  data_count > 1 ? \", \" : \"])\\n\");\n> diff --git a/drivers/gpu/host1x/hw/debug_hw_1x06.c b/drivers/gpu/host1x/hw/debug_hw_1x06.c\n> index bd89da5dc64c..b503c740c022 100644\n> --- a/drivers/gpu/host1x/hw/debug_hw_1x06.c\n> +++ b/drivers/gpu/host1x/hw/debug_hw_1x06.c\n> @@ -63,6 +63,7 @@ static void host1x_debug_show_channel_fifo(struct host1x *host,\n>  \t\t\t\t\t   struct output *o)\n>  {\n>  \tu32 val, rd_ptr, wr_ptr, start, end;\n> +\tu32 payload = INVALID_PAYLOAD;\n>  \tunsigned int data_count = 0;\n>  \n>  \thost1x_debug_output(o, \"%u: fifo:\\n\", ch->id);\n> @@ -107,7 +108,7 @@ static void host1x_debug_show_channel_fifo(struct host1x *host,\n>  \t\tif (!data_count) {\n>  \t\t\thost1x_debug_output(o, \"%03x 0x%08x: \",\n>  \t\t\t\t\t    rd_ptr - start, val);\n> -\t\t\tdata_count = show_channel_command(o, val);\n> +\t\t\tdata_count = show_channel_command(o, val, &payload);\n>  \t\t} else {\n>  \t\t\thost1x_debug_cont(o, \"%08x%s\", val,\n>  \t\t\t\t\t  data_count > 1 ? \", \" : \"])\\n\");\n> \n\n--\nTo unsubscribe from this list: send the line \"unsubscribe linux-tegra\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<linux-tegra-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-tegra-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"uxtg+vnf\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y3t6r3htxz9t2r\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 30 Sep 2017 12:44:20 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752632AbdI3CoT (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tFri, 29 Sep 2017 22:44:19 -0400","from mail-wm0-f68.google.com ([74.125.82.68]:53360 \"EHLO\n\tmail-wm0-f68.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752578AbdI3CoS (ORCPT\n\t<rfc822;linux-tegra@vger.kernel.org>);\n\tFri, 29 Sep 2017 22:44:18 -0400","by mail-wm0-f68.google.com with SMTP id q132so2273001wmd.2;\n\tFri, 29 Sep 2017 19:44:17 -0700 (PDT)","from [192.168.1.145] (ppp109-252-90-109.pppoe.spdop.ru.\n\t[109.252.90.109]) by smtp.googlemail.com with ESMTPSA id\n\tj73sm12020047wmf.15.2017.09.29.19.44.14\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 29 Sep 2017 19:44:16 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=E1Y7wd9GOkmWw+/L/nEUh6WbL3UnTS/58lkATVJLNiw=;\n\tb=uxtg+vnfrh8jmGBNGHGq2/GUBZgfQ/5CSU8BB6QXPJoeuLr0BTAX3jeWxVCPeryx0f\n\thumdKaZLzZI4BUmdvUjCns0Vuz9sHI6ZVu4jeGnnY/ZdK+wOOMvg5MLIDCuza0ambZnL\n\tyK21CP+YB+/RxtqI+ry3AJ4RVxW8HyRsuglgR3dPHYqWSuDywxXoio+WuJ2uS2aMHmQ5\n\tvPZnxOO0YZohCEvz6sfPUSftBH2i5GkfFUlrDBEV5bbiRt/YLewC9kgNeYbcajjYlw9y\n\tiImfW7PTKdOK+xbXVkc/JddV4V7dG6xyhUzXDOTiOULZaEdsKptPuHWXj7szSIxTzCit\n\tqn+Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:to:cc:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=E1Y7wd9GOkmWw+/L/nEUh6WbL3UnTS/58lkATVJLNiw=;\n\tb=hAoULPSmapshfSB7bvwpPwQOVnGHX2V5l860UuvK9KvX74Oa9iP0JkLqVT181FY0Mv\n\tVC8r4q3xAybWaIMiI3atHOVLxZvl+BYY1UnbWTpN7rLd78X+RFqQ6csTrnUvlhyp0gHx\n\tRaTtLRlWRgMeOCOYp9hW5H86a8PNfEp+jK95rC8j8jxgVev522s+5auhffDzZlcWYD+l\n\t5bjauXxQn/sHcV+akmG9UYhE+zlts9msOZlxSWBg/JabN9i/2Gbei29ut10KyTdBaeB8\n\tpG6bREJEkCU+5Y9aL2MfbbepnAtafQI1CszLJMyKxkrqmfe6ThsD0PrNqEmbLKJVhwWX\n\t6PiQ==","X-Gm-Message-State":"AHPjjUgll2/KDdHFOi/O/78+ZiBNNzIDtm8kVcpAi79i663qoHbjhh6r\n\t50sch7I1jdT1bED5YWKddqu8jdLg","X-Google-Smtp-Source":"AOwi7QBCbmPZolILteNPqHkPYyeCvR4Nm0EKnDNkZN/XK6jYdNWPdKMuRc0z+rHvNpW/6CJetpaJPA==","X-Received":"by 10.28.214.212 with SMTP id n203mr4733799wmg.10.1506739456767; \n\tFri, 29 Sep 2017 19:44:16 -0700 (PDT)","Subject":"Re: [PATCH v3 4/6] gpu: host1x: Disassemble more instructions","To":"Mikko Perttunen <mperttunen@nvidia.com>, thierry.reding@gmail.com,\n\tjonathanh@nvidia.com","Cc":"dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org","References":"<20170928125044.32516-1-mperttunen@nvidia.com>\n\t<20170928125044.32516-5-mperttunen@nvidia.com>","From":"Dmitry Osipenko <digetx@gmail.com>","Message-ID":"<0e8d5867-f689-a4fe-9460-cf3642e90545@gmail.com>","Date":"Sat, 30 Sep 2017 05:44:13 +0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170928125044.32516-5-mperttunen@nvidia.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","Sender":"linux-tegra-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-tegra.vger.kernel.org>","X-Mailing-List":"linux-tegra@vger.kernel.org"}}]