From patchwork Fri Feb 2 11:58:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13542831 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 AD3BC1353E6 for ; Fri, 2 Feb 2024 12:01:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706875308; cv=none; b=d7Tymp2GYMbe/vHDN06fH7JxHnH7S06RNqsN/AsoVcNOVvhwtvQDSPchoCl+vmrYUwpOFVXSmF7zyCTY4yrvhekaqwspGqwbW5q1BIxK8rdDlYsLp8oEDPpAR7Lzqcwl/6NSRghoNxZyL6zVIzT33OefG1Gtt0xbvjAvCgpgeSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706875308; c=relaxed/simple; bh=T/aeB4SvRrOwhX6zYPTwe6zaMD3LgVZ7lhPzPEP2uhg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CpWJdlJ3q1tg3px5vyh7CFS3mjFfghZpROtrZu8eqx23y1dFaWbQTD3zG8OJyZeoPK9oZtSrORDnOBvIR8q+I+CuOHuHj1qE2/Nra2WDw937nJg9pmZqA8k87Ew2pgnB/NN09hXPrDNsiHDMED/gmcjQYBYjTNqGISiJRLaA0mc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=TQ03WnXU; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=2ih1/Kfs; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=TQ03WnXU; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=2ih1/Kfs; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="TQ03WnXU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2ih1/Kfs"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="TQ03WnXU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2ih1/Kfs" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [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 DD76F22351; Fri, 2 Feb 2024 12:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706875304; 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: in-reply-to:in-reply-to:references:references; bh=SlS3LslkGOQqrEAT9+oH47d4ooopvBfWXeWImr+dmF0=; b=TQ03WnXUmAtJy935Y8mMtIH8xMUc7l2t/snMI3ZRjdg73g7w5LyvBD4LGDnvvm9vllqPp1 xXviJOYNyQFNUZFaGWff+MWBbdcGKvHbsrXpkz1Z9N+PfWU1f8zP/eaNqZgbeh+oFg2FIo wb9hwVQxQrI0tMagKJXeBH2Q2vWZDpg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706875304; 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: in-reply-to:in-reply-to:references:references; bh=SlS3LslkGOQqrEAT9+oH47d4ooopvBfWXeWImr+dmF0=; b=2ih1/KfsjJrIZ7SjrWDIPV8d7xmK/zN1RjhwaCCzQ6KIBvsCWccPZbNrjHm+qaFNwQUBMi rEc6Yu6fR7hE91Aw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706875304; 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: in-reply-to:in-reply-to:references:references; bh=SlS3LslkGOQqrEAT9+oH47d4ooopvBfWXeWImr+dmF0=; b=TQ03WnXUmAtJy935Y8mMtIH8xMUc7l2t/snMI3ZRjdg73g7w5LyvBD4LGDnvvm9vllqPp1 xXviJOYNyQFNUZFaGWff+MWBbdcGKvHbsrXpkz1Z9N+PfWU1f8zP/eaNqZgbeh+oFg2FIo wb9hwVQxQrI0tMagKJXeBH2Q2vWZDpg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706875304; 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: in-reply-to:in-reply-to:references:references; bh=SlS3LslkGOQqrEAT9+oH47d4ooopvBfWXeWImr+dmF0=; b=2ih1/KfsjJrIZ7SjrWDIPV8d7xmK/zN1RjhwaCCzQ6KIBvsCWccPZbNrjHm+qaFNwQUBMi rEc6Yu6fR7hE91Aw== 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 ACE3313A58; Fri, 2 Feb 2024 12:01:44 +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 8HrpKKjZvGWfeAAAD6G6ig (envelope-from ); Fri, 02 Feb 2024 12:01:44 +0000 From: Thomas Zimmermann To: javierm@redhat.com, pjones@redhat.com, deller@gmx.de, ardb@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann Subject: [PATCH v2 8/8] fbdev/efifb: Remove framebuffer relocation tracking Date: Fri, 2 Feb 2024 12:58:49 +0100 Message-ID: <20240202120140.3517-9-tzimmermann@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240202120140.3517-1-tzimmermann@suse.de> References: <20240202120140.3517-1-tzimmermann@suse.de> Precedence: bulk X-Mailing-List: linux-fbdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [4.90 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmx.de]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[7]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FREEMAIL_TO(0.00)[redhat.com,gmx.de,kernel.org]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: **** X-Spam-Score: 4.90 X-Spam-Flag: NO If the firmware framebuffer has been reloacted, the sysfb code fixes the screen_info state before it creates the framebuffer's platform device. Efifb will automatically receive a screen_info with updated values. Hence remove the tracking from efifb. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas Acked-by: Sui Jingfeng --- drivers/video/fbdev/efifb.c | 76 +------------------------------------ 1 file changed, 1 insertion(+), 75 deletions(-) diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index f76b7ae007518..8dd82afb3452b 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -47,8 +46,6 @@ static bool use_bgrt = true; static bool request_mem_succeeded = false; static u64 mem_flags = EFI_MEMORY_WC | EFI_MEMORY_UC; -static struct pci_dev *efifb_pci_dev; /* dev with BAR covering the efifb */ - struct efifb_par { u32 pseudo_palette[16]; resource_size_t base; @@ -348,9 +345,6 @@ static struct attribute *efifb_attrs[] = { }; ATTRIBUTE_GROUPS(efifb); -static struct resource *bar_resource; -static u64 bar_offset; - static int efifb_probe(struct platform_device *dev) { struct screen_info *si; @@ -411,21 +405,7 @@ static int efifb_probe(struct platform_device *dev) si->rsvd_pos = 24; } - efifb_fix.smem_start = si->lfb_base; - - if (si->capabilities & VIDEO_CAPABILITY_64BIT_BASE) { - u64 ext_lfb_base; - - ext_lfb_base = (u64)(unsigned long)si->ext_lfb_base << 32; - efifb_fix.smem_start |= ext_lfb_base; - } - - if (bar_resource && - bar_resource->start + bar_offset != efifb_fix.smem_start) { - dev_info(&efifb_pci_dev->dev, - "BAR has moved, updating efifb address\n"); - efifb_fix.smem_start = bar_resource->start + bar_offset; - } + efifb_fix.smem_start = __screen_info_lfb_base(si); efifb_defined.bits_per_pixel = si->lfb_depth; efifb_defined.xres = si->lfb_width; @@ -640,57 +620,3 @@ static struct platform_driver efifb_driver = { }; builtin_platform_driver(efifb_driver); - -#if defined(CONFIG_PCI) - -static void record_efifb_bar_resource(struct pci_dev *dev, int idx, u64 offset) -{ - u16 word; - - efifb_pci_dev = dev; - - pci_read_config_word(dev, PCI_COMMAND, &word); - if (!(word & PCI_COMMAND_MEMORY)) { - dev_err(&dev->dev, - "BAR %d: assigned to efifb but device is disabled!\n", - idx); - return; - } - - bar_resource = &dev->resource[idx]; - bar_offset = offset; - - dev_info(&dev->dev, "BAR %d: assigned to efifb\n", idx); -} - -static void efifb_fixup_resources(struct pci_dev *dev) -{ - u64 base = screen_info.lfb_base; - u64 size = screen_info.lfb_size; - int i; - - if (efifb_pci_dev || screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) - return; - - if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE) - base |= (u64)screen_info.ext_lfb_base << 32; - - if (!base) - return; - - for (i = 0; i < PCI_STD_NUM_BARS; i++) { - struct resource *res = &dev->resource[i]; - - if (!(res->flags & IORESOURCE_MEM)) - continue; - - if (res->start <= base && res->end >= base + size - 1) { - record_efifb_bar_resource(dev, i, base - res->start); - break; - } - } -} -DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY, - 16, efifb_fixup_resources); - -#endif