From patchwork Mon Dec 19 16:05:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13076955 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E7A64C4332F for ; Mon, 19 Dec 2022 17:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=prFTdbijP5p+41SyRTUPrzxRBpDf1a7iHW2QXs2/mF0=; b=sJSDNJFce72CnH kdNR2yM3Apm8gzX2BjNxfKuAwudTG3AYUcbdSl+XKhXwKlWictEui6LC2CW99fhp+/YEDPgzjWFOl X3vfR5OG66n5nv0/4Y8CkjxMmW+usyVIzKN2Nfv62j9rLlgwy5bkJBWf26gnLPwWIjIyT0wCK4ncE 5jmEKcewjTCbIXrkyQn7V2O7Q1nGYxWSdorglvFz1Mf7pd9K0rjvqlJeHvXplECg+OyHqCg1fDqdM cqgqd4hZlVKXaeALAaxuspJbgRy5Dk9c2C3LNxzPrSIm4e7R/jMkIZD5BpWFadSiRPHABLLzA0hcr hdaJaT2qkKCpPoYRTT4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7KOx-00H6IU-7A; Mon, 19 Dec 2022 17:58:13 +0000 Received: from smtp-out2.suse.de ([195.135.220.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7Idu-00Fn3Z-9F for linux-arm-kernel@lists.infradead.org; Mon, 19 Dec 2022 16:05:36 +0000 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 62A4D6106B; Mon, 19 Dec 2022 16:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1671465922; 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=TA3a5UCvu+T6cGVUv2fP+uAA75vjFZc4XwLIqHS7zss=; b=FNwQicw5ASnAz1j2lbGQUHsL358NMsllfeHdZm5DLNhxsOLY9lu9Stw1PHBh0VJEbxCH1Q nxik6kB49QPVBopQkOiTnZRRAtP+zVFL95RKZjlqvpGDbpGdOYoMCMzR8ySAhy14H0L4Ee /J0OXjgcfHGKJYvXOvi43e3h8hTsqbQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1671465922; 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=TA3a5UCvu+T6cGVUv2fP+uAA75vjFZc4XwLIqHS7zss=; b=2GyFGQ6UIYjZ/0fswPwJCnbqyO1wiWiMMEIGx6DNWI5pWAT1nZ+lopSVkSzPsJF0sPeBYi 5hx2jNvDMjFsEyDw== 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 2BD7913910; Mon, 19 Dec 2022 16:05:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sJrdCcKLoGPeZwAAMHmgww (envelope-from ); Mon, 19 Dec 2022 16:05:22 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@gmail.com, deller@gmx.de, javierm@redhat.com Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 16/18] fbdev/vesafb: Do not use struct fb_info.apertures Date: Mon, 19 Dec 2022 17:05:14 +0100 Message-Id: <20221219160516.23436-17-tzimmermann@suse.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221219160516.23436-1-tzimmermann@suse.de> References: <20221219160516.23436-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221219_080530_633255_0C060799 X-CRM114-Status: GOOD ( 15.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Acquire ownership of the firmware scanout buffer by calling Linux' aperture helpers. Remove the use of struct fb_info.apertures and do not set FBINFO_MISC_FIRMWARE; both of which previously configured buffer ownership. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/vesafb.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c index 47ce244e4bb8..3f8bdfcf51f0 100644 --- a/drivers/video/fbdev/vesafb.c +++ b/drivers/video/fbdev/vesafb.c @@ -9,6 +9,7 @@ * */ +#include #include #include #include @@ -31,6 +32,8 @@ struct vesafb_par { u32 pseudo_palette[256]; + resource_size_t base; + resource_size_t size; int wc_cookie; struct resource *region; }; @@ -191,7 +194,7 @@ static void vesafb_destroy(struct fb_info *info) arch_phys_wc_del(par->wc_cookie); if (info->screen_base) iounmap(info->screen_base); - release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); + release_mem_region(par->base, par->size); framebuffer_release(info); } @@ -316,14 +319,8 @@ static int vesafb_probe(struct platform_device *dev) par = info->par; info->pseudo_palette = par->pseudo_palette; - /* set vesafb aperture size for generic probing */ - info->apertures = alloc_apertures(1); - if (!info->apertures) { - err = -ENOMEM; - goto err; - } - info->apertures->ranges[0].base = screen_info.lfb_base; - info->apertures->ranges[0].size = size_total; + par->base = screen_info.lfb_base; + par->size = size_total; printk(KERN_INFO "vesafb: mode is %dx%dx%d, linelength=%d, pages=%d\n", vesafb_defined.xres, vesafb_defined.yres, vesafb_defined.bits_per_pixel, vesafb_fix.line_length, screen_info.pages); @@ -460,27 +457,29 @@ static int vesafb_probe(struct platform_device *dev) info->fbops = &vesafb_ops; info->var = vesafb_defined; info->fix = vesafb_fix; - info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE | - (ypan ? FBINFO_HWACCEL_YPAN : 0); + info->flags = FBINFO_FLAG_DEFAULT | (ypan ? FBINFO_HWACCEL_YPAN : 0); if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { err = -ENOMEM; goto err_release_region; } + err = devm_aperture_acquire_for_platform_device(dev, par->base, par->size); + if (err) + goto err_fb_dealloc_cmap; if (register_framebuffer(info)<0) { err = -EINVAL; - fb_dealloc_cmap(&info->cmap); - goto err_release_region; + goto err_fb_dealloc_cmap; } fb_info(info, "%s frame buffer device\n", info->fix.id); return 0; +err_fb_dealloc_cmap: + fb_dealloc_cmap(&info->cmap); err_release_region: arch_phys_wc_del(par->wc_cookie); if (info->screen_base) iounmap(info->screen_base); if (par->region) release_region(0x3c0, 32); -err: framebuffer_release(info); release_mem_region(vesafb_fix.smem_start, size_total); return err;