Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp208331rwb; Tue, 25 Jul 2023 14:33:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlGNUbOSIlqc5Oxhm6b+zdowhnME7WYyGUp6ynHkV9i06Zuoy+FM/afwf9/CojKwN2mbcOcu X-Received: by 2002:a17:902:6bc9:b0:1b8:83a3:7db6 with SMTP id m9-20020a1709026bc900b001b883a37db6mr309894plt.44.1690320829429; Tue, 25 Jul 2023 14:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690320829; cv=none; d=google.com; s=arc-20160816; b=db62UiomeFAXJ3fhEL2YANshyLgntUjlePcXBRdTcBSmQPDcD6XQFPqUR/Oi9UDIeF Z1XPufh4EooP/GmOTpWJjkclopKIPb6TKg0r0NBXGxdF66TAs/h0w4QLckn7ln2dO3Wt omrBn/R7NIHzYnckdLaNc2E6dVQEe8TG4owfJeuRQg9nMhXA85MWJiW0InOJiv0T6/wV 2bOcM3hDg0EIiNaLHAe7AMmDTG5VeefdZd+qWbmVtzSiBvv9XezPCv7/u2uZhT6U00S9 3ujXOn36s0TahYyM82RCv5C1B34nfEbcqDHFob+z300j/gSZVsz1Z0HZxhkfTeCUsM13 sh2Q== 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=lM2CzDQfp0mReKEVvFxFLiVdcF1C0wjArx7H0NB06xM=; fh=qz8LMSyKuQbd38kXODX3LTjA+DxS7Zy3vDDeJlmyoXw=; b=nfa0KCDYukD5mBBSLIdiDsGBAefFyohofPuwfiAybNlWFPg46v6xYiyD02F0rTo5r9 41QFZ2/6+os8a4aBWVIHaT6sCvN8UxTD5RPeRbUXatwd9C6MgzVUkAvLxlcjEFb3WU+N ANBaH6WEzYeCNQSqj8wGvEwf2+y1BuykfaUEOkds1IcVxOe0FJD/haBiUdO4o6TX8S+j LxlcXs/HyhIMgVZfTZATEQCX8RqqC6t2RTXKcvOXm6DI9BKq8XXzLYkHwCsbvgn37SXF johh9TE7yQBVzgnVREFhOOR/PspqfFEAtFjiA03x6PrmzHVEusXW3ArMhsxRwIDe0lyM uIag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dkhLGLia; 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 i6-20020a17090332c600b001b6788a54f4si13654080plr.191.2023.07.25.14.33.36; Tue, 25 Jul 2023 14:33:49 -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=dkhLGLia; 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 S231510AbjGYVbB (ORCPT + 99 others); Tue, 25 Jul 2023 17:31:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230433AbjGYVax (ORCPT ); Tue, 25 Jul 2023 17:30:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A59B2136; Tue, 25 Jul 2023 14:30:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CC72D6190B; Tue, 25 Jul 2023 21:30:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF6E2C433C7; Tue, 25 Jul 2023 21:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690320631; bh=V6TKiwei04nE3RMXlxgDm9GDIfoUHRbLAP5mFRrxSIg=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=dkhLGLiaFpp+WjJG779pBjcd3WWJVUu7utaxHvlhcCRdyzKeXxkvnWXgNVYfPoCrC 00BYWkOLqS5AK4f/ex7wJFl3qsWzUCOOkzfm/Cyzl5oIfUQ7DqrXlAmvuyPuwBxUPA ONK4jTWRuMX1h4/Bl/vemPvweN7BSgbtdFdQORDKSnKMkr6ISQfqIHvsO7IiH5p3gK EJ70gqs8zlRPzntbZNEBREXXUhMcG42MjKUkPsZq0UCfuSLS4q/5yJ/zJbBJjWnurM FpnEVIVkuBSlkaZ72zuAYKfS4WzIJUU8X8YsdtvLqIitYGOEVk1jXey/IJMQ/mNsx1 gAFGaUQUp5rTQ== Date: Tue, 25 Jul 2023 16:30:29 -0500 From: Bjorn Helgaas To: suijingfeng Cc: Sui Jingfeng , David Airlie , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, kvm@vger.kernel.org, linux-pci@vger.kernel.org, linux-fbdev@vger.kernel.org, Alex Deucher , Christian Konig , Pan Xinhui , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Ben Skeggs , Karol Herbst , Lyude Paul , Bjorn Helgaas , Alex Williamson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Hawking Zhang , Mario Limonciello , Lijo Lazar , YiPeng Chai , Bokun Zhang , Likun Gao , Ville Syrjala , Jason Gunthorpe , Kevin Tian , Cornelia Huck , Yishai Hadas , Abhishek Sahu , Yi Liu , Jani Nikula Subject: Re: [PATCH v3 4/9] PCI/VGA: Improve the default VGA device selection Message-ID: <20230725213029.GA666158@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5fbc1ec7-fb61-7e4d-960c-81cc11b706f5@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,URIBL_BLOCKED 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 Mon, Jul 24, 2023 at 08:16:18PM +0800, suijingfeng wrote: > On 2023/7/20 03:32, Bjorn Helgaas wrote: > > > 2) It does not take the PCI Bar may get relocated into consideration. > > > 3) It is not effective for the PCI device without a dedicated VRAM Bar. > > > 4) It is device-agnostic, thus it has to waste the effort to iterate all > > > of the PCI Bar to find the VRAM aperture. > > > 5) It has invented lots of methods to determine which one is the default > > > boot device, but this is still a policy because it doesn't give the > > > user a choice to override. > > I don't think we need a list of*potential* problems. We need an > > example of the specific problem this will solve, i.e., what currently > > does not work? > > > This version do allow the arbitration service works on non-x86 arch, > which also allow me remove a arch-specific workaround. > I will give more detail at the next version. Yes. This part I think we want. > But I want to provide one more drawback of vgaarb here: > > (6) It does not works for non VGA-compatible PCI(e) display controllers. > > Because, currently, vgaarb deal with PCI VGA compatible devices only. > > See another my patch set [1] for more elaborate discussion. > > It also ignore PCI_CLASS_NOT_DEFINED_VGA as Maciej puts it[2]. > > While my approach do not required the display controller to be > VGA-compatible to enjoy the arbitration service. I think vgaarb is really only for dealing with the problem of the legacy VGA address space routing. For example, there may be VGA devices that require the [pci 0xa0000-0xbffff] range but they don't describe that via a BAR. There may also be VGA option ROMs that depend on that range so they can initialize the device. The [pci 0xa0000-0xbffff] range can only be routed to one device at a time, and vgaarb is what takes care of that by manipulating the VGA Enable bits in bridges. I don't think we should extend vgaarb to deal with non-VGA GPUs in general, i.e., I don't think it should be concerned with devices and option ROMs that do not require the [pci 0xa0000-0xbffff] range. I think a strict reading of the PCI Class Code spec would be that only devices with Programming Interface 0000 0000b can depend on that legacy range. If that's what vgaarb currently enforces, great. If it currently deals with more than just 0000 0000b devices, and there's some value in restricting it to only 0000 0000b, we could try that, but I would suggest doing that in a tiny patch all by itself. Then if we trip over a problem, it's easy to bisect and revert it. > [1] https://patchwork.freedesktop.org/patch/546690/?series=120548&rev=1 > > [2] https://lkml.org/lkml/2023/6/18/315 >