From patchwork Tue Sep 24 08:41:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13810506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71D9DCF9C6B for ; Tue, 24 Sep 2024 08:42:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EF60810E64D; Tue, 24 Sep 2024 08:42:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.b="fuWmuzzr"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="iG8F2L+6"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="m+SbjWVk"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="aprqwMmQ"; dkim-atps=neutral Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E8FB10E64D for ; Tue, 24 Sep 2024 08:42:34 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4B84721BBC; Tue, 24 Sep 2024 08:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1727167353; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jq1ZSekyMg3r/5R/q9kgdjIL9cU1H9bO/eAhO1BJS8k=; b=fuWmuzzreCquePvWvUOnjY20YwN2vpU5TGih956hmQ47qDrxYI3dOeNNKrfZ/Qicwv/6bj ZqjzUT71vJWRv30qQBQWRA/Mro5QnxLJO1bd9IKecaYM3iL4JQG0AR0HaDrKron+Ct/znn ti6oFMON1iHT2GffxqiTqDX+2QNFPeY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1727167353; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jq1ZSekyMg3r/5R/q9kgdjIL9cU1H9bO/eAhO1BJS8k=; b=iG8F2L+6NbVIUufp5mX/uu34tnqOtRz4T5wQBwXsAb2r1zjve2LrEX/gINs0hJFdT5VE7K tCIC1CoNqIaRiPBQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1727167352; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jq1ZSekyMg3r/5R/q9kgdjIL9cU1H9bO/eAhO1BJS8k=; b=m+SbjWVkqiBzyHYwxl/Qo+oKaokaTs0PtmFcNQQXBpLlCDvxL9ug3imMTMUx0GryVOraqM TMqDpZp5a+qA5BzzcX5qGkf6+yuFXp1oXvtahq48+8KWDr6jFWQzzmqCTZ3gc6pMdTn0Ln 0fNnp9/D68mO7xyYj/9kQpNpQgQarGw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1727167352; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jq1ZSekyMg3r/5R/q9kgdjIL9cU1H9bO/eAhO1BJS8k=; b=aprqwMmQ2vlCX5GNE3eM1+8XRuRUae9dVSxWzCVJQxA/tFqXI/0XbhLf8Rqokw5ThQIUby vz5DFo2jHhahFbDQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 055F01386E; Tue, 24 Sep 2024 08:42:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id nAgmO3d78mYsewAAD6G6ig (envelope-from ); Tue, 24 Sep 2024 08:42:31 +0000 From: Thomas Zimmermann To: javierm@redhat.com, alexander.deucher@amd.com, chaitanya.kumar.borah@intel.com Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann , Helge Deller , Sam Ravnborg , Daniel Vetter , "Linux regression tracking (Thorsten Leemhuis)" , stable@vger.kernel.org Subject: [PATCH] firmware/sysfb: Disable sysfb for firmware buffers with unknown parent Date: Tue, 24 Sep 2024 10:41:03 +0200 Message-ID: <20240924084227.262271-1-tzimmermann@suse.de> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[lists.freedesktop.org,suse.de,gmx.de,ravnborg.org,ffwll.ch,leemhuis.info,vger.kernel.org]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,intel.com:email,imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_SEVEN(0.00)[10]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmx.de] X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The sysfb framebuffer handling only operates on graphics devices that provide the system's firmware framebuffer. If that device is not known, assume that any graphics device has been initialized by firmware. Fixes a problem on i915 where sysfb does not release the firmware framebuffer after the native graphics driver loaded. Reported-by: Borah, Chaitanya Kumar Closes: https://lore.kernel.org/dri-devel/SJ1PR11MB6129EFB8CE63D1EF6D932F94B96F2@SJ1PR11MB6129.namprd11.prod.outlook.com/ Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12160 Signed-off-by: Thomas Zimmermann Fixes: b49420d6a1ae ("video/aperture: optionally match the device in sysfb_disable()") Cc: Javier Martinez Canillas Cc: Thomas Zimmermann Cc: Helge Deller Cc: Sam Ravnborg Cc: Daniel Vetter Cc: Alex Deucher Cc: dri-devel@lists.freedesktop.org Cc: Linux regression tracking (Thorsten Leemhuis) Cc: # v6.11+ Acked-by: Alex Deucher Reviewed-by: Javier Martinez Canillas --- drivers/firmware/sysfb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index 02a07d3d0d40..a3df782fa687 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -67,9 +67,11 @@ static bool sysfb_unregister(void) void sysfb_disable(struct device *dev) { struct screen_info *si = &screen_info; + struct device *parent; mutex_lock(&disable_lock); - if (!dev || dev == sysfb_parent_dev(si)) { + parent = sysfb_parent_dev(si); + if (!dev || !parent || dev == parent) { sysfb_unregister(); disabled = true; }