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 173DFC6FD1D for ; Wed, 15 Mar 2023 09:34:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3ABD310E984; Wed, 15 Mar 2023 09:34:42 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 8847710E984 for ; Wed, 15 Mar 2023 09:34:40 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A67DD2F4; Wed, 15 Mar 2023 02:35:23 -0700 (PDT) Received: from [10.57.53.168] (unknown [10.57.53.168]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7D43D3F8C6; Wed, 15 Mar 2023 02:34:38 -0700 (PDT) Message-ID: Date: Wed, 15 Mar 2023 09:34:37 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] drm/komeda: Take over EFI framebuffer properly To: patrik.berglund@arm.com, dri-devel@lists.freedesktop.org References: <20230313102209.53966-1-patrik.berglund@arm.com> Content-Language: en-GB From: Steven Price In-Reply-To: <20230313102209.53966-1-patrik.berglund@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: Liviu Dudau , Mihail Atanassov , "James \(Qian\) Wang" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 13/03/2023 10:22, patrik.berglund@arm.com wrote: > From: Patrik Berglund > > The Arm Morello board EDK2 port already provides an EFI GOP display for > Ceti/Cetus (Komeda) with more boards incoming. > However, once the Komeda driver probes and takes over the hardware, > it should take over the logical framebuffer as well, otherwise, > the now-defunct GOP device hangs around and virtual console output > inevitably disappears into the wrong place most of the time. > > We'll do this right before doing the SRST because that is the point > when the GOP will stop working. > The GOP might also fail because the encoder driver do things but this > is better than nothing. > > Signed-off-by: Patrik Berglund +CC the maintainers. Looks right to me, hdlcd has something very similar. Reviewed-by: Steven Price > --- > drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c | 12 ++++++++++++ > drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 6 ++++++ > drivers/gpu/drm/arm/display/komeda/komeda_kms.h | 1 + > 3 files changed, 19 insertions(+) > > diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c > index 6c56f5662bc7..72035af9bc5f 100644 > --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c > +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c > @@ -8,6 +8,7 @@ > #include > #include > #include "d71_dev.h" > +#include "komeda_kms.h" > #include "malidp_io.h" > > static u64 get_lpu_event(struct d71_pipeline *d71_pipeline) > @@ -310,6 +311,17 @@ static int d71_reset(struct d71_dev *d71) > u32 __iomem *gcu = d71->gcu_addr; > int ret; > > + /* > + * If we are already running, the most likely reason is that the EFI left > + * us running (GOP), so make sure to take over from simple framebuffer > + * drivers. > + */ > + if (malidp_read32(gcu, BLK_STATUS) & GCU_STATUS_ACTIVE) { > + ret = komeda_kms_remove_framebuffers(); > + if (ret) > + return ret; > + } > + > malidp_write32(gcu, BLK_CONTROL, GCU_CONTROL_SRST); > > ret = dp_wait_cond(!(malidp_read32(gcu, BLK_CONTROL) & GCU_CONTROL_SRST), > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > index 62dc64550793..12af409aeabb 100644 > --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > @@ -7,6 +7,7 @@ > #include > #include > > +#include > #include > #include > #include > @@ -349,3 +350,8 @@ void komeda_kms_detach(struct komeda_kms_dev *kms) > komeda_kms_cleanup_private_objs(kms); > drm->dev_private = NULL; > } > + > +int komeda_kms_remove_framebuffers(void) > +{ > + return drm_aperture_remove_framebuffers(false, &komeda_kms_driver); > +} > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h > index 3a872c292091..1a43707ed68f 100644 > --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h > @@ -187,5 +187,6 @@ void komeda_crtc_flush_and_wait_for_flip_done(struct komeda_crtc *kcrtc, > > struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev); > void komeda_kms_detach(struct komeda_kms_dev *kms); > +int komeda_kms_remove_framebuffers(void); > > #endif /*_KOMEDA_KMS_H_*/