Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1065189rdb; Fri, 1 Dec 2023 06:17:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTYY4fJ8VjxNwm4STHfQfi4pYM5JR7dSVeZhUfHi5JgwnYe4rAsCV7677JyrHdkx54R39W X-Received: by 2002:a05:6a20:8e26:b0:18c:9a9c:5b5d with SMTP id y38-20020a056a208e2600b0018c9a9c5b5dmr17593663pzj.60.1701440237364; Fri, 01 Dec 2023 06:17:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701440237; cv=none; d=google.com; s=arc-20160816; b=fMs7x31G05UzXHw6iqMONjMD5Tf0Qt16FjkISu7gnUxAf+nsaeX4RxX9SQb4z354dm 0wWgrA+jG2pYLKyhBSv5n+UZoLkRGJedVyk8kksSZVEbFhM2H9D1y8nrc855N+OSGBze hydQdmCRdsX47JuGqbmy6h55V0AAMnDULApv5hzGjTiD33rrz7BnZlaEjmGxgm4w4gpQ u6khVm7YzFPkKD5GKdSKzXRuM36lT2hPI8Po+52XkFi91VpP5xiXBXlioqVsM6/FbqlT BXDJaCB9yX7eD5aD4BfAjvPOmnAmoPj9DBAJdOj+x+oEw0A12JBqqBqhdz9BC9Vw/Y33 Hwzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=MJQPrjEbwnWoXRgfWZMLIA19K+UrEYt4GGLLJInlnkw=; fh=GWQV52manuVpXHVdCz2/oXTzNnB63/ydRfcrmr1LRtk=; b=JeQbI8lK/b7U9k2WN80ueW21Rv8aUEyStgFfgr3AcBrgZKgg2Oa7GCX/h/8zfiiU1h MrXV2JR0aoFz2DGmsdliQf+HP4D3Odahc+naiMiTyM/8Vi/pjcfm/6W/+NJVUO8wO2hY gNpiu1wEDIA6ChQHg5XFVmBYFc/3JuJhjXZ4rFPENUIjipjEO/BOVPNoCy4Te5tQT8Se jxJ9UJPtnxWliWmQOgJilZIulYUHyW2Qdtg8xOOqhe+bUV0VrrUSXmyVz1H2kAsT7c42 pfLmRCA2uxEJjla4Vofhkfpe1KFqTZ8pHqfrf+p/W06LOcEghvdJ+dMHvOK2oClCH42S 7vEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VAoqrfB2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s24-20020a634518000000b005bda050625fsi3349297pga.455.2023.12.01.06.17.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 06:17:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VAoqrfB2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0C2F584C2995; Fri, 1 Dec 2023 06:17:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379123AbjLAOQp (ORCPT + 99 others); Fri, 1 Dec 2023 09:16:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379094AbjLAOQo (ORCPT ); Fri, 1 Dec 2023 09:16:44 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2594519E for ; Fri, 1 Dec 2023 06:16:51 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBEE7C43391; Fri, 1 Dec 2023 14:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701440210; bh=MJQPrjEbwnWoXRgfWZMLIA19K+UrEYt4GGLLJInlnkw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=VAoqrfB2+2J4i4OGNP/3tHLhCaStYAJg2OWwtGZ7ghy+SXR5LCpWIcvdBLm90tp9f 8Wfa2u30Z7n4sxrmBwmQCx2493wxi7ZGRgKpacU9qPTk9yevf/brhE7u+stHfyEfUD lFN2R6uGZ6At7QK6/13kngH7xGIMMQ92/VyI1zrtez5/SIgbF346XmhW/3CPUT8s4K 73u41AZzdgvO9CKY7IqyKhCGzqQcbHc5ELkb/xLM15CrhdbVGEiqNWXgxTcIS3BxTy jrvlzpxi/hybq4kv2iOI6hzr/CtbAIgotLHRbb3uBw3IfxqCGQENFPMMiFTnyMf7Lk x3gtHSaJ7IwWA== Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-50bdebb1786so281412e87.1; Fri, 01 Dec 2023 06:16:50 -0800 (PST) X-Gm-Message-State: AOJu0YxTVu5hUf5X76XNYlerVJ+7nqNdGI42S4Ddz6I4Qr+3Cgt0ORmx Y6KPLeF+mLe67S5DTUIbSeA6GCVDu61bZ/QtAA== X-Received: by 2002:a19:430d:0:b0:50b:e03b:ebc7 with SMTP id q13-20020a19430d000000b0050be03bebc7mr83514lfa.20.1701440208798; Fri, 01 Dec 2023 06:16:48 -0800 (PST) MIME-Version: 1.0 References: <20231113085305.1823455-1-javierm@redhat.com> <87jzqi59bt.fsf@minerva.mail-host-address-is-not-set> <874jhj1fm3.fsf@minerva.mail-host-address-is-not-set> <58672ab8-99bf-4a2a-af79-031d1e8fcba0@suse.de> <87fs0mxlyp.fsf@minerva.mail-host-address-is-not-set> In-Reply-To: <87fs0mxlyp.fsf@minerva.mail-host-address-is-not-set> From: Rob Herring Date: Fri, 1 Dec 2023 08:16:36 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] of/platform: Disable sysfb if a simple-framebuffer node is found To: Javier Martinez Canillas Cc: Thomas Zimmermann , Ard Biesheuvel , devicetree@vger.kernel.org, Sergio Lopez , Sima Vetter , Hector Martin , Andrew Worsley , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Frank Rowand Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 01 Dec 2023 06:17:03 -0800 (PST) On Fri, Dec 1, 2023 at 4:21=E2=80=AFAM Javier Martinez Canillas wrote: > > Thomas Zimmermann writes: > > > Hi > > > > Am 18.11.23 um 12:10 schrieb Javier Martinez Canillas: > >> Ard Biesheuvel writes: > >> > >> Hello Ard, > >> > >>> On Fri, 17 Nov 2023 at 00:09, Rob Herring wrote: > >> > >> [...] > >> > >>>>>> > >>>>>> This could also lead to an interesting scenario. As simple-framebu= ffer > >>>>>> can define its memory in a /reserved-memory node, but that is igno= red > >>>>>> in EFI boot. Probably would work, but only because EFI probably > >>>>>> generates its memory map table from the /reserved-memory nodes. > >>>>>> > >>>>> > >>>>> I see. So what would be the solution then? Ignoring creating a plat= form > >>>>> device for "simple-framebuffer" if booted using EFI and have an EFI= -GOP? > >>>> > >>>> Shrug. I don't really know anything more about EFI FB, but I would > >>>> guess it can't support handling resources like clocks, power domains= , > >>>> regulators, etc. that simple-fb can. So if a platform needs those, d= o > >>>> we say they should not setup EFI-GOP? Or is there a use case for > >>>> having both? Clients that don't muck with resources can use EFI-GOP > >>>> and those that do use simple-fb. For example, does/can grub use > >>>> EFI-GOP, but not simple-fb? > >>>> > >>> > >>> The EFI GOP is just a dumb framebuffer, and it is not even generally > >>> possible to cross reference the GOP with a particular device in the > >>> device hierarchy unless you e.g., compare the BARs of each device wit= h > >>> the region described by the GOP protocol. > >>> > >>> GRUB for EFI will use the GOP and nothing else, but only at boot time > >>> (the GOP protocol is more than a magic linear memory region, it also > >>> implements a Blt() abstraction that permits the use of framebuffers > >>> that are not mapped linearly into the address space at all, and GRUB > >>> makes use of this) > >>> > >>> The EFI stub will only expose GOPs to the kernel if they are in fact > >>> linear framebuffers, but has zero insight into whether the hardware > >>> needs clocks and regulators, and whether or not the framebuffer needs > >>> IOMMU pass through (which might be the case if the scanout is using > >>> DMA into system memory) > >>> > >>> So calling EFI GOP 'source of truth' is rather generous, and I think > >>> it makes sense to prioritize more accurate descriptions of the > >>> underlying framebuffer over EFI GOP. > >>> > >> > >> That was my opinion as well and the reason why I called the DTB the > >> single source of truth. > >> > >>> However, making 'simple-framebuffer' magic in this regard doesn't see= m > >>> like a great approach to me. Is there a better way we could get the > >>> resource conflict to be decided in a way where the EFI GOP gets > >>> superseded if its resources are claimed by another device? > >>> > >> > >> There is an aperture [0] framework that is used by the fbdev and DRM > >> subsystems to allow native drivers to remove any conflicting devices > >> that share the same framebuffer aperture. > >> > >> But it only makes sense for native drivers to use that I think, but > >> in this case is about two drivers that attempt to use the same frame > >> buffer provided by the firmware but getting it from different places. > >> > >> I don't have a better idea than this patch but maybe Thomas or Sima do= ? > > > > At SUSE, we've carried such a patch in our repos for some time. It work= s > > around the double-framebuffer problem in a similar way. [1] > > > > Thanks for the information. I see that your patch is basically mine but > doing it unconditionally while this one only does the sysfb_disable() if > a "simple-framebuffer" DT node has been found. > > > As Javier mentioned, we do track the framebuffer ranges for EFI/VESA/OF > > framebuffers in the graphics aperture helpers. Fbdev has done this for > > decades, and the current codebase extends and harmonizes this > > functionality among fbdev and DRM drivers. > > > > WRT DT vs EFI: AFAIK the EFI support on affected platforms looks at the > > DT to set up the EFI framebuffer. So IMHO the DT is the authoritative > > source on the framebuffer. > > > > Agreed. Sima Vetter also mentioned on IRC that they think this patch is > the least bad option. Rob, Ard any thoughts? Maybe we can land this as > a fix and then figure how this could be better handled in the long term? What about moving the DT setup code here to sysfb? Then we just setup the right thing up front. However, there might be one other issue with that and this fix. The DT simplefb can have resources such as clocks and regulators. With fw_devlink, the driver won't probe until those dependencies are met. So if you want the framebuffer console up early, then you may want to register the EFI framebuffer first and then handoff to the DT simplefb when it probes (rather than registering the device). But I agree, probably better to take this patch now and have those quirks instead of flat out not working. Rob