From nobody Tue Sep 29 01:18:11 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 EEA5237F8C4 for ; Thu, 13 Aug 2026 17:44:33 +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=1786643075; cv=none; b=qoJ+PCLJkanjtDPEkEgBvQdg4oEk471bC3BPxxDEWRwZ3QjDUndoabZlfyAgbUmRb6WjM69P5FeLRImkg5Q/1lQ/FLiHsW7A3h2HjFlypNeVR+2xBLLEktree52kCJB8PUSaZg5UEgcfE98Vud7lJzL2NOWYlReaWh68LVuybLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786643075; c=relaxed/simple; bh=HY/3y1F57XpjwQEPpDihUBWf2GBCrSsQ/kbYH1qIcPw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M1w4eW1NJao50TUxLN7n/HgRAfgHYX80zWX7/1Oqx2H0jJLCEPMgUlVB4yYoA8jxRIhan0UkBoiNUzr/vmZW6LUfxU16Z37BZC0UTCbx/V8CgLclGr0mkVf22YpwGldPbGiB9NvMlbQjfxXDMEEF5ppzqQP3ONR87gW2/iQVMrY= 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=BrYcbarb; 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="BrYcbarb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786643072; 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=BrYcbarbA6WMCTaQF0dCb90OjHno23x8Gtkn1FwILZjXb6Ytl89DEvC0j9Rgob26vK5FkF gLXE7gcHeND37l1i6YV4UuJ7ixS9Ea5A+wf3Fdly7xbOte9CPV8fdBWWiqlPKDvqJz1rjP Bnob8zgYtL3UOFdr7pt7Lpb8dJ3Ri8E= 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-355-6hvQk1RBNW6t1v6PxmWfOg-1; Thu, 13 Aug 2026 13:44:28 -0400 X-MC-Unique: 6hvQk1RBNW6t1v6PxmWfOg-1 X-Mimecast-MFC-AGG-ID: 6hvQk1RBNW6t1v6PxmWfOg_1786643067 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 D6E9F19560AE; Thu, 13 Aug 2026 17:44:26 +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 4CEED195608A; Thu, 13 Aug 2026 17:44:25 +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 v6 1/5] drm/nouveau: Fix cleanup bug in nouveau_drm_device_new() Date: Thu, 13 Aug 2026 13:42:52 -0400 Message-ID: <20260813174416.1812656-2-lyude@redhat.com> In-Reply-To: <20260813174416.1812656-1-lyude@redhat.com> References: <20260813174416.1812656-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:11 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 5A9283B0AC6 for ; Thu, 13 Aug 2026 17:44:35 +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=1786643076; cv=none; b=uchNSPSRxtpAe4CG08e1LNFYBxXr1cV/FfTH8rEB4XUBI8XkYDwCIqZlWk1AgwmUOghU4OY5/3xosRzhs4wOWCKv0Gfo1rwyMEQi45RpX1WHqs2fiz70YNdn+HO/Flf3xtc/jkwiQ5M4C3q/pVUnO/76md1iWCMgb9oLMxZ9ysU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786643076; c=relaxed/simple; bh=3Sgk8fW6A6YFl9SYM84qjjBB7P/8HxPUyJEisZrp3rM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FpGnqQk1kCYUd67JdTj09OLIuebB0ygngZpbIQDFoJ3oTADVuIUA6TWdU4pDqZU6bdI19lJdYBFkHdhGMFCyBxQsESBGwVo1g+SgWIQBYUO6jnIpFV28TEVjdbGxDWCPQuG5x2QOSi9wQbsCZ9+oPOm1opTj0e7ZDNyjsLchksc= 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=TdA21C0i; 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="TdA21C0i" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786643074; 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=NzeCgaMnOsG+RV68upoUHtAiXUIkruVdtD9NVtgw7D4=; b=TdA21C0iEj2B/brn5YdrPFxMo17Ber5kPgR50gLVwVL3FkjQXheR6RfRgsD8h3mYGaVjEx ES+1EN4O5q3ElZ1qAZLiSkPZMaBRiPnNaDEarRkreJ3z5GQHvZlir0su1JL8+TyUQIPEDc DTvC8gOQ1kTVKN7zaKGDba6KCbz+Ywc= 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-308-FyiTRK8vN9WhUgUcxgXCdw-1; Thu, 13 Aug 2026 13:44:31 -0400 X-MC-Unique: FyiTRK8vN9WhUgUcxgXCdw-1 X-Mimecast-MFC-AGG-ID: FyiTRK8vN9WhUgUcxgXCdw_1786643069 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 5A7B71956057; Thu, 13 Aug 2026 17:44:29 +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 D80CA195608A; Thu, 13 Aug 2026 17:44:27 +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 v6 2/5] drm/nouveau: Print the nouveau.atomic parameter in nouveau_display_options() Date: Thu, 13 Aug 2026 13:42:53 -0400 Message-ID: <20260813174416.1812656-3-lyude@redhat.com> In-Reply-To: <20260813174416.1812656-1-lyude@redhat.com> References: <20260813174416.1812656-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. Signed-off-by: Lyude Paul --- 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:11 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 2C2623CAA3F for ; Thu, 13 Aug 2026 17:44:38 +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=1786643079; cv=none; b=tM7WC2PJykjXc2j4PGsOp2ON0n2Ni1xKbyJbnphpgAMcPvVJRXVOl68l/y2ODd72uIofoBl92tsL5RDRqI/Hqzm7mNvQ0hlJMfwce7xcW/4YIPKveKYKKgPCwnG4xcOdiv+5EeYYV4rQXFJ/k+r7k01S3aMZHGwyhIMNYGzKPBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786643079; c=relaxed/simple; bh=+9R5dr8ioZ1ffbybmqx/l9N7UGdMUj9S2WMfaFv4fD4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gPBw1BGjgPaA+21GVLYwoQh+Et5YkoSDMjc7D/kvDEwsGRKchfN6FAD0FiVzApbM/1O0APeSyNeEs2nJAIu3ZQUPFZCgPJyXxHe8+dWfqis2lmmZdjEmuWZK2zrzqXxKlew2/r3ELSHhyme7+dHxzwOIVv6YTEAg12cvj6laKBE= 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=XT2As4EW; 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="XT2As4EW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786643077; 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=XT2As4EWl9oNzLmlMimAG0VY7Zur5LIGMXoCTqk+MTSLMkIMrD47aU44PlxGxpcApyP0k9 F91A9Tr0wUSMv4szH9AkKl6Yo8FYQVeK2GwNnKj4zeacuy9Wc25UTOZa7oiIUPYfS81YCY +uA7MS3NubAFAZQD6ufgMn2E/JxrkGE= 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-130-p6kESRPkPzWuSb7dt25syQ-1; Thu, 13 Aug 2026 13:44:33 -0400 X-MC-Unique: p6kESRPkPzWuSb7dt25syQ-1 X-Mimecast-MFC-AGG-ID: p6kESRPkPzWuSb7dt25syQ_1786643072 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 D2C6C195609F; Thu, 13 Aug 2026 17:44:31 +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 24308195608A; Thu, 13 Aug 2026 17:44:30 +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 v6 3/5] drm/nouveau: Fix drm_driver struct/nouveau.atomic parameter handling Date: Thu, 13 Aug 2026 13:42:54 -0400 Message-ID: <20260813174416.1812656-4-lyude@redhat.com> In-Reply-To: <20260813174416.1812656-1-lyude@redhat.com> References: <20260813174416.1812656-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:11 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 AA2884854F1 for ; Thu, 13 Aug 2026 17:44: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=1786643082; cv=none; b=gBZRv4t1x+ld07hofKOFS6sSaeLuX3rHOJ1E77ffFYDBbQG0UxC/pSN8PeqvxwjaQcQ7tBbtiayRjNgMFj4UZW+ufD82auLeDpuRYilAdR/MDBJQYPpwimp4MFDKdPkG38xw419O9zTdh1BuMlhKTi2hfisofDdUQA8voa1nQOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786643082; c=relaxed/simple; bh=JmfmJ+BVkA0Lvu6Ld1ANuTuq6fbGZCUsZkt8eqpkkmo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QegGhljFuaAVt52k46FLjjX1xND60eLRcKKxnQGaWtg7RwDOhDISm5iObbrsc+FkWFi+Bu1dPTf99XMX2KDBVduJkKelg74AVEClgi4s7xiHV3b2IBGJPWT4tGSVEuiwmVIL7UWd5AVXN4+CwiV56TZ/eXGKjIoI1eXfbDJzMO4= 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=gN0ktFVW; 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="gN0ktFVW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786643079; 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=gN0ktFVWO+HtELF4Vi1Nh3Ug07eeyM7i9GiMLgG4bm1t+v9gH34+bBUx+EJcjezXbPrnNC qCmcKuCGAUjRD0qLFeZ2O2E5Sb6gh5heR0GucenZ7zISi3EHcWa3DCAKb6Em2tu9Ry9FaW NF0D4P6fafY9ZWe/Gkf7IMj7aHj5SGk= Received: from mx-prod-mc-03.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-119-se-oAB3mOCq_R7iWyeTgUA-1; Thu, 13 Aug 2026 13:44:36 -0400 X-MC-Unique: se-oAB3mOCq_R7iWyeTgUA-1 X-Mimecast-MFC-AGG-ID: se-oAB3mOCq_R7iWyeTgUA_1786643074 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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 58AD019560B2; Thu, 13 Aug 2026 17:44:34 +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 9C9D8195DF9A; Thu, 13 Aug 2026 17:44:32 +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 v6 4/5] drm/nouveau/kms: Only allow enabling atomic modesetting on nv50+ Date: Thu, 13 Aug 2026 13:42:55 -0400 Message-ID: <20260813174416.1812656-5-lyude@redhat.com> In-Reply-To: <20260813174416.1812656-1-lyude@redhat.com> References: <20260813174416.1812656-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:11 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 DD8A34A1387 for ; Thu, 13 Aug 2026 17:44:42 +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=1786643084; cv=none; b=i+f2t4JwUYmqliqIcIIG4wGo6hu83USXZjh0jaKIGeF/VLtPzoYeOiUp4Pn+OgxMTcsTgBPuO94jGbiHVbPJ5kMSijsdXk9HrcKypXb8JRxQFuGMgFmMPgCLAz1VWsKINvIi7h1q5f1/eDnsr0V8fvrxvo1DYVOTDeoly2prFgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786643084; c=relaxed/simple; bh=UB4oGHle2SvQoJemFYVhlm8kVxk0NdWrzdXlsnnPcMw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C0d8iePd7EUOpYXzE8Cd/3Ddk1tSL9ASPTuazE6y3q3/y8vAfiqNkA7Oz/w8/xPmd1lo4cOTs3ZyuElVBTPyCcqL61KHxFx73hvrWAi6B9W5IPNWPq3fODmw8isEBcC9qEXY3+UIXM1QyOtXgU7k1fsjXtPysV2iGg6ve/CBFBY= 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=CBch/kUR; 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="CBch/kUR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786643081; 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=XZ/w9x7ar3zo3vN5AX5ttHkyzzQLo6ZYRxnrGe//FUU=; b=CBch/kURHjJNfIOKc6lCCjJAicp7AoW4zBADxpwOg/q6hDhfX3fh8kxGTHTmKnE2/hmLDJ f9n6R0sn9CQXdnZVJjtqF5qxFifVrAqz5+/44j5JnEGRFVEuSfwFMukKFwPqXFCE/67MdG 6AepdJiCu0vTDjQUZIZCPM7T5eg/jmw= 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-517-EX7Il46UPWKJr_ukDuWezg-1; Thu, 13 Aug 2026 13:44:38 -0400 X-MC-Unique: EX7Il46UPWKJr_ukDuWezg-1 X-Mimecast-MFC-AGG-ID: EX7Il46UPWKJr_ukDuWezg_1786643077 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 CFBFD1800149; Thu, 13 Aug 2026 17:44:36 +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 1F1E9195DF98; Thu, 13 Aug 2026 17:44:35 +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 v6 5/5] drm/nouveau/kms/nv50-: Enable atomic modesetting by default Date: Thu, 13 Aug 2026 13:42:56 -0400 Message-ID: <20260813174416.1812656-6-lyude@redhat.com> In-Reply-To: <20260813174416.1812656-1-lyude@redhat.com> References: <20260813174416.1812656-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 ( --- drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouvea= u/nouveau_drm.c index 82a8061e6d3e2..8ee36c5d79fdb 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -745,7 +745,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 -1) dev_warn(parent, "Atomic modesetting not supported (needs nv50+)\n"); =20 driver =3D &driver_legacy_kms; --=20 2.55.0