From patchwork Thu Jul 7 15:39:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 589280 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14B0BCCA479 for ; Thu, 7 Jul 2022 15:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235264AbiGGPkB (ORCPT ); Thu, 7 Jul 2022 11:40:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231320AbiGGPkB (ORCPT ); Thu, 7 Jul 2022 11:40:01 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 204042C673 for ; Thu, 7 Jul 2022 08:40:00 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C59852216C; Thu, 7 Jul 2022 15:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657208398; 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=J8uZh/mb0lXvuuZKPB/mOmCHtRcAzVf536X0Ud6AFPQ=; b=e7n7I9vH7kEhMJUdF0RGtIU8fIgjbVRsaSIn5Jkuaq06Wk0B+ALgKS/M18qWXqAgtjShM+ 41iixvwVdJiMUe+BJqGeLrTqxKC8hWWqsOYq2NYCSqpSle13ibpMPo1u0afJ+SJKkcoWbK 4KzzYSk+xiMFBYiUL2DIffHcx608Bk0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657208398; 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=J8uZh/mb0lXvuuZKPB/mOmCHtRcAzVf536X0Ud6AFPQ=; b=y5DUq/My++X0Oi4JAC/PW3eTIykpm0Z9CqfTRXUiLNGrkEvkvnY+1SW8HtoJpWBsHTyoum 9pYFBfOQZLgK3/AA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8924E13B4E; Thu, 7 Jul 2022 15:39:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eAaJIE7+xmI9UQAAMHmgww (envelope-from ); Thu, 07 Jul 2022 15:39:58 +0000 From: Thomas Zimmermann To: javierm@redhat.com, deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, maxime@cerno.tech Cc: linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, dri-devel@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH 02/11] fbdev/vga16fb: Create EGA/VGA devices in sysfb code Date: Thu, 7 Jul 2022 17:39:43 +0200 Message-Id: <20220707153952.32264-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220707153952.32264-1-tzimmermann@suse.de> References: <20220707153952.32264-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Move the device-creation from vga16fb to sysfb code. Move the few extra videomode checks into vga16fb's probe function. The vga16fb driver requires a screen_info for type VIDEO_TYPE_VGAC or VIDEO_TYPE_EGAC. Such code is nowhere present in the kernel, except for some MIPS systems. It's not clear if the vga16fb driver actually works in practice. Signed-off-by: Thomas Zimmermann --- drivers/firmware/sysfb.c | 4 +++ drivers/video/fbdev/vga16fb.c | 59 +++++++++++++++++------------------ 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index 1f276f108cc9..3fd3563d962b 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -94,6 +94,10 @@ static __init int sysfb_init(void) name = "efi-framebuffer"; else if (si->orig_video_isVGA == VIDEO_TYPE_VLFB) name = "vesa-framebuffer"; + else if (si->orig_video_isVGA == VIDEO_TYPE_VGAC) + name = "vga-framebuffer"; + else if (si->orig_video_isVGA == VIDEO_TYPE_EGAC) + name = "ega-framebuffer"; else name = "platform-framebuffer"; diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c index faf76972114d..f7c1bb018843 100644 --- a/drivers/video/fbdev/vga16fb.c +++ b/drivers/video/fbdev/vga16fb.c @@ -185,19 +185,19 @@ static inline void setindex(int index) } /* Check if the video mode is supported by the driver */ -static inline int check_mode_supported(void) +static inline int check_mode_supported(const struct screen_info *si) { /* non-x86 architectures treat orig_video_isVGA as a boolean flag */ #if defined(CONFIG_X86) /* only EGA and VGA in 16 color graphic mode are supported */ - if (screen_info.orig_video_isVGA != VIDEO_TYPE_EGAC && - screen_info.orig_video_isVGA != VIDEO_TYPE_VGAC) + if (si->orig_video_isVGA != VIDEO_TYPE_EGAC && + si->orig_video_isVGA != VIDEO_TYPE_VGAC) return -ENODEV; - if (screen_info.orig_video_mode != 0x0D && /* 320x200/4 (EGA) */ - screen_info.orig_video_mode != 0x0E && /* 640x200/4 (EGA) */ - screen_info.orig_video_mode != 0x10 && /* 640x350/4 (EGA) */ - screen_info.orig_video_mode != 0x12) /* 640x480/4 (VGA) */ + if (si->orig_video_mode != 0x0D && /* 320x200/4 (EGA) */ + si->orig_video_mode != 0x0E && /* 640x200/4 (EGA) */ + si->orig_video_mode != 0x10 && /* 640x350/4 (EGA) */ + si->orig_video_mode != 0x12) /* 640x480/4 (VGA) */ return -ENODEV; #endif return 0; @@ -1321,11 +1321,20 @@ static int __init vga16fb_setup(char *options) static int vga16fb_probe(struct platform_device *dev) { + struct screen_info *si; struct fb_info *info; struct vga16fb_par *par; int i; int ret = 0; + si = dev_get_platdata(&dev->dev); + if (!si) + return -ENODEV; + + ret = check_mode_supported(si); + if (ret) + return ret; + printk(KERN_DEBUG "vga16fb: initializing\n"); info = framebuffer_alloc(sizeof(struct vga16fb_par), &dev->dev); @@ -1352,10 +1361,10 @@ static int vga16fb_probe(struct platform_device *dev) par = info->par; #if defined(CONFIG_X86) - par->isVGA = screen_info.orig_video_isVGA == VIDEO_TYPE_VGAC; + par->isVGA = si->orig_video_isVGA == VIDEO_TYPE_VGAC; #else /* non-x86 architectures treat orig_video_isVGA as a boolean flag */ - par->isVGA = screen_info.orig_video_isVGA; + par->isVGA = si->orig_video_isVGA; #endif par->palette_blanked = 0; par->vesa_blanked = 0; @@ -1425,16 +1434,21 @@ static int vga16fb_remove(struct platform_device *dev) return 0; } +static const struct platform_device_id vga16fb_driver_id_table[] = { + {"ega-framebuffer", 0}, + {"vga-framebuffer", 0}, + { } +}; + static struct platform_driver vga16fb_driver = { .probe = vga16fb_probe, .remove = vga16fb_remove, .driver = { - .name = "vga16fb", + .name = "vga-framebuffer", }, + .id_table = vga16fb_driver_id_table, }; -static struct platform_device *vga16fb_device; - static int __init vga16fb_init(void) { int ret; @@ -1447,32 +1461,15 @@ static int __init vga16fb_init(void) vga16fb_setup(option); #endif - ret = check_mode_supported(); + ret = platform_driver_register(&vga16fb_driver); if (ret) return ret; - ret = platform_driver_register(&vga16fb_driver); - - if (!ret) { - vga16fb_device = platform_device_alloc("vga16fb", 0); - - if (vga16fb_device) - ret = platform_device_add(vga16fb_device); - else - ret = -ENOMEM; - - if (ret) { - platform_device_put(vga16fb_device); - platform_driver_unregister(&vga16fb_driver); - } - } - - return ret; + return 0; } static void __exit vga16fb_exit(void) { - platform_device_unregister(vga16fb_device); platform_driver_unregister(&vga16fb_driver); } From patchwork Thu Jul 7 15:39:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 589279 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA982CCA47F for ; Thu, 7 Jul 2022 15:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235202AbiGGPkC (ORCPT ); Thu, 7 Jul 2022 11:40:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbiGGPkB (ORCPT ); Thu, 7 Jul 2022 11:40:01 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52FCB2CCBF for ; Thu, 7 Jul 2022 08:40:00 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id ECA6822174; Thu, 7 Jul 2022 15:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657208398; 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=SuKPmf5uVn0ang87bL1p9igKcmpSelj6HtQl75lgOic=; b=SfQxXCLKjgtvjg+zEtlWRH8/KVF2A2Hps7+xniscEVYkP5g4NmpKOXRxyBN3U0uA/uaPIu jcoDKlpN7ANxHTGrB2aAAua/fs9Dm6tjE24QPeDHH60y/pJtfzvayw9ZazIf5k6bsp8yB1 i6ziG9e+cx2HAGsxaH6gVVIzrhEvjp8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657208398; 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=SuKPmf5uVn0ang87bL1p9igKcmpSelj6HtQl75lgOic=; b=Tqe011xR3issK0a7FZWCIfV/WclJKTiGHPujqnwmpM3xBj4oQlVXY5ewEvNF8UY+/u0Y2Q zlFoAEVUXfVmylCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BDBCC13A33; Thu, 7 Jul 2022 15:39:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qE9sLU7+xmI9UQAAMHmgww (envelope-from ); Thu, 07 Jul 2022 15:39:58 +0000 From: Thomas Zimmermann To: javierm@redhat.com, deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, maxime@cerno.tech Cc: linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, dri-devel@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH 03/11] fbdev/vga16fb: Auto-generate module init/exit code Date: Thu, 7 Jul 2022 17:39:44 +0200 Message-Id: <20220707153952.32264-4-tzimmermann@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220707153952.32264-1-tzimmermann@suse.de> References: <20220707153952.32264-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Move vgag16fb's option parsing into the driver's probe function and generate the rest of the module's init/exit functions from macros. Keep the options code, although there are no options defined. Signed-off-by: Thomas Zimmermann --- drivers/video/fbdev/vga16fb.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c index f7c1bb018843..e7767ed50c5b 100644 --- a/drivers/video/fbdev/vga16fb.c +++ b/drivers/video/fbdev/vga16fb.c @@ -1321,12 +1321,21 @@ static int __init vga16fb_setup(char *options) static int vga16fb_probe(struct platform_device *dev) { +#ifndef MODULE + char *option = NULL; +#endif struct screen_info *si; struct fb_info *info; struct vga16fb_par *par; int i; int ret = 0; +#ifndef MODULE + if (fb_get_options("vga16fb", &option)) + return -ENODEV; + vga16fb_setup(option); +#endif + si = dev_get_platdata(&dev->dev); if (!si) return -ENODEV; @@ -1449,31 +1458,7 @@ static struct platform_driver vga16fb_driver = { .id_table = vga16fb_driver_id_table, }; -static int __init vga16fb_init(void) -{ - int ret; -#ifndef MODULE - char *option = NULL; - - if (fb_get_options("vga16fb", &option)) - return -ENODEV; - - vga16fb_setup(option); -#endif - - ret = platform_driver_register(&vga16fb_driver); - if (ret) - return ret; - - return 0; -} - -static void __exit vga16fb_exit(void) -{ - platform_driver_unregister(&vga16fb_driver); -} +module_platform_driver(vga16fb_driver); MODULE_DESCRIPTION("Legacy VGA framebuffer device driver"); MODULE_LICENSE("GPL"); -module_init(vga16fb_init); -module_exit(vga16fb_exit); From patchwork Thu Jul 7 15:39:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 588331 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66B7BC433EF for ; Thu, 7 Jul 2022 15:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231320AbiGGPkC (ORCPT ); Thu, 7 Jul 2022 11:40:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235202AbiGGPkB (ORCPT ); Thu, 7 Jul 2022 11:40:01 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 901082CDC8 for ; Thu, 7 Jul 2022 08:40:00 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3093B1FE63; Thu, 7 Jul 2022 15:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657208399; 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=lF9a02oUlFzrrOo5gyMhGnhLeg9CuZy/YxicIfRKwl4=; b=joOnQDXCl+KbKC1sFIJcHKXxuEBjkDT3R/h6zSRm04R3k0k+ED662VUX8iZ4KrzEU8di6g 6nD26GmkdiQiewCuVdvpKtL3gxKfNRC8cXJaUrX8s4AcdVJgkchWdFWKAzYUjrrjMSoM5h U+ST+B7U8AtgM1+jVQvj1YtD9A6njVg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657208399; 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=lF9a02oUlFzrrOo5gyMhGnhLeg9CuZy/YxicIfRKwl4=; b=bzFgz22rL0pfT6r+zmlwzJcdN2QXc3guOQyztpoSC9205UNBsbLYM6s6GDHJ0N64Zl98dw uImxwMt8Tft/DEBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F09B113B4E; Thu, 7 Jul 2022 15:39:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YOfdOU7+xmI9UQAAMHmgww (envelope-from ); Thu, 07 Jul 2022 15:39:58 +0000 From: Thomas Zimmermann To: javierm@redhat.com, deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, maxime@cerno.tech Cc: linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, dri-devel@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH 04/11] fbdev/core: Remove remove_conflicting_pci_framebuffers() Date: Thu, 7 Jul 2022 17:39:45 +0200 Message-Id: <20220707153952.32264-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220707153952.32264-1-tzimmermann@suse.de> References: <20220707153952.32264-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Remove remove_conflicting_pci_framebuffers() and implement similar functionality in aperture_remove_conflicting_pci_device(), which was the only caller. Removes an otherwise unused interface and streamlines the aperture helper. No functional changes. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/aperture.c | 30 ++++++++++++-------- drivers/video/fbdev/core/fbmem.c | 48 -------------------------------- include/linux/fb.h | 2 -- 3 files changed, 18 insertions(+), 62 deletions(-) diff --git a/drivers/video/aperture.c b/drivers/video/aperture.c index 538f2d40acda..f42a0d8bc211 100644 --- a/drivers/video/aperture.c +++ b/drivers/video/aperture.c @@ -321,30 +321,36 @@ EXPORT_SYMBOL(aperture_remove_conflicting_devices); */ int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name) { + bool primary = false; resource_size_t base, size; int bar, ret; - /* - * WARNING: Apparently we must kick fbdev drivers before vgacon, - * otherwise the vga fbdev driver falls over. - */ -#if IS_REACHABLE(CONFIG_FB) - ret = remove_conflicting_pci_framebuffers(pdev, name); - if (ret) - return ret; +#ifdef CONFIG_X86 + primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; #endif - ret = vga_remove_vgacon(pdev); - if (ret) - return ret; for (bar = 0; bar < PCI_STD_NUM_BARS; ++bar) { if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) continue; + base = pci_resource_start(pdev, bar); size = pci_resource_len(pdev, bar); - aperture_detach_devices(base, size); + ret = aperture_remove_conflicting_devices(base, size, primary, name); + if (ret) + break; } + if (ret) + return ret; + + /* + * WARNING: Apparently we must kick fbdev drivers before vgacon, + * otherwise the vga fbdev driver falls over. + */ + ret = vga_remove_vgacon(pdev); + if (ret) + return ret; + return 0; } diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index c4a18322dee9..877de85309f3 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1787,54 +1787,6 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, } EXPORT_SYMBOL(remove_conflicting_framebuffers); -/** - * remove_conflicting_pci_framebuffers - remove firmware-configured framebuffers for PCI devices - * @pdev: PCI device - * @name: requesting driver name - * - * This function removes framebuffer devices (eg. initialized by firmware) - * using memory range configured for any of @pdev's memory bars. - * - * The function assumes that PCI device with shadowed ROM drives a primary - * display and so kicks out vga16fb. - */ -int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, const char *name) -{ - struct apertures_struct *ap; - bool primary = false; - int err, idx, bar; - - for (idx = 0, bar = 0; bar < PCI_STD_NUM_BARS; bar++) { - if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) - continue; - idx++; - } - - ap = alloc_apertures(idx); - if (!ap) - return -ENOMEM; - - for (idx = 0, bar = 0; bar < PCI_STD_NUM_BARS; bar++) { - if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) - continue; - ap->ranges[idx].base = pci_resource_start(pdev, bar); - ap->ranges[idx].size = pci_resource_len(pdev, bar); - pci_dbg(pdev, "%s: bar %d: 0x%lx -> 0x%lx\n", __func__, bar, - (unsigned long)pci_resource_start(pdev, bar), - (unsigned long)pci_resource_end(pdev, bar)); - idx++; - } - -#ifdef CONFIG_X86 - primary = pdev->resource[PCI_ROM_RESOURCE].flags & - IORESOURCE_ROM_SHADOW; -#endif - err = remove_conflicting_framebuffers(ap, name, primary); - kfree(ap); - return err; -} -EXPORT_SYMBOL(remove_conflicting_pci_framebuffers); - /** * register_framebuffer - registers a frame buffer device * @fb_info: frame buffer info structure diff --git a/include/linux/fb.h b/include/linux/fb.h index 07fcd0e56682..b91c77016560 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -615,8 +615,6 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, /* drivers/video/fbmem.c */ extern int register_framebuffer(struct fb_info *fb_info); extern void unregister_framebuffer(struct fb_info *fb_info); -extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, - const char *name); extern int remove_conflicting_framebuffers(struct apertures_struct *a, const char *name, bool primary); extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); From patchwork Thu Jul 7 15:39:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 588332 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54976CCA483 for ; Thu, 7 Jul 2022 15:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235474AbiGGPkC (ORCPT ); Thu, 7 Jul 2022 11:40:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235304AbiGGPkC (ORCPT ); Thu, 7 Jul 2022 11:40:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCDCA2CDE6 for ; Thu, 7 Jul 2022 08:40:00 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 63EA01FE74; Thu, 7 Jul 2022 15:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657208399; 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=JLZSjD9KJpu7/jrbo2ieGliOMjlns4+usNCsA+ouyXY=; b=MSLUB6HmZ5SUgQsaqAtnrace+tiSG6OWsYXgL0TCDAPbEsrbTfIr2YALHDSGZ8fA35U0v+ QpvypxYuH7b5LUe1TiQU0Fbu28zeQNBR9Z2xLDh+ibKPkQd62yzEDE9YtvDgknDDcFKQwF Se8bOTrhgEJC5IDkl8pB/MUHJxXZSYk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657208399; 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=JLZSjD9KJpu7/jrbo2ieGliOMjlns4+usNCsA+ouyXY=; b=Fmo8XrVRzBLbfFhcWB+r6bkOlVK51/wqJM7bMObLfxs70eCxlsg1bd1aV/yloxcT315rTt JkeHieEr9W+2RyBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 33EF213A33; Thu, 7 Jul 2022 15:39:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SNC9C0/+xmI9UQAAMHmgww (envelope-from ); Thu, 07 Jul 2022 15:39:59 +0000 From: Thomas Zimmermann To: javierm@redhat.com, deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, maxime@cerno.tech Cc: linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, dri-devel@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH 05/11] fbdev: Convert drivers to aperture helpers Date: Thu, 7 Jul 2022 17:39:46 +0200 Message-Id: <20220707153952.32264-6-tzimmermann@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220707153952.32264-1-tzimmermann@suse.de> References: <20220707153952.32264-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Convert fbdev drivers from fbdev's remove_conflicting_framebuffers() to the framework-independent aperture_remove_conflicting_devices(). Calling this function will also remove conflicting DRM drivers. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/staging/sm750fb/sm750.c | 15 +++++---------- drivers/video/fbdev/aty/radeon_base.c | 17 ++++------------- drivers/video/fbdev/hyperv_fb.c | 6 ++++-- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index dbd1159a2ef0..ce04c38f6afd 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 +#include #include #include #include @@ -987,22 +988,16 @@ static int sm750fb_framebuffer_alloc(struct sm750_dev *sm750_dev, int fbidx) static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev) { - struct apertures_struct *ap; + resource_size_t base = pci_resource_start(pdev, 0); + resource_size_t size = pci_resource_len(pdev, 0); bool primary = false; - ap = alloc_apertures(1); - if (!ap) - return -ENOMEM; - - ap->ranges[0].base = pci_resource_start(pdev, 0); - ap->ranges[0].size = pci_resource_len(pdev, 0); #ifdef CONFIG_X86 primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; #endif - remove_conflicting_framebuffers(ap, "sm750_fb1", primary); - kfree(ap); - return 0; + + return aperture_remove_conflicting_devices(base, size, primary, "sm750_fb1"); } static int lynxfb_pci_probe(struct pci_dev *pdev, diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c index b311c07fe66d..e5e362b8c9da 100644 --- a/drivers/video/fbdev/aty/radeon_base.c +++ b/drivers/video/fbdev/aty/radeon_base.c @@ -54,6 +54,7 @@ #include "radeonfb.h" +#include #include #include #include @@ -2239,20 +2240,10 @@ static const struct bin_attribute edid2_attr = { static int radeon_kick_out_firmware_fb(struct pci_dev *pdev) { - struct apertures_struct *ap; + resource_size_t base = pci_resource_start(pdev, 0); + resource_size_t size = pci_resource_len(pdev, 0); - ap = alloc_apertures(1); - if (!ap) - return -ENOMEM; - - ap->ranges[0].base = pci_resource_start(pdev, 0); - ap->ranges[0].size = pci_resource_len(pdev, 0); - - remove_conflicting_framebuffers(ap, KBUILD_MODNAME, false); - - kfree(ap); - - return 0; + return aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME, false); } static int radeonfb_pci_register(struct pci_dev *pdev, diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index 886c564787f1..a944a6620527 100644 --- a/drivers/video/fbdev/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c @@ -45,6 +45,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -1074,8 +1075,9 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) info->screen_size = dio_fb_size; getmem_done: - remove_conflicting_framebuffers(info->apertures, - KBUILD_MODNAME, false); + aperture_remove_conflicting_devices(info->apertures->ranges[0].base, + info->apertures->ranges[0].size, + KBUILD_MODNAME, false); if (gen2vm) { /* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */ From patchwork Thu Jul 7 15:39:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 589276 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1C2FCCA479 for ; Thu, 7 Jul 2022 15:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235632AbiGGPkE (ORCPT ); Thu, 7 Jul 2022 11:40:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235304AbiGGPkD (ORCPT ); Thu, 7 Jul 2022 11:40:03 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E91532DABE for ; Thu, 7 Jul 2022 08:40:00 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9B6861FF3B; Thu, 7 Jul 2022 15:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657208399; 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=SsNU5ZT8YAEfVU3CGunrfCSQh+rYIufk6s0ZucPuscE=; b=tgFOz17UXq5RbXtRaav/XAe0nP3QSQtqZO0FaCGIgJubOTxas7oHnw4tVhz7VK29qZlARP DrTjAMoiYhuTBwJF/SF0EPPcdYNs982IRfqTGXtg1RQgGuGSGs+6zGemoz3Eq7az1xr38y 7sYaa864SVqE8KvvpbxBTqn4zs9PUv4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657208399; 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=SsNU5ZT8YAEfVU3CGunrfCSQh+rYIufk6s0ZucPuscE=; b=eQSin4DurarZuoLBhGITOfaz99wdsAKGqj1ct9AeoIMWGW63aI3GI/XxjR7q/+ToYiKzXu iN4dXl3U7O5ALJDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 678DB13B4E; Thu, 7 Jul 2022 15:39:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cHFbGE/+xmI9UQAAMHmgww (envelope-from ); Thu, 07 Jul 2022 15:39:59 +0000 From: Thomas Zimmermann To: javierm@redhat.com, deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, maxime@cerno.tech Cc: linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, dri-devel@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH 06/11] fbdev: Remove conflicting devices on PCI bus Date: Thu, 7 Jul 2022 17:39:47 +0200 Message-Id: <20220707153952.32264-7-tzimmermann@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220707153952.32264-1-tzimmermann@suse.de> References: <20220707153952.32264-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Remove firmware devices on the PCI bus, by calling aperture_remove_conflicting_pci_devices() in the probe function of each related fbdev driver. iSo far, most of these drivers did not remove conflicting VESA or EFI devices, or outride failed for resource conflicts (i.e., matroxfb.) This must have been broken for quite some time. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/arkfb.c | 5 +++++ drivers/video/fbdev/asiliantfb.c | 5 +++++ drivers/video/fbdev/aty/aty128fb.c | 5 +++++ drivers/video/fbdev/aty/atyfb_base.c | 7 ++++++- drivers/video/fbdev/carminefb.c | 5 +++++ drivers/video/fbdev/chipsfb.c | 7 ++++++- drivers/video/fbdev/cirrusfb.c | 5 +++++ drivers/video/fbdev/cyber2000fb.c | 5 +++++ drivers/video/fbdev/geode/gx1fb_core.c | 5 +++++ drivers/video/fbdev/geode/gxfb_core.c | 5 +++++ drivers/video/fbdev/geode/lxfb_core.c | 5 +++++ drivers/video/fbdev/gxt4500.c | 5 +++++ drivers/video/fbdev/i740fb.c | 5 +++++ drivers/video/fbdev/i810/i810_main.c | 5 +++++ drivers/video/fbdev/imsttfb.c | 8 +++++++- drivers/video/fbdev/intelfb/intelfbdrv.c | 5 +++++ drivers/video/fbdev/kyro/fbdev.c | 5 +++++ drivers/video/fbdev/matrox/matroxfb_base.c | 5 +++++ drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 5 +++++ drivers/video/fbdev/neofb.c | 5 +++++ drivers/video/fbdev/nvidia/nvidia.c | 7 ++++++- drivers/video/fbdev/pm2fb.c | 5 +++++ drivers/video/fbdev/pm3fb.c | 5 +++++ drivers/video/fbdev/pvr2fb.c | 5 +++++ drivers/video/fbdev/riva/fbdev.c | 5 +++++ drivers/video/fbdev/s3fb.c | 5 +++++ drivers/video/fbdev/savage/savagefb_driver.c | 5 +++++ drivers/video/fbdev/sis/sis_main.c | 5 +++++ drivers/video/fbdev/skeletonfb.c | 8 ++++++++ drivers/video/fbdev/sm712fb.c | 5 +++++ drivers/video/fbdev/sstfb.c | 5 +++++ drivers/video/fbdev/sunxvr2500.c | 5 +++++ drivers/video/fbdev/sunxvr500.c | 5 +++++ drivers/video/fbdev/tdfxfb.c | 5 +++++ drivers/video/fbdev/tgafb.c | 7 +++++++ drivers/video/fbdev/tridentfb.c | 5 +++++ drivers/video/fbdev/vermilion/vermilion.c | 7 ++++++- drivers/video/fbdev/via/via-core.c | 5 +++++ drivers/video/fbdev/vt8623fb.c | 5 +++++ 39 files changed, 206 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c index eb3e47c58c5f..453daa072f53 100644 --- a/drivers/video/fbdev/arkfb.c +++ b/drivers/video/fbdev/arkfb.c @@ -11,6 +11,7 @@ * Code is based on s3fb */ +#include #include #include #include @@ -949,6 +950,10 @@ static int ark_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) int rc; u8 regval; + rc = aperture_remove_conflicting_pci_devices(dev, "arkfb"); + if (rc < 0) + return rc; + /* Ignore secondary VGA device because there is no VGA arbitration */ if (! svga_primary_device(dev)) { dev_info(&(dev->dev), "ignoring secondary device\n"); diff --git a/drivers/video/fbdev/asiliantfb.c b/drivers/video/fbdev/asiliantfb.c index f8ef62542f7f..3818437a8f69 100644 --- a/drivers/video/fbdev/asiliantfb.c +++ b/drivers/video/fbdev/asiliantfb.c @@ -29,6 +29,7 @@ * more details. */ +#include #include #include #include @@ -545,6 +546,10 @@ static int asiliantfb_pci_init(struct pci_dev *dp, struct fb_info *p; int err; + err = aperture_remove_conflicting_pci_devices(dp, "asiliantfb"); + if (err) + return err; + if ((dp->resource[0].flags & IORESOURCE_MEM) == 0) return -ENODEV; addr = pci_resource_start(dp, 0); diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index 5cdbbba2a013..57e398fe7a81 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -47,6 +47,7 @@ */ +#include #include #include #include @@ -2055,6 +2056,10 @@ static int aty128_probe(struct pci_dev *pdev, const struct pci_device_id *ent) void __iomem *bios = NULL; #endif + err = aperture_remove_conflicting_pci_devices(pdev, "aty128fb"); + if (err) + return err; + /* Enable device in PCI config */ if ((err = pci_enable_device(pdev))) { printk(KERN_ERR "aty128fb: Cannot enable PCI device: %d\n", diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index a3e6faed7745..4804b6e9f3f4 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -48,6 +48,7 @@ ******************************************************************************/ +#include #include #include #include @@ -3533,7 +3534,11 @@ static int atyfb_pci_probe(struct pci_dev *pdev, struct fb_info *info; struct resource *rp; struct atyfb_par *par; - int rc = -ENOMEM; + int rc; + + rc = aperture_remove_conflicting_pci_devices(pdev, "atyfb"); + if (rc) + return rc; /* Enable device in PCI config */ if (pci_enable_device(pdev)) { diff --git a/drivers/video/fbdev/carminefb.c b/drivers/video/fbdev/carminefb.c index 3a1c2e0739a1..4651b48a87f9 100644 --- a/drivers/video/fbdev/carminefb.c +++ b/drivers/video/fbdev/carminefb.c @@ -7,6 +7,7 @@ * - FB1 is display 1 with unique memory area * - both display use 32 bit colors */ +#include #include #include #include @@ -614,6 +615,10 @@ static int carminefb_probe(struct pci_dev *dev, const struct pci_device_id *ent) struct fb_info *info; int ret; + ret = aperture_remove_conflicting_pci_devices(dev, "carminefb"); + if (ret) + return ret; + ret = pci_enable_device(dev); if (ret) return ret; diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c index 618fb6dbbedb..5ad64714d39e 100644 --- a/drivers/video/fbdev/chipsfb.c +++ b/drivers/video/fbdev/chipsfb.c @@ -14,6 +14,7 @@ * more details. */ +#include #include #include #include @@ -351,7 +352,11 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) struct fb_info *p; unsigned long addr; unsigned short cmd; - int rc = -ENODEV; + int rc; + + rc = aperture_remove_conflicting_pci_devices(dp, "chipsfb"); + if (rc) + return rc; if (pci_enable_device(dp) < 0) { dev_err(&dp->dev, "Cannot enable PCI device\n"); diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c index 51e072c03e1c..4ff6f624f912 100644 --- a/drivers/video/fbdev/cirrusfb.c +++ b/drivers/video/fbdev/cirrusfb.c @@ -34,6 +34,7 @@ * */ +#include #include #include #include @@ -2085,6 +2086,10 @@ static int cirrusfb_pci_register(struct pci_dev *pdev, unsigned long board_addr, board_size; int ret; + ret = aperture_remove_conflicting_pci_devices(pdev, "cirrusfb"); + if (ret) + return ret; + ret = pci_enable_device(pdev); if (ret < 0) { printk(KERN_ERR "cirrusfb: Cannot enable PCI device\n"); diff --git a/drivers/video/fbdev/cyber2000fb.c b/drivers/video/fbdev/cyber2000fb.c index d45355b9a58c..be7bcf95c96a 100644 --- a/drivers/video/fbdev/cyber2000fb.c +++ b/drivers/video/fbdev/cyber2000fb.c @@ -33,6 +33,7 @@ * (which, incidentally, is about the same saving as a 2.5in hard disk * entering standby mode.) */ +#include #include #include #include @@ -1720,6 +1721,10 @@ static int cyberpro_pci_probe(struct pci_dev *dev, sprintf(name, "CyberPro%4X", id->device); + err = aperture_remove_conflicting_pci_devices(dev, name); + if (err) + return err; + err = pci_enable_device(dev); if (err) return err; diff --git a/drivers/video/fbdev/geode/gx1fb_core.c b/drivers/video/fbdev/geode/gx1fb_core.c index 5d34d89fb665..4cac7e3bb1a0 100644 --- a/drivers/video/fbdev/geode/gx1fb_core.c +++ b/drivers/video/fbdev/geode/gx1fb_core.c @@ -6,6 +6,7 @@ * Copyright (C) 2005 Arcom Control Systems Ltd. */ +#include #include #include #include @@ -320,6 +321,10 @@ static int gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct fb_info *info; int ret; + ret = aperture_remove_conflicting_pci_devices(pdev, "gx1fb"); + if (ret) + return ret; + info = gx1fb_init_fbinfo(&pdev->dev); if (!info) return -ENOMEM; diff --git a/drivers/video/fbdev/geode/gxfb_core.c b/drivers/video/fbdev/geode/gxfb_core.c index 44089b331f91..2527bd80ec5f 100644 --- a/drivers/video/fbdev/geode/gxfb_core.c +++ b/drivers/video/fbdev/geode/gxfb_core.c @@ -15,6 +15,7 @@ * * 16 MiB of framebuffer memory is assumed to be available. */ +#include #include #include #include @@ -364,6 +365,10 @@ static int gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct fb_videomode *modedb_ptr; unsigned int modedb_size; + ret = aperture_remove_conflicting_pci_devices(pdev, "gxfb"); + if (ret) + return ret; + info = gxfb_init_fbinfo(&pdev->dev); if (!info) return -ENOMEM; diff --git a/drivers/video/fbdev/geode/lxfb_core.c b/drivers/video/fbdev/geode/lxfb_core.c index 66c81262d18f..9d26592dbfce 100644 --- a/drivers/video/fbdev/geode/lxfb_core.c +++ b/drivers/video/fbdev/geode/lxfb_core.c @@ -6,6 +6,7 @@ * Built from gxfb (which is Copyright (C) 2006 Arcom Control Systems Ltd.) */ +#include #include #include #include @@ -484,6 +485,10 @@ static int lxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct fb_videomode *modedb_ptr; unsigned int modedb_size; + ret = aperture_remove_conflicting_pci_devices(pdev, "lxfb"); + if (ret) + return ret; + info = lxfb_init_fbinfo(&pdev->dev); if (info == NULL) diff --git a/drivers/video/fbdev/gxt4500.c b/drivers/video/fbdev/gxt4500.c index e5475ae1e158..f0d36a4fdaef 100644 --- a/drivers/video/fbdev/gxt4500.c +++ b/drivers/video/fbdev/gxt4500.c @@ -6,6 +6,7 @@ * Copyright (C) 2006 Paul Mackerras, IBM Corp. */ +#include #include #include #include @@ -621,6 +622,10 @@ static int gxt4500_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct fb_var_screeninfo var; enum gxt_cards cardtype; + err = aperture_remove_conflicting_pci_devices(pdev, "gxt4500fb"); + if (err) + return err; + err = pci_enable_device(pdev); if (err) { dev_err(&pdev->dev, "gxt4500: cannot enable PCI device: %d\n", diff --git a/drivers/video/fbdev/i740fb.c b/drivers/video/fbdev/i740fb.c index 09dd85553d4f..23329de28e77 100644 --- a/drivers/video/fbdev/i740fb.c +++ b/drivers/video/fbdev/i740fb.c @@ -12,6 +12,7 @@ * i740fb by Patrick LERDA, v0.9 */ +#include #include #include #include @@ -1008,6 +1009,10 @@ static int i740fb_probe(struct pci_dev *dev, const struct pci_device_id *ent) bool found = false; u8 *edid; + ret = aperture_remove_conflicting_pci_devices(dev, "i740fb"); + if (ret) + return ret; + info = framebuffer_alloc(sizeof(struct i740fb_par), &(dev->dev)); if (!info) return -ENOMEM; diff --git a/drivers/video/fbdev/i810/i810_main.c b/drivers/video/fbdev/i810/i810_main.c index 41a86efca516..ff09f8c20bfc 100644 --- a/drivers/video/fbdev/i810/i810_main.c +++ b/drivers/video/fbdev/i810/i810_main.c @@ -28,6 +28,7 @@ * more details. */ +#include #include #include #include @@ -2016,6 +2017,10 @@ static int i810fb_init_pci(struct pci_dev *dev, struct fb_videomode mode; int err = -1, vfreq, hfreq, pixclock; + err = aperture_remove_conflicting_pci_devices(dev, "i810fb"); + if (err) + return err; + info = framebuffer_alloc(sizeof(struct i810fb_par), &dev->dev); if (!info) return -ENOMEM; diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c index f489386855c0..d7edb9c5d3a3 100644 --- a/drivers/video/fbdev/imsttfb.c +++ b/drivers/video/fbdev/imsttfb.c @@ -16,6 +16,7 @@ * more details. */ +#include #include #include #include @@ -1469,7 +1470,12 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct imstt_par *par; struct fb_info *info; struct device_node *dp; - int ret = -ENOMEM; + int ret; + + ret = aperture_remove_conflicting_pci_devices(pdev, "imsttfb"); + if (ret) + return ret; + ret = -ENOMEM; dp = pci_device_to_OF_node(pdev); if(dp) diff --git a/drivers/video/fbdev/intelfb/intelfbdrv.c b/drivers/video/fbdev/intelfb/intelfbdrv.c index 5647fca8c49a..d4a2891a9a7a 100644 --- a/drivers/video/fbdev/intelfb/intelfbdrv.c +++ b/drivers/video/fbdev/intelfb/intelfbdrv.c @@ -107,6 +107,7 @@ * Add support for 945GME. (Phil Endecott ) */ +#include #include #include #include @@ -483,6 +484,10 @@ static int intelfb_pci_register(struct pci_dev *pdev, DBG_MSG("intelfb_pci_register\n"); + err = aperture_remove_conflicting_pci_devices(pdev, "intelfb"); + if (err) + return err; + num_registered++; if (num_registered != 1) { ERR_MSG("Attempted to register %d devices " diff --git a/drivers/video/fbdev/kyro/fbdev.c b/drivers/video/fbdev/kyro/fbdev.c index d57772f96ad2..b4b93054c520 100644 --- a/drivers/video/fbdev/kyro/fbdev.c +++ b/drivers/video/fbdev/kyro/fbdev.c @@ -9,6 +9,7 @@ * for more details. */ +#include #include #include #include @@ -676,6 +677,10 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) unsigned long size; int err; + err = aperture_remove_conflicting_pci_devices(pdev, "kyrofb"); + if (err) + return err; + if ((err = pci_enable_device(pdev))) { printk(KERN_WARNING "kyrofb: Can't enable pdev: %d\n", err); return err; diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c index 236521b19daf..3e26346c05a2 100644 --- a/drivers/video/fbdev/matrox/matroxfb_base.c +++ b/drivers/video/fbdev/matrox/matroxfb_base.c @@ -100,6 +100,7 @@ * */ +#include #include #include "matroxfb_base.h" @@ -2044,6 +2045,10 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm u_int32_t cmd; DBG(__func__) + err = aperture_remove_conflicting_pci_devices(pdev, "matroxfb"); + if (err) + return err; + svid = pdev->subsystem_vendor; sid = pdev->subsystem_device; for (b = dev_list; b->vendor; b++) { diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c index a7508f5be343..96800c9c9cd9 100644 --- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c +++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c @@ -10,6 +10,7 @@ #undef DEBUG +#include #include #include #include @@ -999,6 +1000,10 @@ static int mb862xx_pci_probe(struct pci_dev *pdev, struct device *dev = &pdev->dev; int ret; + ret = aperture_remove_conflicting_pci_devices(pdev, "mb862xxfb"); + if (ret) + return ret; + ret = pci_enable_device(pdev); if (ret < 0) { dev_err(dev, "Cannot enable PCI device\n"); diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c index 8ad2a79623af..93a2d2d1abe8 100644 --- a/drivers/video/fbdev/neofb.c +++ b/drivers/video/fbdev/neofb.c @@ -54,6 +54,7 @@ * */ +#include #include #include #include @@ -2029,6 +2030,10 @@ static int neofb_probe(struct pci_dev *dev, const struct pci_device_id *id) DBG("neofb_probe"); + err = aperture_remove_conflicting_pci_devices(dev, "neofb"); + if (err) + return err; + err = pci_enable_device(dev); if (err) return err; diff --git a/drivers/video/fbdev/nvidia/nvidia.c b/drivers/video/fbdev/nvidia/nvidia.c index a372a183c1f0..329e2e8133c6 100644 --- a/drivers/video/fbdev/nvidia/nvidia.c +++ b/drivers/video/fbdev/nvidia/nvidia.c @@ -9,6 +9,7 @@ * */ +#include #include #include #include @@ -1276,11 +1277,15 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent) struct nvidia_par *par; struct fb_info *info; unsigned short cmd; - + int ret; NVTRACE_ENTER(); assert(pd != NULL); + ret = aperture_remove_conflicting_pci_devices(pd, "nvidiafb"); + if (ret) + return ret; + info = framebuffer_alloc(sizeof(struct nvidia_par), &pd->dev); if (!info) diff --git a/drivers/video/fbdev/pm2fb.c b/drivers/video/fbdev/pm2fb.c index d3be2c64f1c0..bc80d8498aeb 100644 --- a/drivers/video/fbdev/pm2fb.c +++ b/drivers/video/fbdev/pm2fb.c @@ -27,6 +27,7 @@ * */ +#include #include #include #include @@ -1516,6 +1517,10 @@ static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id) int err; int retval = -ENXIO; + err = aperture_remove_conflicting_pci_devices(pdev, "pm2fb"); + if (err) + return err; + err = pci_enable_device(pdev); if (err) { printk(KERN_WARNING "pm2fb: Can't enable pdev: %d\n", err); diff --git a/drivers/video/fbdev/pm3fb.c b/drivers/video/fbdev/pm3fb.c index a8faf46adeb1..ba69846d444f 100644 --- a/drivers/video/fbdev/pm3fb.c +++ b/drivers/video/fbdev/pm3fb.c @@ -22,6 +22,7 @@ * */ +#include #include #include #include @@ -1315,6 +1316,10 @@ static int pm3fb_probe(struct pci_dev *dev, const struct pci_device_id *ent) int err; int retval = -ENXIO; + err = aperture_remove_conflicting_pci_devices(dev, "pm3fb"); + if (err) + return err; + err = pci_enable_device(dev); if (err) { printk(KERN_WARNING "pm3fb: Can't enable PCI dev: %d\n", err); diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c index f4add36cb5f4..b73ad14efa20 100644 --- a/drivers/video/fbdev/pvr2fb.c +++ b/drivers/video/fbdev/pvr2fb.c @@ -45,6 +45,7 @@ #undef DEBUG +#include #include #include #include @@ -942,6 +943,10 @@ static int pvr2fb_pci_probe(struct pci_dev *pdev, { int ret; + ret = aperture_remove_conflicting_pci_devices(pdev, "pvrfb"); + if (ret) + return ret; + ret = pci_enable_device(pdev); if (ret) { printk(KERN_ERR "pvr2fb: PCI enable failed\n"); diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c index 5bafc44c591b..0ea74e28f915 100644 --- a/drivers/video/fbdev/riva/fbdev.c +++ b/drivers/video/fbdev/riva/fbdev.c @@ -29,6 +29,7 @@ * doublescan modes are broken */ +#include #include #include #include @@ -1898,6 +1899,10 @@ static int rivafb_probe(struct pci_dev *pd, const struct pci_device_id *ent) NVTRACE_ENTER(); assert(pd != NULL); + ret = aperture_remove_conflicting_pci_devices(pd, "rivafb"); + if (ret) + return ret; + info = framebuffer_alloc(sizeof(struct riva_par), &pd->dev); if (!info) { ret = -ENOMEM; diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c index b93c8eb02336..f66c4de0e188 100644 --- a/drivers/video/fbdev/s3fb.c +++ b/drivers/video/fbdev/s3fb.c @@ -11,6 +11,7 @@ * which is based on the code of neofb. */ +#include #include #include #include @@ -1129,6 +1130,10 @@ static int s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) return -ENODEV; } + rc = aperture_remove_conflicting_pci_devices(dev, "s3fb"); + if (rc) + return rc; + /* Allocate and fill driver data structure */ info = framebuffer_alloc(sizeof(struct s3fb_info), &(dev->dev)); if (!info) diff --git a/drivers/video/fbdev/savage/savagefb_driver.c b/drivers/video/fbdev/savage/savagefb_driver.c index 8114c921ceb8..b7818b652698 100644 --- a/drivers/video/fbdev/savage/savagefb_driver.c +++ b/drivers/video/fbdev/savage/savagefb_driver.c @@ -41,6 +41,7 @@ * */ +#include #include #include #include @@ -2176,6 +2177,10 @@ static int savagefb_probe(struct pci_dev *dev, const struct pci_device_id *id) DBG("savagefb_probe"); + err = aperture_remove_conflicting_pci_devices(dev, "savagefb"); + if (err) + return err; + info = framebuffer_alloc(sizeof(struct savagefb_par), &dev->dev); if (!info) return -ENOMEM; diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c index f28fd69d5eb7..7114c5c17c91 100644 --- a/drivers/video/fbdev/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c @@ -19,6 +19,7 @@ * which is (c) 1998 Gerd Knorr */ +#include #include #include #include @@ -5849,6 +5850,10 @@ static int sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if(sisfb_off) return -ENXIO; + ret = aperture_remove_conflicting_pci_devices(pdev, "sisfb"); + if (ret) + return ret; + sis_fb_info = framebuffer_alloc(sizeof(*ivideo), &pdev->dev); if(!sis_fb_info) return -ENOMEM; diff --git a/drivers/video/fbdev/skeletonfb.c b/drivers/video/fbdev/skeletonfb.c index 304320ce6c6f..125df366e23a 100644 --- a/drivers/video/fbdev/skeletonfb.c +++ b/drivers/video/fbdev/skeletonfb.c @@ -42,6 +42,7 @@ * more details. */ +#include #include #include #include @@ -668,6 +669,13 @@ static int xxxfb_probe(struct pci_dev *dev, const struct pci_device_id *ent) struct device *device = &dev->dev; /* or &pdev->dev */ int cmap_len, retval; + /* + * Remove firmware-based drivers that create resource conflicts. + */ + retval = aperture_remove_conflicting_pci_devices(pdev, "xxxfb"); + if (retval) + return retval; + /* * Dynamically allocate info and par */ diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c index 092a1caa1208..3baf33635e65 100644 --- a/drivers/video/fbdev/sm712fb.c +++ b/drivers/video/fbdev/sm712fb.c @@ -18,6 +18,7 @@ * Framebuffer driver for Silicon Motion SM710, SM712, SM721 and SM722 chips */ +#include #include #include #include @@ -1502,6 +1503,10 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, dev_info(&pdev->dev, "Silicon Motion display driver.\n"); + err = aperture_remove_conflicting_pci_devices(pdev, "smtcfb"); + if (err) + return err; + err = pci_enable_device(pdev); /* enable SMTC chip */ if (err) return err; diff --git a/drivers/video/fbdev/sstfb.c b/drivers/video/fbdev/sstfb.c index 535ef4693cd4..73ca2782ebfc 100644 --- a/drivers/video/fbdev/sstfb.c +++ b/drivers/video/fbdev/sstfb.c @@ -80,6 +80,7 @@ * Includes */ +#include #include #include #include @@ -1326,6 +1327,10 @@ static int sstfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct sst_spec *spec; int err; + err = aperture_remove_conflicting_pci_devices(pdev, "sstfb"); + if (err) + return err; + /* Enable device in PCI config. */ if ((err=pci_enable_device(pdev))) { printk(KERN_ERR "cannot enable device\n"); diff --git a/drivers/video/fbdev/sunxvr2500.c b/drivers/video/fbdev/sunxvr2500.c index 1d3bacd9d5ac..81d59613ea1f 100644 --- a/drivers/video/fbdev/sunxvr2500.c +++ b/drivers/video/fbdev/sunxvr2500.c @@ -5,6 +5,7 @@ * Copyright (C) 2007 David S. Miller (davem@davemloft.net) */ +#include #include #include #include @@ -123,6 +124,10 @@ static int s3d_pci_register(struct pci_dev *pdev, struct s3d_info *sp; int err; + err = aperture_remove_conflicting_pci_devices(pdev, "s3dfb"); + if (err) + return err; + err = pci_enable_device(pdev); if (err < 0) { printk(KERN_ERR "s3d: Cannot enable PCI device %s\n", diff --git a/drivers/video/fbdev/sunxvr500.c b/drivers/video/fbdev/sunxvr500.c index 9daf17b11106..3a51b2a1480c 100644 --- a/drivers/video/fbdev/sunxvr500.c +++ b/drivers/video/fbdev/sunxvr500.c @@ -5,6 +5,7 @@ * Copyright (C) 2007 David S. Miller (davem@davemloft.net) */ +#include #include #include #include @@ -249,6 +250,10 @@ static int e3d_pci_register(struct pci_dev *pdev, unsigned int line_length; int err; + err = aperture_remove_conflicting_pci_devices(pdev, "e3dfb"); + if (err) + return err; + of_node = pci_device_to_OF_node(pdev); if (!of_node) { printk(KERN_ERR "e3d: Cannot find OF node of %s\n", diff --git a/drivers/video/fbdev/tdfxfb.c b/drivers/video/fbdev/tdfxfb.c index 67e37a62b07c..059e0174e139 100644 --- a/drivers/video/fbdev/tdfxfb.c +++ b/drivers/video/fbdev/tdfxfb.c @@ -64,6 +64,7 @@ * */ +#include #include #include #include @@ -1376,6 +1377,10 @@ static int tdfxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct fb_monspecs *specs; bool found; + err = aperture_remove_conflicting_pci_devices(pdev, "tdfxfb"); + if (err) + return err; + err = pci_enable_device(pdev); if (err) { printk(KERN_ERR "tdfxfb: Can't enable pdev: %d\n", err); diff --git a/drivers/video/fbdev/tgafb.c b/drivers/video/fbdev/tgafb.c index 9266c76783cc..4600138e3bef 100644 --- a/drivers/video/fbdev/tgafb.c +++ b/drivers/video/fbdev/tgafb.c @@ -12,6 +12,7 @@ * more details. */ +#include #include #include #include @@ -106,6 +107,12 @@ static struct pci_driver tgafb_pci_driver = { static int tgafb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) { + int ret; + + ret = aperture_remove_conflicting_pci_devices(pdev, "tgafb"); + if (ret) + return ret; + return tgafb_register(&pdev->dev); } diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c index 319131bd72cf..6813df793c49 100644 --- a/drivers/video/fbdev/tridentfb.c +++ b/drivers/video/fbdev/tridentfb.c @@ -16,6 +16,7 @@ * timing value tweaking so it looks good on every monitor in every mode */ +#include #include #include #include @@ -1470,6 +1471,10 @@ static int trident_pci_probe(struct pci_dev *dev, int chip_id; bool found = false; + err = aperture_remove_conflicting_pci_devices(dev, "tridentfb"); + if (err) + return err; + err = pci_enable_device(dev); if (err) return err; diff --git a/drivers/video/fbdev/vermilion/vermilion.c b/drivers/video/fbdev/vermilion/vermilion.c index ff61605b8764..82b36dbb5b1a 100644 --- a/drivers/video/fbdev/vermilion/vermilion.c +++ b/drivers/video/fbdev/vermilion/vermilion.c @@ -14,6 +14,7 @@ * Alan Hourihane */ +#include #include #include #include @@ -442,7 +443,11 @@ static int vml_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) struct vml_info *vinfo; struct fb_info *info; struct vml_par *par; - int err = 0; + int err; + + err = aperture_remove_conflicting_pci_devices(dev, "vmlfb"); + if (err) + return err; par = kzalloc(sizeof(*par), GFP_KERNEL); if (par == NULL) diff --git a/drivers/video/fbdev/via/via-core.c b/drivers/video/fbdev/via/via-core.c index 89d75079b730..2ee8fcae08df 100644 --- a/drivers/video/fbdev/via/via-core.c +++ b/drivers/video/fbdev/via/via-core.c @@ -8,6 +8,7 @@ /* * Core code for the Via multifunction framebuffer device. */ +#include #include #include #include @@ -617,6 +618,10 @@ static int via_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int ret; + ret = aperture_remove_conflicting_pci_devices(pdev, "viafb"); + if (ret) + return ret; + ret = pci_enable_device(pdev); if (ret) return ret; diff --git a/drivers/video/fbdev/vt8623fb.c b/drivers/video/fbdev/vt8623fb.c index a92a8c670cf0..62318cef5f8c 100644 --- a/drivers/video/fbdev/vt8623fb.c +++ b/drivers/video/fbdev/vt8623fb.c @@ -12,6 +12,7 @@ * (http://davesdomain.org.uk/viafb/) */ +#include #include #include #include @@ -670,6 +671,10 @@ static int vt8623_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) return -ENODEV; } + rc = aperture_remove_conflicting_pci_devices(dev, "vt8623fb"); + if (rc) + return rc; + /* Allocate and fill driver data structure */ info = framebuffer_alloc(sizeof(struct vt8623fb_info), &(dev->dev)); if (!info) From patchwork Thu Jul 7 15:39:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 589278 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D80EACCA485 for ; Thu, 7 Jul 2022 15:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235507AbiGGPkD (ORCPT ); Thu, 7 Jul 2022 11:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235470AbiGGPkC (ORCPT ); Thu, 7 Jul 2022 11:40:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AFB8E9A for ; Thu, 7 Jul 2022 08:40:01 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id ED6F51FF4F; Thu, 7 Jul 2022 15:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657208399; 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=De8S57X+suSKIr+oaW7vvkAWfi5bTh0xCCKRzOI4SBg=; b=gTksLONgi9XMbEZBHCWg+oA3de/owUCQvCsFwwTun7xhsO3/MRxk/EkUbWzD4Pw15CE58e PJXgQQM9RE9K9u4NyWRRXE6kaObCS/XkffzNC9qCoqEBgKUvKv2IIONICuA0Pba0O3xO81 gtVqRMZieOXcM3Brx/FltRnFMsJuSj0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657208399; 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=De8S57X+suSKIr+oaW7vvkAWfi5bTh0xCCKRzOI4SBg=; b=AFqUMXg/peIvvHIotk3Kttpf/scYDzXh9K1KG/2sg4a9NBvv2bbybMZaa5bgSS55XvlQXu jH6nBLE/KR2NjKDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A082413A33; Thu, 7 Jul 2022 15:39:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kPI9Jk/+xmI9UQAAMHmgww (envelope-from ); Thu, 07 Jul 2022 15:39:59 +0000 From: Thomas Zimmermann To: javierm@redhat.com, deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, maxime@cerno.tech Cc: linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, dri-devel@lists.freedesktop.org, Thomas Zimmermann , Zack Rusin , Daniel Vetter , Alex Deucher , Zhen Lei , Changcheng Deng , Maarten Lankhorst , Maxime Ripard Subject: [PATCH 07/11] video/aperture: Disable and unregister sysfb devices via aperture helpers Date: Thu, 7 Jul 2022 17:39:48 +0200 Message-Id: <20220707153952.32264-8-tzimmermann@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220707153952.32264-1-tzimmermann@suse.de> References: <20220707153952.32264-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Call sysfb_disable() before removing conflicting devices in aperture helpers. Fixes sysfb state if fbdev has been disabled. Signed-off-by: Thomas Zimmermann Fixes: fb84efa28a48 ("drm/aperture: Run fbdev removal before internal helpers") Cc: Zack Rusin Cc: Thomas Zimmermann Cc: Javier Martinez Canillas Cc: Daniel Vetter Cc: Daniel Vetter Cc: Sam Ravnborg Cc: Helge Deller Cc: Alex Deucher Cc: Zhen Lei Cc: Changcheng Deng Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: dri-devel@lists.freedesktop.org Reviewed-by: Javier Martinez Canillas --- drivers/video/aperture.c | 14 ++++++++++++++ drivers/video/fbdev/core/fbmem.c | 12 ------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/video/aperture.c b/drivers/video/aperture.c index f42a0d8bc211..101e13c2cf41 100644 --- a/drivers/video/aperture.c +++ b/drivers/video/aperture.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -286,7 +287,20 @@ int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t si #if IS_REACHABLE(CONFIG_FB) struct apertures_struct *a; int ret; +#endif + + /* + * If a driver asked to unregister a platform device registered by + * sysfb, then can be assumed that this is a driver for a display + * that is set up by the system firmware and has a generic driver. + * + * Drivers for devices that don't have a generic driver will never + * ask for this, so let's assume that a real driver for the display + * was already probed and prevent sysfb to register devices later. + */ + sysfb_disable(); +#if IS_REACHABLE(CONFIG_FB) a = alloc_apertures(1); if (!a) return -ENOMEM; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 877de85309f3..3ee3ea018245 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -1765,17 +1764,6 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, do_free = true; } - /* - * If a driver asked to unregister a platform device registered by - * sysfb, then can be assumed that this is a driver for a display - * that is set up by the system firmware and has a generic driver. - * - * Drivers for devices that don't have a generic driver will never - * ask for this, so let's assume that a real driver for the display - * was already probed and prevent sysfb to register devices later. - */ - sysfb_disable(); - mutex_lock(®istration_lock); do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); From patchwork Thu Jul 7 15:39:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 589277 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BCADCCA481 for ; Thu, 7 Jul 2022 15:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235576AbiGGPkD (ORCPT ); Thu, 7 Jul 2022 11:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbiGGPkC (ORCPT ); Thu, 7 Jul 2022 11:40:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C5E2C673 for ; Thu, 7 Jul 2022 08:40:01 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2D7DA1FF58; Thu, 7 Jul 2022 15:40:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657208400; 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=j5fY3Ea70f/1BWSbsP/cFiQ0tI3pdSpnfUk47C85qqo=; b=Pdr35ePFUfiihNOZy9AyhyNW1lA9ib9jQ4LrqFbcbT13SAbhU9Rg8E9ohoD2R6b0/hylFm fA3yrNeQ3o3TDJsA7dxcO06gxMJUf1zx19YvWzrU8ShtbBxplKwf8R2AgE+btknpa0584F koTRipdx2Z2gM9q2q+IAVBD/uhqntoE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657208400; 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=j5fY3Ea70f/1BWSbsP/cFiQ0tI3pdSpnfUk47C85qqo=; b=/UoVIgD2+Vu7wXxPZ6+/9zC6ZYyMHpHAdfjGw7t1a05v/ssSGWcCim8V+B1pHLHuI2RdvZ wnUOADB0finooICQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F140613B4E; Thu, 7 Jul 2022 15:39:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mDzxOU/+xmI9UQAAMHmgww (envelope-from ); Thu, 07 Jul 2022 15:39:59 +0000 From: Thomas Zimmermann To: javierm@redhat.com, deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, maxime@cerno.tech Cc: linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, dri-devel@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH 08/11] video: Provide constants for VGA I/O range Date: Thu, 7 Jul 2022 17:39:49 +0200 Message-Id: <20220707153952.32264-9-tzimmermann@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220707153952.32264-1-tzimmermann@suse.de> References: <20220707153952.32264-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Provide VGA_FB_ constants for the VGA framebuffer I/O range and convert fbdev code. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/core/fbmem.c | 4 ++-- drivers/video/fbdev/vga16fb.c | 15 ++++++--------- include/video/vga.h | 2 ++ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 3ee3ea018245..2237049327db 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -39,6 +39,7 @@ #include +#include