Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp625906rwd; Mon, 12 Jun 2023 20:14:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5vILHGInDm9CV/RVlnNY82PDbhk5DXQaZRRtliEVf6WAkJDOILdRxAa7SptpoVexAKImfK X-Received: by 2002:a17:906:9b8d:b0:973:df9c:b1aa with SMTP id dd13-20020a1709069b8d00b00973df9cb1aamr12796010ejc.71.1686626079746; Mon, 12 Jun 2023 20:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686626079; cv=none; d=google.com; s=arc-20160816; b=rodtYGq99pMs5mkeN6BOjFxKAFTnHc/C30CGW+oTrwNlu/4jxq/CH5YkMk45rpKzNd s7/GX5/Z6z0oAYLShr2xyyKD2COW2p1Ets9/m0MuXUY4w/slQfV8v4NqsLVXdFDRFmDh Wyw6VVgkxdVRgTd+aRryGSEHbHV/F00LYuv3nhIENzLe/Z9rMeImVeCosklB8rYleeEW 3TsulfTygGGU8tcepBnZKz8TEpe/u/vqwZSTNx+Op/Hz17lpp0mLhFFWvabl3gJOedeZ CX2SQfuJcAUcXth+dTLbSp1WFxfp5ZUl1MEz8/R2y3OvLlzGFdR2MxKYJ0ZDyuQrJSlA OpmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :hmm_source_type:hmm_attache_num:hmm_source_ip; bh=btfhp53flz2znRJhVRVROxzr2+xJwf5jWKVzzdMQNCg=; b=AZmPjcXDdbdj4NvW10bWwndRbt87OOaehnaYaGsjVa9flGaKLF+vKq5cHuj/ZibMxi kTBMVRfJ+btKSVSDO0G3r3EQK+qmJqJMac+ryfOvGuF9CIY21JwEr2Di0/68uPpKhMY8 uL1j6Np2PbGWfg1nHsETKyetLcyv8K+yYmd6xdQRbBP+xeOYsOqnVSBaFxPzoq0CGkvZ mhd+J2y/ZRF2pSNZL1CYonEaLixCqO0xZ5GmN09OFrrFPE60ycXIxPD5xnQfzeiy+8we 2RDNO0rFfXAdhJCI5aADMIH+jUmdYQ5e9BrGBvD+LPX2lz2q9qGBthUY0ybrp6JzCp4G dIyQ== 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 lf3-20020a170907174300b0096661b3f659si6320396ejc.796.2023.06.12.20.14.15; Mon, 12 Jun 2023 20:14:39 -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 S238503AbjFMDFT (ORCPT + 99 others); Mon, 12 Jun 2023 23:05:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239386AbjFMDEG (ORCPT ); Mon, 12 Jun 2023 23:04:06 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C4AE8210A; Mon, 12 Jun 2023 20:03:07 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.43:47948.1267835893 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.43]) by 189.cn (HERMES) with SMTP id 2B88B1002F4; Tue, 13 Jun 2023 11:02:26 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-75648544bd-7vx9t with ESMTP id 9b21112c8a744a598e4680c08d0d9487 for bhelgaas@google.com; Tue, 13 Jun 2023 11:02:30 CST X-Transaction-ID: 9b21112c8a744a598e4680c08d0d9487 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn From: Sui Jingfeng <15330273260@189.cn> To: Bjorn Helgaas 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, linux-fbdev@vger.kernel.org, Sui Jingfeng , Alex Deucher , Christian Konig , Pan Xinhui , David Airlie , Daniel Vetter Subject: [PATCH v7 8/8] drm/radeon: Implement the is_boot_device callback function Date: Tue, 13 Jun 2023 11:01:51 +0800 Message-Id: <20230613030151.216625-9-15330273260@189.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230613030151.216625-1-15330273260@189.cn> References: <20230613030151.216625-1-15330273260@189.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FROM_LOCAL_DIGITS, FROM_LOCAL_HEX,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Sui Jingfeng [why] The vga_is_firmware_default() defined in drivers/pci/vgaarb.c is arch-dependent, it's a dummy on non-x86 architectures currently. This made VGAARB lost an important condition for the arbitration. It could still be wrong even if we remove the #ifdef and #endif guards. because the PCI bar will move (resource re-allocation). [how] The device that owns the firmware framebuffer should be the default boot device. This patch adds an arch-independent function to enforce this rule. The vgaarb subsystem will call back to radeon_is_boot_device() function when drm/radeon is successfully bound to a radeon GPU device. Cc: Alex Deucher Cc: Christian Konig Cc: Pan Xinhui Cc: David Airlie Cc: Daniel Vetter Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/radeon/radeon_device.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 71f2ff39d6a1..afb49000830c 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -1263,6 +1264,15 @@ static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = { .can_switch = radeon_switcheroo_can_switch, }; +static bool radeon_is_boot_device(struct pci_dev *pdev) +{ + struct drm_device *dev = pci_get_drvdata(pdev); + struct radeon_device *rdev = dev->dev_private; + struct radeon_mc *gmc = &rdev->mc; + + return drm_aperture_contain_firmware_fb(gmc->aper_base, gmc->aper_size); +} + /** * radeon_device_init - initialize the driver * @@ -1425,7 +1435,7 @@ int radeon_device_init(struct radeon_device *rdev, /* if we have > 1 VGA cards, then disable the radeon VGA resources */ /* this will fail for cards that aren't VGA class devices, just * ignore it */ - vga_client_register(rdev->pdev, radeon_vga_set_decode, NULL); + vga_client_register(rdev->pdev, radeon_vga_set_decode, radeon_is_boot_device); if (rdev->flags & RADEON_IS_PX) runtime = true; -- 2.25.1