From patchwork Fri May 11 17:56:03 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: 10394789 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 C734760348 for ; Fri, 11 May 2018 17:56:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB2BC28F77 for ; Fri, 11 May 2018 17:56:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CED8B28F7A; Fri, 11 May 2018 17:56:22 +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 F07F128F77 for ; Fri, 11 May 2018 17:56:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 61F996E2E1; Fri, 11 May 2018 17:56:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30065.outbound.protection.outlook.com [40.107.3.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 706CF6E2E1 for ; Fri, 11 May 2018 17:56:17 +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=Mhg+PmnF5IxZsq+Q4fhtTtNH+eWisCZKBzTb2D7aAl0=; b=qqAG3BdAcFEK8oZ9VE+M2/JwV1SsKu+Q/4FlDdgyZYPLOLqDJFZ5bgSrxv1pUPSHSkh2LuiO8c7f2RdvmoTMt3ZcbKDdQGYLDaauMaOL1hysfvmA12g5K5OX1NrgMF+yAlijHswY0LZNmZutPRBAE8ZNHYg0Pwo7B1qDLtxhNoc= 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 AM4PR08MB2676.eurprd08.prod.outlook.com (2603:10a6:205:c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Fri, 11 May 2018 17:56:14 +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] drm: mali-dp: Add debugfs file for reporting internal errors Date: Fri, 11 May 2018 18:56:03 +0100 Message-Id: <1526061363-30411-1-git-send-email-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: CWLP265CA0008.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:10::20) To AM4PR08MB2676.eurprd08.prod.outlook.com (2603:10a6:205:c::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:AM4PR08MB2676; X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB2676; 3:lcOOgaPxk+N60mU83r3seQEQSi0vIKmgMCNQwUTnHPNeAynqqZXfoqLA/t4bSF/BwwYFDIIF8iUa0Nw+CrhQ94VK3Jvil2t+lVEJWYJTDKYEZA/qqMnOdaxkm+3CInBCxcGX+Q5gUHi0PmFS5PEk9WpZfI1HLrMifyxyAwUTPvvVVBQ22dXkO+0ACx5oUXZB23nvt2TuHJV8aiFlJTin77PY2ZVHXvpbrNcQf3aOiw7x0ICR5xrW1ialqjV3ru3+; 25:oTVl9bTJwJmhG0ZaGGcIynFzlk2p+WKWutyQm8yHXV4bdzIYBpySEzOYDrMtyOOiSg35eBaXcTpTvRc3JJ3kJRX5vz2RlGibjoODAgSQ8JwLlMXigKEmi3qSoZa+Vqfk6qKkGupO0lLqyPOLFfnP+xXtHwIpu6A+PIropKb4nlk2RR5vnS9OayC9rp+Vjc/GnL2hxQ4HYRrf5TTEhh/WF6j7lTowqpuNjiGDvfbPR9uR0B0kLgC90gy/2vd87ICF9vhB5r9GgPm1Wb9jseTGge3sDiaHwvNiQXk7S8MUpIqrEn4HTkvNB3kFPQ2SfELuI9ngffNurfm87okaSHJeZQ==; 31:ruDBfl6bL8eJoD2rmfMZa25+AcRlEhvNMvhX/Xmr6vwFEVqXbxnKEDYyW5qootvLyN5O/5+LHnJmzLmZZmFE2m6xMbBZ25aAR7V9Nr6E0Oecne1xI8y4YqiWCrCkGqB0E0UaafsqmuFhg3zvYemvl8xYwmmMaAYr652EVm1CxStBTrms9/pHEggPuSNr7ovNIrO7luMpy/4KS3PNE6GjyjPOAvzQR+SCXU6Ud9Sx0gU= X-MS-TrafficTypeDiagnostic: AM4PR08MB2676: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB2676; 20:Ag6bjhvnui+vcgXX4RwUQXuRr6D6/4InskxbhCUKnWwai/z+3YhhlFiz1oKXguFVnm50wgay/EeH4K2xzJHUk0PsPFIJLRAX2VGIYcSwWiUxpWoT8MEzrtT5o8bH2rbCRI8+gmh3SEaM6NTcwa7U5BNRghFoHQycyifWzml/7qFaABw4xZchqqyp4hOP/ka8xK/M8DsKJ2i8hcoAuIQPgVCGUxFKbCnf/Li8TDuhp7vbdpa4BLKraf2PenD3nQOQ; 4:m1UafhR4IW5npLLT0Vw7RkM9U96aNUwY3yC1XaO9p2qwomwzZO790pwfAaPAoanJIJfJxqolcR8y/1gfQj7I3jwnBkl67teBM+ulVIVIeTjiNhUEgtlb9V3kV2zEqrgqtlOkFv7b4Vn3URkzl5lVdV4UZ/oTDrIajHj6IY4Tp8ZzyCJWnlt51xebQoFIZnCFj74Kz6ndOzZ+GLOLHs2BYUd03caKdkETSxgb98l15jIlluzNLDSlN4qiVFUdv8ZYp+V9mUXkmrwXZZGRNz6YR4nzs8aibN2jD9S0Wg8b7IsOUr7dozXkmjlzuz24q68OWX6ADTUYP44bNOZEXJf/lI6o19HKdLkjx0zrY3jnid8OcRcpLDdCygP/7XTTpiAkq5HQM0qqf0uFSRQqiBkTmTTzEVL9yNrepC9RYkgA7rY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(217544274631240)(211171220733660)(17755550239193); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM4PR08MB2676; BCL:0; PCL:0; RULEID:; SRVR:AM4PR08MB2676; X-Forefront-PRVS: 06691A4183 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(376002)(39380400002)(39860400002)(346002)(199004)(189003)(68736007)(50466002)(3846002)(6116002)(106356001)(2906002)(956004)(486006)(2616005)(476003)(8936002)(36756003)(1857600001)(5660300001)(81156014)(8676002)(81166006)(52116002)(51416003)(7696005)(316002)(4326008)(97736004)(966005)(66066001)(47776003)(50226002)(26005)(6666003)(86362001)(53936002)(16586007)(48376002)(6306002)(72206003)(59450400001)(6486002)(105586002)(16526019)(478600001)(386003)(25786009)(305945005)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB2676; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR08MB2676; 23:sZQ4M/sYBCaFzStx/kQpsBg1+oCVmSejSk9H5+hdw?= =?us-ascii?Q?uQD6UWtlVTehMZlc0XgnomaHttHNCRfytfFjkyUetcAbtafbCj30ainIM495?= =?us-ascii?Q?mhIwCoMKCLktTX058WG/QLP3JYh39Hra14ija2cPeQ9YFJeD457y8xAwoSeD?= =?us-ascii?Q?jAxntzanXF6aU0cTioa7lIAePD+5oxPuuHl4aCQ5ZVq0JG0bN0o1BD5PWsGl?= =?us-ascii?Q?99xB7HsC2ItdBoO4rE/jAamtiy/9pcyZ3nHYkw+U9qhRA3Lox9PcquCgeJA4?= =?us-ascii?Q?lLjBuSFku9b4bVTBzQy/WVysY15lOpkYf+kvWuwl9UcEQ0dN/K8oDHuKvMed?= =?us-ascii?Q?pUsi1ULSZZZvwqmMP4ECyqAG1sX/E6lyRtYArqEBuP7m2C//s3eZiTkfnChW?= =?us-ascii?Q?PuyVMOc+Qkf9O/VL58AkaWl9N6znbY7kIw1erBUqSZD00lwBghqVhN6uxfe8?= =?us-ascii?Q?EgIKrp9yMozkmruwopuCElOLKdynRgEeaFQ3hzmm9CA2AouNP8hNYh0kxxrR?= =?us-ascii?Q?S+JIJMvCJ5qyAH40f5LJBOqc8SErAP1xScPyvixS5sEFCPJfGklbojPpbznD?= =?us-ascii?Q?FN+MDjQ70+SMYrvBzj1b0T6H3IB3IXJowoO89mddfQc2QSeR0s+Y7wZR4WTC?= =?us-ascii?Q?igz311HLk6haDmXdIVwXzPHMDvKRCZYSXKuaQsGqY895nEH0L2Pmb8ATCFQr?= =?us-ascii?Q?sGztBKLy+oz5G7roLuEXXFAVpzPgRx/YbFDiYvrQrgPZtPJBzvN0GWINKlee?= =?us-ascii?Q?QSwHa3pzMnhVsz54L1YWK9hfVO5wQyWtvmNZ+uR+nZ8/4yPKoWELFx9YPDGT?= =?us-ascii?Q?qKPwi5tVzL1WJROIp4fbuae/aE7SM1OHBzf0+ko7qsaPFntoDAsQk3DdopFC?= =?us-ascii?Q?P7xay23d63CPX59lJDGot2rFH9114GZbUhEg0H3a+lFOW2bqMMB8qpbVZay7?= =?us-ascii?Q?EOnN22xj7rCdjtxYqq/gC2uzqpwsvxXny691XJ9f11C1EonnNWF8eel1n+Dh?= =?us-ascii?Q?pS2Gbz8VYHNpMH+c8P2NrZ5QHKf60T2E53UuDHqXf9Ch2hYHIkaFf6i4Ji4S?= =?us-ascii?Q?YHNRxVxmpAFI462U+FJylVjHO5m2FidILZQFaI2mM/ZqN85hRJ4VMu164GSi?= =?us-ascii?Q?uikWwaE3rnLUS/gP1oyeymHHFM1W2oAau/7ZQjdInFjaYfS+tuM5z/ZtlmuN?= =?us-ascii?Q?URJxlqc9VZ4o0o=3D?= X-Microsoft-Antispam-Message-Info: U7Pzv2qNsr7/FQzdoKTCopyrps5H49zum8oH6Y6oEEievym3MbmRhYjJ/CKzNsYhxndg90yorOjB9mRloeEd1gjHSJhZ807tZBDj2VlNn+Tm+BqqkwfG9K7QD8GjGZiNxmj3iBnKS449TMciCB0quOfqgXvF3mucJ46Z/z2LW0UHdU26Aicte73qfe7WoD1K X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB2676; 6:S0tJ/Oq/JdpW3SOuqSVCqp0XrFN4u2k5O5Erc9Kz2mXSLr1O7etdfv2DQdVwWufynCUvIXkw7S2qoAL8jmFxMucshaxYh8MwoOdJrwPU6O/Q3rWtmkgz1ziLoZcx8lxTzLIukusWNsYVeQUT+aXBusQRxpb6IZJ4ouvYdw+YbR2m6LohLbqyFoFcEOQnYXizliAo/yTqLSQnyCEM4v80d2TBVKsswg9TrEdxeJVXXEAsbyROPOaNBgspMBxbeWKiSvSQMiyL9aUPJGfwJU/l/HTw7vYAo259wvM1yMbwIUJfBGCEpcOuCMDKUOGRZbmP9CUKMr51V8fZTe6jtDYSBbEc4m/WFAJqXOwRNFB2hn3VmUPP7QQc6JyfIWqAl4sgpRtahvNsIL/E6bvXhcmEJ/U7dL8KFGh+zK4b5BNfcoFtSDXYUzR+VGfkrWUDTqVkoOvpYdayEvoRBYymPI69CA==; 5:BK7FDZuDvP+sBFgFCTYLpioP/dZSvBRd+6LJdCxCuNQi/DC/6SrG7V5iuF+B+0fEZpOT8Ga3jYPmIxy+qdzqNpmXDr5ewz0gUruHPJbNHsyh0e+tDaSHNfH+re3sDrKC3a45HxN4ZVnHDgU3Xe3h+3Qb8FXFc8Jl+ekKhy2HtgM=; 24:Hh3ys1LXvgbMreN1XWnJu7fNfFauo0lU76XuQX0db7CAbU/WsqvX4K8gmJpyHBjkPepp1W1d1oNqoj2/Gt0UNpgKzyBRMF4JFP7XURebnNU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB2676; 7:3oScK4nNQryZ6sdE53y22O5nBzu/lkPMtVOQzVUz02QZEekegegbQpVJXPwU9tuS21a3aHCpdtyJFLuckWFXTj5iHIJ3Nj1+/u2C7CXRh66CmMZQEeRqBeqSkp0eWsZMMAOve4bPYiNOF8I3t1Erh8PiQhxTlWbi4kHKewMaL6a+SkirEViqtFD2Tv482VoXb63l1R/PxEmKqhiIBEooBauHmP//9kD3wsiVhGL01u5P1iav6yuf4CmVbjM37PM+ X-MS-Office365-Filtering-Correlation-Id: 447a6264-10da-4a70-8e24-08d5b7687cf4 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2018 17:56:14.1333 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 447a6264-10da-4a70-8e24-08d5b7687cf4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB2676 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 erorrs, that doesn't help when we are investigating different bugs, especially on the FPGA models which have a lot of constrains, so we could easily end up in AXI or underrun errors. Add a new file called debug that contains an agregate 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 This a morphosis of the patch presented here [1], where the errors where reported continuously via trace_printk. [1] https://lists.freedesktop.org/archives/dri-devel/2018-February/167042.html Signed-off-by: Alexandru Gheorghe Acked-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_drv.c | 61 +++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/arm/malidp_drv.h | 15 ++++++++++ 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, 122 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index 8d20faa..70ce19a 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 @@ -29,6 +30,7 @@ #include #include #include +#include #include "malidp_drv.h" #include "malidp_regs.h" @@ -327,6 +329,62 @@ 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) +{ + atomic_set(&error_stats->num_errors, 0); + atomic_set(&error_stats->last_error_status, 0); + atomic64_set(&error_stats->last_error_vblank, -1); +} + +void malidp_error(struct malidp_error_stats *error_stats, u32 status, + u64 vblank) +{ + atomic_set(&error_stats->last_error_status, status); + atomic64_set(&error_stats->last_error_vblank, vblank); + atomic_inc(&error_stats->num_errors); +} + +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, + atomic_read(&error_stats->num_errors)); + seq_printf(m, "[%s] last_error_status : 0x%08x\n", prefix, + atomic_read(&error_stats->last_error_status)); + seq_printf(m, "[%s] last_error_vblank : %ld\n", prefix, + atomic64_read(&error_stats->last_error_vblank)); +} + +static int malidp_show_stats(struct seq_file *m, void *arg) +{ + struct drm_info_node *node = (struct drm_info_node *)m->private; + struct drm_device *drm = node->minor->dev; + struct malidp_drm *malidp = drm->dev_private; + + malidp_error_stats_dump("DE", &malidp->de_errors, m); + malidp_error_stats_dump("SE", &malidp->se_errors, m); + return 0; +} + +static struct drm_info_list malidp_debugfs_list[] = { + { "debug", malidp_show_stats, 0 }, +}; + +static int malidp_debugfs_init(struct drm_minor *minor) +{ + struct malidp_drm *malidp = minor->dev->dev_private; + + malidp_error_stats_init(&malidp->de_errors); + malidp_error_stats_init(&malidp->se_errors); + return drm_debugfs_create_files(malidp_debugfs_list, + ARRAY_SIZE(malidp_debugfs_list), minor->debugfs_root, minor); +} + +#endif //CONFIG_DEBUG_FS + static struct drm_driver malidp_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_PRIME, @@ -343,6 +401,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..c49056c 100644 --- a/drivers/gpu/drm/arm/malidp_drv.h +++ b/drivers/gpu/drm/arm/malidp_drv.h @@ -18,6 +18,12 @@ #include #include "malidp_hw.h" +struct malidp_error_stats { + atomic_t num_errors; + atomic_t last_error_status; + atomic64_t last_error_vblank; +}; + struct malidp_drm { struct malidp_hw_device *dev; struct drm_crtc crtc; @@ -25,6 +31,10 @@ 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; +#endif }; #define crtc_to_malidp_device(x) container_of(x, struct malidp_drm, crtc) @@ -62,6 +72,11 @@ 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_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..ec40a44 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->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->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)