Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3317220rdb; Thu, 16 Nov 2023 06:31:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrClDBDr2X9JUwDYEaypi+IVlGlgbrkpBYYoOYUun6kdgAd+3w8D9/b2NmX25E4hI4/PUb X-Received: by 2002:a05:6e02:1c8c:b0:357:6bd2:b2ad with SMTP id w12-20020a056e021c8c00b003576bd2b2admr20331913ill.22.1700145083216; Thu, 16 Nov 2023 06:31:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700145083; cv=none; d=google.com; s=arc-20160816; b=w+ZXk6OhcOkZ+29oU0zq0qygxGSvgGN+CRofiv+ttLZDDnqPZc5TDpTZV1LRClmO80 7Pw9e61JcKZ2PT1sNyT51SQ18ypH4vZXqFslICdjB1Zhwjvgh/JQSlT98tt7QDmJq4jo EZw0zkni8rEgaOl0NLkG5yhGZeEf1N8VESpTAvrm4Gzr7Ysv4c/6L8Rpe1ZABMtOT777 GE4rPRsD3FXw5Vqjp+RkwqnAknNWPJCr34na9FXKm5jqRmxkdPNrxlb7lxsfF9KzZJNn XNNOi3FQr7RHY1rVNGuFQFWuXkPGCMZ64mQA/FI17rVWIvfAcgjE847cW8Jc+BtDB0mt 9+Dg== 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=9SwyNxCIUz6quOyDxgmp35RHWIz3sCwnVUo/KZeGBGo=; fh=tgW93hCxJlcTl+JbST3WEE5m6Bp0bFwgtK6swCcpFPk=; b=EhK6fF/u3bByksLbNh06a1GFq7KD1fG099ObduOJf2I55bCipuuWokwvh+hfQ15ASh 0xzU5xoz7ABNjPLw8MZhwiLnVcJEf0+A6dJSKKw5OSVSi7FsJKt3dQn1PG98y/jQiWC+ TOfgi+97o0FR6xS4lQBqHQ6l3mPAPvU6CNopoMRAl3lpirYKb1YTWbJRNf0/2EqssMRM 9kDEQi+xeyosD4g8d4xiVi+K5lJFMx+OJ2SW2o+oqE1i8B/07x4BweNVteGbrNVlezBe kswyEEOlgpCvNgJm2MIWrbw/CHgsdDdbRYhkQaQl/0S7Y9pYBPK1LjixQUNCTj7j0uX4 7lig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=drQJwxo0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 25-20020a631759000000b00565eb0b2e66si12585336pgx.864.2023.11.16.06.31.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 06:31:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=drQJwxo0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 5EF7880A73EA; Thu, 16 Nov 2023 06:31:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233968AbjKPObM (ORCPT + 99 others); Thu, 16 Nov 2023 09:31:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbjKPObL (ORCPT ); Thu, 16 Nov 2023 09:31:11 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1541098 for ; Thu, 16 Nov 2023 06:31:06 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5AC1C433CC; Thu, 16 Nov 2023 14:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700145065; bh=nkr6WoisDwyKnThmymGE20Y09erBdJh/ybpDhjAfA4M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=drQJwxo0EHLXhOCm+VbfX6mHYLg9T+UjlT90OMVHW5p7qFKf8arFFgvv4FhxF/ImW zz4R09GsjLW7FLHd8ltROQ9JQBch1GSrUnQVmVtHE5kOOMy3DvpD8v4PuX5NnGw30X tbNspDUPYpqmLZFUFnenCUuckv/T2r7amqKTUzbD7j2vZWxYImE6dYrVXziYp5qFYD vW24Uh/jnh+43It8pvdTL5ZrlpfIpmG4hfm6ws7rZPjCcaDqm/aG5RnGUdqfIdVcLI M4D/48wZNb3/3zWcMpUJPpoa7fBFi9cBzxQfWU+CnI0kCsp4s0bWUHPdtMeHACQj9+ j3T2tebQo95BA== Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2c5b7764016so10987261fa.1; Thu, 16 Nov 2023 06:31:05 -0800 (PST) X-Gm-Message-State: AOJu0YwdZe5PslwuUeZN0cqODMGmGaN5zBVNtmrMKMY5CaPs2TZaaI5H og8sirlW1q6b4fOpzhUpD7F3/1LXRpiIqaJm+Jo= X-Received: by 2002:a05:651c:3cf:b0:2c5:3e:6bdb with SMTP id f15-20020a05651c03cf00b002c5003e6bdbmr6334354ljp.32.1700145063865; Thu, 16 Nov 2023 06:31:03 -0800 (PST) MIME-Version: 1.0 References: <20231113085305.1823455-1-javierm@redhat.com> <87jzqi59bt.fsf@minerva.mail-host-address-is-not-set> In-Reply-To: From: Ard Biesheuvel Date: Fri, 17 Nov 2023 00:30:51 +1000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] of/platform: Disable sysfb if a simple-framebuffer node is found To: Rob Herring Cc: Javier Martinez Canillas , linux-kernel@vger.kernel.org, Thomas Zimmermann , Sima Vetter , dri-devel@lists.freedesktop.org, Andrew Worsley , Hector Martin , Sergio Lopez , Frank Rowand , devicetree@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 16 Nov 2023 06:31:12 -0800 (PST) On Fri, 17 Nov 2023 at 00:09, Rob Herring wrote: > > On Thu, Nov 16, 2023 at 3:36=E2=80=AFAM Javier Martinez Canillas > wrote: > > > > Rob Herring writes: > > > > Hello Rob, > > > > > On Mon, Nov 13, 2023 at 2:53=E2=80=AFAM Javier Martinez Canillas > > > wrote: > > >> > > >> Some DT platforms use EFI to boot and in this case the EFI Boot Serv= ices > > >> may register a EFI_GRAPHICS_OUTPUT_PROTOCOL handle, that will later = be > > >> queried by the Linux EFI stub to fill the global struct screen_info = data. > > >> > > >> The data is used by the Generic System Framebuffers (sysfb) framewor= k to > > >> add a platform device with platform data about the system framebuffe= r. > > >> > > >> But if there is a "simple-framebuffer" node in the DT, the OF core w= ill > > >> also do the same and add another device for the system framebuffer. > > >> > > >> This could lead for example, to two platform devices ("simple-frameb= uffer" > > >> and "efi-framebuffer") to be added and matched with their correspond= ing > > >> drivers. So both efifb and simpledrm will be probed, leading to foll= owing: > > >> > > >> [ 0.055752] efifb: framebuffer at 0xbd58dc000, using 16000k, tota= l 16000k > > >> [ 0.055755] efifb: mode is 2560x1600x32, linelength=3D10240, page= s=3D1 > > >> [ 0.055758] efifb: scrolling: redraw > > >> [ 0.055759] efifb: Truecolor: size=3D2:10:10:10, shift=3D30:20:10= :0 > > >> ... > > >> [ 3.295896] simple-framebuffer bd58dc000.framebuffer: [drm] *ERRO= R* > > >> could not acquire memory range [??? 0xffff79f30a29ee40-0x2a5000001a7 > > >> flags 0x0]: -16 > > >> [ 3.298018] simple-framebuffer: probe of bd58dc000.framebuffer > > >> failed with error -16 > > >> > > >> To prevent the issue, make the OF core to disable sysfb if there is = a node > > >> with a "simple-framebuffer" compatible. That way only this device wi= ll be > > >> registered and sysfb would not attempt to register another one using= the > > >> screen_info data even if this has been filled. > > >> > > >> This seems the correct thing to do in this case because: > > >> > > >> a) On a DT platform, the DTB is the single source of truth since is = what > > >> describes the hardware topology. Even if EFI Boot Services are us= ed to > > >> boot the machine. > > > > > > This is the opposite of what we do for memory and memory reservations= . > > > EFI is the source of truth for those. > > > > > > This could also lead to an interesting scenario. As simple-framebuffe= r > > > can define its memory in a /reserved-memory node, but that is ignored > > > 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 platform > > 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, do > 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 with 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. However, making 'simple-framebuffer' magic in this regard doesn't seem 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?