From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76AC1C433FE for ; Wed, 22 Dec 2021 17:07:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344202AbhLVRHH (ORCPT ); Wed, 22 Dec 2021 12:07:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbhLVRHH (ORCPT ); Wed, 22 Dec 2021 12:07:07 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 749E8C061574 for ; Wed, 22 Dec 2021 09:07:06 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id f134-20020a1c1f8c000000b00345c05bc12dso1864440wmf.3 for ; Wed, 22 Dec 2021 09:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xf0dcGkvmURFRRNeHLTQphIAlqufMTucRtU3DVITyFY=; b=RCVUlNvIf2TY1hZQ2BN3r7OcxX0mQkrpHTo1Xj5KCDbfFss8/WsANNVOQaJoQt36XX vt5FB0/ZaNCw0oT9EzetO/35FMtQcEf0iHBiFnhdNM1a/yOT3znsrOk2ovuXhCP9MsLj kqNzaai7C3ovmFxJ8plk9KfgerLUXa0NB9urt6Qzjov8ecyJgbRdZ8Qa35Kj4LP5ErEr H/oQSA2M3Bd6sQ8wNvIQsBVj0KDgg+AeSbRm8eIwUBNC+YukWgez412JYmnKlMb6vVNh FlZJiXK+277nT2aHd8oMaqgamCw1rxwpTJiumj+k3xOI7VhCxKJZRn+rLQp7ysvI4zBm gkMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xf0dcGkvmURFRRNeHLTQphIAlqufMTucRtU3DVITyFY=; b=Ipz8QSOuQX688WF/RfRqsHhqCR9YTnlW6d/ykZpccykwwfyhkiWv42fy8vAFVa1yg4 nSJFEjf8MpBusX2feC8LG+w915jj6XV5MaLodEqxKjxzPh/X12yu8w69UIkpTEtxk2rS JNdiPwB9RE0yy5RM4sjAuEiaRizypd5o6QaF9N6kIFRRJDkfTVeg76Pr7Qh8UZi+i4Xm fdc3ShUU759YH4XufawixBdJ5YOKBBZa7HWaci8h8dqwdciAKul5lsAKhPJ2eOHGQMXW 4bf1unbhOUxDFMzEQAQBK0q5Cd8VsxBH2U/Rhm9Bm0qxofxm3QMUB3kHm45vtYpGRlqK ABaw== X-Gm-Message-State: AOAM530UZeUQlcR77u+jiLT6ZOUUOT/678XXr0IuI5EHtrr5sI0GxfhR waZXN79HxSs3bU6RaCPy6d4= X-Google-Smtp-Source: ABdhPJxHHsH7bFTy6QqNlKLW9op/sk+p9MsGhCZ8BoEj0/Y1+Hg7+OLndTV/9ExKMNaqsZgnSML3ww== X-Received: by 2002:a1c:5404:: with SMTP id i4mr1534466wmb.107.1640192825110; Wed, 22 Dec 2021 09:07:05 -0800 (PST) Received: from archbook.localnet ([217.151.114.10]) by smtp.gmail.com with ESMTPSA id y13sm2796186wrd.89.2021.12.22.09.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 09:07:04 -0800 (PST) From: Nicolas Frattaroli To: dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, kernel@pengutronix.de, Andy Yan , Benjamin Gaignard , Michael Riesch , Sandy Huang , Heiko =?ISO-8859-1?Q?St=FCbner?= , Peter Geis , Sascha Hauer , Sascha Hauer , Nicolas Frattaroli Subject: Re: [PATCH 22/22] drm: rockchip: Add VOP2 driver Date: Wed, 22 Dec 2021 18:07:02 +0100 Message-ID: <26571551.24qHfsk75X@archbook> In-Reply-To: <1761858.GBYTvM79DV@archbook> References: <20211220110630.3521121-1-s.hauer@pengutronix.de> <20211220110630.3521121-23-s.hauer@pengutronix.de> <1761858.GBYTvM79DV@archbook> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Dienstag, 21. Dezember 2021 14:44:39 CET Nicolas Frattaroli wrote: > On Montag, 20. Dezember 2021 12:06:30 CET Sascha Hauer wrote: > > From: Andy Yan > > > > The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568. > > It replaces the VOP unit found in the older Rockchip SoCs. > > > > This driver has been derived from the downstream Rockchip Kernel and > > heavily modified: > > > > - All nonstandard DRM properties have been removed > > - dropped struct vop2_plane_state and pass around less data between > > functions > > - Dropped all DRM_FORMAT_* not known on upstream > > - rework register access to get rid of excessively used macros > > - Drop all waiting for framesyncs > > > > The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB > > board. Overlay support is tested with the modetest utility. AFBC support > > on the cluster windows is tested with weston-simple-dmabuf-egl on > > weston using the (yet to be upstreamed) panfrost driver support. > > > > Signed-off-by: Sascha Hauer > > --- > > Hi Sascha, > > quick partial review of the code in-line. > > For reference, I debugged locking issues with the kernel lock > debug config options and assert_spin_locked in the reg write > functions, as well as some manual deduction. > As a small follow-up, I've completely mapped out the calls to vop2_writel, vop2_readl, vop2_vp_write and vop2_win_write and coloured in whether they were called with the lock held or not. The conclusion is startling: Most of the code absolutely does not care about the reg_lock. Here's the graph as an SVG: https://overviewer.org/~pillow/up/6800427ef3/vop2_callgraph_modified.svg vop2_isr here needs to be paid special attention, as it also acquires a different spinlock, and we want to avoid deadlocks. Perhaps we should precisely define which lock must be held for what registers, such that the vop2_isr can write its interrupt related registers without acquiring the "big" reg_lock. I'm also not entirely sure whether I should assume vop2_readl needs to be called with the lock held. This needs some investigating both in terms of whether the hardware presents a writel as an atomic write of a long, and whether the code assumes the state between readl calls is ever a consistent view. Regards, Nicolas Frattaroli From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 761DAC433F5 for ; Wed, 22 Dec 2021 17:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2P5GzmC/wU1WqTMinoY0D/ldvcilGXTh/Xxcgwa+XOk=; b=mXyB51z60EBeq3 lFw92mxPmYRfBpnxrjAYngduP3RrLIWhULY4Ufu2wS3JKeAzOzDwGiD7xraYRT3E4iB5fQ1k5op0A 4t3ifmWsP882AEnorrjcJ89xzcz9jVHdXxQLSQus5KTPnSmGxPNp85YiHHFjiwX/QlNmMD3O7fA3u AqS9ClxRcZUhTl71+JB3xYby8ms89bnUgpf6rbRkR6HTWuPYed03WuWMwcy6QRvyLYItVeHm/O1d2 hmhyyqv5mhjS6ro+uWJ9elkKH1MXKwE26o43b4xfRXHim5tCl2xRuCQnCpDZCJc+NyNd9D35G6ZcR 7ChvsDkeRyWRH+dylBGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0553-00Awye-4K; Wed, 22 Dec 2021 17:07:09 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0550-00Awxz-Q4; Wed, 22 Dec 2021 17:07:08 +0000 Received: by mail-wm1-x335.google.com with SMTP id a83-20020a1c9856000000b00344731e044bso1872772wme.1; Wed, 22 Dec 2021 09:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xf0dcGkvmURFRRNeHLTQphIAlqufMTucRtU3DVITyFY=; b=RCVUlNvIf2TY1hZQ2BN3r7OcxX0mQkrpHTo1Xj5KCDbfFss8/WsANNVOQaJoQt36XX vt5FB0/ZaNCw0oT9EzetO/35FMtQcEf0iHBiFnhdNM1a/yOT3znsrOk2ovuXhCP9MsLj kqNzaai7C3ovmFxJ8plk9KfgerLUXa0NB9urt6Qzjov8ecyJgbRdZ8Qa35Kj4LP5ErEr H/oQSA2M3Bd6sQ8wNvIQsBVj0KDgg+AeSbRm8eIwUBNC+YukWgez412JYmnKlMb6vVNh FlZJiXK+277nT2aHd8oMaqgamCw1rxwpTJiumj+k3xOI7VhCxKJZRn+rLQp7ysvI4zBm gkMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xf0dcGkvmURFRRNeHLTQphIAlqufMTucRtU3DVITyFY=; b=AszvE1OholhDHaI3N8TqneBtQtjuwj3tKX1Da4CIZIUd/+y3uUwfI/u/OZeOMVKwk9 XLib/kia7nxHjegSEllcFl+fs/QDMNGGbIfXzUiDtLVC36kkMDe2DDt8GuxjpAJ41ZwG gueIU5+8/IaysP6SgDD7DYEcPE1EF1jkWWyb18sbmLuLipZE2SA1o/S5jYDjTAx8Zcog ZAckjksdm3sIln7U2Ecd7LDuvHNsN8HyUNBYWIxloTQN4YcnauYcZjjC9agFxSwGXVOP GFLg0QsqX3NZkN55pAj/ofKIHMoljBfBkRMAXGb5i2Vah7KwXic4UViJQgM+Z9N6VuK/ gnrw== X-Gm-Message-State: AOAM5303A+GqM/TNH3cZyOrmNahE4jpzsvkw2dscwtsT054qn2WEFDwA ddTNbEDpJN3cr0WEBXdGLdY= X-Google-Smtp-Source: ABdhPJxHHsH7bFTy6QqNlKLW9op/sk+p9MsGhCZ8BoEj0/Y1+Hg7+OLndTV/9ExKMNaqsZgnSML3ww== X-Received: by 2002:a1c:5404:: with SMTP id i4mr1534466wmb.107.1640192825110; Wed, 22 Dec 2021 09:07:05 -0800 (PST) Received: from archbook.localnet ([217.151.114.10]) by smtp.gmail.com with ESMTPSA id y13sm2796186wrd.89.2021.12.22.09.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 09:07:04 -0800 (PST) From: Nicolas Frattaroli To: dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, kernel@pengutronix.de, Andy Yan , Benjamin Gaignard , Michael Riesch , Sandy Huang , Heiko =?ISO-8859-1?Q?St=FCbner?= , Peter Geis , Sascha Hauer , Sascha Hauer , Nicolas Frattaroli Subject: Re: [PATCH 22/22] drm: rockchip: Add VOP2 driver Date: Wed, 22 Dec 2021 18:07:02 +0100 Message-ID: <26571551.24qHfsk75X@archbook> In-Reply-To: <1761858.GBYTvM79DV@archbook> References: <20211220110630.3521121-1-s.hauer@pengutronix.de> <20211220110630.3521121-23-s.hauer@pengutronix.de> <1761858.GBYTvM79DV@archbook> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_090706_903582_4B32B3DB X-CRM114-Status: GOOD ( 24.71 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On Dienstag, 21. Dezember 2021 14:44:39 CET Nicolas Frattaroli wrote: > On Montag, 20. Dezember 2021 12:06:30 CET Sascha Hauer wrote: > > From: Andy Yan > > > > The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568. > > It replaces the VOP unit found in the older Rockchip SoCs. > > > > This driver has been derived from the downstream Rockchip Kernel and > > heavily modified: > > > > - All nonstandard DRM properties have been removed > > - dropped struct vop2_plane_state and pass around less data between > > functions > > - Dropped all DRM_FORMAT_* not known on upstream > > - rework register access to get rid of excessively used macros > > - Drop all waiting for framesyncs > > > > The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB > > board. Overlay support is tested with the modetest utility. AFBC support > > on the cluster windows is tested with weston-simple-dmabuf-egl on > > weston using the (yet to be upstreamed) panfrost driver support. > > > > Signed-off-by: Sascha Hauer > > --- > > Hi Sascha, > > quick partial review of the code in-line. > > For reference, I debugged locking issues with the kernel lock > debug config options and assert_spin_locked in the reg write > functions, as well as some manual deduction. > As a small follow-up, I've completely mapped out the calls to vop2_writel, vop2_readl, vop2_vp_write and vop2_win_write and coloured in whether they were called with the lock held or not. The conclusion is startling: Most of the code absolutely does not care about the reg_lock. Here's the graph as an SVG: https://overviewer.org/~pillow/up/6800427ef3/vop2_callgraph_modified.svg vop2_isr here needs to be paid special attention, as it also acquires a different spinlock, and we want to avoid deadlocks. Perhaps we should precisely define which lock must be held for what registers, such that the vop2_isr can write its interrupt related registers without acquiring the "big" reg_lock. I'm also not entirely sure whether I should assume vop2_readl needs to be called with the lock held. This needs some investigating both in terms of whether the hardware presents a writel as an atomic write of a long, and whether the code assumes the state between readl calls is ever a consistent view. Regards, Nicolas Frattaroli _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 65955C433EF for ; Wed, 22 Dec 2021 17:07:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A62E210E124; Wed, 22 Dec 2021 17:07:07 +0000 (UTC) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DEFC10E124 for ; Wed, 22 Dec 2021 17:07:06 +0000 (UTC) Received: by mail-wm1-x32f.google.com with SMTP id g191-20020a1c9dc8000000b0032fbf912885so1861795wme.4 for ; Wed, 22 Dec 2021 09:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xf0dcGkvmURFRRNeHLTQphIAlqufMTucRtU3DVITyFY=; b=RCVUlNvIf2TY1hZQ2BN3r7OcxX0mQkrpHTo1Xj5KCDbfFss8/WsANNVOQaJoQt36XX vt5FB0/ZaNCw0oT9EzetO/35FMtQcEf0iHBiFnhdNM1a/yOT3znsrOk2ovuXhCP9MsLj kqNzaai7C3ovmFxJ8plk9KfgerLUXa0NB9urt6Qzjov8ecyJgbRdZ8Qa35Kj4LP5ErEr H/oQSA2M3Bd6sQ8wNvIQsBVj0KDgg+AeSbRm8eIwUBNC+YukWgez412JYmnKlMb6vVNh FlZJiXK+277nT2aHd8oMaqgamCw1rxwpTJiumj+k3xOI7VhCxKJZRn+rLQp7ysvI4zBm gkMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xf0dcGkvmURFRRNeHLTQphIAlqufMTucRtU3DVITyFY=; b=qoLJaxju1I9tpstXZdW2x7qeVqezD1zaTRIVDDU5D8bdEVICCrnc4oneFNdEIgYm4l rcKC3mTef1B46UYUz4VGdqQ8KVAJ+f0HZ0/JG6M8N5cAT0w31u6mrtApmeC2BPCujrab lLCUHaMhv/92YrQB6mb6LbtIIBc7nTbgxLvfXcqJIG32TSaHIx/IVM72B95UdVDv6kpg 3pjS6jU2DXfJUQvqw6uWzjTRnWBuU7NDn66/FoGbXyZ9pMHM10VJwWPJVI80M7c8T73n 21j7Q9qeH4NT4ev5Wg1S4bjwWcGgW4hFuwvqVeglERkgjXIGNiVVtmI/viFzjotoJwg4 cfiA== X-Gm-Message-State: AOAM531XKqj3RdJVfSct32lGOOCHMC5Rqi1QIBiNaFvPQRXe/Y4htgSF gzsUSp9zHzXqAsgnImG0tSG73W+JjRg= X-Google-Smtp-Source: ABdhPJxHHsH7bFTy6QqNlKLW9op/sk+p9MsGhCZ8BoEj0/Y1+Hg7+OLndTV/9ExKMNaqsZgnSML3ww== X-Received: by 2002:a1c:5404:: with SMTP id i4mr1534466wmb.107.1640192825110; Wed, 22 Dec 2021 09:07:05 -0800 (PST) Received: from archbook.localnet ([217.151.114.10]) by smtp.gmail.com with ESMTPSA id y13sm2796186wrd.89.2021.12.22.09.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 09:07:04 -0800 (PST) From: Nicolas Frattaroli To: dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH 22/22] drm: rockchip: Add VOP2 driver Date: Wed, 22 Dec 2021 18:07:02 +0100 Message-ID: <26571551.24qHfsk75X@archbook> In-Reply-To: <1761858.GBYTvM79DV@archbook> References: <20211220110630.3521121-1-s.hauer@pengutronix.de> <20211220110630.3521121-23-s.hauer@pengutronix.de> <1761858.GBYTvM79DV@archbook> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Benjamin Gaignard , Peter Geis , Sascha Hauer , Sandy Huang , Nicolas Frattaroli , linux-rockchip@lists.infradead.org, Michael Riesch , kernel@pengutronix.de, Andy Yan , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Dienstag, 21. Dezember 2021 14:44:39 CET Nicolas Frattaroli wrote: > On Montag, 20. Dezember 2021 12:06:30 CET Sascha Hauer wrote: > > From: Andy Yan > > > > The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568. > > It replaces the VOP unit found in the older Rockchip SoCs. > > > > This driver has been derived from the downstream Rockchip Kernel and > > heavily modified: > > > > - All nonstandard DRM properties have been removed > > - dropped struct vop2_plane_state and pass around less data between > > functions > > - Dropped all DRM_FORMAT_* not known on upstream > > - rework register access to get rid of excessively used macros > > - Drop all waiting for framesyncs > > > > The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB > > board. Overlay support is tested with the modetest utility. AFBC support > > on the cluster windows is tested with weston-simple-dmabuf-egl on > > weston using the (yet to be upstreamed) panfrost driver support. > > > > Signed-off-by: Sascha Hauer > > --- > > Hi Sascha, > > quick partial review of the code in-line. > > For reference, I debugged locking issues with the kernel lock > debug config options and assert_spin_locked in the reg write > functions, as well as some manual deduction. > As a small follow-up, I've completely mapped out the calls to vop2_writel, vop2_readl, vop2_vp_write and vop2_win_write and coloured in whether they were called with the lock held or not. The conclusion is startling: Most of the code absolutely does not care about the reg_lock. Here's the graph as an SVG: https://overviewer.org/~pillow/up/6800427ef3/vop2_callgraph_modified.svg vop2_isr here needs to be paid special attention, as it also acquires a different spinlock, and we want to avoid deadlocks. Perhaps we should precisely define which lock must be held for what registers, such that the vop2_isr can write its interrupt related registers without acquiring the "big" reg_lock. I'm also not entirely sure whether I should assume vop2_readl needs to be called with the lock held. This needs some investigating both in terms of whether the hardware presents a writel as an atomic write of a long, and whether the code assumes the state between readl calls is ever a consistent view. Regards, Nicolas Frattaroli From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05368C433EF for ; Wed, 22 Dec 2021 17:08:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cHB14HOMUd3iJ1AM4Q0BQBN0zwzx5kHkRdXz+UEil4Y=; b=ecpJtwWNf2Jc1N wIdnWip5jBx++vEynAqpakByUX64UMs6lIh9nHfMkUyV/dNF5xg9zu+NzM50F4yH8N0+CK7DSFFL3 oVnR5ApPwa45YKmPmdzotN2zF1nq95UWtO8u7J50iLsmUlhR/D1iz/lYB9ht5g4lU47HSRwKxZbwK NLI7hvHC9lKE7qrd598Z6vYK+1wOzss4Ml7wLteSNIZxfHvz6iUbEIPjUV53MoxVK2DQ4u06DYPcx lB5xizoXztCmWhp1/ScY69V/k1/hthbGRFHUS38l+d6eCM0YL7/NsthMK2ZciJIQYR3ky0KgKtWmC npq0Y1YzEWMm5lqyYOJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0555-00Awyr-Gv; Wed, 22 Dec 2021 17:07:11 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0550-00Awxz-Q4; Wed, 22 Dec 2021 17:07:08 +0000 Received: by mail-wm1-x335.google.com with SMTP id a83-20020a1c9856000000b00344731e044bso1872772wme.1; Wed, 22 Dec 2021 09:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xf0dcGkvmURFRRNeHLTQphIAlqufMTucRtU3DVITyFY=; b=RCVUlNvIf2TY1hZQ2BN3r7OcxX0mQkrpHTo1Xj5KCDbfFss8/WsANNVOQaJoQt36XX vt5FB0/ZaNCw0oT9EzetO/35FMtQcEf0iHBiFnhdNM1a/yOT3znsrOk2ovuXhCP9MsLj kqNzaai7C3ovmFxJ8plk9KfgerLUXa0NB9urt6Qzjov8ecyJgbRdZ8Qa35Kj4LP5ErEr H/oQSA2M3Bd6sQ8wNvIQsBVj0KDgg+AeSbRm8eIwUBNC+YukWgez412JYmnKlMb6vVNh FlZJiXK+277nT2aHd8oMaqgamCw1rxwpTJiumj+k3xOI7VhCxKJZRn+rLQp7ysvI4zBm gkMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xf0dcGkvmURFRRNeHLTQphIAlqufMTucRtU3DVITyFY=; b=AszvE1OholhDHaI3N8TqneBtQtjuwj3tKX1Da4CIZIUd/+y3uUwfI/u/OZeOMVKwk9 XLib/kia7nxHjegSEllcFl+fs/QDMNGGbIfXzUiDtLVC36kkMDe2DDt8GuxjpAJ41ZwG gueIU5+8/IaysP6SgDD7DYEcPE1EF1jkWWyb18sbmLuLipZE2SA1o/S5jYDjTAx8Zcog ZAckjksdm3sIln7U2Ecd7LDuvHNsN8HyUNBYWIxloTQN4YcnauYcZjjC9agFxSwGXVOP GFLg0QsqX3NZkN55pAj/ofKIHMoljBfBkRMAXGb5i2Vah7KwXic4UViJQgM+Z9N6VuK/ gnrw== X-Gm-Message-State: AOAM5303A+GqM/TNH3cZyOrmNahE4jpzsvkw2dscwtsT054qn2WEFDwA ddTNbEDpJN3cr0WEBXdGLdY= X-Google-Smtp-Source: ABdhPJxHHsH7bFTy6QqNlKLW9op/sk+p9MsGhCZ8BoEj0/Y1+Hg7+OLndTV/9ExKMNaqsZgnSML3ww== X-Received: by 2002:a1c:5404:: with SMTP id i4mr1534466wmb.107.1640192825110; Wed, 22 Dec 2021 09:07:05 -0800 (PST) Received: from archbook.localnet ([217.151.114.10]) by smtp.gmail.com with ESMTPSA id y13sm2796186wrd.89.2021.12.22.09.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 09:07:04 -0800 (PST) From: Nicolas Frattaroli To: dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, kernel@pengutronix.de, Andy Yan , Benjamin Gaignard , Michael Riesch , Sandy Huang , Heiko =?ISO-8859-1?Q?St=FCbner?= , Peter Geis , Sascha Hauer , Sascha Hauer , Nicolas Frattaroli Subject: Re: [PATCH 22/22] drm: rockchip: Add VOP2 driver Date: Wed, 22 Dec 2021 18:07:02 +0100 Message-ID: <26571551.24qHfsk75X@archbook> In-Reply-To: <1761858.GBYTvM79DV@archbook> References: <20211220110630.3521121-1-s.hauer@pengutronix.de> <20211220110630.3521121-23-s.hauer@pengutronix.de> <1761858.GBYTvM79DV@archbook> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_090706_903582_4B32B3DB X-CRM114-Status: GOOD ( 24.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Dienstag, 21. Dezember 2021 14:44:39 CET Nicolas Frattaroli wrote: > On Montag, 20. Dezember 2021 12:06:30 CET Sascha Hauer wrote: > > From: Andy Yan > > > > The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568. > > It replaces the VOP unit found in the older Rockchip SoCs. > > > > This driver has been derived from the downstream Rockchip Kernel and > > heavily modified: > > > > - All nonstandard DRM properties have been removed > > - dropped struct vop2_plane_state and pass around less data between > > functions > > - Dropped all DRM_FORMAT_* not known on upstream > > - rework register access to get rid of excessively used macros > > - Drop all waiting for framesyncs > > > > The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB > > board. Overlay support is tested with the modetest utility. AFBC support > > on the cluster windows is tested with weston-simple-dmabuf-egl on > > weston using the (yet to be upstreamed) panfrost driver support. > > > > Signed-off-by: Sascha Hauer > > --- > > Hi Sascha, > > quick partial review of the code in-line. > > For reference, I debugged locking issues with the kernel lock > debug config options and assert_spin_locked in the reg write > functions, as well as some manual deduction. > As a small follow-up, I've completely mapped out the calls to vop2_writel, vop2_readl, vop2_vp_write and vop2_win_write and coloured in whether they were called with the lock held or not. The conclusion is startling: Most of the code absolutely does not care about the reg_lock. Here's the graph as an SVG: https://overviewer.org/~pillow/up/6800427ef3/vop2_callgraph_modified.svg vop2_isr here needs to be paid special attention, as it also acquires a different spinlock, and we want to avoid deadlocks. Perhaps we should precisely define which lock must be held for what registers, such that the vop2_isr can write its interrupt related registers without acquiring the "big" reg_lock. I'm also not entirely sure whether I should assume vop2_readl needs to be called with the lock held. This needs some investigating both in terms of whether the hardware presents a writel as an atomic write of a long, and whether the code assumes the state between readl calls is ever a consistent view. Regards, Nicolas Frattaroli _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel