Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22130701rwd; Fri, 30 Jun 2023 04:25:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlGSf55EWGQmychXz1IIHi4cNjk3wEaMHNOLDjRLJV9KRimGFbDKMt/nC9bMrx+A08xA8Gtp X-Received: by 2002:a17:903:1205:b0:1b3:e90b:93e1 with SMTP id l5-20020a170903120500b001b3e90b93e1mr2652775plh.36.1688124340192; Fri, 30 Jun 2023 04:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688124340; cv=none; d=google.com; s=arc-20160816; b=ipTVqfpGsRqaodp3IEfOzlERept17kksdO39FJZRdvRAZ1/CJ1ypu6F2KMc7VFWZvF 96T9KfzE2gSmGlILPovG/Xans/E77WXhnkD+E3G0DgHl1WIyKRJjyZAZ6qDXyA8xXZlv pxBkfegjrhSn0ErDm5NAyMmEj34ve3TKQoph4AkUFfVPUAB/UaiXCy3wsr9T5aws8vMM CtsygJQhKOJTyX8pCmcorgVWTMUZVgHPsCBpMYGK1WcQ1m+JIOz+02xSMuycrM6Tkjby cmRn/crKN+ZdA9XPvnIQCmD0yVd8giPBX3r+0OGaGhMaw49mXFVZa9YqFBrdb6VIvxBG G6Qw== 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 :dkim-signature; bh=btfhp53flz2znRJhVRVROxzr2+xJwf5jWKVzzdMQNCg=; fh=f11+oyWq+O0QlZi22+oxI5KQNrQBOI3XUWrW6i/d8i0=; b=L0nj0LbSwry+TjJX7JulMIrMSGkJAOZ1iWGN2Mbm2RvjppPPJeF7QCww785fU3Mwac LBowozlpoTEtxK4Y3ir7bMvZQoxkH8mXHsl2y29KPWMVXdljrNs/GNgz07N+6BLc5Kuv pA/AipIqx/v6crt9JYDg/c0P4Aio+y8IHwb/6yc/36tNcTxWoRNndZ0cbK964C5N79Qe wTgd6Bu9j4ruGTtXFatiZ/TKOmEF2QAG4AdBouEqXl55qZP1x7aY9nexEtyKmUzfDlWO hZp5nWkNx/WD85QVWx/qJWsmiUX5/TrzqfEszrIQFz2Uw4dkJEwrn7zXQE1OpbI2HrFX +xzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=T73HFHyy; 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=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c21-20020a170902849500b001b3d822f131si11603595plo.239.2023.06.30.04.25.26; Fri, 30 Jun 2023 04:25:40 -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=@linux.dev header.s=key1 header.b=T73HFHyy; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232775AbjF3LEH (ORCPT + 99 others); Fri, 30 Jun 2023 07:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232307AbjF3LDZ (ORCPT ); Fri, 30 Jun 2023 07:03:25 -0400 Received: from out-21.mta0.migadu.com (out-21.mta0.migadu.com [IPv6:2001:41d0:1004:224b::15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AC633C14 for ; Fri, 30 Jun 2023 04:03:12 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1688122990; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=btfhp53flz2znRJhVRVROxzr2+xJwf5jWKVzzdMQNCg=; b=T73HFHyypfPukJHUCivjqAqiND6lcrXP+g0ZSla4MUTvXmqJbQrwuT16aoxpOada4b8PuN Zb0G/hybooeV4zLJKuZI6dmV348rzV47I3c7QaAf/CWaoV1LLUZGqtqBRZZ0N54w/EswIc 92ry4Yxu6TJa1mUgnhkXb/bif7YjLxY= From: Sui Jingfeng To: Alex Deucher , David Airlie , Daniel Vetter , Thomas Zimmermann , Maxime Ripard , Jani Nikula Cc: dri-devel@lists.freedesktop.org, amd-gfx@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 , Christian Konig , Pan Xinhui Subject: [PATCH v1 4/4] drm/radeon: Implement the is_boot_device callback function Date: Fri, 30 Jun 2023 19:02:43 +0800 Message-Id: <20230630110243.141671-5-sui.jingfeng@linux.dev> In-Reply-To: <20230630110243.141671-1-sui.jingfeng@linux.dev> References: <20230630110243.141671-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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