Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1738358lqg; Mon, 4 Mar 2024 02:06:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUV0pgSbStkQuVDpk8JSn7FGPSKOnhqR47PlwPquqEM47pQWkeciorLs4A2QW802apzSlz394lf/a47P/6pz/um6vqxz7bJ31hr3Hlbeg== X-Google-Smtp-Source: AGHT+IEwYKuNrv5Hotg329seao3Yk8w4WxsSsAhtpzyRFX9vUnrVvO2Q+IWre/Vaid8h532CKnf2 X-Received: by 2002:a05:6a20:430c:b0:1a1:4aa3:5844 with SMTP id h12-20020a056a20430c00b001a14aa35844mr5790578pzk.48.1709546789753; Mon, 04 Mar 2024 02:06:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709546789; cv=pass; d=google.com; s=arc-20160816; b=mpGXJqtAPZchZPd19DjQluyLezdGc1ugezfxKcbFKPc9VvcBEWWzQRunzuLmcaqTXK d7leSgnI/HxeznXES5N5pD6U9ek2Fitl1yNTIQnRUiiNV6kqIKlxCVLycPw+4eLDXa+W fF/UYhuiYr/iqlktJb5OFKyN+g7AkDm965+wjzIsBronBoCxfMzxv11tIrfb7jWaEX7f 9jy9qe5Am6vAhzL6fwrRh/2dbiaBPsRDZUNf38Dp4bbViq1E0kv0yexaSlIDuYa88+1s FBD2G85ZlaIMBWjUs2DV4ITLE1IsW5hpP7ZxM9QCPI0yvoT1nKTCjyib/8cpcXLRFhkb JK4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=QmKyHMZR7wrNWPvO0paIqA+LLrOahggQb4Qz1CB3MXU=; fh=epOVfjb5y+u5+4jOKvxvreNphOQVFA4l/i1ccWzaf4I=; b=PK24ri3pL+zZPXQVEtM1yOr36l90ep03VglrZR8ORwq9ZL4YB0cran2vMOMUCcmR0d QuZXH7UMplRjdtGzW4JcQkvFOUQWhCNXKzy3mwIeCeGw09UgqzsCT4HdRHrsNRKS478w 9Xg4tnNqskfMx/PXxWQSnCITnGh/e34zT0DN3L9GKde684Dr5bZUmqr+C7iiJWjYUjDZ 46M/ngNarMrsfpDlNtYTdh6PBtznCKhDrjuyYIFYzgOVJC3HYGae6efsTX4Dp2l6cHcG 6bGaUMojP/LywA/MgtPER6SXodKfQhh0ViQAU0Zv/4BcW/rFBEjMBXZxI4CqVIA7pKqE mo0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GqrZRx2u; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-90372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90372-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u21-20020a056a00099500b006e603c6a31asi2826411pfg.51.2024.03.04.02.06.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 02:06:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90372-linux.lists.archive=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=@collabora.com header.s=mail header.b=GqrZRx2u; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-90372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90372-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 6F8222817DC for ; Mon, 4 Mar 2024 10:06:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E626624B28; Mon, 4 Mar 2024 10:06:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="GqrZRx2u" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 609DC241E5 for ; Mon, 4 Mar 2024 10:05:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709546761; cv=none; b=m/3HRYL7o5f20XCLAWe9efT51bTakuSDfftdXdjKwauaV0Ljt1WJPxBQkYA0GY/YZJVvcm8e8zwicD9ft7qYafipCts2aNKLGrhfXN1V7AXi94EJmW6o1EA6UrOdaztzibYLoON1+RyipcgxYqbbISYYRJ4oIQ/ODE2jUUooWx4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709546761; c=relaxed/simple; bh=RWN2Ea3qOUjs6zLtAAXLBFQstrOSR//0aV6xqRJRRoM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=m6LesYSu4wNaajNrMf+PgdJf6P13tL19i4OAkt/DNzCsWnm7q1BDgle2L/ertudmVH7EEgbU4a2zaZPNo7JbhCQ8BVmJ1wfsmbtXnB/gE5eXZG3K/oOcm1O96LYEhDpzIH55nig870mY0N0HeZJejFQB6iGt8wNPIply2HZa76s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=GqrZRx2u; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1709546757; bh=RWN2Ea3qOUjs6zLtAAXLBFQstrOSR//0aV6xqRJRRoM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=GqrZRx2uqquFaYJnQ+ZQZ4Z5duNI4garPorJYbWGIcwBXVtikqwGmsSv+TSPAg24/ RXtRy6utMLXjpXYUgoqYIi3/d9O+yDEDdapjK8iyOOQWm95lkCw9vP+pqVAYSvaQD8 2MeMrgwT075yFyFqbgrhlhUourXnkm0DYcWti2SKsj7qwmwpzr5NkdzCU723O1qGkl hsm+FVUUP+eKRI3nVfLaQw+qnAQ2d+V7KV28h+QT9kSsPpO37FbQ9Z+39g4eJeebS6 BZl01pEvqkNz72VepmGyH3Z82Mge3rfc4KlUMUxuOyG3FMtsearuwQFdR9Dq5xmou0 Zf8TRylfj2Qtw== Received: from [100.113.186.2] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id D61573782091; Mon, 4 Mar 2024 10:05:56 +0000 (UTC) Message-ID: <3dab3afd-7d0c-4bf1-b4f6-984f8d5d2d02@collabora.com> Date: Mon, 4 Mar 2024 11:05:56 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/5] soc: mediatek: mtk-cmdq: Add cmdq_pkt_acquire_event() function Content-Language: en-US To: "Jason-JH.Lin" , Jassi Brar , Chun-Kuang Hu , Matthias Brugger Cc: Jason-ch Chen , Singo Chang , Nancy Lin , Shawn Sung , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Project_Global_Chrome_Upstream_Group@mediatek.com References: <20240301111126.22035-1-jason-jh.lin@mediatek.com> <20240301111126.22035-5-jason-jh.lin@mediatek.com> From: AngeloGioacchino Del Regno In-Reply-To: <20240301111126.22035-5-jason-jh.lin@mediatek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Il 01/03/24 12:11, Jason-JH.Lin ha scritto: > Add cmdq_pkt_acquire_event() function to support CMDQ user making > an instruction for acquiring event. > > CMDQ users can use cmdq_pkt_acquire_event() and cmdq_pkt_clear_event() > to acquire GCE event and release GCE event and achieve the MUTEX_LOCK > protection between GCE threads. > > Signed-off-by: Jason-JH.Lin > Change-Id: Icdae6b60345c7ec1d7541ac76d1f06da56959cde Drop Change-Id please. > --- > drivers/soc/mediatek/mtk-cmdq-helper.c | 15 +++++++++++++++ > include/linux/soc/mediatek/mtk-cmdq.h | 9 +++++++++ > 2 files changed, 24 insertions(+) > > diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c > index 2e9fc9bb1183..0183b40a0eff 100644 > --- a/drivers/soc/mediatek/mtk-cmdq-helper.c > +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c > @@ -342,6 +342,21 @@ int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear) > } > EXPORT_SYMBOL(cmdq_pkt_wfe); > > +int cmdq_pkt_acquire_event(struct cmdq_pkt *pkt, u16 event) > +{ > + struct cmdq_instruction inst = {}; > + > + if (event >= CMDQ_MAX_EVENT) > + return -EINVAL; > + > + inst.op = CMDQ_CODE_WFE; > + inst.value = CMDQ_WFE_UPDATE | CMDQ_WFE_UPDATE_VALUE | CMDQ_WFE_WAIT; > + inst.event = event; > + > + return cmdq_pkt_append_command(pkt, inst); > +} > +EXPORT_SYMBOL(cmdq_pkt_acquire_event); > + > int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event) > { > struct cmdq_instruction inst = { {0} }; > diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h > index 2fe9be240fbc..de93c0a8e8a9 100644 > --- a/include/linux/soc/mediatek/mtk-cmdq.h > +++ b/include/linux/soc/mediatek/mtk-cmdq.h > @@ -202,6 +202,15 @@ int cmdq_pkt_mem_move(struct cmdq_pkt *pkt, dma_addr_t src_addr, dma_addr_t dst_ > */ > int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear); > > +/** > + * cmdq_pkt_acquire_event() - append acquire event command to the CMDQ packet > + * @pkt: the CMDQ packet > + * @event: the desired event to be acquired What you wrote in the commit message is good documentation for this function, please also put it here in kerneldoc format as a documentation paragraph. > + * > + * Return: 0 for success; else the error code is returned > + */ > +int cmdq_pkt_acquire_event(struct cmdq_pkt *pkt, u16 event); > + > /** > * cmdq_pkt_clear_event() - append clear event command to the CMDQ packet > * @pkt: the CMDQ packet