From patchwork Tue May 15 10:18:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10400799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3DFEE600F4 for ; Tue, 15 May 2018 10:20:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 231E528746 for ; Tue, 15 May 2018 10:20:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1789D28755; Tue, 15 May 2018 10:20:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 403A42874B for ; Tue, 15 May 2018 10:20:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C39F889911; Tue, 15 May 2018 10:20:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0055.outbound.protection.outlook.com [104.47.2.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3B31D89911 for ; Tue, 15 May 2018 10:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=qIE6sgmwqeQedrMXtwjXUyjjccItCmUCaJ0nZBK7nrM=; b=qpBVBLkJkIbv/R1viFST7ljQC+3+Pumd+5kSU+Nwt4WuynX0qSveTiO4b+s5RociUHwKZwYYjFRmqgXbxbdaPG3jctFj7pdPWGQw/9hLm8bB/iIxZcXK5S/m5at6BAU6xqstBadFrxbi+q0sjXlWHsCfFsGNiSRz085hGhVxifc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alexandru-Cosmin.Gheorghe@arm.com; Received: from e114479-lin.cambridge.arm.com (217.140.96.140) by HE1PR08MB2682.eurprd08.prod.outlook.com (2603:10a6:7:2b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Tue, 15 May 2018 10:20:27 +0000 From: Alexandru Gheorghe To: liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH v2] drm: mali-dp: Add debugfs file for reporting internal errors Date: Tue, 15 May 2018 11:18:50 +0100 Message-Id: <1526379530-31141-1-git-send-email-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20180514091925.GA20992@e107564-lin.cambridge.arm.com> References: <20180514091925.GA20992@e107564-lin.cambridge.arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: CWLP265CA0014.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:10::26) To HE1PR08MB2682.eurprd08.prod.outlook.com (2603:10a6:7:2b::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:HE1PR08MB2682; X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB2682; 3:EdrqyCS1eDuXmGyX1Us5GN6RZE8YDLPgl4Mltv3QuomHmWNN2zgv+SeRcPmeL5quJrcb5zaIfJmhCcdcTP0zvDSQMa932YNNg97eqnj+wjuYcQpPXXGzWEwdwK4MI7DdtuLM1UPP1IK2UThDeD1bRod//pZDsvOtKaJe0/Y5bBQNZUfA8WoYq5kv2c6fajfOZqwEyNEZZU1o3ooiYfuok4UViWlmRn+sIeNUx8PbqX4o6HxUjskMVrBduIBkLkBS; 25:NOks8AJRHA3ANeNoPqD2zrzUvTq6YybmaMrqE06nihbPKr6LIFqYcJoaW2cAaRZBPhXM10lBYSgyg24TJU0vmahb3I22Zj1kD8VNau0Z2FwLfHz2qFN+StN9e20f21IloqjjZTo19qlTxF+tW5q9aJ+agembZvF+5v43/+eaOhlAc0OsarvVUm4p1clxsNIQeiySE2f/L4W5yMFruipaviOVMnb9FW04ynLh8tus26GgqxxTP2C85vyBfYntMZxQNY5V9pK6bmRuGqphdXdYga48ZLlUg9lCBYAQQpQOFppBaXufnSAkLzjTPOCwXtC/HjNToWrf2GArROI/dc9UXg==; 31:DKli56SKgrEsG5oXeHaKRkfzyQLhL66U2XRAsmwVPhbXmMjuZbnm6ZABvGIGz7ZymuD60S+bu5soTzow4MUwmpjGp8SwqEC0XMrPqPvZsjCz6h29BAcjfx8JeJzumep9C44PSOmtX0hqi2mAgVOxLWI+AWv4ni6e2Lbjrv8DzHDpd0M3x3bgvaEvDRCdli1MbgtjOukwAq0uLP1ew+X9ZNH7oi7WJk3ve+oZRGkCVTo= X-MS-TrafficTypeDiagnostic: HE1PR08MB2682: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB2682; 20:/nsz7/iRsGSLAn0/PIhRpjB/Ni8mQsF4MsFl4dCsjc7M+RaTXpqFVkJQQb2lyRwez5i9RoaFN6K1MiKZO3YDTyuCj13CrZQLrjG+MPdwzdF5emuDnQBXWuoliBhw9MQ1l2AeBnId8NVNpSDbmZHHtEzGWfET1FGKuQhIlOg7XPC+ZZ9WWZKM5aGseyb7sZ3Hi5KreNflYNYIfZffoJJWxzW6JHKQSURXcFrX91HMaSlGogjN484ZIiby3SyiQJaG; 4:s09U45GV/QWpdiLDp9AwOL+i0OfVdvT+izvbQe0htbqmN66NC+vwB/8Sstd3zRThTB6NIEUcxxhnYMv4kGoEUN1gYho6T9ZIndlKZL7SpMeRT8RdRpxuYCKg/DWPTovHHmOukGhi1j3uFZfpmzB9AQ+THMUZbO6/BPwRyP+OOysoWzg7x4nqoA02DtIfDiHoip444e2huK/nPiBATsJ5VSyIRxGgL6iL75ja5ADqRO5gFL1kM6ZiEsJly4PpH+95j4/t3ryz6KrgHYmJGnzkzeyypAQXU0Feg6QXRnCDOUkHmtgMjWihVFbZ98gYIDl8FY/Mlb0X3thzVCfaZw45z0XQImCfU5kWJPesAZStSO2Ut/3HGh79wWYvJQmS3ecb X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(211171220733660)(17755550239193); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:HE1PR08MB2682; BCL:0; PCL:0; RULEID:; SRVR:HE1PR08MB2682; X-Forefront-PRVS: 0673F5BE31 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(39860400002)(366004)(346002)(376002)(189003)(199004)(305945005)(59450400001)(47776003)(16586007)(7736002)(8676002)(6486002)(81156014)(76176011)(81166006)(16526019)(97736004)(50466002)(386003)(51416003)(52116002)(316002)(86362001)(7696005)(478600001)(50226002)(48376002)(26005)(8936002)(72206003)(2906002)(53936002)(25786009)(5660300001)(4326008)(66066001)(106356001)(6116002)(3846002)(68736007)(36756003)(11346002)(6666003)(446003)(956004)(2616005)(486006)(476003)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR08MB2682; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR08MB2682; 23:Nsx9leb/BC3lIql2pn8FflBpQeFWfdpYCut2GvGwO?= =?us-ascii?Q?qOfVUzGMfdG+Y0KYcf3BpBBJyQnarzR0oImiwuShCRsA43F3XZgAme6eSl5u?= =?us-ascii?Q?gUsiZdp7tW1TQh43f3l3MKn7xI6u0D8zFPBUnDGwKCtzgMu9Ed5xUFuovIsu?= =?us-ascii?Q?vltab8TrIRxEY/zW5ta6FM9uFu61LRWeC8UZrRE+dK3GL0iqvf+VFIPbV2jA?= =?us-ascii?Q?9BKstfF+viY78o3cUKQ3etAf1nU8baCfPPT+tfMzFtxRjEFziO3sBblRPxRe?= =?us-ascii?Q?dQJ+3m7BQc6w0rXhjYdfYleqR8naZfZdc9GgI7gAnLklEqV66Ky/dmVsFQeg?= =?us-ascii?Q?OsSE02D4CmyXz5ycpKgEq43r5Rw/PYoOF+MsaqYJC8d1VV+4auO27LVO/5+0?= =?us-ascii?Q?7RoiPg+LQarJ6wjj9X+cZtL2c/OKuC3kt3K48Pl6sTGOBySGYKL+tFGD2X5h?= =?us-ascii?Q?/nk97l3qAAAGe5mxp40zGPDpMSXpTxf7uDl/Khb6DkBxIpmLXnhRQ6w/91N4?= =?us-ascii?Q?+S8Yc+w/ZofS0+KiiHBa8Yac9CH60YSeLbFIcLmcno6v33aR+tZu5WwTx8Jl?= =?us-ascii?Q?yHkz4HukcKP1iMG4oqBfPNfzJlyuOivGNbEHprWeNc73UqTwm8pvLqkZITkh?= =?us-ascii?Q?HN3Ls9ECMvJg0X+S5ilmYWm3mu0mYUvzH9MxSedGkADQBhfHV+EEFWq2yZmv?= =?us-ascii?Q?e0CtcK8DkCZ6HTWF3ZPAQgX0boo4g5OpkXDBj75voMAIqPXovqoznfPdmK8B?= =?us-ascii?Q?523nbdHUCxfdIAviSmICarTaEN695e1EeJuCFVf3AhbvJyG6YNsbQ31yfAoD?= =?us-ascii?Q?LIEu0Rr34f40XoK3je+MUlrq16SZ080f25Q5hvomrODrgeYFnNuRnhs45PfU?= =?us-ascii?Q?2dyngyZLC1m2Kc6wMtjxA4SfPYLbJ+Ke1nivA5LA+UDokCN8jjBxn3Md0Ays?= =?us-ascii?Q?JqlOVyThsYaO+x5QTarn/ua2r6F5SV3paqL8T6D7udnK9GoV2DQFLEKOAhIJ?= =?us-ascii?Q?aVKmdeQC1wIoQdHgE1ubq6fencnqCbR93XvD0YDL9Vx/TNV9PgBC9nHoIvX6?= =?us-ascii?Q?3nPd4mqYKv7CHGi3B2Xqw2dYLyTOferDvMZpvknM9vT2E2EROVWsc4LgY+NV?= =?us-ascii?Q?/AMynwTO6OqiAKIFXMyA9yIc/fygFnSoyGd4Hn6uhy4rydk+ZvJ6w=3D=3D?= X-Microsoft-Antispam-Message-Info: nYTHB/IAaBL1jbPUCPn+hDskBWHiNmBnCRHDUTwOOjzRdJBeaD84Kb5K37haJZeNNhHP/Gr45eND/7wCfvyvrOnwfU4HIHZ1fdEVqJwGi+AZZK7xk6ub+UBbKsZyL046vIUNfgTtYXEDDGIbKShitpPh0t0GPdxjFe2PNDicsf5XMA/xcDKixJcLbH4ZLo/B X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB2682; 6:UYV6qgKc8bFZQMp1Fp3E7/+VjuwGzyIHzBMgE9mdZZaGNL1ij54ffJxKKHzGksnM4UF7qJAsLZsUVOH3XA/gzQYygcPjQTJFcKG7lLMfEYBa5aLXkAA4f62c3d4ct0FroFAh/Khw3BMztA41hUY/qNFupLWw234BAdVPUnsOBeWUlhtYq+4pyS9pHh3XYZ5hi2cy+xx1uKjD2kvXK9owjyq+Qb1UJYBWRmJMxiA7B7f3z3YU3umkMI/hvGps1cG2Z5+iZszzsq2F4WUk/MAQJhm2GQWP+HY86JyIiGbZrZIWrMOlV/ojFeYsFkSw9dsF701PcB2fFxbK3nc0AQHZ2BlyZfPDnGwSM38HuwWNfE3ONePkP18bREHNbNZaeGRwOa/8cCRnKzfEydWEY9g7w922Dls8qQ/NkGboGKy80QCZm2JFoRxPjLjB2qNu/2dHukQQwROCP00bQAobeiU8sQ==; 5:2f/QwdBxk/ImvfBK7oQtxvpSrJSSYeOyxCehD2h6XGQ7gtW2PxsHFMWVWvU86IXJMkqgVHI2khyrc1AXOO5aXTKZQsJEMCn1yEHUyJZhigxBFNgVduXWLuSlrMqNlo6/5KCjUfg6bk2ynjZE9iKL6lmrjUOPa+y35Eb/8AFhdiI=; 24:arEXRr9mxwLitnEIrpTB/CLL950Ie8vsEcwLAaz+VB/Nplfr4gNQeNFonAxmsB3Sx+GR8FqcF5An3JQOz01yT6OpmLxA2uT97Qy6hUllyHM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB2682; 7:m0V3f9rj8GQai8k6nzOAbsogWPycLxtZEl99Je+BrPzIG0tFTCePVuNYT+CokBo2RBvIh2Sz9gpK9ZhpZ+UkrAzVSBNZiDtx0uA8i+1SfZwmtHkDemDrbri/XcnRhyO3vZTpDuSmGuL6xr306eLFM8H6auhxLk73vugl6pfDYGIGO7HvbLIS10ak0Xqxp4s4kS6tHehUz/siNmiT0UOsGNxq6JNEGiRLZfqZ9Xz2wzeA14DaI/0n9qATG8oF/J5p X-MS-Office365-Filtering-Correlation-Id: fa207324-9fe8-4be9-63e1-08d5ba4d7b33 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2018 10:20:27.7663 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa207324-9fe8-4be9-63e1-08d5ba4d7b33 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB2682 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Status register contains a lot of bits for reporting internal errors inside Mali DP. Currently, we just silently ignore all of the errors, that doesn't help when we are investigating different bugs, especially on the FPGA models which have a lot of constraints, so we could easily end up in AXI or underrun errors. Add a new file called debug that contains an aggregate of the errors reported by the Mali DP hardware. E.g: [root@alarm ~]# cat /sys/kernel/debug/dri/1/debug [DE] num_errors : 167 [DE] last_error_status : 0x00000001 [DE] last_error_vblank : 385 [SE] num_errors : 3 [SE] last_error_status : 0x00e23001 [SE] last_error_vblank : 201 Changes since v2: - Add lock to protect the errors stats. - Add possibility to reset the error stats by writing anything to the debug file. Signed-off-by: Alexandru Gheorghe Acked-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_drv.c | 104 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/arm/malidp_drv.h | 19 +++++++ drivers/gpu/drm/arm/malidp_hw.c | 46 ++++++++++++++--- drivers/gpu/drm/arm/malidp_hw.h | 1 + drivers/gpu/drm/arm/malidp_regs.h | 6 +++ 5 files changed, 169 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index 8d20faa..8bfeb46 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -327,6 +328,106 @@ static int malidp_dumb_create(struct drm_file *file_priv, return drm_gem_cma_dumb_create_internal(file_priv, drm, args); } +#ifdef CONFIG_DEBUG_FS + +static void malidp_error_stats_init(struct malidp_error_stats *error_stats) +{ + error_stats->num_errors = 0; + error_stats->last_error_status = 0; + error_stats->last_error_vblank = -1; +} + +void malidp_error(struct malidp_drm *malidp, + struct malidp_error_stats *error_stats, u32 status, + u64 vblank) +{ + unsigned long irqflags; + + spin_lock_irqsave(&malidp->errors_lock, irqflags); + error_stats->last_error_status = status; + error_stats->last_error_vblank = vblank; + error_stats->num_errors++; + spin_unlock_irqrestore(&malidp->errors_lock, irqflags); +} + +void malidp_error_stats_dump(const char *prefix, + struct malidp_error_stats error_stats, + struct seq_file *m) +{ + seq_printf(m, "[%s] num_errors : %d\n", prefix, + error_stats.num_errors); + seq_printf(m, "[%s] last_error_status : 0x%08x\n", prefix, + error_stats.last_error_status); + seq_printf(m, "[%s] last_error_vblank : %lld\n", prefix, + error_stats.last_error_vblank); +} + +static int malidp_show_stats(struct seq_file *m, void *arg) +{ + struct drm_device *drm = m->private; + struct malidp_drm *malidp = drm->dev_private; + unsigned long irqflags; + struct malidp_error_stats de_errors, se_errors; + + spin_lock_irqsave(&malidp->errors_lock, irqflags); + de_errors = malidp->de_errors; + se_errors = malidp->se_errors; + spin_unlock_irqrestore(&malidp->errors_lock, irqflags); + malidp_error_stats_dump("DE", de_errors, m); + malidp_error_stats_dump("SE", se_errors, m); + return 0; +} + +static int malidp_debugfs_open(struct inode *inode, struct file *file) +{ + return single_open(file, malidp_show_stats, inode->i_private); +} + +static ssize_t malidp_debugfs_write(struct file *file, const char __user *ubuf, + size_t len, loff_t *offp) +{ + struct seq_file *m = file->private_data; + struct drm_device *drm = m->private; + struct malidp_drm *malidp = drm->dev_private; + unsigned long irqflags; + + spin_lock_irqsave(&malidp->errors_lock, irqflags); + malidp_error_stats_init(&malidp->de_errors); + malidp_error_stats_init(&malidp->se_errors); + spin_unlock_irqrestore(&malidp->errors_lock, irqflags); + return len; +} + +static const struct file_operations malidp_debugfs_fops = { + .owner = THIS_MODULE, + .open = malidp_debugfs_open, + .read = seq_read, + .write = malidp_debugfs_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static int malidp_debugfs_init(struct drm_minor *minor) +{ + struct malidp_drm *malidp = minor->dev->dev_private; + struct dentry *dentry = NULL; + + malidp_error_stats_init(&malidp->de_errors); + malidp_error_stats_init(&malidp->se_errors); + spin_lock_init(&malidp->errors_lock); + dentry = debugfs_create_file("debug", + S_IRUGO | S_IWUSR, + minor->debugfs_root, minor->dev, + &malidp_debugfs_fops); + if (!dentry) { + DRM_ERROR("Cannot create debug file\n"); + return -ENOMEM; + } + return 0; +} + +#endif //CONFIG_DEBUG_FS + static struct drm_driver malidp_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_PRIME, @@ -343,6 +444,9 @@ static struct drm_driver malidp_driver = { .gem_prime_vmap = drm_gem_cma_prime_vmap, .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, +#ifdef CONFIG_DEBUG_FS + .debugfs_init = malidp_debugfs_init, +#endif .fops = &fops, .name = "mali-dp", .desc = "ARM Mali Display Processor driver", diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h index c70989b..bd907a4 100644 --- a/drivers/gpu/drm/arm/malidp_drv.h +++ b/drivers/gpu/drm/arm/malidp_drv.h @@ -15,9 +15,16 @@ #include #include +#include #include #include "malidp_hw.h" +struct malidp_error_stats { + s32 num_errors; + u32 last_error_status; + s64 last_error_vblank; +}; + struct malidp_drm { struct malidp_hw_device *dev; struct drm_crtc crtc; @@ -25,6 +32,12 @@ struct malidp_drm { struct drm_pending_vblank_event *event; atomic_t config_valid; u32 core_id; +#ifdef CONFIG_DEBUG_FS + struct malidp_error_stats de_errors; + struct malidp_error_stats se_errors; + /* Protects errors stats */ + spinlock_t errors_lock; +#endif }; #define crtc_to_malidp_device(x) container_of(x, struct malidp_drm, crtc) @@ -62,6 +75,12 @@ struct malidp_crtc_state { int malidp_de_planes_init(struct drm_device *drm); int malidp_crtc_init(struct drm_device *drm); +#ifdef CONFIG_DEBUG_FS +void malidp_error(struct malidp_drm *malidp, + struct malidp_error_stats *error_stats, u32 status, + u64 vblank); +#endif + /* often used combination of rotational bits */ #define MALIDP_ROTATED_MASK (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270) diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c index d789b46..c9896ae 100644 --- a/drivers/gpu/drm/arm/malidp_hw.c +++ b/drivers/gpu/drm/arm/malidp_hw.c @@ -632,10 +632,16 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { MALIDP500_DE_IRQ_VSYNC | MALIDP500_DE_IRQ_GLOBAL, .vsync_irq = MALIDP500_DE_IRQ_VSYNC, + .err_mask = MALIDP_DE_IRQ_UNDERRUN | + MALIDP500_DE_IRQ_AXI_ERR | + MALIDP500_DE_IRQ_SATURATION, }, .se_irq_map = { .irq_mask = MALIDP500_SE_IRQ_CONF_MODE, .vsync_irq = 0, + .err_mask = MALIDP500_SE_IRQ_INIT_BUSY | + MALIDP500_SE_IRQ_AXI_ERROR | + MALIDP500_SE_IRQ_OVERRUN, }, .dc_irq_map = { .irq_mask = MALIDP500_DE_IRQ_CONF_VALID, @@ -669,10 +675,15 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { .irq_mask = MALIDP_DE_IRQ_UNDERRUN | MALIDP550_DE_IRQ_VSYNC, .vsync_irq = MALIDP550_DE_IRQ_VSYNC, + .err_mask = MALIDP_DE_IRQ_UNDERRUN | + MALIDP550_DE_IRQ_SATURATION | + MALIDP550_DE_IRQ_AXI_ERR, }, .se_irq_map = { - .irq_mask = MALIDP550_SE_IRQ_EOW | - MALIDP550_SE_IRQ_AXI_ERR, + .irq_mask = MALIDP550_SE_IRQ_EOW, + .err_mask = MALIDP550_SE_IRQ_AXI_ERR | + MALIDP550_SE_IRQ_OVR | + MALIDP550_SE_IRQ_IBSY, }, .dc_irq_map = { .irq_mask = MALIDP550_DC_IRQ_CONF_VALID, @@ -707,10 +718,20 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = { MALIDP650_DE_IRQ_DRIFT | MALIDP550_DE_IRQ_VSYNC, .vsync_irq = MALIDP550_DE_IRQ_VSYNC, + .err_mask = MALIDP_DE_IRQ_UNDERRUN | + MALIDP650_DE_IRQ_DRIFT | + MALIDP550_DE_IRQ_SATURATION | + MALIDP550_DE_IRQ_AXI_ERR | + MALIDP650_DE_IRQ_ACEV1 | + MALIDP650_DE_IRQ_ACEV2 | + MALIDP650_DE_IRQ_ACEG | + MALIDP650_DE_IRQ_AXIEP, }, .se_irq_map = { - .irq_mask = MALIDP550_SE_IRQ_EOW | - MALIDP550_SE_IRQ_AXI_ERR, + .irq_mask = MALIDP550_SE_IRQ_EOW, + .err_mask = MALIDP550_SE_IRQ_AXI_ERR | + MALIDP550_SE_IRQ_OVR | + MALIDP550_SE_IRQ_IBSY, }, .dc_irq_map = { .irq_mask = MALIDP550_DC_IRQ_CONF_VALID, @@ -799,10 +820,17 @@ static irqreturn_t malidp_de_irq(int irq, void *arg) return ret; mask = malidp_hw_read(hwdev, MALIDP_REG_MASKIRQ); - status &= mask; + /* keep the status of the enabled interrupts, plus the error bits */ + status &= (mask | de->err_mask); if ((status & de->vsync_irq) && malidp->crtc.enabled) drm_crtc_handle_vblank(&malidp->crtc); +#ifdef CONFIG_DEBUG_FS + if (status & de->err_mask) { + malidp_error(malidp, &malidp->de_errors, status, + drm_crtc_vblank_count(&malidp->crtc)); + } +#endif malidp_hw_clear_irq(hwdev, MALIDP_DE_BLOCK, status); return (ret == IRQ_NONE) ? IRQ_HANDLED : ret; @@ -878,11 +906,15 @@ static irqreturn_t malidp_se_irq(int irq, void *arg) return IRQ_NONE; status = malidp_hw_read(hwdev, hw->map.se_base + MALIDP_REG_STATUS); - if (!(status & se->irq_mask)) + if (!(status & (se->irq_mask | se->err_mask))) return IRQ_NONE; +#ifdef CONFIG_DEBUG_FS + if (status & se->err_mask) + malidp_error(malidp, &malidp->se_errors, status, + drm_crtc_vblank_count(&malidp->crtc)); +#endif mask = malidp_hw_read(hwdev, hw->map.se_base + MALIDP_REG_MASKIRQ); - status = malidp_hw_read(hwdev, hw->map.se_base + MALIDP_REG_STATUS); status &= mask; /* ToDo: status decoding and firing up of VSYNC and page flip events */ diff --git a/drivers/gpu/drm/arm/malidp_hw.h b/drivers/gpu/drm/arm/malidp_hw.h index b5dd6c7..b45f99f 100644 --- a/drivers/gpu/drm/arm/malidp_hw.h +++ b/drivers/gpu/drm/arm/malidp_hw.h @@ -52,6 +52,7 @@ struct malidp_format_id { struct malidp_irq_map { u32 irq_mask; /* mask of IRQs that can be enabled in the block */ u32 vsync_irq; /* IRQ bit used for signaling during VSYNC */ + u32 err_mask; /* mask of bits that represent errors */ }; struct malidp_layer { diff --git a/drivers/gpu/drm/arm/malidp_regs.h b/drivers/gpu/drm/arm/malidp_regs.h index 149024f..7c37390 100644 --- a/drivers/gpu/drm/arm/malidp_regs.h +++ b/drivers/gpu/drm/arm/malidp_regs.h @@ -53,6 +53,8 @@ #define MALIDP550_DE_IRQ_AXI_ERR (1 << 16) #define MALIDP550_SE_IRQ_EOW (1 << 0) #define MALIDP550_SE_IRQ_AXI_ERR (1 << 16) +#define MALIDP550_SE_IRQ_OVR (1 << 17) +#define MALIDP550_SE_IRQ_IBSY (1 << 18) #define MALIDP550_DC_IRQ_CONF_VALID (1 << 0) #define MALIDP550_DC_IRQ_CONF_MODE (1 << 4) #define MALIDP550_DC_IRQ_CONF_ACTIVE (1 << 16) @@ -60,6 +62,10 @@ #define MALIDP550_DC_IRQ_SE (1 << 24) #define MALIDP650_DE_IRQ_DRIFT (1 << 4) +#define MALIDP650_DE_IRQ_ACEV1 (1 << 17) +#define MALIDP650_DE_IRQ_ACEV2 (1 << 18) +#define MALIDP650_DE_IRQ_ACEG (1 << 19) +#define MALIDP650_DE_IRQ_AXIEP (1 << 28) /* bit masks that are common between products */ #define MALIDP_CFG_VALID (1 << 0)