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 9777741D11E for ; Thu, 13 Aug 2026 20:48:17 +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=1786654099; cv=none; b=pK6YuvfLbthm4BUwpI7knQmDWpFviKCtzpVAqvdA2404fxm4TVAghnbMgMeo9U3beJ5Qp+qmzYtL4ja9MJ1PyFsLRoj2WGvRWdI5JpEIv+u8u/zan5QxThh5Zh3SEGHSHUgnoHIcrBHlobJCP65b0nNvWJNY7TVQsZehgsIV2Xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786654099; c=relaxed/simple; bh=HY/3y1F57XpjwQEPpDihUBWf2GBCrSsQ/kbYH1qIcPw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WJ6eD1jt3k49tZ5dGY69x6ClhpnAafwIgT5hJVZRX0p3nDY7uz3brTw2R9GsLic9nz9xmltwdNftuAWmjo6kmnKbFe6zneaiLSYeqML3nMBxwMxPwoM1vp03jwRn7jgwgFyaN1+MisX85OZUt+xKvX9X7w4NPC/NoAdLNwBcZY8= 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=gHuvIe8m; 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="gHuvIe8m" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786654096; 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=gHuvIe8m75e5yCV97XvVGOPtvf4vLyNpheuFXMKiY0OuRNx9BFAfjEgnDR8SoQpN1b++YO sNN3uSDqzY712Z9Ndi99v2LCQAsfVp2RxPmTGt+SGHAN/INyuV2eJBFucTgar1toS8Jf6Q +zjXZ3KR3nG1/GrfQ0e/g6/gicIRVfY= 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-59-9pI8yLRPO7ymTwB7_EzK4g-1; Thu, 13 Aug 2026 16:48:12 -0400 X-MC-Unique: 9pI8yLRPO7ymTwB7_EzK4g-1 X-Mimecast-MFC-AGG-ID: 9pI8yLRPO7ymTwB7_EzK4g_1786654091 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 D62F8195609F; Thu, 13 Aug 2026 20:48:10 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.207]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 02446427; Thu, 13 Aug 2026 20:48:08 +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 RESEND v7 1/5] drm/nouveau: Fix cleanup bug in nouveau_drm_device_new() Date: Thu, 13 Aug 2026 16:46:47 -0400 Message-ID: <20260813204803.2097176-2-lyude@redhat.com> In-Reply-To: <20260813204803.2097176-1-lyude@redhat.com> References: <20260813204803.2097176-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.6 on 10.30.177.95 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 Reviewed-by: Dave Airlie --- 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.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 5D59633A717 for ; Thu, 13 Aug 2026 20:48:19 +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=1786654101; cv=none; b=iG5xiT78HBEVvBeknXFU4A9/RhyFI1t80rrR3b/9VusEvCKqdZXLDD2SzjLd89hXXZltRr7M4aD+IHiOGqdQQBvqebHg5FqUlPNIMTjz515oL9Mz3zSBcRHnqgxc7Z2RNoSuXQ8ly/PC4wMHJmMoW1l7ZNe2n2OrjnvzK5osuoY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786654101; c=relaxed/simple; bh=3Sgk8fW6A6YFl9SYM84qjjBB7P/8HxPUyJEisZrp3rM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e/9hhrGuXoUJ+kzCztFeJZ7lf4c4wE3hDQuDpclZ0ijMeNTLFapMYbp79BOj/p30jWlMp0ahuUFG/QThAkiaKGlJI1Q7ER5JohbvcQ6dsLtLuWc+lqxbqu7nYYROqy8nYJqKizvTbrgaxwQw4A5zuKrKf95y9zgCjKn6ja+mqGs= 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=NQsLWSzE; 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="NQsLWSzE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786654098; 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=NQsLWSzEhZKfoLXNMefXC7JUKED4a7Eax6slfhZOUKkA+Ehjlmu3Ra1I9Af53pKHueVK2b 2s2SiuZbtMzgV+mwFMdvwOKvymy6c75L7MYRPjbIofFh3oGMZR20ErTv7H2QpBGv4T0HxL U7HjyTSasI58bMKmGQUgCnyC7JJxys4= 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-531-jLIJvevBNFi8cb3i8cO5nQ-1; Thu, 13 Aug 2026 16:48:14 -0400 X-MC-Unique: jLIJvevBNFi8cb3i8cO5nQ-1 X-Mimecast-MFC-AGG-ID: jLIJvevBNFi8cb3i8cO5nQ_1786654093 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 2988F1956096; Thu, 13 Aug 2026 20:48:13 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.207]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A29167C5; Thu, 13 Aug 2026 20:48:11 +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 RESEND v7 2/5] drm/nouveau: Print the nouveau.atomic parameter in nouveau_display_options() Date: Thu, 13 Aug 2026 16:46:48 -0400 Message-ID: <20260813204803.2097176-3-lyude@redhat.com> In-Reply-To: <20260813204803.2097176-1-lyude@redhat.com> References: <20260813204803.2097176-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.6 on 10.30.177.95 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 Reviewed-by: Dave Airlie --- 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 E170D42048D for ; Thu, 13 Aug 2026 20:48:21 +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=1786654104; cv=none; b=VAlO0KseYQjKSrnL+rHBx6nZdCHJcEXRwbAtAUKlJVnFYhuLsDUh5W4zjzVJlAblHQRNt8OjEC9P91r9p//nPfaQKCKtUjKODOya3m2jR6OHtnpH5QRXMoSSr81hsJEGGSW6XqwxmLV0N9GFnDsYPKp13fcB3vELsiVncM05rfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786654104; c=relaxed/simple; bh=+9R5dr8ioZ1ffbybmqx/l9N7UGdMUj9S2WMfaFv4fD4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dQVo14jp9yE7bA5RYYhPO38vEoVtajTtYguY/KDTPTAuLhAGZtUULnIiO+sVP8AFsss51SgEllnO7AByEBlBjFeZHbAdwtuOKoRVqmgO3kEZaMwa/oNDs/+/e+j6W/wIH9EWIWSvvfkKjSNPlp0b1ifEeqMEx9/RkQM0TKI+7rw= 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=QMgybz9K; 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="QMgybz9K" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786654100; 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=QMgybz9Kl43AKOO2gY8G+FwSi9rPJUykwVlDAT0jojHd7wDQKHTsLNoDdbNNrR/iHkM5+m rUZ2AcBpNMGeXCOMjiH9SiO7JQttKtzE+1yPgfZGsoxCxcN2PU/6X7OXL8kp7kJuV+tdjw RkGLUjQJ1HvUFWK+IyZbFE6fhfJvMOw= 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-612-wY-yzp8GNIKQ57JF9QyVxw-1; Thu, 13 Aug 2026 16:48:17 -0400 X-MC-Unique: wY-yzp8GNIKQ57JF9QyVxw-1 X-Mimecast-MFC-AGG-ID: wY-yzp8GNIKQ57JF9QyVxw_1786654095 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 A746E19560A5; Thu, 13 Aug 2026 20:48:15 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.207]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EA746427; Thu, 13 Aug 2026 20:48:13 +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 RESEND v7 3/5] drm/nouveau: Fix drm_driver struct/nouveau.atomic parameter handling Date: Thu, 13 Aug 2026 16:46:49 -0400 Message-ID: <20260813204803.2097176-4-lyude@redhat.com> In-Reply-To: <20260813204803.2097176-1-lyude@redhat.com> References: <20260813204803.2097176-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.6 on 10.30.177.95 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 Reviewed-by: Dave Airlie --- 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 85A6B42F716 for ; Thu, 13 Aug 2026 20:48:24 +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=1786654106; cv=none; b=nJL43pwThHZf3NVt8bs/5L3GbgFsd96s3Ls4DZJw2iWVqtWuEUwq7OfXfMgZ+pmSsLHetEXYgkR68Tu72LCWonxIsuUy+Nf7dDHEYZzRiaxFcXMKnXAwJKO/SoT/igvaz8Cn+LKcXudE66THBanTyoNBw0oSj72pBHEVqy1WU8Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786654106; c=relaxed/simple; bh=JmfmJ+BVkA0Lvu6Ld1ANuTuq6fbGZCUsZkt8eqpkkmo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E7VvynpyXd86hvZxY54ZRytr/rosetfdYJ8ip5fncLnGcyQ3MKxXa7/MoHDcWQ42Iy3pHPFW8l0Xt+tn4duMuVT+uRTSSRsAs8+W2x5SJe9Go0Tm0+22bQ7yX3jHPqexSkboCIK1ri3L7pMxLflx3FV2FIFgeAHg/EBwWpt7VLY= 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=htXiFYbv; 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="htXiFYbv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786654102; 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=htXiFYbvfINbwCXzoHg+hLlIpxr/Njz+nhBFiRvkFwYcc2t4rjWwl7gdrKpvBMtJUpe1Pa bTHoMUxH2y5eNhLUDN/iYYoxQFWQI02n7a9h4r+WQ+0S4X854+RzsS/Zfx/AllrGOP43r5 tapNXxi0+rxXsJ/Dh1gP2HfsiK8Mz24= 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-659-EyatDvqVOm-8OVPrq4__Gg-1; Thu, 13 Aug 2026 16:48:19 -0400 X-MC-Unique: EyatDvqVOm-8OVPrq4__Gg-1 X-Mimecast-MFC-AGG-ID: EyatDvqVOm-8OVPrq4__Gg_1786654097 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 CB8211956040; Thu, 13 Aug 2026 20:48:17 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.207]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 597E4422; Thu, 13 Aug 2026 20:48:16 +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 RESEND v7 4/5] drm/nouveau/kms: Only allow enabling atomic modesetting on nv50+ Date: Thu, 13 Aug 2026 16:46:50 -0400 Message-ID: <20260813204803.2097176-5-lyude@redhat.com> In-Reply-To: <20260813204803.2097176-1-lyude@redhat.com> References: <20260813204803.2097176-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.6 on 10.30.177.95 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 Reviewed-by: Dave Airlie --- 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 5BBCB42EEBE for ; Thu, 13 Aug 2026 20:48:27 +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=1786654111; cv=none; b=aR2KRekwLEg5fQYvIf5uqXeYpwRZuvouxZ8gxiI2ytBhnawfIpzvFL4gH9NVP3rZXIgV0+Mz5NNJnfMq2PbhJ9+WC4/jRK0RFNFU5wP2uGXX+u60Ifxb/7TWTh3PaFItPNz+lXoXc2yOqWadzbX4k5kXna4gDsG5v5sG+9BowKw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786654111; c=relaxed/simple; bh=fVAqIJZajjmSjwwB9NIcPFSjCWXIwQhcW2C8p/ZJIwI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nuXotgqv88/0QNPjvE8Pzo+gNGrwceHoWG3CyIXjD3CgKZcylKdl3TDTlTbaa/t8BwKfezB4ZMz6eTd9aY/5RKSw9B8JTiF9TCERPwju6dl/KvWzZ3hyBelVMARKFomgSeRPsIGFg21NnPWUjBVGe49hb07a/frgpqEozLF30mU= 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=NZrm701G; 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="NZrm701G" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786654106; 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=NZrm701GFJTFKRzrrYzIAwT5+m/Lncoy3Lmqrpq28TWVqQxHOfulGDBWptl9zW+L4nd4fJ NfwutubMskTrnLHD3JqpjTaT/4qjsrQSwXDyPC9tRa5opOv8zW19NubvI3k7bXpbMXbCfN dczLWW1SVhS2v/NBPABAZcXlYQcM5rU= 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-125-YMIbWggxNi64jYhrMW-U9A-1; Thu, 13 Aug 2026 16:48:21 -0400 X-MC-Unique: YMIbWggxNi64jYhrMW-U9A-1 X-Mimecast-MFC-AGG-ID: YMIbWggxNi64jYhrMW-U9A_1786654099 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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 D19AF18002C4; Thu, 13 Aug 2026 20:48:19 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.207]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8065D427; Thu, 13 Aug 2026 20:48:18 +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 RESEND v7 5/5] drm/nouveau/kms/nv50-: Enable atomic modesetting by default Date: Thu, 13 Aug 2026 16:46:51 -0400 Message-ID: <20260813204803.2097176-6-lyude@redhat.com> In-Reply-To: <20260813204803.2097176-1-lyude@redhat.com> References: <20260813204803.2097176-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.6 on 10.30.177.95 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 ( Reviewed-by: Dave Airlie --- 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