Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2353313rwd; Fri, 9 Jun 2023 09:56:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5S+6JyuebbGagwB66teJ8P9+7oDzroL2xg1qzHpYGVkzfsZd06s0e3589mjADjWoK0xg2U X-Received: by 2002:a17:903:230e:b0:1b0:61dd:e523 with SMTP id d14-20020a170903230e00b001b061dde523mr1638801plh.41.1686329766364; Fri, 09 Jun 2023 09:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686329766; cv=none; d=google.com; s=arc-20160816; b=gSG7ehs4K/RM9Al20iKra+Z71/KhNuhg6IxRbzBrklhcdqw0JDtyxlhjk2fq6NSjAu c27AnicSJAjKx333xdtftIZAHkvbFmeiGogZkXbuD41crCAnZhS0yTJCZyoJW8nlMofl pvxrZqvVn6iGIyTg/m0MAf4QWEJL80y2E9QI3D9UKNWgNVH7H9MuxVhCCrzLU699MlSJ 4hS1DtgzRZQqYNbGVKyZI0W7aUT08Cq38r07XLi+2I3Hc4MB7nmcJuj8awBMLO6zln3o wbCBriJoETMyI1X7IBmAHEyhC6W1Yk/7cUd+z1+pCeSvWAh1IKZckxpFRfUuyi+JL/mH H+vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=nYuaJaz0GXRAvYjMt77RA1cPlADZMhjPLxpcM/fYEVU=; b=R6nu88URmNxDKvQ3L0EXdnrOTyv8mJRPTLK0CLaMxOfnGcRqoi3io2/V7Ukq/29PIM BZeOwo7TqcmSSv5rF3x+mTYWbeOj9mxs+h1YYSaL/lVWurfhMOKiLcijEbpDTfAnDPlV NhsIJ3kBkZNZ9hIy+iTCbC72cI+TgxBtCioVHCLu+HQzLAN056R5rSh5WM3+cjrwIp71 AjX//x1cckoEr+qzLF8yK1GhqnTzhvi7yKyB1ILfvCpQx+skwVpwVmtXcE2NWLbciH7t zxssv5D8VOVwYLH4Sa6YFrcJu8h3Oe9ZR7RMPW7Iw+gzsovQz22R2Z3phLJqR8EwNdQG 13Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O4xMnvyr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a170903018a00b001b04c325d66si2999003plg.565.2023.06.09.09.55.54; Fri, 09 Jun 2023 09:56:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O4xMnvyr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229560AbjFIQtD (ORCPT + 99 others); Fri, 9 Jun 2023 12:49:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbjFIQs7 (ORCPT ); Fri, 9 Jun 2023 12:48:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C640F3A8C; Fri, 9 Jun 2023 09:48:52 -0700 (PDT) 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 58DC665A02; 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 Cc: Sui Jingfeng <15330273260@189.cn>, Somalapuram Amaranath , Karol Herbst , nouveau@lists.freedesktop.org, Joonas Lahtinen , dri-devel@lists.freedesktop.org, YiPeng Chai , Mario Limonciello , David Airlie , Ville Syrjala , Yi Liu , kvm@vger.kernel.org, amd-gfx@lists.freedesktop.org, Jason Gunthorpe , Ben Skeggs , linux-pci@vger.kernel.org, Andrey Grodzovsky , Kevin Tian , Lijo Lazar , Daniel Vetter , Bokun Zhang , intel-gfx@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , loongson-kernel@lists.loongnix.cn, Alex Williamson , Abhishek Sahu , Jani Nikula , Rodrigo Vivi , Bjorn Helgaas , Tvrtko Ursulin , Yishai Hadas , Li Yi , Pan Xinhui , linux-kernel@vger.kernel.org, Thomas Zimmermann , Cornelia Huck , Alex Deucher , Christian Konig , Hawking Zhang Subject: Re: [Intel-gfx] [PATCH v3 4/4] PCI/VGA: introduce is_boot_device function callback to vga_client_register 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> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 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