From mboxrd@z Thu Jan 1 00:00:00 1970 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 E095BC433EF for ; Wed, 22 Jun 2022 07:39:08 +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-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=b68T6LWnf4vlaZrwJ9YIQ14ldQvJgTHFYuRNepdFNmU=; b=EevgplZhia38c5T8cWcc0ECgxb PBzlB95Er/kzbGILclk6OftjirzLI9WCLOK918lWqCK9od/4aawothZcny+2YjPGckviDDRmjtYtg R6A4+GCkPPR8eG92WK93DenIrOWEmoVgFkWId5or+CH5i/6o9BSUuq8HLALTkjiQBO1FYC1VqoRmM XbhQfb5UWE3btG4G7LTiidpVkHxQon5bQDzehJDtfwqCfgUe5qc9Hl7U8dt0saj1DhJwS3QbKyeKV RRWZ6hPA8VGbn7d14k4IxCbStIJpch1+bSyu0Oxp+iuVuXVMtHqmJuXwh52EJJ+GyDBAgUgdl/dN9 HAC127aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3uwE-00953S-F0; Wed, 22 Jun 2022 07:38:10 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3uw9-00952K-UB for linux-arm-kernel@lists.infradead.org; Wed, 22 Jun 2022 07:38:07 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 477DB5C00FC; Wed, 22 Jun 2022 03:38:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 22 Jun 2022 03:38:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1655883485; x=1655969885; bh=Cn6Z2/p9SO EAnDYDOhTo2hgXRX/uuhVY54GGM0ULJDw=; b=DA/ngi2a9qaz8ulm8WmNEkiUu2 RedJpyOR7IZNZOztxMmZDhGdT/qWo3HXsJFLIHoLkMxrpwVFYXruscBQVWZR1RjW KmeQBWBDgf8NGjLa0n4XoPuu4wjRBHuOuc2QZ8kxvlG8IKPaRTd7ZUUsgksNYOS2 Tkrbd+yqsefy+rGUcxgEnjGLA0Vu7eQpZlyywN7VPBo0H+5LVUpe9bhI6Bf0l03D 06OleAholZGW4cZpCgnzm8KM2WRgeXkZYr4gNOGbptrA0j53mPq5TZ6OCJ6mWc52 5g6YnE4fqpNecJK5saU1Abf12YIWVsZu9mrms7o1+NLSv+DNi/yxG5fy+uoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1655883485; x=1655969885; bh=Cn6Z2/p9SOEAnDYDOhTo2hgXRX/u uhVY54GGM0ULJDw=; b=ubw0mNuagzWqjF49CTycXdreJzpRYvW2/0Y/wkiagD2p oIU2fuVhbP8zFGtxmA12S2N0N49e+AmbtocvC4WHR1KErspQS80fdzV4Et+Sr4r3 Kbn8Oc+XlD3Wn4K/2Z/mgwTzVyz6fXfu4tQ87wgyym5sxpWXHTIODNaHeEp9XB30 h6AKudFamehCS5bdl7nrTE62WcNbCiBH8L/ZwyNL+lwpd0ux4B/gCo2YD4gW1QTU HEt9Zs8DKUJeNsobJ+ksxucnqIbqlvwml+fTpYO0uEjdJcy6RJrWopLpYx6sKXB6 yUzHJuo5E3Qby1ns7ol6OXCQ3bNnavuxZ3qFe9y/AA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudefgedguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpeforgig ihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrf grthhtvghrnhepteefffefgfektdefgfeludfgtdejfeejvddttdekteeiffejvdfgheeh fffhvedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Jun 2022 03:38:04 -0400 (EDT) Date: Wed, 22 Jun 2022 09:38:03 +0200 From: Maxime Ripard To: Robin Murphy Cc: Jernej Skrabec , wens@csie.org, airlied@linux.ie, daniel@ffwll.ch, samuel@sholland.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] drm/sun4i: Add DMA mask and segment size Message-ID: <20220622073803.34awgg6lm3ps6xmx@houat> References: <20220620181333.650301-1-jernej.skrabec@gmail.com> <45ef3221-8f27-0ae7-8cd9-48575812d797@arm.com> MIME-Version: 1.0 In-Reply-To: <45ef3221-8f27-0ae7-8cd9-48575812d797@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220622_003806_092802_5ACBD7F0 X-CRM114-Status: GOOD ( 23.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: , Content-Type: multipart/mixed; boundary="===============5712014432766295096==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============5712014432766295096== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="hp2rj7odld5eb4tp" Content-Disposition: inline --hp2rj7odld5eb4tp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Robin, On Tue, Jun 21, 2022 at 01:44:44PM +0100, Robin Murphy wrote: > On 2022-06-20 19:13, Jernej Skrabec wrote: > > Kernel occasionally complains that there is mismatch in segment size > > when trying to render HW decoded videos and rendering them directly with > > sun4i DRM driver. Following message can be observed on H6 SoC: > >=20 > > [ 184.298308] ------------[ cut here ]------------ > > [ 184.298326] DMA-API: sun4i-drm display-engine: mapping sg segment lo= nger than device claims to support [len=3D6144000] [max=3D65536] > > [ 184.298364] WARNING: CPU: 1 PID: 382 at kernel/dma/debug.c:1162 debu= g_dma_map_sg+0x2b0/0x350 > > [ 184.322997] CPU: 1 PID: 382 Comm: ffmpeg Not tainted 5.19.0-rc1+ #13= 31 > > [ 184.329533] Hardware name: Tanix TX6 (DT) > > [ 184.333544] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BT= YPE=3D--) > > [ 184.340512] pc : debug_dma_map_sg+0x2b0/0x350 > > [ 184.344882] lr : debug_dma_map_sg+0x2b0/0x350 > > [ 184.349250] sp : ffff800009f33a50 > > [ 184.352567] x29: ffff800009f33a50 x28: 0000000000010000 x27: ffff000= 001b86c00 > > [ 184.359725] x26: ffffffffffffffff x25: ffff000005d8cc80 x24: 0000000= 000000000 > > [ 184.366879] x23: ffff80000939ab18 x22: 0000000000000001 x21: 0000000= 000000001 > > [ 184.374031] x20: 0000000000000000 x19: ffff0000018a7410 x18: fffffff= fffffffff > > [ 184.381186] x17: 0000000000000000 x16: 0000000000000000 x15: fffffff= fffffffff > > [ 184.388338] x14: 0000000000000001 x13: ffff800009534e86 x12: 6f70707= 573206f74 > > [ 184.395493] x11: 20736d69616c6320 x10: 000000000000000a x9 : 0000000= 000010000 > > [ 184.402647] x8 : ffff8000093b6d40 x7 : ffff800009f33850 x6 : 0000000= 00000000c > > [ 184.409800] x5 : ffff0000bf997940 x4 : 0000000000000000 x3 : 0000000= 000000027 > > [ 184.416953] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000= 003960e80 > > [ 184.424106] Call trace: > > [ 184.426556] debug_dma_map_sg+0x2b0/0x350 > > [ 184.430580] __dma_map_sg_attrs+0xa0/0x110 > > [ 184.434687] dma_map_sgtable+0x28/0x4c > > [ 184.438447] vb2_dc_dmabuf_ops_map+0x60/0xcc > > [ 184.442729] __map_dma_buf+0x2c/0xd4 > > [ 184.446321] dma_buf_map_attachment+0xa0/0x130 > > [ 184.450777] drm_gem_prime_import_dev+0x7c/0x18c > > [ 184.455410] drm_gem_prime_fd_to_handle+0x1b8/0x214 > > [ 184.460300] drm_prime_fd_to_handle_ioctl+0x2c/0x40 > > [ 184.465190] drm_ioctl_kernel+0xc4/0x174 > > [ 184.469123] drm_ioctl+0x204/0x420 > > [ 184.472534] __arm64_sys_ioctl+0xac/0xf0 > > [ 184.476474] invoke_syscall+0x48/0x114 > > [ 184.480240] el0_svc_common.constprop.0+0x44/0xec > > [ 184.484956] do_el0_svc+0x2c/0xc0 > > [ 184.488283] el0_svc+0x2c/0x84 > > [ 184.491354] el0t_64_sync_handler+0x11c/0x150 > > [ 184.495723] el0t_64_sync+0x18c/0x190 > > [ 184.499397] ---[ end trace 0000000000000000 ]--- > >=20 > > Fix that by setting DMA mask and segment size. > >=20 > > Signed-off-by: Jernej Skrabec > > --- > > Changes from v1: > > - added comment > > - updated commit message with kernel report > >=20 > > drivers/gpu/drm/sun4i/sun4i_drv.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > >=20 > > diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/= sun4i_drv.c > > index 275f7e4a03ae..f135a6b3cadb 100644 > > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c > > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c > > @@ -7,6 +7,7 @@ > > */ > > #include > > +#include > > #include > > #include > > #include > > @@ -367,6 +368,13 @@ static int sun4i_drv_probe(struct platform_device = *pdev) > > INIT_KFIFO(list.fifo); > > + /* > > + * DE2 and DE3 cores actually supports 40-bit addresses, but > > + * driver does not. > > + */ > > + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); > > + dma_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); >=20 > Nit: this one is a number, not a bitmask, so UINT_MAX would be more > appropriate semantically. Thanks for the suggestion, I've fixed it while applying Maxime --hp2rj7odld5eb4tp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYrLG2wAKCRDj7w1vZxhR xVqLAP908SepTKlaW7ljl34wwmEyK8rFL3xIkpMke8JZsv1LzQD/VH5C1zsAONBE tvabgS329bcFnEQzeo2rWq9zDbyuDAM= =SM9K -----END PGP SIGNATURE----- --hp2rj7odld5eb4tp-- --===============5712014432766295096== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============5712014432766295096==--