From nobody Tue Sep 29 01:18:18 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32ED242D757 for ; Thu, 13 Aug 2026 20:37:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786653461; cv=none; b=XYW0PjCTMxgNyZpFMfk6TWNTKZIJpxxACZi3vV3IrMXoj09b73Q41WQuDHmQKTKTiudfzjHiKmJmu0OB8TVlof0/qlQ9hFqCAAXWzNGlPhEtMXbPznzJlxZk7Fqg5ppraxYAXFXMsKX8lKkQQRWMXFUtPGw3lOVMZa0C4FutH9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786653461; c=relaxed/simple; bh=HY/3y1F57XpjwQEPpDihUBWf2GBCrSsQ/kbYH1qIcPw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l3qmxIhhRSHKBQrJl+/YFyd3W/V0p+RUJ0XaWI6ixJqPq5Wed+E9PryPoQez3ODp5ZbA8/RkppDHI8D1RpOOfffAwmBVi7SAoScp322lQyPUNxTN37+xdEkKx24K+uipj0YBTdPjWYSftHMOQf3jwslVvd/bHLNrUGtGbkAu4Gw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=bd1EO+HH; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bd1EO+HH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786653459; 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=HM8zvcL/8EecJPDVQT6aSutYylxT/HBspErHsI6olAE=; b=bd1EO+HH/xOJk7qju+jYle4C63vx8V12iG5N5sgxkUDJkX9szL3Oqa4sqccLlmftv6OY5H Rq98dOrFrWM16ODdv8tCfhXqZpAuSH0LbHYnIHHxMvMk0fcaf7Rz53VyxllQ9QlsBf5/eV ipdypABtqr720Csn6AH0dfxcdymq3So= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-99-eDDONp3vPnOKQGD-nX5b4Q-1; Thu, 13 Aug 2026 16:37:35 -0400 X-MC-Unique: eDDONp3vPnOKQGD-nX5b4Q-1 X-Mimecast-MFC-AGG-ID: eDDONp3vPnOKQGD-nX5b4Q_1786653453 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6B3611956096; Thu, 13 Aug 2026 20:37:33 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.207]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CD5FC195608A; Thu, 13 Aug 2026 20:37:31 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org Cc: "Maarten Lankhorst" , "Simona Vetter" , "David Airlie" , "Thomas Zimmermann" , "Maxime Ripard" , "Danilo Krummrich" , "Lyude Paul" Subject: [PATCH v7 1/5] drm/nouveau: Fix cleanup bug in nouveau_drm_device_new() Date: Thu, 13 Aug 2026 16:27:05 -0400 Message-ID: <20260813202833.2051778-2-lyude@redhat.com> In-Reply-To: <20260813202833.2051778-1-lyude@redhat.com> References: <20260813202833.2051778-1-lyude@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" Sashiko caught this while reviewing the patches for enabling atomic by default - if we fail to allocate the DRM device pointer, we'll attempt to free the error pointer that it returns rather than the actual struct. Let's fix this while we're at it. Signed-off-by: Lyude Paul --- V3: * Don't use devm, that will just break during unbind (Sashiko). V5: * Fix silly rebasing error * Go back to the old style of error handling since we're not using a second allocation for drm_driver anymore. drivers/gpu/drm/nouveau/nouveau_drm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouvea= u/nouveau_drm.c index 4d1ad718e09b7..a348115518ec4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -749,7 +749,8 @@ nouveau_drm_device_new(const struct drm_driver *drm_dri= ver, struct device *paren drm->dev =3D drm_dev_alloc(drm_driver, parent); if (IS_ERR(drm->dev)) { ret =3D PTR_ERR(drm->dev); - goto done; + kfree(drm); + return ERR_PTR(ret); } =20 drm->dev->dev_private =3D drm; --=20 2.55.0 From nobody Tue Sep 29 01:18:18 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D549042F6FA for ; Thu, 13 Aug 2026 20:37:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786653463; cv=none; b=AdUY1frJJCGD7LTIGY50tCQnSjKPNDqobwdW4/+hmJZ11gBU+X5+7Q0O6x/Pa3+Xm8rPAFaQNVcoiqMfz/qYH3ronq7TEZzk3Jc3yqvZI/Hzm6Rly3u1GuD+hcMHHxG7cPXBkbGXWFMy2TZ+UjCbwPqnwBHwPrreXy5JJ9avZKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786653463; c=relaxed/simple; bh=Tu7YV7dUDnN9ZacQjeiZ15cFpgMCgweRG37vUzzdC1A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sr+gzM+rS1AVNMYfXiarZ79IArEpcT7ZKD/XEQGMIRC/QZVKn6joEWFd7k/GO+SqYnIsPMlR+YLn05inKe5CKVgZ2Hcasxp9gkTzjQTnFNOLffvL6aqvehTFVVdPs101FalQI6jf/lLWES7JWN8TwjaV7OINLkX+2+WJI0z9K3U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=RERGLgwE; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RERGLgwE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786653460; 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=I9JC+g0Maoo410UDO/ewvAWhlpWmYHQJSQQ2FmZGNDs=; b=RERGLgwEbq9mYwX3Cqd1uyG8dIld03P8xF1KqIai4YmvDxYRLNFrBsEFIPdmzkbghB0z8V h0DVmixOzYpeqtv3zJQ6R0W6oUsULMJvB2qOIWpMM34n+iGXrTtD9q05/V4pyroieZZi1o T8YoMp4Z/HW7f1RrQ/90lGIayO431b0= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-606-BLFkP55LMwq_BQPD2_IlLQ-1; Thu, 13 Aug 2026 16:37:37 -0400 X-MC-Unique: BLFkP55LMwq_BQPD2_IlLQ-1 X-Mimecast-MFC-AGG-ID: BLFkP55LMwq_BQPD2_IlLQ_1786653456 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B42321800365; Thu, 13 Aug 2026 20:37:35 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.207]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 364BA195DF9A; Thu, 13 Aug 2026 20:37:34 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org Cc: "Maarten Lankhorst" , "Simona Vetter" , "David Airlie" , "Thomas Zimmermann" , "Maxime Ripard" , "Danilo Krummrich" , "Lyude Paul" Subject: [PATCH v7 2/5] drm/nouveau: Print the nouveau.atomic parameter in nouveau_display_options() Date: Thu, 13 Aug 2026 16:27:06 -0400 Message-ID: <20260813202833.2051778-3-lyude@redhat.com> In-Reply-To: <20260813202833.2051778-1-lyude@redhat.com> References: <20260813202833.2051778-1-lyude@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" Seems like we never remembered to start printing the value for this, so let's start to aid in troubleshooting in case we run into any issues with atomic. drivers/gpu/drm/nouveau/nouveau_drm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouvea= u/nouveau_drm.c index a348115518ec4..451009adee0de 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -1417,6 +1417,7 @@ static void nouveau_display_options(void) DRM_DEBUG_DRIVER("... debug : %s\n", nouveau_debug); DRM_DEBUG_DRIVER("... noaccel : %d\n", nouveau_noaccel); DRM_DEBUG_DRIVER("... modeset : %d\n", nouveau_modeset); + DRM_DEBUG_DRIVER("... atomic : %d\n", nouveau_atomic); DRM_DEBUG_DRIVER("... runpm : %d\n", nouveau_runtime_pm); DRM_DEBUG_DRIVER("... vram_pushbuf : %d\n", nouveau_vram_pushbuf); DRM_DEBUG_DRIVER("... hdmimhz : %d\n", nouveau_hdmimhz); --=20 2.55.0 From nobody Tue Sep 29 01:18:18 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BB3442F6ED for ; Thu, 13 Aug 2026 20:37:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786653470; cv=none; b=WrVLUk9KAkb2WgL3hH2Yo5V4rzRFPNyDzoHiCsbQ7rqXuVlxkRpOK+G9ZYX8P3Ahbq7uVDacG75nJGLdaX3ARaFXRIYD0p5qXnNQX7f2gj6MtnVNJGnsNgUx4USQ9Jdm189XMixN2LZ3phY/7NPfK1gzVk9/iVseNuPl6zqC+LQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786653470; c=relaxed/simple; bh=+9R5dr8ioZ1ffbybmqx/l9N7UGdMUj9S2WMfaFv4fD4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ltJPys0eXBT+J+4IVSEifZXuE0htKiqMSe+LK5q377asm74jgJZ82Dtj1NnXyfIht9SMghRe4b3OeLqNapGdnkakBsTQiTbpAUvBTgWFWBRV7Vq4bp8Pe46Nyd7RkeaVrYZSxut9n8AH0JKeJtfO2Q5KzKF8pjtiBnk/iTGANTg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=M+3yZtrR; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="M+3yZtrR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786653468; 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=Hh27rO9R8DtQJsuiE9nKE16dIfxBWJQ1z/2NAuDC/us=; b=M+3yZtrR4nNBOe80jJzpWCFLxjrIeGged60E35d+/jkbpEWtpnYz7RtMbkHqaD9zriAFiV INLiYsCFd5ARZCWhmTamqK0K5ht6EYsIlftnwI1yWBvLMn3a2L/cRTK16LA7PIrRh5jHm2 DjlK/HiediYYGHW4drvVVFWGL2SJ/0I= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619--5Lyhn0CMQCjIdm7ZvXxxw-1; Thu, 13 Aug 2026 16:37:40 -0400 X-MC-Unique: -5Lyhn0CMQCjIdm7ZvXxxw-1 X-Mimecast-MFC-AGG-ID: -5Lyhn0CMQCjIdm7ZvXxxw_1786653458 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 53D18180034A; Thu, 13 Aug 2026 20:37:38 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.207]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7FC82195DF9A; Thu, 13 Aug 2026 20:37:36 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org Cc: "Maarten Lankhorst" , "Simona Vetter" , "David Airlie" , "Thomas Zimmermann" , "Maxime Ripard" , "Danilo Krummrich" , "Lyude Paul" Subject: [PATCH v7 3/5] drm/nouveau: Fix drm_driver struct/nouveau.atomic parameter handling Date: Thu, 13 Aug 2026 16:27:07 -0400 Message-ID: <20260813202833.2051778-4-lyude@redhat.com> In-Reply-To: <20260813202833.2051778-1-lyude@redhat.com> References: <20260813202833.2051778-1-lyude@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" The way we handled the nouveau.atomic module parameter before was fairly broken, and had a number of issues: - It was only ever actually parsed in the case of PCI devices. - When nouveau.atomic was enabled, it would add the cap for atomic modesetting to the global driver_pci structure. This meant that if one GPU on a system supported atomic and another didn't, it would still get enabled for both. Looking into this exposed further silliness in the way that we actually handle the drm_driver struct. We have one global structure for platform devices, and another for PCI devices - both of which are literally identical. So before we start preparing to enable atomic modesetting by default, let's fix this. Instead of sharing driver_pci and driver_platform, we instead create driver_legacy_kms and driver_atomic_kms, each of which is identical except for the DRIVER_ATOMIC capabilities flag, and then assign either depending on the nouveau_atomic module parameter. Doing this is also preferable, as the next step for enabling atomic modesetting by default will be ensuring that we don't enable it for legacy devices that still don't support it. This requires only checking the atomic modesetting module parameter after the NVKM device is ready, as this allows us to check the GPU family that nouveau is running on. Signed-off-by: Lyude Paul --- V2: * s/driver_pci/drm_driver/ * Dynamically allocate drm_driver struct, get rid of duplicate global driver structs to fix another Sashiko issue. V3: * Don't use devm (sashiko) V4: * Don't return 0 by mistake (thanks C) V6: * Don't embed drm_driver into drm_device, just create two separate hardcoded structs * Move the check earlier drivers/gpu/drm/nouveau/nouveau_drm.c | 100 +++++++++++++++----------- 1 file changed, 58 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouvea= u/nouveau_drm.c index 451009adee0de..d021a3049be1a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -111,9 +111,8 @@ MODULE_PARM_DESC(runpm, "disable (0), force enable (1),= optimus only default (-1 static int nouveau_runtime_pm =3D -1; module_param_named(runpm, nouveau_runtime_pm, int, 0400); =20 -static struct drm_driver driver_stub; -static struct drm_driver driver_pci; -static struct drm_driver driver_platform; +static const struct drm_driver driver_legacy_kms; +static const struct drm_driver driver_atomic_kms; =20 #ifdef CONFIG_DEBUG_FS struct dentry *nouveau_debugfs_root; @@ -727,8 +726,7 @@ nouveau_drm_device_del(struct nouveau_drm *drm) } =20 static struct nouveau_drm * -nouveau_drm_device_new(const struct drm_driver *drm_driver, struct device = *parent, - struct nvkm_device *device) +nouveau_drm_device_new(struct device *parent, struct nvkm_device *device) { static const struct nvif_mclass mmus[] =3D { @@ -737,16 +735,21 @@ nouveau_drm_device_new(const struct drm_driver *drm_d= river, struct device *paren { NVIF_CLASS_MMU_NV04 , -1 }, {} }; + const struct drm_driver *driver; struct nouveau_drm *drm; int ret; =20 + if (nouveau_atomic) + driver =3D &driver_atomic_kms; + else + driver =3D &driver_legacy_kms; + drm =3D kzalloc_obj(*drm); if (!drm) return ERR_PTR(-ENOMEM); =20 drm->nvkm =3D device; - - drm->dev =3D drm_dev_alloc(drm_driver, parent); + drm->dev =3D drm_dev_alloc(driver, parent); if (IS_ERR(drm->dev)) { ret =3D PTR_ERR(drm->dev); kfree(drm); @@ -874,16 +877,13 @@ static int nouveau_drm_probe(struct pci_dev *pdev, return ret; =20 /* Remove conflicting drivers (vesafb, efifb etc). */ - ret =3D aperture_remove_conflicting_pci_devices(pdev, driver_pci.name); + ret =3D aperture_remove_conflicting_pci_devices(pdev, DRIVER_NAME); if (ret) goto fail_nvkm; =20 pci_set_master(pdev); =20 - if (nouveau_atomic) - driver_pci.driver_features |=3D DRIVER_ATOMIC; - - drm =3D nouveau_drm_device_new(&driver_pci, &pdev->dev, device); + drm =3D nouveau_drm_device_new(&pdev->dev, device); if (IS_ERR(drm)) { ret =3D PTR_ERR(drm); goto fail_nvkm; @@ -1360,35 +1360,54 @@ nouveau_driver_fops =3D { .fop_flags =3D FOP_UNSIGNED_OFFSET, }; =20 -static struct drm_driver -driver_stub =3D { - .driver_features =3D DRIVER_GEM | - DRIVER_SYNCOBJ | DRIVER_SYNCOBJ_TIMELINE | - DRIVER_MODESET | - DRIVER_RENDER, - .open =3D nouveau_drm_open, - .postclose =3D nouveau_drm_postclose, - -#if defined(CONFIG_DEBUG_FS) - .debugfs_init =3D nouveau_drm_debugfs_init, +#ifdef CONFIG_DEBUG_FS +#define NOUVEAU_DEBUGFS_OPS .debugfs_init =3D nouveau_drm_debugfs_init, +#else +#define NOUVEAU_DEBUGFS_OPS #endif =20 - .ioctls =3D nouveau_ioctls, - .num_ioctls =3D ARRAY_SIZE(nouveau_ioctls), - .fops =3D &nouveau_driver_fops, - - .gem_prime_import_sg_table =3D nouveau_gem_prime_import_sg_table, - - .dumb_create =3D nouveau_display_dumb_create, - .dumb_map_offset =3D drm_gem_ttm_dumb_map_offset, - - DRM_FBDEV_TTM_DRIVER_OPS, +#define NOUVEAU_DRIVER_OPS \ + .open =3D nouveau_drm_open, \ + .postclose =3D nouveau_drm_postclose, \ + \ + NOUVEAU_DEBUGFS_OPS \ + \ + .ioctls =3D nouveau_ioctls, \ + .num_ioctls =3D ARRAY_SIZE(nouveau_ioctls), \ + .fops =3D &nouveau_driver_fops, \ + \ + .gem_prime_import_sg_table =3D nouveau_gem_prime_import_sg_table, \ + \ + .dumb_create =3D nouveau_display_dumb_create, \ + .dumb_map_offset =3D drm_gem_ttm_dumb_map_offset, \ + \ + DRM_FBDEV_TTM_DRIVER_OPS, \ + \ + .name =3D DRIVER_NAME, \ + .desc =3D DRIVER_DESC, \ + .major =3D DRIVER_MAJOR, \ + .minor =3D DRIVER_MINOR, \ + .patchlevel =3D DRIVER_PATCHLEVEL + +static const struct drm_driver +driver_legacy_kms =3D { + .driver_features =3D DRIVER_GEM + | DRIVER_SYNCOBJ + | DRIVER_SYNCOBJ_TIMELINE + | DRIVER_MODESET + | DRIVER_RENDER, + NOUVEAU_DRIVER_OPS, +}; =20 - .name =3D DRIVER_NAME, - .desc =3D DRIVER_DESC, - .major =3D DRIVER_MAJOR, - .minor =3D DRIVER_MINOR, - .patchlevel =3D DRIVER_PATCHLEVEL, +static const struct drm_driver +driver_atomic_kms =3D { + .driver_features =3D DRIVER_GEM + | DRIVER_SYNCOBJ + | DRIVER_SYNCOBJ_TIMELINE + | DRIVER_MODESET + | DRIVER_RENDER + | DRIVER_ATOMIC, + NOUVEAU_DRIVER_OPS, }; =20 static struct pci_device_id @@ -1457,7 +1476,7 @@ nouveau_platform_device_create(const struct nvkm_devi= ce_tegra_func *func, if (err) goto err_free; =20 - drm =3D nouveau_drm_device_new(&driver_platform, &pdev->dev, *pdevice); + drm =3D nouveau_drm_device_new(&pdev->dev, *pdevice); if (IS_ERR(drm)) { err =3D PTR_ERR(drm); goto err_free; @@ -1482,9 +1501,6 @@ nouveau_drm_init(void) { int ret; =20 - driver_pci =3D driver_stub; - driver_platform =3D driver_stub; - nouveau_display_options(); =20 if (nouveau_modeset =3D=3D -1) { --=20 2.55.0 From nobody Tue Sep 29 01:18:18 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7283242DFEA for ; Thu, 13 Aug 2026 20:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786653467; cv=none; b=hn6/GbZXUxP7/WI+/2DEN5sQEjyzPG6DukDGXR+CYuv5JiGwictLGuOyWZsJjrr6H/94BkAqSacmYMx0h1LiHPdOjVZdGVtV2vJkIl26FCm995yZ1SqgrLZziJ3ChyOuL8PzHPThJgGki/aDJS5vMztyRON05iWfR6E5KXZlkmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786653467; c=relaxed/simple; bh=JmfmJ+BVkA0Lvu6Ld1ANuTuq6fbGZCUsZkt8eqpkkmo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MY4+RIGmXsMY/exIB25RtnbuAI2JUHJmbUM1vwIF1qkKjZ0u9ne2/+SYEqWhhqII3tdlMcHXWylXrehRGzxlsSnx5xbeQQ+0xWHGZgiUhLBeqjVkURcwVQiPrRqUBz/cFT92UsghUUjs1wxWUoQ/Xkv7ON6SVb2/vMl23gQ/vy0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=IXWn/S72; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IXWn/S72" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786653465; 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=a17nsuStiS7IsQuNSpzGOKtORn1O8u7fu4ZIRonx//w=; b=IXWn/S723wEOO57HzFEak5ltPHx1ILz886pdDhC8FLsttGNBVExhQKLoOzH+U0BPIKXS5L 5GvhWjdh3FsP5EUDtjBCithJmGqrQp4npeserWCRTqrtpHMFNbUmKd9b6M/EQexN1Zon57 p6SjpoHI8XiSGk7U4P9FyPClfvHoXh4= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-cq8hJroVPgSFZFM2-UumdQ-1; Thu, 13 Aug 2026 16:37:42 -0400 X-MC-Unique: cq8hJroVPgSFZFM2-UumdQ-1 X-Mimecast-MFC-AGG-ID: cq8hJroVPgSFZFM2-UumdQ_1786653460 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6C8B5195608B; Thu, 13 Aug 2026 20:37:40 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.207]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 09071195DF9A; Thu, 13 Aug 2026 20:37:38 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org Cc: "Maarten Lankhorst" , "Simona Vetter" , "David Airlie" , "Thomas Zimmermann" , "Maxime Ripard" , "Danilo Krummrich" , "Lyude Paul" Subject: [PATCH v7 4/5] drm/nouveau/kms: Only allow enabling atomic modesetting on nv50+ Date: Thu, 13 Aug 2026 16:27:08 -0400 Message-ID: <20260813202833.2051778-5-lyude@redhat.com> In-Reply-To: <20260813202833.2051778-1-lyude@redhat.com> References: <20260813202833.2051778-1-lyude@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" Atomic modesetting support was never added for pre-nv50 chipsets, so make sure we don't allow it to be forced on. Additionally, print a small warning when it's not supported. Signed-off-by: Lyude Paul --- V2: * Check against info.family, not info.chipset V6: * Check against device->card_type so we can perform the check before setting up nvif drivers/gpu/drm/nouveau/nouveau_drm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouvea= u/nouveau_drm.c index d021a3049be1a..82a8061e6d3e2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -739,10 +739,17 @@ nouveau_drm_device_new(struct device *parent, struct = nvkm_device *device) struct nouveau_drm *drm; int ret; =20 - if (nouveau_atomic) - driver =3D &driver_atomic_kms; - else + if (device->card_type >=3D NV_50) { + if (nouveau_atomic) + driver =3D &driver_atomic_kms; + else + driver =3D &driver_legacy_kms; + } else { + if (nouveau_atomic) + dev_warn(parent, "Atomic modesetting not supported (needs nv50+)\n"); + driver =3D &driver_legacy_kms; + } =20 drm =3D kzalloc_obj(*drm); if (!drm) --=20 2.55.0 From nobody Tue Sep 29 01:18:18 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99C5542FCCC for ; Thu, 13 Aug 2026 20:37:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786653472; cv=none; b=fPTlxbtJcv13rA0wGVi5vdW06Tf8Ak/gd/ZFx2ak9AiG1u5+s+0NPKjd/Ci4vnAy0sSimc+yQ7onDDGBhQ71YTfn5E5Y1U1rQ/0QrFgW9drNkHiEFu+EK3Z/KwDnAZfoBIACcnn6wk96UMtCYzglj8DgPb51CSbVZFPu0B8K8i8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786653472; c=relaxed/simple; bh=fVAqIJZajjmSjwwB9NIcPFSjCWXIwQhcW2C8p/ZJIwI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mt/tDws0zo7d2h+MEja8dlgp6okPYpN2+r0PFVXlOWdHxTwUCCzPOMtGIjX2KA5KEXz7L2loW18iyJdzq4M+b6NuaLUYuQ03DTrC1x+sQUa1GqOq3jB5miEOs2MfxadUyEcYhpPgxmqXHNURV6Gsc/oWPuiPn/3wg9jWPZyB4Hc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Z8Ct5lpa; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Z8Ct5lpa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786653469; 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=5Vrk3PlFsrHnHDBdU/h3yMx32mf+J1iZRQWJGUt9qu0=; b=Z8Ct5lpaPNR+n9O/GE9Ha0ck/9nXE3m9HalmkZLkVihmpVHx+iQQ2IR1bbvltFar/C0GYA 7EuUf092H2paL/+LbAsPR60wZiZrU17aQoakrQGeXKaP1xIIyoNmgPvhbtPHXb/QzVztvo TJqLhHhna1CVm7+dah6VJ18zPyhji34= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-213-04hwDPV1NK2-0cOpJ_I0aA-1; Thu, 13 Aug 2026 16:37:44 -0400 X-MC-Unique: 04hwDPV1NK2-0cOpJ_I0aA-1 X-Mimecast-MFC-AGG-ID: 04hwDPV1NK2-0cOpJ_I0aA_1786653462 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8FA19195605E; Thu, 13 Aug 2026 20:37:42 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.207]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 365E2195608A; Thu, 13 Aug 2026 20:37:41 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org Cc: "Maarten Lankhorst" , "Simona Vetter" , "David Airlie" , "Thomas Zimmermann" , "Maxime Ripard" , "Danilo Krummrich" , "Lyude Paul" Subject: [PATCH v7 5/5] drm/nouveau/kms/nv50-: Enable atomic modesetting by default Date: Thu, 13 Aug 2026 16:27:09 -0400 Message-ID: <20260813202833.2051778-6-lyude@redhat.com> In-Reply-To: <20260813202833.2051778-1-lyude@redhat.com> References: <20260813202833.2051778-1-lyude@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" Nouveau is one of the very few modern hardware drivers in the kernel that doesn't have atomic modesetting enabled by default, in part because when it was originally written by Ben there wasn't much in the way of good atomic modesetting clients to actually test things out with. Nowadays however, atomic modesetting is very much the norm - and support in userspace for non-atomic drivers is starting to bitrot a bit - leading to its own set of issues. At the same time, many of those issues are fixed by just turning on atomic in nouveau. Plus, I've been running nouveau with atomic modesetting on by default for most of the machines I work on, and I've already fixed quite a number of issues to the point where things seem quite stable (excluding a single screen flashing bug on my desktop, which I am not particularly convinced has anything to do with atomic modesetting). Now that we've protected against breaking things for chipsets where atomic isn't supported ( --- V7: * Re-add patch hunk that changes the default value of nouveau_atomic, it got dropped somehow? * Correct nouveau_atomic check so we don't spit out errors on old hardware by default. drivers/gpu/drm/nouveau/nouveau_drm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouvea= u/nouveau_drm.c index 82a8061e6d3e2..b0f9fb10a74dd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -103,8 +103,9 @@ MODULE_PARM_DESC(modeset, "enable driver (default: auto= , " int nouveau_modeset =3D -1; module_param_named(modeset, nouveau_modeset, int, 0400); =20 -MODULE_PARM_DESC(atomic, "Expose atomic ioctl (default: disabled)"); -static int nouveau_atomic =3D 0; +MODULE_PARM_DESC(atomic, "Expose atomic ioctl (default: auto, " + "0 =3D disabled, 1 =3D enabled)"); +static int nouveau_atomic =3D -1; module_param_named(atomic, nouveau_atomic, int, 0400); =20 MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only defau= lt (-1)"); @@ -745,7 +746,7 @@ nouveau_drm_device_new(struct device *parent, struct nv= km_device *device) else driver =3D &driver_legacy_kms; } else { - if (nouveau_atomic) + if (nouveau_atomic =3D=3D 1) dev_warn(parent, "Atomic modesetting not supported (needs nv50+)\n"); =20 driver =3D &driver_legacy_kms; --=20 2.55.0