Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10381604rwd; Wed, 21 Jun 2023 22:16:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bZ+qAR9HPvQR0TRRYlowDGw2ymWYfwLgJgvI8688RYOp0LKI+wdTVO1XxTAunfr9jLgW2 X-Received: by 2002:a05:6870:1803:b0:19f:20db:a4d8 with SMTP id t3-20020a056870180300b0019f20dba4d8mr10311878oaf.29.1687410976604; Wed, 21 Jun 2023 22:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687410976; cv=none; d=google.com; s=arc-20160816; b=M9Bm1LIFW6gX6FmWXh09xl3Drvx4P0/s+3KxrevjRfdIoc6hjXYyOB4oNLdRHhtbIg Rez9aSkQubD7MzyZ1Tokn0mYkcK4vIuxknEcbIgQs3Hhn4ahn+yvIjop1wX7R+w3XZWM NWujt/VWjvLELROZpAYZGuhQT1/YqpHi417DhBLDqYs36/4jQ0emjUrkQWcxO22BebyH G7bsRw8F9w7y9OMizmFvoGDPRSUlvNcCFnsg+gIp79GXh8R+H5G6/d4hwxzJRdS0Cw8b PI4cSj0RcrCswQzVz8LIrif3K/un8ajo5QaPZ9TcWqmIMgrmTPAjEK2uemjZGNGFm5kH W4wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id; bh=MkC3a5OfvyzKnocghJnbpUD7Mdeo/g9tUHsvwuSq3Jo=; b=TaPJkCj+MGhwO0SuuE3XJq3TeXACqN3BKbof/0n9L93vX/nxioMhNCL5/9rTsH7ZXK nqRrjI/m6UW6P5THzgBNgnhH+OqRZUibla9TgCXBxlqPwZ8/vuBCLdCO1GxkH8yU12xP Z67gUp4Jfr4MiijdyNHx1tbvs2/UBs2d4DqGIzCpc94aoa7BW89c37OOqJBnkMMBzZD/ 95z9gSECf/Cd18DUFju6oQJatBp1lUGuriWKS5u2x6scnxpNzA+cyP4s3Qc+XfYt31ex lDkcS5eoB6G/BsPxOySZDwtiGsfMU61SuCx+LDO1VaISHFbx22RayRgtp/8r+MqKulKY RMPg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 85-20020a630058000000b0053fe392ca3esi2000322pga.509.2023.06.21.22.16.05; Wed, 21 Jun 2023 22:16:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230476AbjFVEqz (ORCPT + 99 others); Thu, 22 Jun 2023 00:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbjFVEqx (ORCPT ); Thu, 22 Jun 2023 00:46:53 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A198B1995; Wed, 21 Jun 2023 21:46:49 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8AxR8U40pNkc1YAAA--.571S3; Thu, 22 Jun 2023 12:46:48 +0800 (CST) Received: from [10.20.42.43] (unknown [10.20.42.43]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxrM420pNkV5wBAA--.8972S3; Thu, 22 Jun 2023 12:46:46 +0800 (CST) Message-ID: Date: Thu, 22 Jun 2023 12:46:46 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register To: Lyude Paul , Sui Jingfeng <15330273260@189.cn>, Alex Deucher , Christian Konig , Pan Xinhui , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Ben Skeggs , Karol Herbst , Bjorn Helgaas , Alex Williamson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Hawking Zhang , Mario Limonciello , Lijo Lazar , YiPeng Chai , Andrey Grodzovsky , Somalapuram Amaranath , Bokun Zhang , Ville Syrjala , Li Yi , Jason Gunthorpe , Kevin Tian , Cornelia Huck , Yishai Hadas , Abhishek Sahu , Yi Liu Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, loongson-kernel@lists.loongnix.cn References: <20230612192550.197053-1-15330273260@189.cn> <0afadc69f99a36bc9d03ecf54ff25859dbc10e28.camel@redhat.com> Content-Language: en-US From: Sui Jingfeng Organization: Loongson In-Reply-To: <0afadc69f99a36bc9d03ecf54ff25859dbc10e28.camel@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: AQAAf8BxrM420pNkV5wBAA--.8972S3 X-CM-SenderInfo: xvxlyxpqjiv03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBj93XoWxJF4DZFW5CFyfCw47JryrAFc_yoW5Jw48pF WYkFyFkFZ5Jr4ak342v3WxZFy5Aan7JayfKr1DC34a9w15CryxGFWqyFWrK34DXrWxAa1S qFy3KryxKF1vv3gCm3ZEXasCq-sJn29KB7ZKAUJUUUUJ529EdanIXcx71UUU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_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 Hi On 2023/6/22 06:11, Lyude Paul wrote: > For the nouveau bits: > > Reviewed-by: Lyude Paul Thanks a lot > On Tue, 2023-06-13 at 03:25 +0800, Sui Jingfeng wrote: >> From: Sui Jingfeng >> >> The vga_is_firmware_default() function is arch-dependent, it's probably >> wrong if we simply remove the arch guard. As the VRAM BAR which contains >> firmware framebuffer may move, while the lfb_base and lfb_size members of >> the screen_info does not change accordingly. In short, it should take the >> re-allocation of the PCI BAR into consideration. >> >> With the observation that device drivers or video aperture helpers may >> have better knowledge about which PCI bar contains the firmware fb, >> 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 not suitable to >> make such an optimization since it is loaded too early. >> >> 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. Also honor >> the comment: "Clients have two callback mechanisms they can use" >> >> Sui Jingfeng (8): >> PCI/VGA: Use unsigned type for the io_state variable >> PCI/VGA: Deal only with VGA class devices >> PCI/VGA: Tidy up the code and comment format >> PCI/VGA: Replace full MIT license text with SPDX identifier >> video/aperture: Add a helper to detect if an aperture contains >> firmware FB >> PCI/VGA: Introduce is_boot_device function callback to >> vga_client_register >> drm/amdgpu: Implement the is_boot_device callback function >> drm/radeon: Implement the is_boot_device callback function >> >> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +- >> drivers/gpu/drm/drm_aperture.c | 16 +++ >> drivers/gpu/drm/i915/display/intel_vga.c | 3 +- >> drivers/gpu/drm/nouveau/nouveau_vga.c | 2 +- >> drivers/gpu/drm/radeon/radeon_device.c | 12 +- >> drivers/pci/vgaarb.c | 153 +++++++++++++-------- >> drivers/vfio/pci/vfio_pci_core.c | 2 +- >> drivers/video/aperture.c | 29 ++++ >> include/drm/drm_aperture.h | 2 + >> include/linux/aperture.h | 7 + >> include/linux/vgaarb.h | 35 ++--- >> 11 files changed, 184 insertions(+), 89 deletions(-) >> -- Jingfeng