From patchwork Mon Dec 19 16:05:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13076947 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 429FEC4332F for ; Mon, 19 Dec 2022 17:52:53 +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=2VLItqQf2y6jYVGeXF/4rarW715ZVA6w1ArfZnDR1w0=; b=p1FMji5TVDp1Ll +OFg27ulzI1rqtYvEKYUBsx8xiYbFy9BOubdMXONiOKPTaJDq/+aoHahAx05iTyAzkQVOzQ0lElsd pelw+l2mYxPIuZGDnl4PZHQIBowHCUInJDx/BTpeVDsrpT1WNLv3hOAVrkj9U/0Tymb90T6SuNkE4 pAUqSTPaPFIcrjmcSzsJrVYBxKTfjhcl1Yhlqo1vYoTF95kiryxtT25JVN6l94Hv8udZS0XJOSeZ+ ZJ58a7xWN0F07vXronX0CWOxR95g01CX7tXIEx/3Y+Sqm4rFvjhQg8EbHtbY740fQCqL1pg7KbXql RAAbhbEZobr3flMq1Rqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7KI6-00H1rq-EA; Mon, 19 Dec 2022 17:51:09 +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 1p7Ids-00Fn1D-Hv for linux-arm-kernel@lists.infradead.org; Mon, 19 Dec 2022 16:05:34 +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 E58076106A; Mon, 19 Dec 2022 16:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1671465921; 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=7AvP4+yrQ3bqo6F1yy3Vq9Bwx8SPA/+CqvfnX9hA8B0=; b=M/XBwN5UhKeDbKvr5oX4umQ0oHUhZterr0ZR0WuuMHRxAqyUbyaPouEQ3nNOpM6lIFsBkV xL3V8ZvSN6VD+r9nr+QWea8Bkvg88x0UV6Q6hRMeAIfDGTnV1Xx1vrBRSSvdGzVg2Rb2IW uTRijUmIYmENMgW2/6TSCqV9MpTs8KA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1671465921; 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=7AvP4+yrQ3bqo6F1yy3Vq9Bwx8SPA/+CqvfnX9hA8B0=; b=lHANT5l5RGXad1u1esQPLu8UjEwNWcGQmLkf4YhEjPM4ut4rAQKRoR5hVPdV18HkxRP1yH 9erCkjmEUHp9YiAQ== 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 B0B7113910; Mon, 19 Dec 2022 16:05:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eDMHKsGLoGPeZwAAMHmgww (envelope-from ); Mon, 19 Dec 2022 16:05:21 +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 14/18] fbdev/simplefb: Do not use struct fb_info.apertures Date: Mon, 19 Dec 2022 17:05:12 +0100 Message-Id: <20221219160516.23436-15-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_080528_913847_A4A1CC86 X-CRM114-Status: GOOD ( 14.51 ) 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/simplefb.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index e770b4a356b5..10d71879d340 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c @@ -12,6 +12,7 @@ * Copyright (C) 1996 Paul Mackerras */ +#include #include #include #include @@ -68,6 +69,8 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, struct simplefb_par { u32 palette[PSEUDO_PALETTE_SIZE]; + resource_size_t base; + resource_size_t size; struct resource *mem; #if defined CONFIG_OF && defined CONFIG_COMMON_CLK bool clks_enabled; @@ -472,16 +475,11 @@ static int simplefb_probe(struct platform_device *pdev) info->var.blue = params.format->blue; info->var.transp = params.format->transp; - info->apertures = alloc_apertures(1); - if (!info->apertures) { - ret = -ENOMEM; - goto error_fb_release; - } - info->apertures->ranges[0].base = info->fix.smem_start; - info->apertures->ranges[0].size = info->fix.smem_len; + par->base = info->fix.smem_start; + par->size = info->fix.smem_len; info->fbops = &simplefb_ops; - info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE; + info->flags = FBINFO_DEFAULT; info->screen_base = ioremap_wc(info->fix.smem_start, info->fix.smem_len); if (!info->screen_base) { @@ -511,6 +509,11 @@ static int simplefb_probe(struct platform_device *pdev) if (mem != res) par->mem = mem; /* release in clean-up handler */ + ret = devm_aperture_acquire_for_platform_device(pdev, par->base, par->size); + if (ret) { + dev_err(&pdev->dev, "Unable to acquire aperture: %d\n", ret); + goto error_regulators; + } ret = register_framebuffer(info); if (ret < 0) { dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret);