From patchwork Tue Jul 4 15:49:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13301429 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 51F70EB64D9 for ; Tue, 4 Jul 2023 16:02:16 +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=5UnycXVShCklElo7j5HHNqPJc25Az71YFj3Acq09wTg=; b=3ZUsqPtr4AipKy 3lWUqQb9RMKDj1K6kSa7QddBPdLyt6pS1pDdwD/wg3NeWz1q6bBiyItAgmApI3kB9+Jo1bLhkSVsg mRfVyDeqZmgjhw48HfucE0GQDLldAT/QLpxUZkcoQhxHL1o1rJMsN6S4TcIZ+HzisltukeKAcCoMR wMmA/Az52WD4wyYmU1fV+g2qOmdfLoVMZRXstQzQ83EPBaoEfB4Osm/I5KmvP7AWglwt4msEo2xAQ QIZCzH3wGJdEl/I6uB8TS2XF5Iq+tPkvo1xyKu4mwG+2lW/0bysAuVESr5SWo/GcU+rMoLUEvwIkx wRYvB+j51X4wEkNfEF1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTH-00DkfH-2S; Tue, 04 Jul 2023 16:01:43 +0000 Received: from smtp-out2.suse.de ([195.135.220.29]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTE-00Dkbc-2L for linux-arm-kernel@lists.infradead.org; Tue, 04 Jul 2023 16:01:42 +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 685F71FDCE; Tue, 4 Jul 2023 16:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688486495; 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=9HNzFbkOxT3wYRs/yGJOSWV56VFROq6gaVSgPJPLezI=; b=CF/NsosiphT5TK8Gm/jnpeQW+5mJgGl2kBwo4m9jiUoqOtbGoCUfaTgU5P7OzFJ5evzkVX wiBTrnRuKz4CTqobiZHFNfKIBs0ALA3MBVkgGzYBaYtbxSoke/IRp0NC0Oj/Dn5yhEEtL4 pz0fmnzVXTVuyynR1RdYMHlQbC8a+c0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688486495; 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=9HNzFbkOxT3wYRs/yGJOSWV56VFROq6gaVSgPJPLezI=; b=VMsaooGl05z/fGaZ4w2m/1zddiga9OcnyIO0AhrgQW15PMrVEaMH/JhlC0FDqnkN5Z2gGR VaU9K7DdH0tvEgAg== 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 33522139ED; Tue, 4 Jul 2023 16:01:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6JOgC19CpGTzLwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 16:01:35 +0000 From: Thomas Zimmermann To: javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller Subject: [PATCH 01/10] fbdev: Add fb_ops init macros for framebuffers in DMA-able memory Date: Tue, 4 Jul 2023 17:49:58 +0200 Message-ID: <20230704160133.20261-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704160133.20261-1-tzimmermann@suse.de> References: <20230704160133.20261-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_090140_944187_B66D9F1D X-CRM114-Status: GOOD ( 12.38 ) 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 Add initializer macros for struct fb_ops for framebuffers in DMA-able memory areas. Also add a corresponding Kconfig token. As of now, this is equivalent to system framebuffers and mostly useful for labeling drivers correctly. A later patch may add a generic DMA-specific mmap operation. Linux offers a number of dma_mmap_*() helpers for different use cases. Signed-off-by: Thomas Zimmermann Cc: Helge Deller Reviewed-by: Javier Martinez Canillas --- drivers/video/fbdev/Kconfig | 8 ++++++++ include/linux/fb.h | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index cecf15418632..f14229757311 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -168,6 +168,14 @@ config FB_DEFERRED_IO bool depends on FB +config FB_DMA_HELPERS + bool + depends on FB + select FB_SYS_COPYAREA + select FB_SYS_FILLRECT + select FB_SYS_FOPS + select FB_SYS_IMAGEBLIT + config FB_IO_HELPERS bool depends on FB diff --git a/include/linux/fb.h b/include/linux/fb.h index 1d5c13f34b09..1191a78c5289 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -594,6 +594,19 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, __FB_DEFAULT_SYS_OPS_DRAW, \ __FB_DEFAULT_SYS_OPS_MMAP +/* + * Helpers for framebuffers in DMA-able memory + */ + +#define __FB_DEFAULT_DMA_OPS_RDWR \ + .fb_read = fb_sys_read, \ + .fb_write = fb_sys_write + +#define __FB_DEFAULT_DMA_OPS_DRAW \ + .fb_fillrect = sys_fillrect, \ + .fb_copyarea = sys_copyarea, \ + .fb_imageblit = sys_imageblit + /* drivers/video/fbmem.c */ extern int register_framebuffer(struct fb_info *fb_info); extern void unregister_framebuffer(struct fb_info *fb_info); From patchwork Tue Jul 4 15:49:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13301436 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 6DA4AEB64D9 for ; Tue, 4 Jul 2023 16:02:31 +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=Gy7XKYlBYafH0AAZeZ3nnenGNmlz8MgVZLLjgZWvpvA=; b=jQ/rVC7gpwNXy2 hECiE5zMOWhvZnfdnEjIZ/f8AR3zKDlEw7+/gnTkhbrEJLcKIDz5HjYbY/RVmFbevv0OwUBICMle+ ofNYLmKaNF/Uw0xxwh8AuFf0LsQIRnzsvB5hIkahAIGcxoePII6ZmhzLXp/lbdmDYnaFS9/78/MHz LnP4EFozpgxvcjGt7PGStCNmXTLV6Dxq/X7csHxVI+iRJRYgHDd8VPICecpuJ3/6PRcUcRFCsDRTc QJdhwjmzrFuXg2PFtmho0gitje6wQg47is4erlC3SEAPCt8f1vVSdSQlDHZI47k6nOSzlk5ITXtMP HaQPPoJYv72PSFuuijUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTK-00DkhJ-21; Tue, 04 Jul 2023 16:01:46 +0000 Received: from smtp-out2.suse.de ([195.135.220.29]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTE-00Dkbn-2T for linux-arm-kernel@lists.infradead.org; Tue, 04 Jul 2023 16:01:43 +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 A18A81FE08; Tue, 4 Jul 2023 16:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688486495; 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=RGrIuF3cI1OvIpCbh5MVPdujRaXGpEAS9G8thK3Bjk8=; b=Ob56smJEwpaI+dYl+2fjypddbgHsPoLc60wqsjdqsfP+Y8oYOlYC3YrEMZYVCVyMwBedS+ VddpJ+1ZL8yS/t4qLihr5rOBsThhW4LYimVii84/GB0o9AZQ6bd2duCLPWhNDFykaEwitN Zw2XP85/tFgaWv7zbaXhK5JQiuhbAzs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688486495; 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=RGrIuF3cI1OvIpCbh5MVPdujRaXGpEAS9G8thK3Bjk8=; b=YNusq42pTS4Rk6ppjcAw2qlsXNlOEfyOTgrUTgYFCtk1NnErZFvEGtKoZOoZMv/QXz8N8N uBB6YBBXXEN3GRBw== 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 6DB2A133F7; Tue, 4 Jul 2023 16:01:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 2DDTGV9CpGTzLwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 16:01:35 +0000 From: Thomas Zimmermann To: javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 02/10] drm/fbdev-dma: Use fbdev DMA helpers Date: Tue, 4 Jul 2023 17:49:59 +0200 Message-ID: <20230704160133.20261-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704160133.20261-1-tzimmermann@suse.de> References: <20230704160133.20261-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_090140_965444_89D8836C X-CRM114-Status: GOOD ( 13.35 ) 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 Use fbdev's DMA helpers for fbdev-dma. They are equivalent to the previously used system-memory helpers, so no functional changes here. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/Kconfig | 2 +- drivers/gpu/drm/drm_fbdev_dma.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index afb3b2f5f425..da3aa0625c36 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -216,7 +216,7 @@ config DRM_TTM_HELPER config DRM_GEM_DMA_HELPER tristate depends on DRM - select FB_SYS_HELPERS if DRM_FBDEV_EMULATION + select FB_DMA_HELPERS if DRM_FBDEV_EMULATION help Choose this if you need the GEM DMA helper functions diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c index 8217f1ddc007..040c229a1737 100644 --- a/drivers/gpu/drm/drm_fbdev_dma.c +++ b/drivers/gpu/drm/drm_fbdev_dma.c @@ -62,9 +62,9 @@ static const struct fb_ops drm_fbdev_dma_fb_ops = { .owner = THIS_MODULE, .fb_open = drm_fbdev_dma_fb_open, .fb_release = drm_fbdev_dma_fb_release, - __FB_DEFAULT_SYS_OPS_RDWR, + __FB_DEFAULT_DMA_OPS_RDWR, DRM_FB_HELPER_DEFAULT_OPS, - __FB_DEFAULT_SYS_OPS_DRAW, + __FB_DEFAULT_DMA_OPS_DRAW, .fb_mmap = drm_fbdev_dma_fb_mmap, .fb_destroy = drm_fbdev_dma_fb_destroy, }; From patchwork Tue Jul 4 15:50:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13301428 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 00453EB64DD for ; Tue, 4 Jul 2023 16:02:16 +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=I+Bsk77Hft/L1RhHY56c6TQKFeK7yq3EHQaylMjP67I=; b=H1zhVptpomIFM4 vcoSH3u5I0NR54gt3hqvzGUOE0pHTexLCaqnD6tadg2GDMPZ800BVCEGuGndx590c8GVJvIdVeSwU 5jDU76W97f7NTCRn/wWdajezsbJSWwE7LbeJQMJxD87yylmZLhrmggoPRd9W3qG67kl7NuJxteeSA XqnYP2B+nsIFcnRaH5k298n+yTv6xuTQWqDgR8OAvW/LvlwhL1MgnLuLGRxx+UJ0jBsv7H/8F02+X pTty9sXhEO+gIgI9Y3Ln06cq+tcdt7e1nVM+FVWM0MfRjNfP1XJaFntFVfn0pbs0n/TW8C6cXTknK FtaUVcKq2NMpd6L6bwKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTI-00Dkfv-1X; Tue, 04 Jul 2023 16:01:44 +0000 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTE-00Dkbd-2P for linux-arm-kernel@lists.infradead.org; Tue, 04 Jul 2023 16:01:42 +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 DE56A1FE2E; Tue, 4 Jul 2023 16:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688486495; 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=DwKhELjo5lPDL/DaEOwMT8qUV1xa7L1vTRPfyu6L/V8=; b=fr3kSem0xgJbtzcGaOsuEJc9cATS6B59mqbKnNO2BhJF64Eobsi5kyb8+patRJbIBmPOlu qdNL8GER2ro+swqLSFJIem4BhrrbvQlmE2wsDZNDs4jTIG1EoY4qBUITS7F3aMfK8uDtec QdnfhqvZ3JPV4CXmYGS6rjy9jRAdNUo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688486495; 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=DwKhELjo5lPDL/DaEOwMT8qUV1xa7L1vTRPfyu6L/V8=; b=ISZMWp4VU6Ucz8t2+gvRPBnh7IABBVF+4qPiIw+93R3bjeE7ewDLHfIQZSAdzYBngSMiHV ltC7rOy7xYO3IXAg== 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 A43D9139ED; Tue, 4 Jul 2023 16:01:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SM8qJ19CpGTzLwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 16:01:35 +0000 From: Thomas Zimmermann To: javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann , Thierry Reding , Mikko Perttunen Subject: [PATCH 03/10] drm/tegra: Use fbdev DMA helpers Date: Tue, 4 Jul 2023 17:50:00 +0200 Message-ID: <20230704160133.20261-4-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704160133.20261-1-tzimmermann@suse.de> References: <20230704160133.20261-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_090140_948431_D7C2A996 X-CRM114-Status: GOOD ( 12.76 ) 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 Use fbdev's DMA helpers for fbdev emulation. They are equivalent to the previously used system-memory helpers, so no functional changes here. Signed-off-by: Thomas Zimmermann Cc: Thierry Reding Cc: Mikko Perttunen Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/tegra/Kconfig | 2 +- drivers/gpu/drm/tegra/fbdev.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig index 498313778175..39452c8480c1 100644 --- a/drivers/gpu/drm/tegra/Kconfig +++ b/drivers/gpu/drm/tegra/Kconfig @@ -12,7 +12,7 @@ config DRM_TEGRA select DRM_KMS_HELPER select DRM_MIPI_DSI select DRM_PANEL - select FB_SYS_HELPERS if DRM_FBDEV_EMULATION + select FB_DMA_HELPERS if DRM_FBDEV_EMULATION select TEGRA_HOST1X select INTERCONNECT select IOMMU_IOVA diff --git a/drivers/gpu/drm/tegra/fbdev.c b/drivers/gpu/drm/tegra/fbdev.c index e74d9be981c7..82577b7c88da 100644 --- a/drivers/gpu/drm/tegra/fbdev.c +++ b/drivers/gpu/drm/tegra/fbdev.c @@ -59,9 +59,9 @@ static void tegra_fbdev_fb_destroy(struct fb_info *info) static const struct fb_ops tegra_fb_ops = { .owner = THIS_MODULE, - __FB_DEFAULT_SYS_OPS_RDWR, + __FB_DEFAULT_DMA_OPS_RDWR, DRM_FB_HELPER_DEFAULT_OPS, - __FB_DEFAULT_SYS_OPS_DRAW, + __FB_DEFAULT_DMA_OPS_DRAW, .fb_mmap = tegra_fb_mmap, .fb_destroy = tegra_fbdev_fb_destroy, }; From patchwork Tue Jul 4 15:50:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13301435 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 D044EEB64DD for ; Tue, 4 Jul 2023 16:02:31 +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=RV4fh5Gy4o1hnTTfh5Og2u3OqIsP0aohTHqtWcb5tT4=; b=PuFl3qezh83PJn 6GGhreBZTzfN2CRFNVs2Y60ilXz1mEyo5zd/6SaeEVXzUjcOgjUC63oZdxQdCbwzg/syXEIp70q6E JM3veCOj1SkSQN1L8izIP3myt913iy9AcO8RSWpNA8sKY5m0YDGMhlApq7WkzcsGfUKa8asG/88gZ VTMSr96n7jpEW+UrxV1CCqWdKrFu3wj9HUCywCGHeDQqq9WHKpRwg21WCseCm5vFeB7FxCaG0RB6i fq1QO4CHHc4Oc9QBpJGwj63fwmRC8Fef+jX+yGGUuafHVUU6Crj2WewaOR4fFkOY1OR6vYA1f4fPp wyuYP8/pEc1SN29zhhbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTL-00Dki8-2H; Tue, 04 Jul 2023 16:01:47 +0000 Received: from smtp-out1.suse.de ([195.135.220.28]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTG-00Dkbk-0O for linux-arm-kernel@lists.infradead.org; Tue, 04 Jul 2023 16:01:43 +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-out1.suse.de (Postfix) with ESMTPS id 298B1228AF; Tue, 4 Jul 2023 16:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688486496; 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=ckVHReRisnJ+7Edbypsv59JntS0oPCQ/YOl8IC0RY5c=; b=Zvd75MJg3ZOlTYJfyXF5ZQGxEem9yjDFvwsCwJLlON8YJ8DJunXBRFKBBE2o25+1aze2Jk qTCXkTTvnLM1Al2EhjRs21lFJPyyOe6dd02sCx3NNheEUmxKCU3p1kh9FvVc46XwlsNRL1 aLjzBYPHgatbx8pFZmApKmeamwUTXgk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688486496; 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=ckVHReRisnJ+7Edbypsv59JntS0oPCQ/YOl8IC0RY5c=; b=iYDpY+hkmVGlNQL7l7FBkO623kFGawvtm4TS3af1tg2wzU6LX9RhWnhdyCyneq65Hz2Im9 9pwt/equs88KBbCA== 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 E318F133F7; Tue, 4 Jul 2023 16:01:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SH+ENl9CpGTzLwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 16:01:35 +0000 From: Thomas Zimmermann To: javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann , Thierry Reding , Mikko Perttunen Subject: [PATCH 04/10] drm/tegra: Set fbdev flags Date: Tue, 4 Jul 2023 17:50:01 +0200 Message-ID: <20230704160133.20261-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704160133.20261-1-tzimmermann@suse.de> References: <20230704160133.20261-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_090142_354889_AF3CA1E5 X-CRM114-Status: GOOD ( 11.40 ) 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 Set fbdev default flags FBNFO_DEFAULT and mark the framebuffer with FBINFO_VIRTFB. The framebuffer range is in DMA-able memory and should be accessed with the CPU's regular memory ops. Signed-off-by: Thomas Zimmermann Cc: Thierry Reding Cc: Mikko Perttunen Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/tegra/fbdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/tegra/fbdev.c b/drivers/gpu/drm/tegra/fbdev.c index 82577b7c88da..8074430c52f1 100644 --- a/drivers/gpu/drm/tegra/fbdev.c +++ b/drivers/gpu/drm/tegra/fbdev.c @@ -103,6 +103,8 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, return PTR_ERR(info); } + info->flags = FBINFO_DEFAULT; + fb = tegra_fb_alloc(drm, &cmd, &bo, 1); if (IS_ERR(fb)) { err = PTR_ERR(fb); @@ -132,6 +134,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, } } + info->flags |= FBINFO_VIRTFB; info->screen_base = (void __iomem *)bo->vaddr + offset; info->screen_size = size; info->fix.smem_start = (unsigned long)(bo->iova + offset); From patchwork Tue Jul 4 15:50:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13301432 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 52732EB64DD for ; Tue, 4 Jul 2023 16:02:19 +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=8OnggRmXJYIA1gbBjF7ufuC06eNhZxecrKPIng1P8w4=; b=YbUTB+5dz6QBSe 26j/jwd8zw2ajc7H02z4lLe//9beuH9R9BfsOKxwF5Vmx/dS+mqnxZ2G/CCjuJH/PHyfXHfaVJ4wK nhO7T+Z5i65ZyFx6uGHkrUblactzldNEeZY3iOca20kVnYXHCAs/VmtONiyJzKsWPk/6npFOPcJTM pQ1NvBz53PbcVtRFZlgnfffTaRHPN7qhH5Ocgm/l9BiRKqpvOhxPn/iEyFPjZjL27BC5cHvoYWqnw Hjn+C3LpvicJkLBLonvW7mXOfVDxdbnih7VbPSlzQHy5tQKMvGZXY/HhxCOR6b7RpA7i8rNotSYdR oolDtKPHeINevN7ewZHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTL-00Dkhh-0T; Tue, 04 Jul 2023 16:01:47 +0000 Received: from smtp-out2.suse.de ([195.135.220.29]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTE-00Dkbl-2P for linux-arm-kernel@lists.infradead.org; Tue, 04 Jul 2023 16:01:43 +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 741971FE56; Tue, 4 Jul 2023 16:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688486496; 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=J+3lz47dP6MxN3OpfYH2SM01nxUju4y/iq3PJaWbce4=; b=nlzwADnjUI10ghCyK0YnjE5aoj4TqJ8ssx95r3tNPxvOW3yx3eFRlgem0M+ocZrN5qjfgU 12YSn6roHLl5J5d70/Iej/SLV8LVM7RbC3s8QN96I01JIWZH/HH5ywgquEYoHtrYlExac7 R7FlmvuqQ7YuPVFOYNZy82bG1uL3PhA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688486496; 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=J+3lz47dP6MxN3OpfYH2SM01nxUju4y/iq3PJaWbce4=; b=D1v5ty2+5abffNMDkOo7qJsChBKKfQaX1ccvaMkEiWgRVOCMLxerkhgOkHdRwIzooMym2R cGLHuEDwIxgwIqBA== 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 2E0D6139ED; Tue, 4 Jul 2023 16:01:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GMtdCmBCpGTzLwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 16:01:36 +0000 From: Thomas Zimmermann To: javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar Subject: [PATCH 05/10] drm/exynos: Use fbdev DMA helpers Date: Tue, 4 Jul 2023 17:50:02 +0200 Message-ID: <20230704160133.20261-6-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704160133.20261-1-tzimmermann@suse.de> References: <20230704160133.20261-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_090140_950469_A82DCDAA X-CRM114-Status: GOOD ( 14.79 ) 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 Use fbdev's DMA helpers for fbdev emulation. They drivers previously used the I/O-memory helpers, while allocating DMA-able system memory. This could (in theory) result in bus errors from accessing the memory range. This bug has been present since the exynos driver was first added. Signed-off-by: Thomas Zimmermann Fixes: 1c248b7d2960 ("DRM: add DRM Driver for Samsung SoC EXYNOS4210.") Cc: Inki Dae Cc: Seung-Woo Kim Cc: Kyungmin Park Cc: Krzysztof Kozlowski Cc: Alim Akhtar Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/exynos/Kconfig | 2 +- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 7ca7e1dab52c..661b42ad4873 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -7,7 +7,7 @@ config DRM_EXYNOS select DRM_DISPLAY_HELPER if DRM_EXYNOS_DP select DRM_KMS_HELPER select VIDEOMODE_HELPERS - select FB_IO_HELPERS if DRM_FBDEV_EMULATION + select FB_DMA_HELPERS if DRM_FBDEV_EMULATION select SND_SOC_HDMI_CODEC if SND_SOC help Choose this option if you have a Samsung SoC Exynos chipset. diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index fdf65587f1fe..7ca3424b59ce 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -49,9 +49,9 @@ static void exynos_drm_fb_destroy(struct fb_info *info) static const struct fb_ops exynos_drm_fb_ops = { .owner = THIS_MODULE, - __FB_DEFAULT_IO_OPS_RDWR, + __FB_DEFAULT_DMA_OPS_RDWR, DRM_FB_HELPER_DEFAULT_OPS, - __FB_DEFAULT_IO_OPS_DRAW, + __FB_DEFAULT_DMA_OPS_DRAW, .fb_mmap = exynos_drm_fb_mmap, .fb_destroy = exynos_drm_fb_destroy, }; From patchwork Tue Jul 4 15:50:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13301502 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 6C69EEB64D9 for ; Tue, 4 Jul 2023 16:55:49 +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=pNBHv9WIrmLr7g0/nob0cT7s9GmFmmlorZ+6H8/GLV4=; b=uLg7GVbluEN/vZ TCtmdUpk8qBvjGF+HDfwdgXTJWIIQlsajxlucF5em8LH0hBjq2Xao/jS1HVan97mgXQ48EivmV7vB WqKE0sNO2SN4wICKZ6IKmMwgQf1i1IPxF6EVhgkivC/NvzU5FD8PZvIQNoYGQYVvThxXi3ymrf55d QdCnl8kuTbo6SGBRzRaMycxFQTOU1/rsgwaQArQ43bkTJ9WodG9XxdHR9FhshGwBjVeJS8KTYxWWE B1Dq2+s8dpP5ITDW1jGilZeVHsjxbL1gKKzTPRRqBe2vynqz7qodseYTk8okFr4IyM28vv9FaDqRq p0htc+zHS1jssIJZEaKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGjJD-00DsEX-2t; Tue, 04 Jul 2023 16:55:23 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGjJC-00DsEC-1B for linux-arm-kernel@bombadil.infradead.org; Tue, 04 Jul 2023 16:55:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=eBlzheSDw48Q4xAdgD4AA0EgPd9wuEiKQj7UhuQVIfs=; b=aUWWZ7/IdXWAhy+CjAWKEA7f/W g7RKH8oPTTV+6vXoNPyUVOoTN9r625aWu/USrDIAFmTFlAN/Z4mntTDhPERnOprpEayBwmUOtkWyN 2Uf5lkHnIA8p/ry9YYuf6LIAMYX1CJOLkqaCy98wd5LvOBDnTAjuUmtrmnqMZZ3rsqF6NFoT9F1ev lNMHiSD5THGgULrCI5UGziT1U6pJURQ+gYKvFqqfsXDivDUE0OGSN5AuhenGYC4T+rNMnkYCUZ/Vx uDq82OxzqAbDk01vUgBEvPyL8d5Gg4c76sO+NXPQ0UgQe39rzfBpAFnLAOQw+GVIdIi9+8BoOioaB cEXpmf9g==; Received: from smtp-out1.suse.de ([195.135.220.28]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTC-00AzeM-3D for linux-arm-kernel@lists.infradead.org; Tue, 04 Jul 2023 16:01:41 +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-out1.suse.de (Postfix) with ESMTPS id BD500228A9; Tue, 4 Jul 2023 16:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688486496; 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=eBlzheSDw48Q4xAdgD4AA0EgPd9wuEiKQj7UhuQVIfs=; b=TsiZovlR9LXsagSyDorEadQ267cvse0KdHi6OmLQ0AcVcMvfQEPFW3pJjzP7AEU0fa1R0h ZQeeoVLsUc/oHCYHT3cNKRLYfw2GCwZeQ6MYBEmj8AAFA2Y8CpaR68h5ntqi3eN3LhkTAV kPGxt2vUkzvm06LMy4nziJJgZRb6MqI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688486496; 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=eBlzheSDw48Q4xAdgD4AA0EgPd9wuEiKQj7UhuQVIfs=; b=HW+frkjMzNNmgFhghYOQAcmAlwtp8AZPHiig21sMo8fNtW8WBj4vE5gWFqaWYEa0dFtuOE s0jkYHqjllsWraCg== 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 79BFB133F7; Tue, 4 Jul 2023 16:01:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WAnSHGBCpGTzLwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 16:01:36 +0000 From: Thomas Zimmermann To: javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar Subject: [PATCH 06/10] drm/exynos: Set fbdev flags Date: Tue, 4 Jul 2023 17:50:03 +0200 Message-ID: <20230704160133.20261-7-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704160133.20261-1-tzimmermann@suse.de> References: <20230704160133.20261-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_170139_248805_AC0F6756 X-CRM114-Status: GOOD ( 11.61 ) 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 Set fbdev default flags FBNFO_DEFAULT and mark the framebuffer with FBINFO_VIRTFB. The framebuffer range is in DMA-able memory and should be accessed with the CPU's regular memory ops. Signed-off-by: Thomas Zimmermann Cc: Inki Dae Cc: Seung-Woo Kim Cc: Kyungmin Park Cc: Krzysztof Kozlowski Cc: Alim Akhtar Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 7ca3424b59ce..28dc398d6e10 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -72,6 +72,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, return PTR_ERR(fbi); } + fbi->flags = FBINFO_FLAG_DEFAULT; fbi->fbops = &exynos_drm_fb_ops; drm_fb_helper_fill_info(fbi, helper, sizes); @@ -79,6 +80,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, offset = fbi->var.xoffset * fb->format->cpp[0]; offset += fbi->var.yoffset * fb->pitches[0]; + fbi->flags |= FBINFO_VIRTFB; fbi->screen_buffer = exynos_gem->kvaddr + offset; fbi->screen_size = size; fbi->fix.smem_len = size; From patchwork Tue Jul 4 15:50:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13301433 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 06A00C001B1 for ; Tue, 4 Jul 2023 16:02:20 +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=IiR0IURWzbGfn6lxw4vv8ecQWbX7RZovxiE7uwlWZBQ=; b=FptJpdLWEMxFLn zKV3Zham+iXa9JP0WJHQD4/OxXo1O8FEE/CXa6kGw8Rh+nWM6gqFf6s0FbRyPqSjcBqo+f1aGKNS9 atuTJ/ZO+/JbqanvefhvVUKxe71OXzfyCWB+Yh/w7t6OX4/A+jaSwjIBxlkfoKRi6FzCGpouKCxOc 1YJ9rWeiKumYnr/MdpTdvyTijg5QKGSMSQSdtKxzVY20+urIU251o4Aq4RhEWgJJ0sS62IPGBUW7H pl6s17TZAklITqb//SKlHVJNbAHDsoMw66rU/ms2G2WdZeAVvx35bDycqrSja811XVKRAxa2bUwdK /2UDf1sDFtWysIaBjjTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTP-00DklW-39; Tue, 04 Jul 2023 16:01:51 +0000 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTH-00Dkeb-1J for linux-arm-kernel@lists.infradead.org; Tue, 04 Jul 2023 16:01:45 +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 F3B8A1FE0B; Tue, 4 Jul 2023 16:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688486497; 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=EeqCJa62CjT6jK0krEwAw8+agoz+VI2X7/87e544sR8=; b=Gg6MWKYRq0+T+yi1YSXzNHgL0z93Sy4Avhbidi8jfs9K82A3g2HsQNWJ2gnFV0N0iBr2oq sWJlb5/bUu8jJmnR5M50T85OvENZdW66lgdSQPJRvygLcYShleG2Kix0fRQoty/LjfPKCf o+keH+QOdvp/jL6qT/IhrqGawUrYuWE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688486497; 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=EeqCJa62CjT6jK0krEwAw8+agoz+VI2X7/87e544sR8=; b=h0G05qq/C17mmWNu/F7dL00TF1fOwY7Hj+/iL4RNbuA0nygzpO5jitcNiUe3tpKvWnvOGy vG4f1q+m8WQAB4Bw== 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 C1B80139ED; Tue, 4 Jul 2023 16:01:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UNtfLmBCpGTzLwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 16:01:36 +0000 From: Thomas Zimmermann To: javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH 07/10] drm/omapdrm: Set VM flags in GEM-object mmap function Date: Tue, 4 Jul 2023 17:50:04 +0200 Message-ID: <20230704160133.20261-8-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704160133.20261-1-tzimmermann@suse.de> References: <20230704160133.20261-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_090143_623762_1C791709 X-CRM114-Status: GOOD ( 16.52 ) 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 Use the mmap callback in struct drm_gem_object_funcs to set the VM flags. Replace a number of mmap helpers in omapdrm with their GEM helper counterparts. Generate DRM's file-operations instance with GEM's DEFINE_DRM_GEM_FOPS. Signed-off-by: Thomas Zimmermann Cc: Tomi Valkeinen Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/omapdrm/omap_drv.c | 12 +----------- drivers/gpu/drm/omapdrm/omap_gem.c | 24 ++++++----------------- drivers/gpu/drm/omapdrm/omap_gem.h | 3 --- drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 7 +------ 4 files changed, 8 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index e2697fe80e62..afeeb7737552 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -636,17 +636,7 @@ static int dev_open(struct drm_device *dev, struct drm_file *file) return 0; } -static const struct file_operations omapdriver_fops = { - .owner = THIS_MODULE, - .open = drm_open, - .unlocked_ioctl = drm_ioctl, - .compat_ioctl = drm_compat_ioctl, - .release = drm_release, - .mmap = omap_gem_mmap, - .poll = drm_poll, - .read = drm_read, - .llseek = noop_llseek, -}; +DEFINE_DRM_GEM_FOPS(omapdriver_fops); static const struct drm_driver omap_drm_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 6b58a5bb7b44..c9c64ad17ce6 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -524,26 +524,11 @@ static vm_fault_t omap_gem_fault(struct vm_fault *vmf) return ret; } -/** We override mainly to fix up some of the vm mapping flags.. */ -int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma) -{ - int ret; - - ret = drm_gem_mmap(filp, vma); - if (ret) { - DBG("mmap failed: %d", ret); - return ret; - } - - return omap_gem_mmap_obj(vma->vm_private_data, vma); -} - -int omap_gem_mmap_obj(struct drm_gem_object *obj, - struct vm_area_struct *vma) +static int omap_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) { struct omap_gem_object *omap_obj = to_omap_bo(obj); - vm_flags_mod(vma, VM_MIXEDMAP, VM_PFNMAP); + vm_flags_set(vma, VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | VM_IO | VM_MIXEDMAP); if (omap_obj->flags & OMAP_BO_WC) { vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); @@ -563,12 +548,14 @@ int omap_gem_mmap_obj(struct drm_gem_object *obj, * address_space (so unmap_mapping_range does what we want, * in particular in the case of mmap'd dmabufs) */ - vma->vm_pgoff = 0; + vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node); vma_set_file(vma, obj->filp); vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); } + vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); + return 0; } @@ -1282,6 +1269,7 @@ static const struct vm_operations_struct omap_gem_vm_ops = { static const struct drm_gem_object_funcs omap_gem_object_funcs = { .free = omap_gem_free_object, .export = omap_gem_prime_export, + .mmap = omap_gem_object_mmap, .vm_ops = &omap_gem_vm_ops, }; diff --git a/drivers/gpu/drm/omapdrm/omap_gem.h b/drivers/gpu/drm/omapdrm/omap_gem.h index 4d4488939f6b..fec3fa0e4c33 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.h +++ b/drivers/gpu/drm/omapdrm/omap_gem.h @@ -57,9 +57,6 @@ int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args); /* mmap() Interface */ -int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma); -int omap_gem_mmap_obj(struct drm_gem_object *obj, - struct vm_area_struct *vma); u64 omap_gem_mmap_offset(struct drm_gem_object *obj); size_t omap_gem_mmap_size(struct drm_gem_object *obj); diff --git a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c index 8e194dbc9506..36f9ee4baad3 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c +++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c @@ -64,13 +64,8 @@ static int omap_gem_dmabuf_mmap(struct dma_buf *buffer, struct vm_area_struct *vma) { struct drm_gem_object *obj = buffer->priv; - int ret = 0; - ret = drm_gem_mmap_obj(obj, omap_gem_mmap_size(obj), vma); - if (ret < 0) - return ret; - - return omap_gem_mmap_obj(obj, vma); + return drm_gem_mmap_obj(obj, omap_gem_mmap_size(obj), vma); } static const struct dma_buf_ops omap_dmabuf_ops = { From patchwork Tue Jul 4 15:50:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13301434 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 CEEEBEB64D9 for ; Tue, 4 Jul 2023 16:02:20 +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=eA9r2t+x5LOwwrET9KLKJ7nXnUZAE1gVBqLIcqWGBmQ=; b=qQ/O6T9YmHOetl 3rpDDngzHUKQ9mwj9dt2c4g99DmPEGLud6rlBT+Us4ielIDWK3uMXjzko15eSIajdOG+WVo6l87Q5 O+lQ+dTbWIA7249m8UH0a5ezyIuF7+4F3MF5q8H15vjvZCW6mlMz0pofOBltW8wooJAmD/Hy9+uqY uiG5H54eEcWTEgXfgRjxbtYDORQ/tv7oib748ZUoDRNGAyEdYcn+QDDd35Obwxm/MMJ1avj4cNvsU dz0gUGvFZUZ+s9qQ7X4qxe89BW6+f8LA3Zsg3G3TUOLYLXkEl9fqIPpIY4otI9DzTlg+sW9SbIA9z Osd8DkiJwbtNfg+9eYEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTN-00DkjF-0I; Tue, 04 Jul 2023 16:01:49 +0000 Received: from smtp-out2.suse.de ([195.135.220.29]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTH-00Dkea-1A for linux-arm-kernel@lists.infradead.org; Tue, 04 Jul 2023 16:01:45 +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 3E8921FE3F; Tue, 4 Jul 2023 16:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688486497; 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=FhaqfLTC79UBibhKXwv5TRIh+vukkffyioeUBMsQXl4=; b=KGXeppV9ofUO2y6qAbGBMOFp3EGqrc2HFqcLt4AQfx6vU/fiT+irX85LhnXNY7TFqKDc4o fVKHoE4Di1sQvje4E7pRc189cIBzzE/rSKUUW3T/1uN7JsJrrGYay/sYtD/Y/lLyM6T/pK KJcbfI3wuhp/RA9bode5kGnm/JQthLc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688486497; 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=FhaqfLTC79UBibhKXwv5TRIh+vukkffyioeUBMsQXl4=; b=z75jyoUUfUIrS9SQBtS9V4N0jHkNyuu+Wn+S/N4wcyEWO9lJ3F1KqFShl20JWo7IESULAu OqKt/zLQ0UfxOBDA== 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 046A7133F7; Tue, 4 Jul 2023 16:01:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6AY+AGFCpGTzLwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 16:01:37 +0000 From: Thomas Zimmermann To: javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH 08/10] drm/omapdrm: Use GEM mmap for fbdev emulation Date: Tue, 4 Jul 2023 17:50:05 +0200 Message-ID: <20230704160133.20261-9-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704160133.20261-1-tzimmermann@suse.de> References: <20230704160133.20261-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_090143_564674_BDD58552 X-CRM114-Status: GOOD ( 15.34 ) 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 The fbdev emulation currently uses fbdev's default mmap code, which has been written for I/O memory. Provide an mmap that uses GEM's mmap infrastructure. Utilize fine-grained fbdev macros to initialize struct fb_ops. The macros set the read/write and the draw callbacks for DMA memory. Set the fb_mmap callback to omapdrm's new mmap helper. Also select the correct Kconfig token for fbdev's DMA helpers. Note that the DMA helpers are the same as for system memory. Signed-off-by: Thomas Zimmermann Cc: Tomi Valkeinen Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/omapdrm/Kconfig | 2 +- drivers/gpu/drm/omapdrm/omap_fbdev.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig index b4ac76c9f31b..d3c4877e465c 100644 --- a/drivers/gpu/drm/omapdrm/Kconfig +++ b/drivers/gpu/drm/omapdrm/Kconfig @@ -4,7 +4,7 @@ config DRM_OMAP depends on DRM && OF depends on ARCH_OMAP2PLUS select DRM_KMS_HELPER - select FB_SYS_HELPERS if DRM_FBDEV_EMULATION + select FB_DMA_HELPERS if DRM_FBDEV_EMULATION select VIDEOMODE_HELPERS select HDMI default n diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index b7ccce0704a3..b1a2d00ef52d 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -76,6 +76,15 @@ static int omap_fbdev_pan_display(struct fb_var_screeninfo *var, return drm_fb_helper_pan_display(var, fbi); } +static int omap_fbdev_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) +{ + struct drm_fb_helper *helper = info->par; + struct drm_framebuffer *fb = helper->fb; + struct drm_gem_object *bo = drm_gem_fb_get_obj(fb, 0); + + return drm_gem_mmap_obj(bo, omap_gem_mmap_size(bo), vma); +} + static void omap_fbdev_fb_destroy(struct fb_info *info) { struct drm_fb_helper *helper = info->par; @@ -97,14 +106,16 @@ static void omap_fbdev_fb_destroy(struct fb_info *info) static const struct fb_ops omap_fb_ops = { .owner = THIS_MODULE, - FB_DEFAULT_SYS_OPS, + __FB_DEFAULT_DMA_OPS_RDWR, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_setcmap = drm_fb_helper_setcmap, .fb_blank = drm_fb_helper_blank, .fb_pan_display = omap_fbdev_pan_display, + __FB_DEFAULT_DMA_OPS_DRAW, .fb_ioctl = drm_fb_helper_ioctl, - .fb_destroy = omap_fbdev_fb_destroy, + .fb_mmap = omap_fbdev_fb_mmap, + .fb_destroy = omap_fbdev_fb_destroy, }; static int omap_fbdev_create(struct drm_fb_helper *helper, From patchwork Tue Jul 4 15:50:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13301501 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 5EE90EB64D9 for ; Tue, 4 Jul 2023 16:55:28 +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=0+4clQr8g78gGseMIyKw7uJBqSuqi8RBg2xLO4tYYMQ=; b=rvojv+FMPrse+F DwsGqmH0HuMrTCC6Xv6xb3t8eBquQp+LU2xwcXtmVmCtfsenuaTOSh+eprzsIrMpwRsX9EnsijMsN JHpCYp0+95g8W6OodMEkk1WDUMgM45OCsZQlgMY/so8nKVUgNJyP3016YH4d+K0NBE+ItEOCO0OoM qNVw+uAWh5bS7Lc9RTRP/jK4ZUbjGeKqtvjipVyWwfth/MCYqYRVDirY7aY1Sz+JfnkSuhclyf1I4 AXeeHg6Q+wO0JO6eYYWLN3quqrLzRBcQndxysV7qCQA2olIzczGP+BpaZuj9n9VYkOUcEuPTJfOEI kHkv9iWuhwm+kKd1OdTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGjIq-00DsAs-2e; Tue, 04 Jul 2023 16:55:00 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGjIn-00DsAf-1u for linux-arm-kernel@bombadil.infradead.org; Tue, 04 Jul 2023 16:54:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=e76bu1daEheBjGdpEyMYZAPb0mKF+Y+BPHVIDSFcmNA=; b=SmWKfxUbchlAwd1nJsvw1IF2Oz bTBnHfSZLDGt6YFi4XYzHj8So4QaGVXkU4d1QJU9Iw7GP68bXXUYoMfuh+g+PzKokIQeD8uE15wfB k98qBpsoKmOccgWH+6QUgfGdxqZ1NixLw7VMCmrhux0qMoJi/TwyGUReZbrIMKX/sMCRnpo/ADrxg bP4+VBmtWQG2+e2cqF4+iYTppJkyVg4WGW6jVKdmtsJJ8VNxJayvAxo+yGKjlADFy95LqjDrhvdrH 6l6sf6bQXU9uw3bEmF3qdYAy6r2ZGTtkWLIRFaGaygAbSPksbkeTKyOfOKE0dKhyVyAy7eV0/KaX6 JJ+Nsnbg==; Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTD-00AzeP-0f for linux-arm-kernel@lists.infradead.org; Tue, 04 Jul 2023 16:01:42 +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-out1.suse.de (Postfix) with ESMTPS id 7A8B6228B2; Tue, 4 Jul 2023 16:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688486497; 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=e76bu1daEheBjGdpEyMYZAPb0mKF+Y+BPHVIDSFcmNA=; b=R+VKWJ3PuIiRh9QL36PegocvI9fbr90gL9CHh3UxwY8ytQpMx+3vaNpCk4UXGw3ZpA7BCL 70+vfsq69iSkQU3Av3HLWLsFKT+nfqCfEXSbpMgUUuRIPj4jZI7zkMEOzCk9blFzRwRJqL qqXReBhZetjmeb8fYoSUa6e9AGodeVo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688486497; 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=e76bu1daEheBjGdpEyMYZAPb0mKF+Y+BPHVIDSFcmNA=; b=EuU2w4T/d9ejIVQ5io5J/YZsPK1ttIyz7YJ9PSLF0n/GcNXASRYqFASvgDEIl/1Loc8pYR wZNKIKX953uhuUBg== 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 43ED8133F7; Tue, 4 Jul 2023 16:01:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WD6vD2FCpGTzLwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 16:01:37 +0000 From: Thomas Zimmermann To: javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH 09/10] drm/omapdrm: Set fbdev flags Date: Tue, 4 Jul 2023 17:50:06 +0200 Message-ID: <20230704160133.20261-10-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704160133.20261-1-tzimmermann@suse.de> References: <20230704160133.20261-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_170139_396834_A978EA44 X-CRM114-Status: GOOD ( 10.68 ) 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 Set fbdev default flags FBNFO_DEFAULT and mark the framebuffer with FBINFO_VIRTFB. The framebuffer range is in DMA-able memory and should be accessed with the CPU's regular memory ops. Signed-off-by: Thomas Zimmermann Cc: Tomi Valkeinen Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index b1a2d00ef52d..2dd86e6f5268 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -203,10 +203,12 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, helper->fb = fb; + fbi->flags = FBINFO_DEFAULT; fbi->fbops = &omap_fb_ops; drm_fb_helper_fill_info(fbi, helper, sizes); + fbi->flags |= FBINFO_VIRTFB; fbi->screen_buffer = omap_gem_vaddr(bo); fbi->screen_size = bo->size; fbi->fix.smem_start = dma_addr; From patchwork Tue Jul 4 15:50:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13301431 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 9A445EB64DA for ; Tue, 4 Jul 2023 16:02:17 +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=7ryrJUfySeiqYld5QTjuhq7OKmTBF12Y9HNCCIDukqY=; b=wUM4T30dGkGgI7 oeWKwbbtELdrVHevhb0PuzqA+b8tCl41ax/HBxR6kuCSVv6TtwLWvo1fFkZlpmYspknMwSla36zdn 4BPLODkLJ0ghiZ8RNpPMv+vVZ8FB8w57gV4FaU5A9jdK0vx36POYliva0/UZScdAgFat6bD2DMwZw UFkU3LRbsABJgKxOGmNUFbg+RzBjRgEpWrdRLEmmGX3cR5QONjo46g1BEQDJTture7XZtJcXs+Ta4 gySqFA7EywK8L/wjvjjaMqXf85xQbYQmvUa/Gz7jLBJUAP6aFqU27tNdgV1t/I3Ro3+U4E/uMgHVz PQ3Y6JZq0ArkEUxod+wA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTK-00Dkgj-07; Tue, 04 Jul 2023 16:01:46 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTG-00Dke8-2c for linux-arm-kernel@bombadil.infradead.org; Tue, 04 Jul 2023 16:01:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=IfwJgZyv25fxiVPt+iHQRuM1nZU+g6MMG8wm6mkt5SY=; b=ZGpSqz9Ro3rcMBbjzilmQYPaZi LApbrxuXhT19b5fKlO0nV/1e1/VAtrcJMAHl47BlXoM8aXcKR5hh5+gbby2Z1jDOSiYc8MKsM/qnu MIYa5G1OUNt/Q2SfQ8iG5JZXsmbnKgrjSDIoGKwrfLlUtqDNxr3oI4nEm0z9HkoBwUreo5PdWXafN hw8lU4pzt83yOSHaRACtj0XaFLBq19usq/nJyGU/zXUFDEm0jNeh0Wg9zHO0h5wgi2LbH/fmvWFEq i0QhawNrcA9DI2r3MZ/z7Gho/s2cWxGWmCqwWttpu+AGvjU/0mSTMDIfZCTN8GtDE/lZPIvYEPhGJ lUOQmDLQ==; Received: from smtp-out1.suse.de ([195.135.220.28]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGiTD-00AzeS-0J for linux-arm-kernel@lists.infradead.org; Tue, 04 Jul 2023 16:01:41 +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-out1.suse.de (Postfix) with ESMTPS id B6F30228A8; Tue, 4 Jul 2023 16:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688486497; 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=IfwJgZyv25fxiVPt+iHQRuM1nZU+g6MMG8wm6mkt5SY=; b=UicRG1HJiXmMFkgsLRTd1l5SC+SVv4dVJTlVfDnrGzShNVLTm2IWhonLrvJardHroRUY3B CV5BF7Yg6PnP2ee16FRLHZ9Dm7Xux14XOiZ8JV9M3LGsPdMHgEjTMSGOiqRabeDXKrZqX5 aWMJmzsLKpHw2wbGnwOaGhcrLGOBW7o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688486497; 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=IfwJgZyv25fxiVPt+iHQRuM1nZU+g6MMG8wm6mkt5SY=; b=ZSqriK1WLiZyG9FfQQknzF9dhWWA0xjFDZICN6JlsEVTJpFPebmXy3+lX8vU6wcYhHSmhN NpIYxH70VLLb72CA== 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 7F5B7133F7; Tue, 4 Jul 2023 16:01:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UEIdHmFCpGTzLwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 16:01:37 +0000 From: Thomas Zimmermann To: javierm@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller Subject: [PATCH 10/10] fbdev: Remove FB_DEFAULT_SYS_OPS Date: Tue, 4 Jul 2023 17:50:07 +0200 Message-ID: <20230704160133.20261-11-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704160133.20261-1-tzimmermann@suse.de> References: <20230704160133.20261-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_170139_312140_42AD8EBD X-CRM114-Status: GOOD ( 10.29 ) 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 Remove the initializer macro FB_DEFAULT_SYS_OPS and its helper macro __FB_DEFAULT_SYS_OPS_MMAP. There are no users. Signed-off-by: Thomas Zimmermann Cc: Helge Deller (maintainer:FRAMEBUFFER LAYER) Reviewed-by: Javier Martinez Canillas --- include/linux/fb.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/linux/fb.h b/include/linux/fb.h index 1191a78c5289..d370f84fbca9 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -586,14 +586,6 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, .fb_copyarea = sys_copyarea, \ .fb_imageblit = sys_imageblit -#define __FB_DEFAULT_SYS_OPS_MMAP \ - .fb_mmap = NULL /* default implementation */ - -#define FB_DEFAULT_SYS_OPS \ - __FB_DEFAULT_SYS_OPS_RDWR, \ - __FB_DEFAULT_SYS_OPS_DRAW, \ - __FB_DEFAULT_SYS_OPS_MMAP - /* * Helpers for framebuffers in DMA-able memory */