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 94CE3C7EE2E for ; Fri, 9 Jun 2023 16:49:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C89C10E6CD; Fri, 9 Jun 2023 16:48:57 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 846B810E144; Fri, 9 Jun 2023 16:48:54 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 58DA1659F6; Fri, 9 Jun 2023 16:48:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7117EC433EF; Fri, 9 Jun 2023 16:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686329331; bh=wj6ps6y4ft6WvpJQrBdcLusOhuloDy4bHnascQVlTT0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=O4xMnvyru9ylkQLSbinraMlwoqqoCRzqiohujByEGtJFDGMM2+bIqDUl5eHnyQxXo rY6Jt+s9J9b2BJMm3LdqlppNkZafwg1ABQk0do5vWtrwv0HjpULglS2SDN2D6aMymp CWxzgfiCmay+hbv7MVTWZ0mdVEp8uqGYXaqtxKSQkL5P7BHI2KgvO4BKLhYRuItyUe b1MGXu2c7L7tT5+p5OajerVERb9IENBTZBVZNst9tkM+K3jNo95v+iyFA8Z0Q9QZCe 4IkGGUvPbx+9E+dUiQyq/RGdROHaFJmb7Ilr8VJ8sFWFpVVNEi3FletAovP7YIwJSa +jJM45seUVXUw== Date: Fri, 9 Jun 2023 11:48:50 -0500 From: Bjorn Helgaas To: Sui Jingfeng Message-ID: <20230609164850.GA1251187@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0d2ba099-9817-13be-c85b-997211443119@loongson.cn> Subject: Re: [Intel-gfx] [PATCH v3 4/4] PCI/VGA: introduce is_boot_device function callback to vga_client_register X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pan Xinhui , kvm@vger.kernel.org, nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, YiPeng Chai , Mario Limonciello , David Airlie , Yi Liu , Karol Herbst , amd-gfx@lists.freedesktop.org, Sui Jingfeng <15330273260@189.cn>, Jason Gunthorpe , Ben Skeggs , linux-pci@vger.kernel.org, Andrey Grodzovsky , Kevin Tian , Lijo Lazar , Thomas Zimmermann , Bokun Zhang , intel-gfx@lists.freedesktop.org, Maxime Ripard , loongson-kernel@lists.loongnix.cn, Abhishek Sahu , Rodrigo Vivi , Bjorn Helgaas , Yishai Hadas , Li Yi , Somalapuram Amaranath , linux-kernel@vger.kernel.org, Daniel Vetter , Cornelia Huck , Alex Deucher , Christian Konig , Hawking Zhang Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, Jun 09, 2023 at 10:27:39AM +0800, Sui Jingfeng wrote: > On 2023/6/9 03:19, Bjorn Helgaas wrote: > > On Thu, Jun 08, 2023 at 07:43:22PM +0800, Sui Jingfeng wrote: > > > From: Sui Jingfeng > > > > > > The vga_is_firmware_default() function is arch-dependent, which doesn't > > > sound right. At least, it also works on the Mips and LoongArch platforms. > > > Tested with the drm/amdgpu and drm/radeon drivers. However, it's difficult > > > to enumerate all arch-driver combinations. I'm wrong if there is only one > > > exception. > > > > > > With the observation that device drivers typically have better knowledge > > > about which PCI bar contains the firmware framebuffer, which could avoid > > > the need to iterate all of the PCI BARs. > > > > > > But as a PCI function at pci/vgaarb.c, vga_is_firmware_default() is > > > probably not suitable to make such an optimization for a specific device. > > > > > > There are PCI display controllers that don't have a dedicated VRAM bar, > > > this function will lose its effectiveness in such a case. Luckily, the > > > device driver can provide an accurate workaround. > > > > > > Therefore, this patch introduces a callback that allows the device driver > > > to tell the VGAARB if the device is the default boot device. This patch > > > only intends to introduce the mechanism, while the implementation is left > > > to the device driver authors. Also honor the comment: "Clients have two > > > callback mechanisms they can use" > > s/bar/BAR/ (several) > > > > Nothing here uses the callback. I don't want to merge this until we > > have a user. > > This is chicken and egg question. > > If you could help get this merge first, I will show you the first user. > > > I'm not sure why the device driver should know whether its device is > > the default boot device. > > It's not that the device driver should know, > > but it's about that the device driver has the right to override. > > Device driver may have better approach to identify the default boot > device. The way we usually handle this is to include the new callback in the same series as the first user of it. That has two benefits: (1) everybody can review the whole picture and possibly suggest different approaches, and (2) when we merge the infrastructure, we also merge a user of it at the same time, so the whole thing can be tested and we don't end up with unused code. Bjorn