From nobody Mon Feb 9 14:32:54 2026 Received: from mail-pl1-f226.google.com (mail-pl1-f226.google.com [209.85.214.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4C8731062C for ; Mon, 29 Dec 2025 21:59:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767045567; cv=none; b=Eq8NWo3J7n30qbrnpHnzQIMX3wXW3JlJAVZJ2jNvybPRzHDebZMzWtH1YoMVvsoB9m8dsNUBl99zNH5lCPXWgfuQKnsnFMJqDZCB4xvvBprhKqWd5+xvhBWi0qZAUHrJHHN7qRibIUR5Mm0xB6+A+kogHZOUr2EEwr6qpvzbDR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767045567; c=relaxed/simple; bh=iLspBHNkcA5kzZLcf6Qh14tl7aBhjrdKNsAysucsirM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jnhx8cCY8aAAey9q1CKL3H/EjNj7y09Vp8i6xR4N37krGI+io4EK1ON0m7ewjZ+8jJnKwhOt5XIEvsgnI2wLzM4egRM9KvKGKHSvwLDBe0tNYIcxTN8gUSqigefewGx2TaMd+cR/ADqQPCwo4gElcppO/NriJfYD4Z8Lz96V9yc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=VkpryAap; arc=none smtp.client-ip=209.85.214.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="VkpryAap" Received: by mail-pl1-f226.google.com with SMTP id d9443c01a7336-2a07f8dd9cdso98839995ad.1 for ; Mon, 29 Dec 2025 13:59:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767045565; x=1767650365; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VopAtg5cwECNDVQxgLsoKH79OtjRDL2VW4PpyQapOpE=; b=tommB9nc0ZqW9O0QMf/jF7RmWlw9K51w6Z/gkZR9ZUVMR9Uyf9gAQg+yYv18aOuE4M Fjfz0vGLYM96j4e7v7cKJu1Ylitgqwo4Q02sHXOBKUzdyZRjd/sqYaTCyeEBQMYvY7MQ zbwU38QjgOYZp9vXBG9PuA7hvQYfJ+TfxkC0REHFUgroLbTvNuk3tGTJpofJXC29vyh+ LAH25Y+IMjGEXWNVwGVaJtdGnlWr7s+lWZnInPSSV97Mqn5iPgpMBkfUHTzUnZYUNU5w mxq5aUmRDZAknMN92WjcTHliCH7u0gEzJQdYxfGMXtr1lDzgYbEUhOWz+TmZ/DrbzZ9A Y8ZA== X-Forwarded-Encrypted: i=1; AJvYcCU8UFsdvbGRui3rX4D7QuxTuPuCRHXc0uFjQ/BsMESFxDW2zK6ceMNqeajdE9hw2w0bnp2bQQ4d/HkLCT8=@vger.kernel.org X-Gm-Message-State: AOJu0YzBtK2ECzGkTpZrgl7yBJJs1oZ7fkJIY3YFx0jMIAT/Z1NeY67b adb+RpiM0Zo4oEhoHkXERPhizA5AyrHSESljzrfvC+hALltRyTqW1SAC85dR9Vksb1IoF9Rpznf prp7Q8b40RP/iJ16ehezwzLT1WFrT2dzOvVxKlhf+W23rMRYu7PZxDXJjIvx6aFy4fIwPiuLPVS jQZKWXqdjkmbfJdSAQnhWPGzD6Ey8eKwk8RvO17c55+2U/Cz3BwYxlbPiy+NN91+2gCzta2IUt5 0kAW7FIS6j4MQGf X-Gm-Gg: AY/fxX7oSRoJoJn9Be3MiQJwRPmwD8i6/I0v8rj9yfMe0DSqn/xM2Hpt27HM/nL4RaY NfCY3StE+rPCv7Q3pGkb1EIp+58314yzOdfDXRDPmO/HN46iVai9LCd4sITfxRmoW8M4wC0AyPD wM+u6Y7MY59+AalZwv39f8yxkqsOyCGNaXI5u97qAxAtJaRi47+W8Qro816VwKzpMGMIWeMajQw 6Zxu8eNYxFFCSfStnV+EzmjrzCygud47MkniR+agXz2YdDPqaRGZXJWVS7rWSBEuGPeJk/L2AzG lZUeYlX9tNo5ezc0U6lZxlgEjAg+Z1PyKJ73seiz308UnFZTyNX5kNnvE5wMZOMziT6Thdd1J6J RrtscOUv5xnG5UNx6+O8uckv9c+QSYqAvagjeE7FZ3hvKdmvLGq/q1B4wWRJVZzZGyMdJ0zs3SG DIZzuhXJWU/dPsU4boeyJR6M7sSqOYzJUU84YeK95GiM9G X-Google-Smtp-Source: AGHT+IFMoOKntbiZu9opisg0A6XQM25TilC2hO8tAZvXy+lgJPlIUIQg3DX786BGYhSDyb3J+gKVMW7tydEL X-Received: by 2002:a17:902:d488:b0:2a0:7f9e:518c with SMTP id d9443c01a7336-2a2f222aed1mr312345905ad.16.1767045564899; Mon, 29 Dec 2025 13:59:24 -0800 (PST) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-101.dlp.protect.broadcom.com. [144.49.247.101]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-2a2f3d1afc2sm34851225ad.42.2025.12.29.13.59.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Dec 2025 13:59:24 -0800 (PST) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-88a360b8096so245143396d6.0 for ; Mon, 29 Dec 2025 13:59:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1767045562; x=1767650362; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VopAtg5cwECNDVQxgLsoKH79OtjRDL2VW4PpyQapOpE=; b=VkpryAapz7jcWOceNo8wZdiZTByNDRwhHwt0E0drE05En2LzxDH0CVbgp+SUkQdQNs pD6Ua2Z8X6W4N0ukW6d0f9qq59QWjwB6pzdcI22WIFbThvk7qnTBSHPsXzv/H/aBWgJL D3ChCQh322OHbBV+CfvurOT4brjsdJ7bb7Hi8= X-Forwarded-Encrypted: i=1; AJvYcCXIwxl4DD4opWSo8HMSo0cKeEGdaktFkH/dIWh3Oy6EGIK15fDiLzpx++BO+95eXN46x+0tRRI/kEARvZA=@vger.kernel.org X-Received: by 2002:a05:6214:252a:b0:87c:2967:fd32 with SMTP id 6a1803df08f44-88d8281226bmr511303446d6.22.1767045561926; Mon, 29 Dec 2025 13:59:21 -0800 (PST) X-Received: by 2002:a05:6214:252a:b0:87c:2967:fd32 with SMTP id 6a1803df08f44-88d8281226bmr511303186d6.22.1767045561579; Mon, 29 Dec 2025 13:59:21 -0800 (PST) Received: from localhost.localdomain (pool-173-49-113-140.phlapa.fios.verizon.net. [173.49.113.140]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-88d9759f164sm231530026d6.24.2025.12.29.13.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Dec 2025 13:59:19 -0800 (PST) From: Zack Rusin To: dri-devel@lists.freedesktop.org Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lijo Lazar , Hawking Zhang , Mario Limonciello , Ce Sun , "Mario Limonciello (AMD)" , =?UTF-8?q?Timur=20Krist=C3=B3f?= , Vitaly Prosyak , amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/12] drm/amdgpu: Use devm aperture helpers for sysfb restore on probe failure Date: Mon, 29 Dec 2025 16:58:10 -0500 Message-ID: <20251229215906.3688205-5-zack.rusin@broadcom.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251229215906.3688205-1-zack.rusin@broadcom.com> References: <20251229215906.3688205-1-zack.rusin@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e Use devm_aperture_remove_conflicting_pci_devices() instead of the non-devm variant to automatically restore the system framebuffer (efifb/simpledrm) if the driver's probe fails after removing the firmware framebuffer. Call devm_aperture_remove_conflicting_pci_devices_done() after successful probe to cancel the automatic restore, as the driver is now responsible for display output. The aperture removal only applies to VGA and display class devices, matching the existing behavior. This ensures users don't lose display output if the amdgpu driver fails to probe after removing the firmware framebuffer. Signed-off-by: Zack Rusin Cc: Alex Deucher Cc: "Christian K=C3=B6nig" Cc: David Airlie Cc: Simona Vetter Cc: Lijo Lazar Cc: Hawking Zhang Cc: Mario Limonciello Cc: Ce Sun Cc: "Mario Limonciello (AMD)" Cc: "Timur Krist=C3=B3f" Cc: Vitaly Prosyak Cc: amd-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/a= md/amdgpu/amdgpu_device.c index 58c3ffe707d1..6c867657225e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -4737,8 +4737,13 @@ int amdgpu_device_init(struct amdgpu_device *adev, */ if ((pdev->class >> 8) =3D=3D PCI_CLASS_DISPLAY_VGA || (pdev->class >> 8) =3D=3D PCI_CLASS_DISPLAY_OTHER) { - /* Get rid of things like offb */ - r =3D aperture_remove_conflicting_pci_devices(adev->pdev, amdgpu_kms_dri= ver.name); + /* + * Get rid of things like offb. Use devm variant to + * automatically restore sysfb if probe fails. This ensures + * the user doesn't lose display if our probe fails after + * removing the firmware framebuffer (efifb/simpledrm). + */ + r =3D devm_aperture_remove_conflicting_pci_devices(adev->pdev, amdgpu_km= s_driver.name); if (r) return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_drv.c index 2dfbddcef9ab..fc2d2dbaebe8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -32,6 +32,7 @@ #include #include =20 +#include #include #include #include @@ -2528,6 +2529,12 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, amdgpu_get_secondary_funcs(adev); } =20 + /* + * Probe succeeded - cancel the automatic sysfb restore action. + * We're now responsible for display output. + */ + devm_aperture_remove_conflicting_pci_devices_done(pdev); + return 0; =20 err_pci: --=20 2.48.1