From nobody Fri May 8 03:48:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D310DC43217 for ; Wed, 11 May 2022 18:20:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346166AbiEKSUC (ORCPT ); Wed, 11 May 2022 14:20:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346168AbiEKST7 (ORCPT ); Wed, 11 May 2022 14:19:59 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A097B14043B for ; Wed, 11 May 2022 11:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652293197; 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; bh=OjmqosTJ6Gizg8804eI7hEvoeZHHnweNRCj5+1JAafk=; b=VYXKQ/iHdXb2ogBJ4m+Vjq5e8O+qdH2qTVwVETflCgZ9Y+PmrtrNRbEjWZGjdJpnpL2GKq 2/40AtPta/pe6rd3Dr/OXys1CRapMr53t7h7l5sBaDYOKAiWKRtbmg6YN8J1AjdD7VtIJl GQPdUwCh+A+QnRQb26DNnNXtiiSCysE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-286-EUlxPZ5CMFK0edoaKGsZPQ-1; Wed, 11 May 2022 14:19:52 -0400 X-MC-Unique: EUlxPZ5CMFK0edoaKGsZPQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B16AA85A5A8; Wed, 11 May 2022 18:19:51 +0000 (UTC) Received: from emerald.redhat.com (unknown [10.22.33.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1084F400E43D; Wed, 11 May 2022 18:19:51 +0000 (UTC) From: Lyude Paul To: amd-gfx@lists.freedesktop.org Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Evan Quan , Andrey Grodzovsky , Mario Limonciello , Solomon Chiu , Kai-Heng Feng , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] drm/amdgpu: Add 'modeset' module parameter Date: Wed, 11 May 2022 14:19:33 -0400 Message-Id: <20220511181935.810735-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Many DRM drivers feature a 'modeset' argument, which can be used to enable/disable the entire driver (as opposed to passing nomodeset to the kernel, which would disable modesetting globally and make it difficult to load amdgpu afterwards). Apparently amdgpu is actually missing this however, so let's add it! Keep in mind that this currently just lets one enable or disable amdgpu, I haven't bothered adding a headless mode like nouveau has - however I'm sure someone else can add this if needed. Signed-off-by: Lyude Paul --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_drv.c index ebd37fb19cdb..24e6fb4517cc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -872,6 +872,15 @@ MODULE_PARM_DESC(smu_pptable_id, "specify pptable id to be used (-1 =3D auto(default) value, 0 =3D use ppt= able from vbios, > 0 =3D soft pptable id)"); module_param_named(smu_pptable_id, amdgpu_smu_pptable_id, int, 0444); =20 +/** + * DOC: modeset (int) + * Used to enable/disable modesetting for amdgpu exclusively. + */ +bool amdgpu_enable_modeset =3D true; +MODULE_PARM_DESC(modeset, + "Enable or disable display driver (1 =3D on (default), 0 =3D off"); +module_param_named(modeset, amdgpu_enable_modeset, bool, 0444); + /* These devices are not supported by amdgpu. * They are supported by the mach64, r128, radeon drivers */ @@ -2003,6 +2012,11 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, bool is_fw_fb; resource_size_t base, size; =20 + if (!amdgpu_enable_modeset) { + DRM_INFO("modeset=3D0 passed to amdgpu, driver will not be enabled\n"); + return -ENODEV; + } + /* skip devices which are owned by radeon */ for (i =3D 0; i < ARRAY_SIZE(amdgpu_unsupported_pciidlist); i++) { if (amdgpu_unsupported_pciidlist[i] =3D=3D pdev->device) --=20 2.35.1