From patchwork Thu Feb 22 15:41:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204824 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp24629dyb; Thu, 22 Feb 2024 07:42:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVJctAVE3950C/Q9ZB50P5G86xqVhFymS3InSBTBNn9pDNYDz3svbRAcIz9jeW5o+M+5ppbnOIXDS2VZRBRR1OWaJVQZw== X-Google-Smtp-Source: AGHT+IGAbGzQ5IQGg3OcPoUMbddkE72GoTxPYwlCInAW4rl1piJJ7bCdIJSce7yqS1Zh1pN4EJol X-Received: by 2002:a17:906:e2cb:b0:a3f:175b:ea91 with SMTP id gr11-20020a170906e2cb00b00a3f175bea91mr4735334ejb.13.1708616555896; Thu, 22 Feb 2024 07:42:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708616555; cv=pass; d=google.com; s=arc-20160816; b=JjiBQ8fvt2+u0ROnLqS1kTcjy30xRV67gSOXzp1ja84mje/nK4DnRc6BZ5T5vWvKI2 ZWk2b5Ue7qzQuS9CPZM5IlOI7GXQkyeXQU3aP+8wSYdd0WPtxDuaPOj4tg3hZwMffIha nDtbB3Jq+whi+kSUlBDiQwyzT+gP49IGBv7emI24XbBSuLNboGyEs6CbN1oCv8YQrL+2 QuB8jr+ye62u1Ho9cOYlkbIhOg/CwYhitvltkwn2L0tWy1lgfBOQjKcji1NFhV3s67vv 5Wlrm6PsAPlQi1LfQcK6hLeFfnsBBhmoSAN1sMuc8/JYi52YsXQLJYazGC0Nraqx+Q8Y FTMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9eIuDrb97tVunrO7xcRol8+vKXsVHalaYdUrzl+TA84=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=WbOpkN8aOEQvvlsK6ExssibzdwjwvSNDWrTIOvjD6rUOwgpf0USdp7s8SYX9ecF4qX G42tS8CkGlCCUYoMAhe5ocDNuxwXGKHh2GQeh5vi5rrnhzTv/jjQYFk/f5H70tL89p5n mdt6O7FrMrsRaj05JbzECgkNPCv/L4fxD0AydS8IwixeBUx3lSWXtrPnK8jUZzRhJC7S MaBtFefHqtycvrj9q21uwR4hyXT9Kt/xLRTcMmaQvg2YkbHiaTB6oYkwmFqWYcAIYAq6 g/CFLtaxk/jMuJpJcyE09eqpGTbwrKL8WmXXSwC0YOaPeDUc+ztv57rRkw5a1i3y4Vry pf5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pJHhs7lb; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76797-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76797-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p27-20020a1709060e9b00b00a3e6f79e9f9si4279204ejf.659.2024.02.22.07.42.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:42:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76797-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pJHhs7lb; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76797-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76797-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6B0971F27249 for ; Thu, 22 Feb 2024 15:42:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DC071534F6; Thu, 22 Feb 2024 15:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pJHhs7lb" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C95B0152DF4; Thu, 22 Feb 2024 15:41:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616492; cv=none; b=MGXlmT4Fh3tsV+P5QxUCTZA+bPJQf8k7jx9lVkjdHM75xqYRMQduDXi+GPy1pVcao0w0YPcVhFfKveVpuZhU7Hy9Lvp3BP2f80A4zZk78pAxCUju7/OMubWisR8YYhd2BVyG5ABwMk1C8FEXzg+EMQicllaSL6oSj2yoKDSa1A4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616492; c=relaxed/simple; bh=xCIGBwYX6XIyecIkEgq00nSGxn+xtBAV0Xn4DI4lFRE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BwqW9tsMt9uvoYI09W53TAz0DJthhr38MQECVM+5J3FrI7tT1xFlpTpOyPEvxrFK3AOQ0TLGUPKQbXbs19BDm3xPuWyv0JVRLg2Ji86H6ciy+F11WlpnuqfgrHzXSq6UZ/j4zFHKCi/3zGEIeliRBvn6kBQTudhUZUWhTqfDX1o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pJHhs7lb; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AB80C43390; Thu, 22 Feb 2024 15:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616492; bh=xCIGBwYX6XIyecIkEgq00nSGxn+xtBAV0Xn4DI4lFRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJHhs7lbcCFk6UhjYW0wfrz8wcaLvrooR3gSmQxaayS7Sh4/AjqZeRw3hBjMXCEvL 1VzZxJIhdEXWO2U3HCUkWX4Eqq3Ao6MkESVptlhbSp1xaao6k6jbMQqq7x7q3YQAk/ T3JMH2d47sIiA/cjr4RcPUiw8u7MWM19rC/DqOet+LpAmb0443YJsoYOzpdSJl28aX GmUV8fLYij3E8YVd76XEa0xITi/eND1F23dNO7hol5Cfy598RficTVlU5nx+Bf8/R7 MeVQqHDOZENPkIAr8Lh9DraCSOP6JtZPf6iKlel0mtsAyzMECXuV2UES7u4KcpqEDZ p1EfRNUwaDA/g== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 01/12] soc: mediatek: cmdq: Fix typo of CMDQ_JUMP_RELATIVE Date: Thu, 22 Feb 2024 15:41:09 +0000 Message-Id: <20240222154120.16959-2-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614313395156414 X-GMAIL-MSGID: 1791614313395156414 For cmdq jump command, offset 0 means relative jump and offset 1 means absolute jump. cmdq_pkt_jump() is absolute jump, so fix the typo of CMDQ_JUMP_RELATIVE in cmdq_pkt_jump(). Fixes: 946f1792d3d7 ("soc: mediatek: cmdq: add jump function") Signed-off-by: Chun-Kuang Hu Reviewed-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-cmdq-helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index b0cd071c4719..0b2e5690dacf 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -14,7 +14,8 @@ #define CMDQ_POLL_ENABLE_MASK BIT(0) #define CMDQ_EOC_IRQ_EN BIT(0) #define CMDQ_REG_TYPE 1 -#define CMDQ_JUMP_RELATIVE 1 +#define CMDQ_JUMP_RELATIVE 0 +#define CMDQ_JUMP_ABSOLUTE 1 struct cmdq_instruction { union { @@ -397,7 +398,7 @@ int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr) struct cmdq_instruction inst = {}; inst.op = CMDQ_CODE_JUMP; - inst.offset = CMDQ_JUMP_RELATIVE; + inst.offset = CMDQ_JUMP_ABSOLUTE; inst.value = addr >> cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan); return cmdq_pkt_append_command(pkt, inst); From patchwork Thu Feb 22 15:41:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp26517dyb; Thu, 22 Feb 2024 07:46:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXjYYEIxdo51mRiOZnpvEHhamnXG7K5is420Kqsbr2ER551OqU37iNCiIP3lnMahGhd6haYMEoAjEm0DnwgMwcO7wZwKA== X-Google-Smtp-Source: AGHT+IH7MDhINMlW02E91S/PhJFun/cJ7SG25pfT3LDe7kCFfHAu+9UPD91g9O6t91nv5UyolBDU X-Received: by 2002:a05:6358:d391:b0:178:a555:c312 with SMTP id mp17-20020a056358d39100b00178a555c312mr21042551rwb.32.1708616776913; Thu, 22 Feb 2024 07:46:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708616776; cv=pass; d=google.com; s=arc-20160816; b=MmoW0frYJ5GcnKXdYIpcOWXEYifNbrD8oImSRcZX5LGbLz+EznsHaXGWwWObTZMtht dbKNN9NX0NRZC0PxGpkX34dRH+QQIN8BGUQq1X1X/ufvRIFQqi4h710qxtzbrSJa62uG DG9+5gyNkmt+mEhh+cxZ8A2tKm5zW9IsWSdIszeJnEqGkI1kTIUf1S7dija4dHSwqQO1 EgFyODUnY3E1PvykDR5Ev+HRyWV8YU5MpAVNPne2XvDWBIZ1LWy5bAfWgIDjfDaChK9H p38HhnQtmMseol7HNDjpyMQFHL1yLsUoyiOeRIG5WygEsO8TiAqRN4MrF8QnwC2CDULO wKuA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Uy9W0eC2DM+jsJntcnJJQTqaXwEfCNzBzC9jlP8GIlk=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=SQGUiw5QGeoITw41KUKc0D6r+EOzDIcEwkxoYH8E82fMb638bYgeFVB3K39ocGTvOM LiqsDY6yWuMI2gN7keTY7GcPT30uLLdbKrKjNx86SfQ9+YF7cMje7EigRsQTakAXdWPg 9RCgVa5slESiiGn3IO4xU5lX3DP4I2gJpBT3w5n19TUZdJ6R7Juz7zA4AWAPilfehfqq ilNVylxNwYclXy79SwU6bCIOxtaZ7hFG+myrtGrR7XR9Lbtn0kZe3M9BXHTcbkpZNzGN 8eipZyfL1d5YgJj/hMJLQDQtftz46zlYIe51PzEyvHwfjAnMAlTHUcMXrsBdGCapsb+y 64JA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tiBlVyOC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76798-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76798-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k21-20020a6568d5000000b005cdfd4aa8b3si10233893pgt.193.2024.02.22.07.46.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:46:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76798-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tiBlVyOC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76798-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76798-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CC033B26909 for ; Thu, 22 Feb 2024 15:43:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6012A153BD7; Thu, 22 Feb 2024 15:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tiBlVyOC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4C871534F8; Thu, 22 Feb 2024 15:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616495; cv=none; b=dnbE0XTukdQMKwQ2SSKuZQvlXuCM1HHgJxjd7URlII+HfikkXXouBeGYlaWybazL4TI79QGRLjPocW72Su337xQi6FlTh5NBmzABiDB+TvExAZ5a02IBlU97Y+RZyyzQmisSXBvz24MSIs6kymsHiFwqw6q/uqqiDTIEPvdTakI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616495; c=relaxed/simple; bh=RuWY1cv8Dhz18Wxup/ZL/5dm4lWX9+YTDfCxalcnNUo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Elcb0XDhVdJKPCtyf8OH2MWHrGJnPgnKbF8cW/UpWWtwwwNl03R9ieCqRVzhzLYkAE5I7DLHTVffCc/PHfh9KYqA6sDZTZQu+ZDvwGFtzysATsUkPK8MRbV+hWNpkVVUNo6uTWV/Zv7XDHQvSlz2VnuYKN+qTVWg1TycCU34sXs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tiBlVyOC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5700C43394; Thu, 22 Feb 2024 15:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616495; bh=RuWY1cv8Dhz18Wxup/ZL/5dm4lWX9+YTDfCxalcnNUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tiBlVyOCYtJPgJOPH/yQz3yHhsu5izAVu0rXFmi6w6IQTdn8PtsC8zim0x2V6KkLn gFG1gOFuwAKXl+Rp3793LnwLN268Tqmd38WhnUKQL0CrQN59BgC49LbtWhMxfYs87B TAYruJfJ/809V40bGe6y4NHi/Cf8AwxlYazgBLacAuyNQDdUjXyRF22XftDqeekqjV e02JE4zBp0nyDnjUCLKau6xDlPHsswTho8YevEGNB5ABJy/T7UO8Fib5hKNBMidEha SWDtS3AHAMQfcThlt1R1u6kw9JwECb30RwkQkRwT0EfAFBVTOR1yv3cOoKHKRX5kdU pmzIdAqmVsXiw== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 02/12] soc: mediatek: cmdq: Add parameter shift_pa to cmdq_pkt_jump() Date: Thu, 22 Feb 2024 15:41:10 +0000 Message-Id: <20240222154120.16959-3-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614545778132563 X-GMAIL-MSGID: 1791614545778132563 In original design, cmdq_pkt_jump() call cmdq_get_shift_pa() every time to get shift_pa. But the shift_pa is constant value for each SoC, so client driver just need to call cmdq_get_shift_pa() once and pass shift_pa to cmdq_pkt_jump() to prevent frequent function call. Signed-off-by: Chun-Kuang Hu --- drivers/soc/mediatek/mtk-cmdq-helper.c | 5 ++--- include/linux/soc/mediatek/mtk-cmdq.h | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 0b2e5690dacf..3380e56dd69b 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -393,14 +393,13 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value) } EXPORT_SYMBOL(cmdq_pkt_assign); -int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr) +int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) { struct cmdq_instruction inst = {}; inst.op = CMDQ_CODE_JUMP; inst.offset = CMDQ_JUMP_ABSOLUTE; - inst.value = addr >> - cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan); + inst.value = addr >> shift_pa; return cmdq_pkt_append_command(pkt, inst); } EXPORT_SYMBOL(cmdq_pkt_jump); diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index 649955d2cf5c..72adfd867cd9 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -253,10 +253,12 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value); * a physical address which should contains more instruction. * @pkt: the CMDQ packet * @addr: physical address of target instruction buffer + * @shift_pa: shift bits of physical address in CMDQ instruction. This value + * is got by cmdq_get_shift_pa(). * * Return: 0 for success; else the error code is returned */ -int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr); +int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa); /** * cmdq_pkt_finalize() - Append EOC and jump command to pkt. @@ -374,7 +376,7 @@ static inline int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value) return -EINVAL; } -static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr) +static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) { return -EINVAL; } From patchwork Thu Feb 22 15:41:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204826 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp25116dyb; Thu, 22 Feb 2024 07:43:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWgw0UFOp3RB9t1qzMPBeMRymnS987tWs/+BdgY4M7Fb0i0IecdUepSFK2Trh0OuCcVJ+7cKOyokkw/ofINJ1GaJI2sDw== X-Google-Smtp-Source: AGHT+IFNfaf6n2RkIj55QYLAEf3rSTAwVSQyMsq4QPHMThRfwH/ZVdG1Z17p1TQk7P8WAmFx0DaT X-Received: by 2002:a05:6512:242:b0:511:75a7:1513 with SMTP id b2-20020a056512024200b0051175a71513mr12892866lfo.67.1708616610209; Thu, 22 Feb 2024 07:43:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708616610; cv=pass; d=google.com; s=arc-20160816; b=Iiyt+dRSoKZrOt/reBqvXUSo/CEW/jbor1SxAGLKl657NdnKlOZpt3xejC2aAH8k+l 8vX/fdOCTJyOrpMUetF/OmHCJeGTEAPztqQl8pdysC6kJtxcPjm1hwPeGvUoAQXEs9i3 /96fRllpbc4bs6Scica7Har8BU8W8cseuXpyrufzrnFElJiDn3I5QfWOYSrW4GVP1J2h Qq3tvpPIFejXRtrcI3Pn5Kp2rMrFxGfAdVYGBdRgkcW5NwMzs4Y0Zdul/uBMo4rFFMYm I4CIPjZAn9RDclB6c5hpaiRYL1Ta+SCHiQ7IfznCwarpt11pvvmlbk56VMpT3SxDA164 dRQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tibavudpFNMz4Vu/p5JkrX7wcDRf9WI90wwL3kzLuxM=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=gOBAIaCNHZ+fmdtY+vvkxaKXda648M2gqxOpissL3rdZTX9+qelcv9rmneH6HsLIYE SyBkgLCYpZuNdJqi6ibjPwcVl+0W1BK0wZEkClAxgLWUzECc2lYJwGpZ2Qu8cOJJy9l0 6am09esaxG1+BCErD01cuI61RpJP5rUfPEmzze9JQaQ4pO/ntWd10/zo5HmVpRFt1azE 0xd2uYGAvImg45l2vOP+vGQ/X9ph4f7MK6rT94FQelWocQuNUrc5w6qbKxAIz8q0IT9E smPd2rvjJvm2xzwnU1lq+QW0eXCPhuhSt5vqWammN5AGJC1j+3cvGgOq1ujhuPwrlmYC Pgng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OlgSv9Wa; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76800-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76800-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f8-20020a50ee88000000b00564e0241cd6si1978420edr.341.2024.02.22.07.43.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:43:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76800-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OlgSv9Wa; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76800-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76800-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id ADE141F27309 for ; Thu, 22 Feb 2024 15:43:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B56C154BFE; Thu, 22 Feb 2024 15:41:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OlgSv9Wa" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B4FC153BD9; Thu, 22 Feb 2024 15:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616498; cv=none; b=FvnKSHMG2j2wk+hfsqTbU80VmwE32uNtyOQRVfejPHbsFgi9Vc/fOqb2oidjBLmuKOK7OlWAVTS+pMITRbQcmPBu9uNffRNAQV+3zwsbvt5GMhPW0yLpkNPF1JWga9Z21bXCeHDGqmlixRYysXyqBykYwESsDF37ULSY/XYJ1sE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616498; c=relaxed/simple; bh=76oWXYBZv2prDrLhgaX7zuBp9oiheXSqhINTrAxFSR4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TxlOrzBRrxsPLzoJO8I4BiAgYPEHxVwaVGUlYJUK0kAmK8gnWqTI7sY2/pgYQm5+jZxJ6Mnff0lk7P0UL3RaoTsh5XO8T8KAHCMETuvknym+LkspLNjoPbrdKzTfV/1ckk4KvxiRolsenRy9CSNa7OypgJ9gZ7b6Z+J+rDhXNoM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OlgSv9Wa; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7D8EC43399; Thu, 22 Feb 2024 15:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616498; bh=76oWXYBZv2prDrLhgaX7zuBp9oiheXSqhINTrAxFSR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OlgSv9Wa5S0L2u5ow7ycezogfX4uqzAYLRTpryMDSktjrYQUbEZyLX6IcEYb4enmF xXr3lMYIj5V/BPZy1PzXBoEWf3LePahwi67LfmVgs6HHwxrYlWXMxh425+yAReLR7j patZ/IuMbHYFz/Gf/axHJdGpRHHTdLgVdkTLFUqSfxLeWoUN9dHFtrxh5lVN6IU5cW mFiiZV3u+5LAOU1JSlmD83m7BxJwWr/rFm0z6JLXbC02PWWXgZ9GeZrr1jbVIQl1cG 1WE35nA/eHBB6Bmv3yMoDrLh2oxjTek86CFPhmvSTu6JYyJVhmklSP/qGM+o3AsN2l lL1H7ZR5We9Uw== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 03/12] soc: mediatek: cmdq: Rename cmdq_pkt_jump() to cmdq_pkt_jump_abs() Date: Thu, 22 Feb 2024 15:41:11 +0000 Message-Id: <20240222154120.16959-4-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614370580127743 X-GMAIL-MSGID: 1791614370580127743 In order to distinguish absolute jump and relative jump, cmdq_pkt_jump() append absolute jump command, so rename it to cmdq_pkt_jump_abs(). Signed-off-by: Chun-Kuang Hu Reviewed-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-cmdq-helper.c | 4 ++-- include/linux/soc/mediatek/mtk-cmdq.h | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 3380e56dd69b..38d9077725d2 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -393,7 +393,7 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value) } EXPORT_SYMBOL(cmdq_pkt_assign); -int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) +int cmdq_pkt_jump_abs(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) { struct cmdq_instruction inst = {}; @@ -402,7 +402,7 @@ int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) inst.value = addr >> shift_pa; return cmdq_pkt_append_command(pkt, inst); } -EXPORT_SYMBOL(cmdq_pkt_jump); +EXPORT_SYMBOL(cmdq_pkt_jump_abs); int cmdq_pkt_finalize(struct cmdq_pkt *pkt) { diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index 72adfd867cd9..f9b8608cb5d9 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -248,17 +248,18 @@ int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys, int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value); /** - * cmdq_pkt_jump() - Append jump command to the CMDQ packet, ask GCE - * to execute an instruction that change current thread PC to - * a physical address which should contains more instruction. + * cmdq_pkt_jump_abs() - Append jump command to the CMDQ packet, ask GCE + * to execute an instruction that change current thread + * PC to a absolute physical address which should + * contains more instruction. * @pkt: the CMDQ packet - * @addr: physical address of target instruction buffer + * @addr: absolute physical address of target instruction buffer * @shift_pa: shift bits of physical address in CMDQ instruction. This value * is got by cmdq_get_shift_pa(). * * Return: 0 for success; else the error code is returned */ -int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa); +int cmdq_pkt_jump_abs(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa); /** * cmdq_pkt_finalize() - Append EOC and jump command to pkt. @@ -376,7 +377,7 @@ static inline int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value) return -EINVAL; } -static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) +static inline int cmdq_pkt_jump_abs(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) { return -EINVAL; } From patchwork Thu Feb 22 15:41:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp29635dyb; Thu, 22 Feb 2024 07:52:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVqe2PVDPdd0Fvm8uqKxN7njyhvK6jAPS/Dv5azkjWTCzGIB9WiCNOfgFkYIb1T0sCVN6PAqoFIUktfgNOEsOHQUaY0eQ== X-Google-Smtp-Source: AGHT+IHUrZ9+xV1/UMkXIM6Tk5lvF8GfVZGnICb7a6c0SrGtqMKqgVayKrhw3W7NPkh87L0DUq1/ X-Received: by 2002:a17:903:230e:b0:1dc:248:28e6 with SMTP id d14-20020a170903230e00b001dc024828e6mr15080546plh.67.1708617139263; Thu, 22 Feb 2024 07:52:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708617139; cv=pass; d=google.com; s=arc-20160816; b=b8yhyMX/5gJLVy1xeuHEU2urlQ4w8JXyhU7HFX4vtOeZejYw8h6XWXYKO8PQvfmUXm /R11EpPlqZuRfPyGJG44TSHmrqta78OIC0VfFcMNqBA5YTWEDLAMt5bG9BNfZZhLw9WL /p+EXkXHtZf3W/HeNNJSbbaZPtGNB7GsCMeZV9joK8xGa36x9oHcEiQkILFXN7S5rwlv oVyIB3bEyNhfgPRtTa8ictkjrrTkCrl9frAuvTNvponzGYjgud1KS8t+r4xxlwySiiXq A+cJ4Nxt0ceFq96hJABUbabzp/7gmTdrTVBp/y5sAKtafe3ckc7qRVYdnQNrXye7q08N lFQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xVypYhEl//jcDfWledVQzkB9459uKJFxxdtmQaBkJfY=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=RyHDyiixT3dS0VrJmp9xqy1IuXKFODuAIgnxzBGpkRC7/BVYYfIaFQECWyV2yqTuY6 ZQQQiAY46MPfmIuYLkLEvf4ihVWiLPbDJQ85kMWvn5tBa7g/h8c/5WqHM7Kdb7T1Co1O 2VoKFClJGu+j5QgzqDjdcJStXE/WARqQ3T5DbTatTHotxc0qGxo3qfsklx3N0B1FhqY1 838F9cxK3KNnSHIg+t0cXTu21Yw8d/GvuDbphifrXZ3ZwF2FwGaXKUw3Rn8cK7Eq3Ph6 klUjHV1rS2W6Wd+teqZU2XsPVnKi73gexa+7TQJEnXzLHw/N6FYfddAeyTziXtvgo6H0 iPeQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jZVVBKw2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76801-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76801-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id jb19-20020a170903259300b001d8e7df68d9si10011602plb.465.2024.02.22.07.52.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:52:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76801-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jZVVBKw2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76801-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76801-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1D7A928B237 for ; Thu, 22 Feb 2024 15:43:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FA95154C17; Thu, 22 Feb 2024 15:41:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jZVVBKw2" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FE29154C0A; Thu, 22 Feb 2024 15:41:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616501; cv=none; b=FSml6r/fVLShpkOcmtNIG4MOTx+ogBvk5gkTvrl7cEB3TGtrSlDdBGSEPjNUyktMupXdSE6GD2EPOrDhGOV1GOQC7T3mKsBS4wH2mxcKeKGm/EBkEtndI3Og1tkLUNVeBXTrpJ07Q9jv8fkWh3slQYco2VP6kV8U+mkWcp7PgEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616501; c=relaxed/simple; bh=rK1krWLb7shm5l17Ae3PYsFAPIxWE0/hDUOnRbU8Hms=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ncHqStFTUeNELlJ19FmuQ4DnagdT54+ZUJ/I5tW37bqIkmUyR5wLx5W8dM8oNXBCVy6ZNYGIE4Q5sXP0wiZLDx+7hy0PSC+gVSUtyrwlXhgG1oVqVCDxkGbcw5zTZtdQfn5pyuhvS7i48QB5WDRlyimqawGjYSarDfr8MqZPlm8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jZVVBKw2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 964D0C43390; Thu, 22 Feb 2024 15:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616501; bh=rK1krWLb7shm5l17Ae3PYsFAPIxWE0/hDUOnRbU8Hms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jZVVBKw2J1qlidIBDZKh0L7B2jAWgRX+55M0yA4RfXh4LLvWlCqc5FBcwKdjKNO8g tYR5GfRnfvTuGqV4g03wJmYteJn09cG8IkNyGyawEMGf3EeLapDhpNp4lrik9xS3eH 5tpzH2woRsubrZ7fHY9HR+o4wamHPJXB3VIFDeHSd12N54XTsrmvh/5AymtyhwKWUe mEs7qqZmxk1jDQWIwhCw6wvCTYZzzxjho5a83m3uLpfpkhXDQZv6bzy+9Jc/GscTOF f+mvwe6MbfC614OuDsa4+eAKBZnwM5fTP0opxQaj/vu9bAFFu7+HT0v2+2bJ9jq748 GXS1chuI2eyIQ== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 04/12] soc: mediatek: cmdq: Add cmdq_pkt_jump_rel() helper function Date: Thu, 22 Feb 2024 15:41:12 +0000 Message-Id: <20240222154120.16959-5-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614925495367214 X-GMAIL-MSGID: 1791614925495367214 cmdq_pkt_jump_rel() append relative jump command to the packet. Relative jump change PC to the target address with offset from current PC. Signed-off-by: Chun-Kuang Hu Reviewed-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-cmdq-helper.c | 10 ++++++++++ include/linux/soc/mediatek/mtk-cmdq.h | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 38d9077725d2..678db09983d4 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -404,6 +404,16 @@ int cmdq_pkt_jump_abs(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) } EXPORT_SYMBOL(cmdq_pkt_jump_abs); +int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_pa) +{ + struct cmdq_instruction inst = { {0} }; + + inst.op = CMDQ_CODE_JUMP; + inst.value = (u32)offset >> shift_pa; + return cmdq_pkt_append_command(pkt, inst); +} +EXPORT_SYMBOL(cmdq_pkt_jump_rel); + int cmdq_pkt_finalize(struct cmdq_pkt *pkt) { struct cmdq_instruction inst = { {0} }; diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index f9b8608cb5d9..a935cd69d80f 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -261,6 +261,20 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value); */ int cmdq_pkt_jump_abs(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa); +/** + * cmdq_pkt_jump_rel() - Append jump command to the CMDQ packet, ask GCE + * to execute an instruction that change current thread + * PC to a physical address with relative offset. The + * target address should contains more instruction. + * @pkt: the CMDQ packet + * @offset: relative offset of target instruction buffer from current PC. + * @shift_pa: shift bits of physical address in CMDQ instruction. This value + * is got by cmdq_get_shift_pa(). + * + * Return: 0 for success; else the error code is returned + */ +int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_pa); + /** * cmdq_pkt_finalize() - Append EOC and jump command to pkt. * @pkt: the CMDQ packet @@ -382,6 +396,11 @@ static inline int cmdq_pkt_jump_abs(struct cmdq_pkt *pkt, dma_addr_t addr, u8 sh return -EINVAL; } +static inline int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_pa) +{ + return -EINVAL; +} + static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt) { return -EINVAL; From patchwork Thu Feb 22 15:41:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp27279dyb; Thu, 22 Feb 2024 07:47:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0EMNrr37yJwAW9UtrMBP2aC9Nx2zgyIEGavJLWTWiIgetCEtLCR1ZF4C/RgnIQjJK8zFLZv42rQmQPXdDGA59gKo5vg== X-Google-Smtp-Source: AGHT+IFMMraVtEzp8fSP7hGzFGJnByLg/sM0MupRkt5MgGpHJK/oRtXhseJ/cakMq4yUAlC4giNT X-Received: by 2002:a05:6a00:2387:b0:6e4:c8cc:adce with SMTP id f7-20020a056a00238700b006e4c8ccadcemr3261484pfc.26.1708616868071; Thu, 22 Feb 2024 07:47:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708616868; cv=pass; d=google.com; s=arc-20160816; b=vrIRJ8Q2xqhBp0IZ2Rb5NtbO4Yz4z+BsWlPHwOBtATmcZzNAiBs12qpdY9Mbe/EM6h vuhlr5c93ew1eiVq1FyQrdLUtPBoQHf/yH9JkrpSyff0UTc6QlP7Xia3rHAMomH+cfXd mNCr/XEseC7wWehXC5JuiBfBbuVx7OSyg6PqxLrlwzV8+nICev50al0UXRSpUa3A+ewg L9WN/8mNYPKsj3NVQUtDy0ydwPo3RDMxBmu4mdu7VBRJgwbpEBSYRlrjfolVzG8d9nyx a94UlZhEc0Vj+DMWnclxkA+bPY8/va3LQoU3r2hLnBMEg9EBUnqZxgXtsyfcmDu5i0YY sKYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=QPqXgewCfZe0W2aD2P/HGNDKtXkbfRHvg6TYmGgfd8I=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=qEaFQ+QIEwaI7LhSPVM2GhfCLkFzwDu3LnCEU9+w6OQhqX401/YmmnHUCjf2aIczcj XCxf7vBOxtv5jH3pygblSjrwiFva4Dl2r35IH7zq0L8K3kohl23YMf3EPJLZ9AKQKAjo GXZwS+EEK2LnQ7S8+Rct6RGit533/Jrl7m0IzWo2BS7CkeTS+zHpwSBxpSMYUyOkRp6B q/CGVnu4XDlzU09VDd9tXNjneACRq56s+QuxTKrWn8ndYOwg0Zkt/N91/8bHxUUBKFPn 03HXUuw7n7Cud6ilpOuQ4eKut2CA051wRUvG+NS85Y9UoGhZkOq2TT6iM0rmA9cvzFxl rZ1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SX0BMFOx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76802-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76802-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n51-20020a056a000d7300b006e396759fa7si9198535pfv.172.2024.02.22.07.47.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:47:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76802-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SX0BMFOx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76802-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76802-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E221FB276A2 for ; Thu, 22 Feb 2024 15:44:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BE4215099F; Thu, 22 Feb 2024 15:41:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SX0BMFOx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB9AF154C0A; Thu, 22 Feb 2024 15:41:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616505; cv=none; b=qdsxDg4joc4Q3AeUALcomXOCZKjlHnXOyAoum0kzMmONnRHzLA3w6Pdmm2QFw6k8PUixXKIRnelneQCNZrezz1Lx6sOeciY98fW090f7x3C6UXoTnaletNXm1tO0/tMuutiBdcWi9NmMY6fx7h7kSP6Es47ErBTQDyHYsZtEvyE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616505; c=relaxed/simple; bh=nDJV3H5ien5JKkaRFl6YIw977BIcRyhSssibdZZbNS0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DdQBj+mRmFwktrhZ04vEhp+pupMXvDVfXYgIqUne53QtzmcmxtrUpizAxiaf3Rxot7NqULju6T1Uos2NoY2cG2dyyfZpIOBUrv77pSzjQzXKUv0s/kApRpPHUAJUrJl4ejwiEsbb8SHYTd2bj1t+aPQkDoCEDC6Kk7dyy+GqB6c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SX0BMFOx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1EB1C433C7; Thu, 22 Feb 2024 15:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616504; bh=nDJV3H5ien5JKkaRFl6YIw977BIcRyhSssibdZZbNS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SX0BMFOx6A7QuL23OjGPgrhtp4wl94MOyaFh5GXEeo2EooTQMADyzw49eslKGwAhN 3EB8LW7Bu0Nlwqew+qd2UPkhMWeJYO4Ty8PxJ51VhXGfyCrQ/11COqa0l0GTGZe8eE XeAwwP4EVI/6I7hUjU/Dak0EBzOD5BNLevXL/Sd86iOhFzmmzKLKqUd0wxhpYCN2tF 7wzImDW7aud3DtY69Xs4Xd+e590SV7485TjKcQ148H5VK2LgencYiHnv4rE/XQxbQg j3ps7o0ECniy5n2qHhn7SiKZK9Wuzpyau6Wjup4wsjqVa5LGLpbCgJEyf6VSBgrnZl B8EmhyPJDJw2w== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 05/12] soc: mediatek: cmdq: Add cmdq_pkt_eoc() helper function Date: Thu, 22 Feb 2024 15:41:13 +0000 Message-Id: <20240222154120.16959-6-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614641069288909 X-GMAIL-MSGID: 1791614641069288909 cmdq_pkt_eoc() append eoc command to CMDQ packet. eoc command would ask GCE to generate IRQ. It's usually appended to the end of packet to notify all command in the packet is done. Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Chun-Kuang Hu --- drivers/soc/mediatek/mtk-cmdq-helper.c | 10 ++++++++++ include/linux/soc/mediatek/mtk-cmdq.h | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 678db09983d4..766dbafaef62 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -414,6 +414,16 @@ int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_pa) } EXPORT_SYMBOL(cmdq_pkt_jump_rel); +int cmdq_pkt_eoc(struct cmdq_pkt *pkt) +{ + struct cmdq_instruction inst = { {0} }; + + inst.op = CMDQ_CODE_EOC; + inst.value = CMDQ_EOC_IRQ_EN; + return cmdq_pkt_append_command(pkt, inst); +} +EXPORT_SYMBOL(cmdq_pkt_eoc); + int cmdq_pkt_finalize(struct cmdq_pkt *pkt) { struct cmdq_instruction inst = { {0} }; diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index a935cd69d80f..45110494ee9d 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -275,6 +275,20 @@ int cmdq_pkt_jump_abs(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa); */ int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_pa); +/** + * cmdq_pkt_eoc() - Append EOC and ask GCE to generate an IRQ at end of execution + * @pkt: The CMDQ packet + * + * Appends an End Of Code (EOC) command to the CMDQ packet and asks the GCE + * to generate an interrupt at the end of the execution of all commands in + * the pipeline. + * The EOC command is usually appended to the end of the pipeline to notify + * that all commands are done. + * + * Return: 0 for success or negative error number + */ +int cmdq_pkt_eoc(struct cmdq_pkt *pkt); + /** * cmdq_pkt_finalize() - Append EOC and jump command to pkt. * @pkt: the CMDQ packet @@ -401,6 +415,11 @@ static inline int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_p return -EINVAL; } +static inline int cmdq_pkt_eoc(struct cmdq_pkt *pkt) +{ + return -EINVAL; +} + static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt) { return -EINVAL; From patchwork Thu Feb 22 15:41:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204827 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp25557dyb; Thu, 22 Feb 2024 07:44:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXlfprx2kTl2fkcEXVoQdznDCAK3zKZeovarhiNnAEuCr+MxGHRCWEqlCEXoS5Ag6y2cKDCg4JU3qRFUH64djf0cYy5jg== X-Google-Smtp-Source: AGHT+IGn6J8hLFoGa4kqaAhAU6qoPPVYW9ShyF/T1y2uLUz5d4VU3KbiyN/91IAzqYb0I8Fgon86 X-Received: by 2002:a05:6122:25f2:b0:4d1:34a1:d180 with SMTP id ds18-20020a05612225f200b004d134a1d180mr4475070vkb.11.1708616664540; Thu, 22 Feb 2024 07:44:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708616664; cv=pass; d=google.com; s=arc-20160816; b=AfsXPvLTZeC+Bz+ceZ0aHlN5zRI+1XNf4ZvF+Rt21yVSEB6z5XKhnKv1M6ijiS05sa GKgXya7WIEm89uGkVM4EihlbkIFBcAVudHCDzqcs/Dx+x/ba1845dh/MH9Pyo9S7MUc+ GsqSVdw9/JJ4wIhsqejrl0e37Pdi6foHGv5c1c3FWYZ7QKfYXNlT4qTYv9lZfQ3MH6od qvmGDuXqAXVFFBBIoWutQuRTVB2Kqq+L37B34fyWDHloDri8sPE3qvcRqIxNw9UTk8C4 qNXFy8zEiCXn2n3pybomOVohV+dsN04Htq7g0i7cJnM9z+8cfvRe2cJ/qTNhd9RYJeoM D/Xg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5gDlZsYzSYffdtx1la/FNhRlTDlkb5YIvVty12LIpcE=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=AFLlehP1dMwWEecgS2zxpl7t18dUhNShyPh2jH/IP9fpCBebltv/oC+LJdF8GqEA5z RZ9/3TMYwQA/3Nr68Qqhz6G7orzbOT5qRZiA5+nx3j/sJGZ+CLy6vALoQvYYQJACM1Jb 41YiKQlGNs/nkknvqqKoIoZU7xO5nb06joUVaL3xScQfdNvVtF2BgLnzbO7z8s9ASyGl rCVmvFIcM9YZI9RaGmnWUMKbvQzyCOUuO670qCL3UzKufynsns2EO9+858qvdVt13q+s nly2K0NEKPbxfFxJMwBIZzzSsX62cY6SapoiZ0cKxQvFlkz55kgolVewJ/x2uSLgY83g TThA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqhMuhuM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76803-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76803-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q2-20020ad45742000000b0068f2eed8e0esi13405117qvx.287.2024.02.22.07.44.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:44:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76803-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqhMuhuM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76803-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76803-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 55BAA1C24948 for ; Thu, 22 Feb 2024 15:44:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBC46156961; Thu, 22 Feb 2024 15:41:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jqhMuhuM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DC11155A24; Thu, 22 Feb 2024 15:41:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616508; cv=none; b=TLmZ9DtP2NBCE+zuIYLz/GNuwhi1HzxsPKXaf5irHBeWarUT6oIMx+vT847B9uBJWEFONxTHkN77SVJeR8MHV+qJMeIhR/JrY4ERfDNPFxU+tKXbSbhsHBWxYV8tWB10LU1ya9XeIGDOKZY82rr6L8TEGSrQFMHA4LtGJGWpBsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616508; c=relaxed/simple; bh=nGIP2vJqkcuTspXXlk6nKjt5v1e19Z7ObipqHsmxyZM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hTNyFmb6fBXkUwFogSwWPZTBqikz2hAGPjeBP/aGEWhwm8+uxCMF2fRwucGqQEV2EOrOp8Jo7ZyIXWt1JIEeyVT1W6DGm3mzE1EWtREcaPsZm4MzxAQNsD/ugXUXJz8N6fyp4Rs73GIp2s1i1ucz0s/hV98u985n7spNcHMnHpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jqhMuhuM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A070C43394; Thu, 22 Feb 2024 15:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616508; bh=nGIP2vJqkcuTspXXlk6nKjt5v1e19Z7ObipqHsmxyZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jqhMuhuMr3ZVz+g+vLndCqRLYsyQZ4IinHR1grM3SGkXk45xdHov7i6pbWL1tNzC7 ytz8QU3K6Q8kVwdoQJpx01oWPHIIQ8S3+lz9k1QGQ1qhy9Xz+chv3XLLm+pq4YUA2z 7m9plYDKkAc53EjNpO6qtn2WsZJBIYtB58RkgZ5cW8ouNZRjR7aOCVCs5iB8/lyGEq 1sp8GncUj0cT5w2oga4GHKDdONNXrwk2yZtsKNlEht08xZtyjjwZLbN2WyQNTugeN5 TriCyLboxKdX/bgFn6GItjoW3pQUoEupiVACgnfU+CtbJBYQ5kbqA5oN31Fi4/SAG4 y0fKqeK49d0ZA== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 06/12] soc: mediatek: cmdq: Remove cmdq_pkt_flush_async() helper function Date: Thu, 22 Feb 2024 15:41:14 +0000 Message-Id: <20240222154120.16959-7-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614427353382920 X-GMAIL-MSGID: 1791614427353382920 cmdq_pkt_flush_async() is not used by all client drivers (MediaTek drm driver and MediaTek mdp3 driver), so remove it. Signed-off-by: Chun-Kuang Hu --- drivers/soc/mediatek/mtk-cmdq-helper.c | 15 --------------- include/linux/soc/mediatek/mtk-cmdq.h | 18 ------------------ 2 files changed, 33 deletions(-) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 766dbafaef62..bbe41302210a 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -446,19 +446,4 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt) } EXPORT_SYMBOL(cmdq_pkt_finalize); -int cmdq_pkt_flush_async(struct cmdq_pkt *pkt) -{ - int err; - struct cmdq_client *client = (struct cmdq_client *)pkt->cl; - - err = mbox_send_message(client->chan, pkt); - if (err < 0) - return err; - /* We can send next packet immediately, so just call txdone. */ - mbox_client_txdone(client->chan, 0); - - return 0; -} -EXPORT_SYMBOL(cmdq_pkt_flush_async); - MODULE_LICENSE("GPL v2"); diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index 45110494ee9d..f82e789550ae 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -297,19 +297,6 @@ int cmdq_pkt_eoc(struct cmdq_pkt *pkt); */ int cmdq_pkt_finalize(struct cmdq_pkt *pkt); -/** - * cmdq_pkt_flush_async() - trigger CMDQ to asynchronously execute the CMDQ - * packet and call back at the end of done packet - * @pkt: the CMDQ packet - * - * Return: 0 for success; else the error code is returned - * - * Trigger CMDQ to asynchronously execute the CMDQ packet and call back - * at the end of done packet. Note that this is an ASYNC function. When the - * function returned, it may or may not be finished. - */ -int cmdq_pkt_flush_async(struct cmdq_pkt *pkt); - #else /* IS_ENABLED(CONFIG_MTK_CMDQ) */ static inline int cmdq_dev_get_client_reg(struct device *dev, @@ -425,11 +412,6 @@ static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt) return -EINVAL; } -static inline int cmdq_pkt_flush_async(struct cmdq_pkt *pkt) -{ - return -EINVAL; -} - #endif /* IS_ENABLED(CONFIG_MTK_CMDQ) */ #endif /* __MTK_CMDQ_H__ */ From patchwork Thu Feb 22 15:41:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204828 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp25830dyb; Thu, 22 Feb 2024 07:44:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW6pTUJQAECPdGCQKXM9i1EsK/wqVOHYISO54J7JPaL8uCAnEUz0S9QfkmPU0SYfH3THZ+LsrZKs6WytiMoGcIEdRcwwA== X-Google-Smtp-Source: AGHT+IFaP+iBRWMS+lbZEZ3SsqBDHfq9LtLR3IpajzV9IhiinIX//lBzeAKhjSzEbTdTMSPay+Xj X-Received: by 2002:a05:6808:3845:b0:3c1:7ea6:ff71 with SMTP id ej5-20020a056808384500b003c17ea6ff71mr2081955oib.12.1708616693384; Thu, 22 Feb 2024 07:44:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708616693; cv=pass; d=google.com; s=arc-20160816; b=IdZ2efTt3S9sdnlf3uSTHrS9/i4JsUb2pm6+C2/Zv4uNPlR4z47seZGYCWqCNiy/nS HgwBRItQqVn9gXup0sN95KF3luGV05jQWuvOCq6bl01HgQkxw8w6HdFUKIUgxpSkjfJF XQuCHpifOyxXP0CW5hH5ZkKu2lNuKWg0/5N0M2+BwxhE5dcoO4UcrgUsskWHOhY+mYgJ vbYK0RYwkQYYGva+izx0c6frsx4Ut7Qub1xydCwbKzSuM/V2c5REGTPlyoEsSw0XVrqa RVtTXKGA+ypjVJeUadBBihj6Yc/n+H6eGpZu0m1djHWi52cHKAHPQoPQwhBghMvNd5pr NHyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hwUROcBrFm6NVio+xuFMjF7z84GtRU/t16s+qSv3qrM=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=B1pvY1vQ6SSQcb/GppgOuDdIn4uI3EP337Xkm+LKkiaJQIt0JVs6k4C/Yb7ZCHAs3w rCGOC/QQ2RpCp4oYob7CYJ/OCqWqNyQax6j6+UqNCjgFHdRBWi+Y237YAIaXDhxi5QDZ rdTM7QTudY1+ktpPJGQbhT2uc1DWLoJ5/cIe9gVGEuTJs4J04hOyiHKbWAUH8FRIxKnb 9sy9PBntgvB3PsjKhwJwHq6FrxHQywbVfaa65lsAd4CGTQBlrQpBRpfuvXWDNVZyLFFf plheLlIbb9zxR6ARR/hZCsh8F/C1huJt+9EpYGLA+XmLHJOSGhRz2BZhs1bDxVlUokXs cvMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I9h3a/Eg"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76804-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76804-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j14-20020ac8664e000000b0042dc8edb6e7si12800247qtp.657.2024.02.22.07.44.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:44:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76804-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I9h3a/Eg"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76804-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76804-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2D7001C249B3 for ; Thu, 22 Feb 2024 15:44:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6987015696B; Thu, 22 Feb 2024 15:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I9h3a/Eg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7E79156966; Thu, 22 Feb 2024 15:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616511; cv=none; b=W7WYvRkYCalw2BlSROBhFS7YP8i82aNDwPLwQrXSGNAoTRsp36Rw7BpIiS3l5YX+YHehLm6kO4PwhKUbjVE6TJoCtEze6uuc9mOWck5Gs3R2MhAHkNpzldxD++HLykmSrBGFhaTZg9Fkgda/Isn/BLpRdpfK+skKKAWM/j6IyXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616511; c=relaxed/simple; bh=9avcaQo+g1SO3OnMBO0SW08LTKb5Q/Pc21HFm51gndM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GhskCZVaa56Zz74Q0RcvxuroO9dPbkEtMgL0r32kyY+JHGOtyqcKHoG/tWBfYSHTW5q+dI1zbzbC9saNBQTXG3ctf+lj3pH/zY4U4wR4KKG0TRNvna3/hElcjM/0030v9fBw+zqqy6S3n7ETCDVgs2mVBDE7xT/qclmXfB3N6yA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I9h3a/Eg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84D17C433A6; Thu, 22 Feb 2024 15:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616511; bh=9avcaQo+g1SO3OnMBO0SW08LTKb5Q/Pc21HFm51gndM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I9h3a/EgFD0efBdf9svW4VSrGmDb6rsd2zPtk3U/b2zo/X5iMDU8AfEEL2k0d9tGW Yyh37Kn8PPwqqS7Aseq8cxgUFfX7wQtEJOLjs0B8MAiQ5LNayOfTCeWgdUndvS7IdT hvOR274o+TGEjGTKzdy/5EuYnO26HTEcMV1C0uvzAEZYinyEesdVnBtZ7LLclZeYSo apxaQmIxZvulopyzfm/b3aYiSP7p6hvXwVclkGiwOcwQIBS4O/c1ADziRgE4nD8cn0 nU8xAHIhys2JpoCwhGzc7wEBdc41y3GgISPPlwxN+eqxQwzUV+qnowsbht3Uw3SX7U erKvjaBM/Ad0Q== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 07/12] soc: mediatek: cmdq: Refine cmdq_pkt_create() and cmdq_pkt_destroy() Date: Thu, 22 Feb 2024 15:41:15 +0000 Message-Id: <20240222154120.16959-8-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614457932764824 X-GMAIL-MSGID: 1791614457932764824 cmdq_pkt_create() and cmdq_pkt_destroy() is not suitable for client drivers so each client driver has implement its own function. This refinement would pass struct cmdq_pkt pointer into cmdq_pkt_create(). In addition, client driver has the struct cmdq_client information, so it's not necessary to store this information in struct cmdq_pkt. After this refinement, client drivers could use these helper funciton instead of implementing its own version. Signed-off-by: Chun-Kuang Hu --- drivers/soc/mediatek/mtk-cmdq-helper.c | 24 +++++++----------------- include/linux/soc/mediatek/mtk-cmdq.h | 14 ++++++++------ 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index bbe41302210a..1a1f1b260a06 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -106,22 +106,16 @@ void cmdq_mbox_destroy(struct cmdq_client *client) } EXPORT_SYMBOL(cmdq_mbox_destroy); -struct cmdq_pkt *cmdq_pkt_create(struct cmdq_client *client, size_t size) +int cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *pkt, size_t size) { - struct cmdq_pkt *pkt; struct device *dev; dma_addr_t dma_addr; - pkt = kzalloc(sizeof(*pkt), GFP_KERNEL); - if (!pkt) - return ERR_PTR(-ENOMEM); pkt->va_base = kzalloc(size, GFP_KERNEL); - if (!pkt->va_base) { - kfree(pkt); - return ERR_PTR(-ENOMEM); - } + if (!pkt->va_base) + return -ENOMEM; + pkt->buf_size = size; - pkt->cl = (void *)client; dev = client->chan->mbox->dev; dma_addr = dma_map_single(dev, pkt->va_base, pkt->buf_size, @@ -129,24 +123,20 @@ struct cmdq_pkt *cmdq_pkt_create(struct cmdq_client *client, size_t size) if (dma_mapping_error(dev, dma_addr)) { dev_err(dev, "dma map failed, size=%u\n", (u32)(u64)size); kfree(pkt->va_base); - kfree(pkt); - return ERR_PTR(-ENOMEM); + return -ENOMEM; } pkt->pa_base = dma_addr; - return pkt; + return 0; } EXPORT_SYMBOL(cmdq_pkt_create); -void cmdq_pkt_destroy(struct cmdq_pkt *pkt) +void cmdq_pkt_destroy(struct cmdq_client *client, struct cmdq_pkt *pkt) { - struct cmdq_client *client = (struct cmdq_client *)pkt->cl; - dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size, DMA_TO_DEVICE); kfree(pkt->va_base); - kfree(pkt); } EXPORT_SYMBOL(cmdq_pkt_destroy); diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index f82e789550ae..d9d0ee5ecb7a 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -62,17 +62,19 @@ void cmdq_mbox_destroy(struct cmdq_client *client); /** * cmdq_pkt_create() - create a CMDQ packet * @client: the CMDQ mailbox client + * @pkt: the CMDQ packet * @size: required CMDQ buffer size * - * Return: CMDQ packet pointer + * Return: 0 for success; else the error code is returned */ -struct cmdq_pkt *cmdq_pkt_create(struct cmdq_client *client, size_t size); +int cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *pkt, size_t size); /** * cmdq_pkt_destroy() - destroy the CMDQ packet + * @client: the CMDQ mailbox client * @pkt: the CMDQ packet */ -void cmdq_pkt_destroy(struct cmdq_pkt *pkt); +void cmdq_pkt_destroy(struct cmdq_client *client, struct cmdq_pkt *pkt); /** * cmdq_pkt_write() - append write command to the CMDQ packet @@ -312,12 +314,12 @@ static inline struct cmdq_client *cmdq_mbox_create(struct device *dev, int index static inline void cmdq_mbox_destroy(struct cmdq_client *client) { } -static inline struct cmdq_pkt *cmdq_pkt_create(struct cmdq_client *client, size_t size) +static inline int cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *pkt, size_t size) { - return ERR_PTR(-EINVAL); + return -EINVAL; } -static inline void cmdq_pkt_destroy(struct cmdq_pkt *pkt) { } +static inline void cmdq_pkt_destroy(struct cmdq_client *client, struct cmdq_pkt *pkt) { } static inline int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value) { From patchwork Thu Feb 22 15:41:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204835 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp31166dyb; Thu, 22 Feb 2024 07:55:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVUIkdszAWZL7dcknIYuWuadRL8wNhNbQif2TSnmaJOo5XXWdv2m6ZVxCqftLIcwRoWyT2UOY8sum6ZNESkTIfq3qpIpw== X-Google-Smtp-Source: AGHT+IHzG+JOLhWA6uJE5LUtVFjW/v9ifaEXu3CGptEzZOK6ugWjCwZV4l82smgJO42/nHA7F9C3 X-Received: by 2002:a05:6e02:c73:b0:365:f79:baa8 with SMTP id f19-20020a056e020c7300b003650f79baa8mr17948102ilj.23.1708617340693; Thu, 22 Feb 2024 07:55:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708617340; cv=pass; d=google.com; s=arc-20160816; b=dtOr0UJJp1IS1BDAzqVF7blsEWBxg+slwbLfrJn5tqkQtMJ853ZzcT/lEz+RPoDS22 HeQxnEHtOUppFvgcNWmGRjzjz+DsFUhxcwloX3sIAj/sG5flGNgnB28ZvjTEptAINMfM kbkji1fmizstGZ/BSGf6JQpT+jQsIkc1nHm53J7lt9iHrY3u5KJfjXFwnUCEHd8ozygA 6T1Or+z/6DecgJ8NQxWD064VSI+8VsFy2WByEKZxmczuyzCde3LJa8KI3M/a1HPzZmb2 d3L891+k/87MGumVVQLZpAFcOMPLjVEdlBPF7vKwr3ni7ZYMZ/ys+qVGCmvuE0y4jbPa VZfg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VmU5djMcZq3un9NXE8bxt+eQx9GKGrESkVjr84+O68E=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=UVdaJEEsAQwNDmmDN8ih+9bDU0ou0aFcADNjEFa3/kI8qsQIk0RMOjDN3uscQVdt4n FsmY+fJADx1pooj8MBLHFQBMgMHtCckGug8MpTcSc0hkmnyqOSlnmy6opposNnYCJ+0g SfTiApY4sDxfrp7sh3g5AdMY2yoszWp+UQ66HYTZoLr5V1nHl8GTKEDFtMPImDk+UrZn XROdLvsIqfq5BHmtRuu1jyYFA1xwzgFZeVcii3SCRyi8MnZyNVB6n2eYB0gvYKC++uDw UlNLXXEZziDF39o2unv+NujdiEK9q8vOqBpweu3vx+BlNdxaV30pjZn3RF4R7lFLmosh GBiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qcu2M+N4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76806-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76806-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l124-20020a632582000000b005cdc2cc9a1dsi10643195pgl.699.2024.02.22.07.55.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:55:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76806-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qcu2M+N4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76806-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76806-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id ED63828C5B7 for ; Thu, 22 Feb 2024 15:45:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B0B6157E91; Thu, 22 Feb 2024 15:41:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qcu2M+N4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AACE715699D; Thu, 22 Feb 2024 15:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616514; cv=none; b=XGE2wKggdA+VZycSqGyUG8E57kEahit7mvq8UykqXSKxXASWdrTGxmB+XNgG7MbVTvU2PqOOV+HIjlt2SeQLDZyF1Gpv2+6Fk455ROUO1f1jFo7cTaqlHnM35pIVcXkAQNC3uUHwlvHlP0+QbkQR8QTwjS4uUs985o0D3zSNFKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616514; c=relaxed/simple; bh=TyYfmOPE/p3NSd8TeId10uLJdlRXk+ZcnArj63ZnB78=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lDE/s7P2chuw6HbAq6l1VWiSD6EXfkjCFkrj3Nak0zNR02eGl3GMhTAVEKqw5+XKJTIXQzUxPG6gVgup/ceHLeVLrbvxddqzt022Xh6keW85T+XSGp4664AHzAUmbkQhExrkARcuDbw9l1/+ANowX7gLoRCMQ3iClA05fjW+gsM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qcu2M+N4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B457CC433C7; Thu, 22 Feb 2024 15:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616514; bh=TyYfmOPE/p3NSd8TeId10uLJdlRXk+ZcnArj63ZnB78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qcu2M+N40lnWO0VRIjirr4tmgHxDycIihP1hNLX/vwGiRrExvp4aZrtKxMjGVbO/W CBLfCfyrPZH7R+m/3nGdAvmq/SDiPRQg0oGXxG8peloIbT/vIJMbsk4YROvB16QtZg 7chEHJhemcr7VY6Cda3yNzVUcCbZdmdbvEgbBBu2mnARRfTGrmNgSUOHm0mH7Fp/DN mfSKHNVYx0WbaDJ7SaRIWbPGejb4IbGX/0YX69D8G9lhcLvLDIkZqvFnGfPnXfRN5E oT/eQXFrH2F0Fq47VyZuN8iiG7CgBgBDdqLxgpXg6znePkxnGLTDcfbrRthubA1kdn xp2RIuy2lFMXg== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 08/12] drm/mediatek: Use cmdq_pkt_eoc() instead of cmdq_pkt_finalize() Date: Thu, 22 Feb 2024 15:41:16 +0000 Message-Id: <20240222154120.16959-9-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791615136678519264 X-GMAIL-MSGID: 1791615136678519264 For some client driver, it want to reduce latency between excuting previous packet command and next packet command, so append jump command to the end of previous packet and the jump destination address is the start address of next packet command buffer. Before next packet exist, the previous packet has no information of where to jump to, so append nop command first. When next packet exist, change nop command to jump command. For mediatek drm driver, it never has next packet, so appending nop command is redundant. Because cmdq_pkt_finalize() would append nop command, so change calling cmdq_pkt_finalize() to cmdq_pkt_eoc() to prevent append redundant nop command. Signed-off-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index c729af3b9822..df693fa268ce 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -593,7 +593,7 @@ static void mtk_drm_crtc_update_config(struct mtk_drm_crtc *mtk_crtc, cmdq_pkt_clear_event(cmdq_handle, mtk_crtc->cmdq_event); cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event, false); mtk_crtc_ddp_config(crtc, cmdq_handle); - cmdq_pkt_finalize(cmdq_handle); + cmdq_pkt_eoc(cmdq_handle); dma_sync_single_for_device(mtk_crtc->cmdq_client.chan->mbox->dev, cmdq_handle->pa_base, cmdq_handle->cmd_buf_size, From patchwork Thu Feb 22 15:41:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp31638dyb; Thu, 22 Feb 2024 07:56:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUv+ytaf6+idh+s0jnIXNGYIMgI92AHajbEiLtzsrl2AiYPgR+dCpA80BYZ6vrW5SdxTQaVIr4vip/XKifpj1fkFh4hrg== X-Google-Smtp-Source: AGHT+IGBYYhuxDoNDjrVNpBYxYEO17DedU4M3rqocatyNPw1D+TD8LuADhKywXnEYC5AL+LICrZv X-Received: by 2002:aa7:8b86:0:b0:6e3:6e83:4279 with SMTP id r6-20020aa78b86000000b006e36e834279mr12411416pfd.28.1708617394924; Thu, 22 Feb 2024 07:56:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708617394; cv=pass; d=google.com; s=arc-20160816; b=T6UUXx+XHycXEoyWpzA75LP/ISTQ35JBINntrkpNz9YJUqhIl7IHFLPhYtxP5sJgGC Xn/tXzHS6uLIzTbh3xJlD1b/L1T0qfkskUqclYaXuU1cMvKGrkL8eJUx5EkNFNS2ga+d LvU6znzTc6KLZgkThTbwnopbZjAalhMpVzmazJbYVrbLdhcHCIjbf526DQSewq4zdX2T x/C1YlJtOOffFc3nTloiepwVAA4AcugpOs5/8FEpDeOjrVKnNrKPAJrDRK1+AXyn/BKw hVuQMMAdF75YEbBAs23EgYD9mwzYkzOG0HqyecMWNZ+wN60dwXUHozpk3x6HxERx7W9M MlwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=o2lFpqVZSjYcpKx1VqOIje41okLbu68nZb28RiY01sA=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=IXPMWsVnezFPRpE3c4b9qGAoXy4sArRafoLxElUMU4NezrXDYJLJj4ReaSCDLY7Zkh /+N/wl3dr1HtzjQ66w80UH5h+/qKwW0wMjySk3qamEDmkgAFtpoYx0JJVcdfggO1WLOq QzDVPCirb6U1K6lquAJwNKxSwaSyQwgJbGkdeN87qcKl4FfvSeuV+ZyojsW64se3jZNh YS1ifollVxxw/zpTavWC2JO7s+N9msECn60lRMCX+PE/+ZorbVTjXIOJtcppwFt1bNbn Bo9gRznNrCYWtmFWRX1yWlqOKT3+S7AIVvao67vZjVCXExSOI4dhS4KydXf2t25nbYi3 saHg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p1c65uyn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76807-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76807-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s5-20020a056a0008c500b006e09670b2f7si9561186pfu.107.2024.02.22.07.56.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:56:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76807-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p1c65uyn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76807-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76807-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1CCC528C903 for ; Thu, 22 Feb 2024 15:45:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 045481509B4; Thu, 22 Feb 2024 15:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p1c65uyn" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5213660EC7; Thu, 22 Feb 2024 15:41:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616518; cv=none; b=ZRm7Ui9/onsnsUpjaC+UnShrjxCIgSKnwrvb2awLVzZFmYyr4tA4ixQiQdBmjlAX52BcFNcLK3ubpfZU9N+sBIZ8FOlJl6npLx7L7wxOaBsQ5BXDEg+JIKd5NKmcWGZRV8P5/e3v5OuxS0Hp7/fWgAg9xp+CxuHoPGoI758pEOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616518; c=relaxed/simple; bh=8s/AE2Lvj5xM13lRGG/ygcRJb/+6WUbmfaVrUP2qSz0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Yu43Q6+EbNpf6L6qK/rQJm2ncXz+UR0tKGLktv7YH2+U/WzEfSw+TisrWI6zKDunv+3idvEofrWNZS6oJqxPTUdMlSv4Nyxf/l5W3vKOnWGafcaWnF1kHs8SP8VRkbLQiNBpyHV0YiftLONVcAjOKAEV4hKitDKLZKDdDHzvHY0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p1c65uyn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04137C43601; Thu, 22 Feb 2024 15:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616517; bh=8s/AE2Lvj5xM13lRGG/ygcRJb/+6WUbmfaVrUP2qSz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p1c65uynO06Q+jx9RFAiP9vWUSRKGgvfkj6UXpCWnWf+XjVPUyNrh6x8WwC2R5kwx JNCiHJyhnTlRwTNffysBLEjfPfxX5aYQPpwwEXS1mmni9vz0yAcKVBbpacpgmYams4 cG7foLyWBBNjZdTYkkuQGfTWtkFIJ/IdkFjR4rMjuJ+bVksWnkSOY48sukoMWrDslv n8yRYEemp52iXka9p2aPXkiwSrNZ8DXZ1zCZfKaPw6n92leEbE720kwarSk06C5ftK Dpm7I1V7ynnAZUxaHLdNSqR72kd9h0EhbLbHdb1Lo5TcvIo9ZYqXB0mmxxGIHF4KEw 7ketiNKMvCtww== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 09/12] drm/mediatek: Use cmdq_pkt_create() and cmdq_pkt_destroy() Date: Thu, 22 Feb 2024 15:41:17 +0000 Message-Id: <20240222154120.16959-10-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791615193520756252 X-GMAIL-MSGID: 1791615193520756252 Use cmdq_pkt_create() and cmdq_pkt_destroy() common function instead of implementing drm version. Signed-off-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 46 +++---------------------- 1 file changed, 4 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index df693fa268ce..96c0db44dc79 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -111,44 +111,6 @@ static void mtk_drm_finish_page_flip(struct mtk_drm_crtc *mtk_crtc) } } -#if IS_REACHABLE(CONFIG_MTK_CMDQ) -static int mtk_drm_cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *pkt, - size_t size) -{ - struct device *dev; - dma_addr_t dma_addr; - - pkt->va_base = kzalloc(size, GFP_KERNEL); - if (!pkt->va_base) - return -ENOMEM; - - pkt->buf_size = size; - pkt->cl = (void *)client; - - dev = client->chan->mbox->dev; - dma_addr = dma_map_single(dev, pkt->va_base, pkt->buf_size, - DMA_TO_DEVICE); - if (dma_mapping_error(dev, dma_addr)) { - dev_err(dev, "dma map failed, size=%u\n", (u32)(u64)size); - kfree(pkt->va_base); - return -ENOMEM; - } - - pkt->pa_base = dma_addr; - - return 0; -} - -static void mtk_drm_cmdq_pkt_destroy(struct cmdq_pkt *pkt) -{ - struct cmdq_client *client = (struct cmdq_client *)pkt->cl; - - dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size, - DMA_TO_DEVICE); - kfree(pkt->va_base); -} -#endif - static void mtk_drm_crtc_destroy(struct drm_crtc *crtc) { struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); @@ -156,7 +118,7 @@ static void mtk_drm_crtc_destroy(struct drm_crtc *crtc) mtk_mutex_put(mtk_crtc->mutex); #if IS_REACHABLE(CONFIG_MTK_CMDQ) - mtk_drm_cmdq_pkt_destroy(&mtk_crtc->cmdq_handle); + cmdq_pkt_destroy(&mtk_crtc->cmdq_client, &mtk_crtc->cmdq_handle); if (mtk_crtc->cmdq_client.chan) { mbox_free_channel(mtk_crtc->cmdq_client.chan); @@ -1083,9 +1045,9 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, mbox_free_channel(mtk_crtc->cmdq_client.chan); mtk_crtc->cmdq_client.chan = NULL; } else { - ret = mtk_drm_cmdq_pkt_create(&mtk_crtc->cmdq_client, - &mtk_crtc->cmdq_handle, - PAGE_SIZE); + ret = cmdq_pkt_create(&mtk_crtc->cmdq_client, + &mtk_crtc->cmdq_handle, + PAGE_SIZE); if (ret) { dev_dbg(dev, "mtk_crtc %d failed to create cmdq packet\n", drm_crtc_index(&mtk_crtc->base)); From patchwork Thu Feb 22 15:41:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204833 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp29384dyb; Thu, 22 Feb 2024 07:51:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU33pd9qkKbr61zU93BBEO/iy4W5bU5Qk2/JDJDidimXG1QmW/n0dUQVMSdjHbMfkCJGZw0Y1vUVbTf77XGOb70PoXM5w== X-Google-Smtp-Source: AGHT+IGbXI9LE7+czc+diA81D66UQOST8gzZ5RA7nVTZIzceDnXSwcnq4p6Jx9IkuSLRq+tzwrL8 X-Received: by 2002:a05:6359:4c1a:b0:17a:ce47:3986 with SMTP id kj26-20020a0563594c1a00b0017ace473986mr19346705rwc.28.1708617113055; Thu, 22 Feb 2024 07:51:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708617113; cv=pass; d=google.com; s=arc-20160816; b=qATEj9x1+bT+0Rt6b+9QJZcU8kMhrMi3SUKntkqlibXSvWk+LKmiQP6RJPxal22RkS FO+cZSkvM0+8dC2XWWuZBx9rbUIEhYPGPfZB1yfs0FxtZXN3WHTyVDs3mP0DDwxH8XBY gakPFTQS3t673ZydE434XyxH5PxButwyprTHNtMoTcGeDKqbhACIzclHEO7Qi7aPkt8I db2h0HJk2Cj/re5+xUcDlvoE3MYFv4HRXVQ7n8YfRgw8iPm727gz22nvivIQ4w9W7Bt6 DDfcQhSF04U2e3jqiWnpp7qj9CoaGt92JgE+YVUXLnXcNzFDlyQed0Xmz9Da7mSWp2uL k8QQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Gg/ThM+TLiVE6WJbjtMjLEFTXXF/HE62xjrwPLpeINM=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=w7Eh2BTc7VBAPs7J21Xx7LYRIPcd4omjeNpxn2sPgoxOTbMiTx3RAftDFtBF0XIUvo IHa+ZoPtdC7fZ1qcpobURkZtuHbv7xH6E6r+1BryW67h48GWIzLyw9z1PNQ4+Y+wrAk1 51hM87HvTwDGl6zKIQzPtjntuH8grDNtS7FwIRpb0+htQGngmDxqyO/Dt4tcFjHJsc7s gGM4zqeee1IQ8/AU1eLmL9hvYJBTjxJsuP8w/N8EQ73lAhHFn0evCTElIP9fIEd2DZvI RlxLSYt3F5NmpQ6RPGtglsusWLYemev83Y2zGLz/fMEObTfME4hfPojuO5W+PI/+Ugzc Ow3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uQUAk1TB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76808-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76808-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s22-20020a63af56000000b005e0b862f469si9646901pgo.158.2024.02.22.07.51.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:51:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76808-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uQUAk1TB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76808-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76808-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 10670B27EE4 for ; Thu, 22 Feb 2024 15:46:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 733BF1586EE; Thu, 22 Feb 2024 15:42:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uQUAk1TB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCCF11586D5; Thu, 22 Feb 2024 15:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616522; cv=none; b=bmEDvI9NGB8CVt/F/8yGwpZyJiIuOan5EHsPZQNXyIongky4fI+Pet24AtPLBlDZNgOn1xdTIGG7zgHpoh7dzjJPScOXe4rQ0uDynvnGxQ5NMtxA7HK4h0+q/GG7A4RmGVl+KGRyAmKScEdGP/rHAsF8HmAWOMHGhhRrRmMpa8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616522; c=relaxed/simple; bh=EnlDgbrVCRzMk/5nA8phcXNSHmHCcO7T/tMtxNbprvs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lm/g3KzdiDQ2eCk7BZdzTjcn8AI7cgavZR0TaXFNvGp0D0HRdJweG0SiiBxlP1HaLYQUzthXOhYEzaXXPxrKEXUK6KpNpyGp1n+l/07tgMiPQ8bXxXUDFNURDci2Vd787oI65tFKs814nRbupKKZZo6Uz1CgNJZM/MWMSZHsrn8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uQUAk1TB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DA22C43390; Thu, 22 Feb 2024 15:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616521; bh=EnlDgbrVCRzMk/5nA8phcXNSHmHCcO7T/tMtxNbprvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uQUAk1TBgeFaNwoHocfLvos2nHMyvH2XhcOjildr5QnbcV2KxngArqmqNWBVDSjzG Rr60cmb1GL7P5guQAhUHdGl8n17FvfS14znBK6SuHtcLOmjQsLqT2VfryOM5b/Go2k qvY/6/yWtPNrJMKmilSD9hky8QFKJeipX5pfeh0Y1TbPyjeogfzMvz3m1TPJC/wIey tZPcuuf0Ae6zfvyrJZVfN8knDfILwu/d/n51eDiRcZXDk7HFoOl967jQFc5CJCRXwB DWUEHXISRfU+C9fjoVXBr8lpUtKNb83AGQLg31Gy3Prv41xtoGM9+GoekwBQvm5prS muIVquBk9yXQA== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 10/12] media: platform: mtk-mdp3: Get fine-grain control of cmdq_pkt_finalize() Date: Thu, 22 Feb 2024 15:41:18 +0000 Message-Id: <20240222154120.16959-11-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614897971193350 X-GMAIL-MSGID: 1791614897971193350 In order to have fine-grained control, use cmdq_pkt_eoc() and cmdq_pkt_jump_rel() to replace cmdq_pkt_finalize(). Signed-off-by: Chun-Kuang Hu --- drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 3 ++- drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 2 ++ drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c index 6adac857a477..b720e69b341d 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c @@ -471,7 +471,8 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) dev_err(dev, "mdp_path_config error\n"); goto err_free_path; } - cmdq_pkt_finalize(&cmd->pkt); + cmdq_pkt_eoc(&cmd->pkt); + cmdq_pkt_jump_rel(&cmd->pkt, CMDQ_INST_SIZE, mdp->cmdq_shift_pa); for (i = 0; i < num_comp; i++) memcpy(&comps[i], path->comps[i].comp, diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c index 94f4ed78523b..2214744c937c 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c @@ -231,6 +231,8 @@ static int mdp_probe(struct platform_device *pdev) goto err_put_scp; } + mdp->cmdq_shift_pa = cmdq_get_shift_pa(mdp->cmdq_clt->chan); + init_waitqueue_head(&mdp->callback_wq); ida_init(&mdp->mdp_ida); platform_set_drvdata(pdev, mdp); diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h index 7e21d226ceb8..ed61e0bb69ee 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h @@ -83,6 +83,7 @@ struct mdp_dev { u32 id_count; struct ida mdp_ida; struct cmdq_client *cmdq_clt; + u8 cmdq_shift_pa; wait_queue_head_t callback_wq; struct v4l2_device v4l2_dev; From patchwork Thu Feb 22 15:41:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp26518dyb; Thu, 22 Feb 2024 07:46:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWpHFc2qFB2N0AQbgpahyJfBi7buvPTJUOoTwqmjsBD2BRjhfCO+lg7rTRCurAgcKuoIYZj4ceEmRhVfgIciVYM/HqO0g== X-Google-Smtp-Source: AGHT+IH49tHeas0wtCy+DnFmEUrf5n5yuHq1UC3nHosq4hdkXKTwrQY8aoKxBC1t/ScaJTwizajM X-Received: by 2002:a62:5887:0:b0:6e4:7590:da67 with SMTP id m129-20020a625887000000b006e47590da67mr10776419pfb.8.1708616777009; Thu, 22 Feb 2024 07:46:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708616776; cv=pass; d=google.com; s=arc-20160816; b=BbC1FQh2/rjdVW1Y3bovTe4JiJ+GIE+70fuyBVlCBUQJ+gnOQ57Ib7GxDxebq5X81a n2TZwj4Tgd9E9zX/PJiybhczPbrUj7btRqwlEN8kumqgRNiHGGZoRcNMbw6m8MXoWDzH KUKh0j4a0NjQIN/esoKu71asMtZ/yadU/Oo10YASZQKxgTr00OtRmCx9MVKa+u6ae3yl VG5RA0RBxyNxkGWZKsqDuxLwt1TdLGv0xkbVSUK+AQJFNFL8q68Nc20r468fOpn1OXOg QZm8E3DVE2k4jbTDStvo6VmSpt6YDZ5tGBps3LFmSOOAcWf73wywaYa1hNN02n49skLL qzDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=yrfnvtEETKyA7JCfJ502ChZKTIbLBKz6Spbq7uKIgS4=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=uLe96a1bFNdU6Gqgs4brFsPCBGb0E8pkaijwhpYeJYMy/1JEC0Iw7sGr+OHvLmjb/9 q9acvHWg8NS1AIKnwhZ1bWbWprI1Wvg1EbrayLUYcGji3Z/z6OOjHBUFF4/Q2KX8Elax zc+lzODrNIPqTVmRK5NtuplwPGkIM8irza/oHqC7NWjIxYIzZln4+1xCyp4D4Rr/DQYp giIan+unX09+GIbKd48sh8dcg6+PrydMYd++BvNB3S0jz/uIfLOTXHoIxBYMRuKRf4RZ bwe/CQIceJGi5WoSqeWrYmECFOt6WKxng7wR5vaRVT2eqBtIfavJfTutf9vJzRH+kgTD l7YA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bMRvnplW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76809-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76809-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y20-20020a056a001c9400b006e4c395c9d2si2303951pfw.77.2024.02.22.07.46.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:46:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76809-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bMRvnplW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76809-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76809-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CE83628CF56 for ; Thu, 22 Feb 2024 15:46:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8AE3158D6F; Thu, 22 Feb 2024 15:42:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bMRvnplW" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A8C21586D5; Thu, 22 Feb 2024 15:42:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616525; cv=none; b=sxSa02wZirBnpcJkilJCP0v+WI68ddtYmM3dyPoGkDXZMNR4b52hPZLvh8IgUhFxv5KMj1ASUpy+PZs9Z2CZEJhastAApmER3eiNQ0HFg5NaFcp+FFzMpPlRISu+5A/7XlsYvms/mHerDaMuZ/hN3KJkAGtWCe/I07mYxfr4jlc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616525; c=relaxed/simple; bh=KgDcscSofoiJ56aGo6M+RgNx0sKZfbHtKRJhpGa5w9Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QeP32PtRGHVbmLzCIoWfIPdk7JeBf39IlyJiUMKdx2/MgYaVWrixGnwcKebrc8Kj4tCGFL4Rf5iB/AuFHGlXPEAr5cunC+cd2xJaeGQ2+/kYVKQ4Sjr1iHx5BHPn/sfqPTExVY7MwAe2yQ1lG1vQZAgDY4j+NC0Q62v7oWz2X20= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bMRvnplW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC892C433C7; Thu, 22 Feb 2024 15:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616524; bh=KgDcscSofoiJ56aGo6M+RgNx0sKZfbHtKRJhpGa5w9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMRvnplWNr4x0m1A+BadooEBnvlrCUQoEAi8eDvoZ+gs9jt023jMYy/vdPgGMCIKI x33RQJpFw+SxNgNabT81f1WfKax8FGGnF9UJnY9lu3j/U2X71coiWNQsTaXgfBGHWN THMaQqWamo0XU3LXS/PgxKfbWZ6Cn0uYEsQb3XAE9MjtUtxVX79jxi6AwUMj8jKLuI u82Q/MhXrWsx7vu0l+55IQ73dIjtFyP85ep2vjjpNpk9LnM9j2BlsKF7ZGvtnr4io2 psVBM4eLtJgkJ4EepXV4lNx0tVKVKwb0SK3RSNDeI419yC5tLFi4m/1f/Nu2HEDccJ fN6JTn/mWt9Fw== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 11/12] media: platform: mtk-mdp3: Use cmdq_pkt_create() and cmdq_pkt_destroy() Date: Thu, 22 Feb 2024 15:41:19 +0000 Message-Id: <20240222154120.16959-12-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614545431142044 X-GMAIL-MSGID: 1791614545431142044 Use cmdq_pkt_create() and cmdq_pkt_destroy() common function instead of implementing mdp3 version. Signed-off-by: Chun-Kuang Hu --- .../platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 45 ++----------------- 1 file changed, 4 insertions(+), 41 deletions(-) diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c index b720e69b341d..c7a9f142102d 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c @@ -287,43 +287,6 @@ static int mdp_path_config(struct mdp_dev *mdp, struct mdp_cmdq_cmd *cmd, return 0; } -static int mdp_cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *pkt, - size_t size) -{ - struct device *dev; - dma_addr_t dma_addr; - - pkt->va_base = kzalloc(size, GFP_KERNEL); - if (!pkt->va_base) - return -ENOMEM; - - pkt->buf_size = size; - pkt->cl = (void *)client; - - dev = client->chan->mbox->dev; - dma_addr = dma_map_single(dev, pkt->va_base, pkt->buf_size, - DMA_TO_DEVICE); - if (dma_mapping_error(dev, dma_addr)) { - dev_err(dev, "dma map failed, size=%u\n", (u32)(u64)size); - kfree(pkt->va_base); - return -ENOMEM; - } - - pkt->pa_base = dma_addr; - - return 0; -} - -static void mdp_cmdq_pkt_destroy(struct cmdq_pkt *pkt) -{ - struct cmdq_client *client = (struct cmdq_client *)pkt->cl; - - dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size, - DMA_TO_DEVICE); - kfree(pkt->va_base); - pkt->va_base = NULL; -} - static void mdp_auto_release_work(struct work_struct *work) { struct mdp_cmdq_cmd *cmd; @@ -341,7 +304,7 @@ static void mdp_auto_release_work(struct work_struct *work) atomic_dec(&mdp->job_count); wake_up(&mdp->callback_wq); - mdp_cmdq_pkt_destroy(&cmd->pkt); + cmdq_pkt_destroy(mdp->cmdq_clt, &cmd->pkt); kfree(cmd->comps); cmd->comps = NULL; kfree(cmd); @@ -388,7 +351,7 @@ static void mdp_handle_cmdq_callback(struct mbox_client *cl, void *mssg) atomic_dec(&mdp->job_count); wake_up(&mdp->callback_wq); - mdp_cmdq_pkt_destroy(&cmd->pkt); + cmdq_pkt_destroy(mdp->cmdq_clt, &cmd->pkt); kfree(cmd->comps); cmd->comps = NULL; kfree(cmd); @@ -418,7 +381,7 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) goto err_cancel_job; } - ret = mdp_cmdq_pkt_create(mdp->cmdq_clt, &cmd->pkt, SZ_16K); + ret = cmdq_pkt_create(mdp->cmdq_clt, &cmd->pkt, SZ_16K); if (ret) goto err_free_cmd; @@ -513,7 +476,7 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) err_free_comps: kfree(comps); err_destroy_pkt: - mdp_cmdq_pkt_destroy(&cmd->pkt); + cmdq_pkt_destroy(mdp->cmdq_clt, &cmd->pkt); err_free_cmd: kfree(cmd); err_cancel_job: From patchwork Thu Feb 22 15:41:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp26681dyb; Thu, 22 Feb 2024 07:46:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV+p5es4TYKEZ/F7K1uFta+NRBL5rqfzi9fPYr046EMHDGO7ZZlZwQ6aLY+pR8N2c/nLCKPwSr347WlX5p5Ss4BJUoA6A== X-Google-Smtp-Source: AGHT+IHMI0rjd6RRXXJ4cu4bklLrPTxJC8WJcC7Bs3S24LEZSLVd1JD2l4Vz1HP3TBUkC+W5EaPE X-Received: by 2002:a17:902:da87:b0:1db:3a89:775b with SMTP id j7-20020a170902da8700b001db3a89775bmr26014865plx.3.1708616795003; Thu, 22 Feb 2024 07:46:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708616794; cv=pass; d=google.com; s=arc-20160816; b=M0flCqtOzSNcu/YOwAXCA6KtGc5xqCmMd5aMDy0qrDGi6XjLyWO8oNk8VKikyGZXRQ h9yML60FWolMxwCwWj4CO8deW25R0NLdApwmf6mUejnpSYI4gQgKodsXgKaqPc5f4lK5 StsRxP3Jul6JnlN8UWmryglZ+yCiWXPC14qocyDG5eenysNXWTu0//LIFe9nHaGG3muK CCRgnbjhsOo0UqGlZnQnj1o4KPTHQGQMVhMWo6uNpSfpCheKcBE9j1wwZB4Sec/lcvpi XbjnVBJfJFIPifCiIF1ukRiZPbVrfmN6Bl3uwDZVy5SyjDyI1QyXYFlWfDomwmeBRVTG 8KSQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9AqcDnRl7iouMRyjBtEQhyEfZKzO3Bq9O+oha54W/Ek=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=Etuw6l5GL6jkL21nmmLuLc54ZaeJGVgMAxYdYQNZ0dacqgH9myQmO/bqgNto2VMONE 38/1a+KVgaa3HrcgdFIOYLphhl1yGuzuK0JmkYldGYw1RCxM1vZVS6lUVAt4+ErSNoE/ ELGlhMQ0XzG/kb3Oo2pAL4k8NGGRneofYCIocbzuNBRRPvfVR+y5LhBzHvNweBlCWpyT FUl1xPQng+6YBrU1P6VdqUBqM43+agGe1oxzx6v6fIYqITDZQK+arJdHMkUAcy+QvKBJ Znk/gUk4HaiZHArfq/Iv3Vl4zK2E62HTK5LCu3FN43w01E4orANX/rdbrea40UzZP+tm 6pww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ULvRevFm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76810-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76810-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j2-20020a170902da8200b001d93327867bsi10483228plx.286.2024.02.22.07.46.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:46:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76810-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ULvRevFm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76810-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76810-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CEB61286E28 for ; Thu, 22 Feb 2024 15:46:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7873158D8D; Thu, 22 Feb 2024 15:42:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ULvRevFm" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27F75158D75; Thu, 22 Feb 2024 15:42:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616528; cv=none; b=LcCdg7vCAhoDTtVTOrrGXeOmfrKb5mW9NxkPduOpM77lQ2SAhZkPULqrftYGtdFT/IyOEFvtk++5okIvvp9wWPky4+A0i4TCxMqQNO85u6ZN+w/vBg0QQ5cvBcqSvK0rKT/npR2P8Ii19W5BJJMMJSOY9iiH1PWryyXfgLYGFs4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616528; c=relaxed/simple; bh=KO0UKLqm+OddAhcTdqHcm9JrDeUZKFWO1dn/YTdiCjg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=C4aMGogdeu0NBcPIWZQNXN0H8O8nrOVhi3f50urY8ctefsar20vuJt8V5joPJNGdRiVayVq37YIJzSA80gljYrC3/kXePrzNZjifLAwSimyh2uB8OE0U9uJZr6Hcj65Xs+IH6PMSrtz0NG/2eyWV5jaACfvfnM9csfhpdILzUcg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ULvRevFm; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 307CBC433F1; Thu, 22 Feb 2024 15:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616528; bh=KO0UKLqm+OddAhcTdqHcm9JrDeUZKFWO1dn/YTdiCjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ULvRevFmAJDU77CXRU8vM7MQqLlnOOa+4MS6HSmJUK1Dv3q5StBZqUarVmP1cNx/s NPOPZz6LnWNa5c4SE/6hHkp7Ph+8W10fK7lSZoAad6b6MsKKFoWxNxxunTGmNHN7MJ 1e15LcfeelpJqpw5z6ME5jy9sUOsDeNj/r2x+YuH3bL7pehvhKcB/s6Ct8J7L+AQ7h 7REHqiFQB5M/nnabCq1Ef5H733QyWF27OeHuZE3GuudfYe2NVK1JW1GOVjArfOQRBs tRY0ceNI+8LI/Bsg3op9OFroEYzKfSiwGTvtVBhG1nd/XN6D4Bou9doj+WPlj+XK3z jD+HeaPMqs6CQ== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 12/12] soc: mediatek: cmdq: Remove cmdq_pkt_finalize() helper function Date: Thu, 22 Feb 2024 15:41:20 +0000 Message-Id: <20240222154120.16959-13-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614564505791212 X-GMAIL-MSGID: 1791614564505791212 In order to have fine-grained control, use cmdq_pkt_eoc() and cmdq_pkt_jump_rel() to replace cmdq_pkt_finalize(). Signed-off-by: Chun-Kuang Hu --- drivers/soc/mediatek/mtk-cmdq-helper.c | 22 ---------------------- include/linux/soc/mediatek/mtk-cmdq.h | 13 ------------- 2 files changed, 35 deletions(-) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 1a1f1b260a06..d8fe98338bf2 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -414,26 +414,4 @@ int cmdq_pkt_eoc(struct cmdq_pkt *pkt) } EXPORT_SYMBOL(cmdq_pkt_eoc); -int cmdq_pkt_finalize(struct cmdq_pkt *pkt) -{ - struct cmdq_instruction inst = { {0} }; - int err; - - /* insert EOC and generate IRQ for each command iteration */ - inst.op = CMDQ_CODE_EOC; - inst.value = CMDQ_EOC_IRQ_EN; - err = cmdq_pkt_append_command(pkt, inst); - if (err < 0) - return err; - - /* JUMP to end */ - inst.op = CMDQ_CODE_JUMP; - inst.value = CMDQ_JUMP_PASS >> - cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan); - err = cmdq_pkt_append_command(pkt, inst); - - return err; -} -EXPORT_SYMBOL(cmdq_pkt_finalize); - MODULE_LICENSE("GPL v2"); diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index d9d0ee5ecb7a..6bdb9c0d6a29 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -291,14 +291,6 @@ int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_pa); */ int cmdq_pkt_eoc(struct cmdq_pkt *pkt); -/** - * cmdq_pkt_finalize() - Append EOC and jump command to pkt. - * @pkt: the CMDQ packet - * - * Return: 0 for success; else the error code is returned - */ -int cmdq_pkt_finalize(struct cmdq_pkt *pkt); - #else /* IS_ENABLED(CONFIG_MTK_CMDQ) */ static inline int cmdq_dev_get_client_reg(struct device *dev, @@ -409,11 +401,6 @@ static inline int cmdq_pkt_eoc(struct cmdq_pkt *pkt) return -EINVAL; } -static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt) -{ - return -EINVAL; -} - #endif /* IS_ENABLED(CONFIG_MTK_CMDQ) */ #endif /* __MTK_CMDQ_H__ */