Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2528453lqz; Tue, 2 Apr 2024 23:58:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVoYJVFudBKv/tYKyQq0lywNTfFrUbhFCXX3MY9aUf9rKJXQhXEneLKm0/KG/ev4Ch0j0rhcX08YUDaS+svW4phLjH+KNM/i+p5zPe9Sg== X-Google-Smtp-Source: AGHT+IG6aYqap7lcAadf8GcmUy3oV4h7sz6Qg9/H2N6TepTasOQOlDW35uEZINAwBzppeYsPwQ4n X-Received: by 2002:a05:6a21:318b:b0:1a6:ff14:a6a3 with SMTP id za11-20020a056a21318b00b001a6ff14a6a3mr13584972pzb.25.1712127526652; Tue, 02 Apr 2024 23:58:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712127526; cv=pass; d=google.com; s=arc-20160816; b=JobFiQhNQumhztqto7+W7XY5m+AEdxwt3VGkjlBbnc2ddDOPx6yXtW3LHQRO7o9838 IQyE/EM/Jgc/JjediCtp7zBJGhti/T9DOuLmZ1x2rJN78hfiya/A+Kmnsz07nqi4zSxR mQuL1HRbcximrmi5konCtxT+wimu4CkSitpmXZhZuFCYKeyhOBkIzu0iMaez/G2arVxs 0jSjRo0jlHw+vqFLVUt4QIBVdYjD+WzgPX2nkVkHMuUDX4UVvv84BYn+X28D9cBL9Ukz 5+Spl3+CfQjGCFkMtt4rBnU2N4elf5DF6hzt7SccJkVurPPFXgyhKyni2XKs08cPiWoF C6GA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=n2Vks/BZ0rlvMfSgw1uKAIL5FKtlzLmx1DK8tbvNN0g=; fh=tIGUu/tS8clb6eJPLiL5PWTs4hLnmMTnIPhkNYRWhig=; b=kYoJmInWcaWofGb3oCzHqYUkm8JtnPdDy6oFsnRePJnMcWLP+t51RXlTKF1jtxP3co bAybSa1s358htAQTR3I33kJe4qAPOlMyN2wb9x3i7ZJoNpu2a7b2HjXFhhneMO5HbMj9 j9eW/lyrqNCKLPvkxo7TkDm5pyIdoz6PNJmC1FpI2GHGs13IRpIsKuSttRTvgXDjjk2e Z69w40iJ8QhcOboHOSdeeEBO36PHCV0AfncGVrECVcCheOT6VUJeSbTZGjXCN/anfN42 ZzCyBoYe1xdLBmK7pOrR03oBThBy9kJgzTXEr4fX99ziWuL5OE9UExKGSQlQrNEnRzRB Qcdg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=efQW3Asd; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-129108-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129108-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t13-20020a17090aba8d00b002a08b51294esi14755216pjr.35.2024.04.02.23.58.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 23:58:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129108-linux.lists.archive=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=@mediatek.com header.s=dk header.b=efQW3Asd; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-129108-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129108-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B58F4B21D00 for ; Wed, 3 Apr 2024 06:57:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 348375F47D; Wed, 3 Apr 2024 06:56:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="efQW3Asd" Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (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 4BBB05CDD3; Wed, 3 Apr 2024 06:56:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712127380; cv=none; b=up9jYfO8vdreONnlndPTtv+tkzKXEgSfIDZVBiqm54ijE3dMh1yVYFfOfnBvyegZnp7feNb9hdzQQs9rKnhLoDlpg9oPW4844psTpBJJvOPR+oquJU8qIogLyHhhksvBnUB/dkNKMUs/VjhoaVObvvQe1Ocf4Ihq5Vkk4/7aK+k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712127380; c=relaxed/simple; bh=mPVl0zTkmKd52nuWPdn6X4BRSxpRpkoqUXmytI5gCyI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=r4mpdFZ5gtjxMYFXT3LBD6FvWbARenPzX1iU8a357mg+nSlCdY0fZcqxnixjAEq2cZ6qmSzZm14fjKYiP76E280bgdAqjxSSbNDcSPpkF1unUdnlzxfK1uwZlzqme3KOHTsq2ZLWikQJIz7xqoiq/kxOptIY2l5//Of0Wicp8kI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=efQW3Asd; arc=none smtp.client-ip=60.244.123.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 3ed75c1af18711eeb8927bc1f75efef4-20240403 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=n2Vks/BZ0rlvMfSgw1uKAIL5FKtlzLmx1DK8tbvNN0g=; b=efQW3AsdZDnuuanbq+Q4a7t9y5d8YE3b7CNq6O0PewV6G3oETJgOPLaUHrx917C7XKxHHU3Fc3YR1zAzujkNGbTtbWl8RKjGwElB9uBiCH9cfGZ+PS8N9q4lV31mr4MNcr5EYUL/J0wHAmHoZhXdgBiYMFlOtiqOC8Jt7S5m7Sc=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:ccd1b3b5-8d30-4b40-abe5-7fba5ec6387d,IP:0,U RL:0,TC:0,Content:56,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:56 X-CID-META: VersionHash:6f543d0,CLOUDID:3f74c385-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:801|102,TC:nil,Content:3,EDM:-3,IP:n il,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LE S:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 3ed75c1af18711eeb8927bc1f75efef4-20240403 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 676330687; Wed, 03 Apr 2024 14:56:07 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by MTKMBS14N2.mediatek.inc (172.21.101.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 3 Apr 2024 14:56:05 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 3 Apr 2024 14:56:05 +0800 From: Shawn Sung To: CK Hu , Jassi Brar , AngeloGioacchino Del Regno CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , Hsiao Chien Sung , "Jason-JH . Lin" , Houlong Wei , , , , Subject: [PATCH v4 5/9] mailbox: mtk-cmdq: Support GCE loop packets in interrupt handler Date: Wed, 3 Apr 2024 14:55:59 +0800 Message-ID: <20240403065603.21920-6-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240403065603.21920-1-shawn.sung@mediatek.com> References: <20240403065603.21920-1-shawn.sung@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--6.597500-8.000000 X-TMASE-MatchedRID: wDTc/wNgEcPlOkrqlJanurMjW/sniEQKLoYOuiLW+uUnArDy4nBG1Hv9 jBhUgWuoqNt6gBjaBAGOpJpDdVJ03s3AmdtMjGJVA9lly13c/gHt/okBLaEo+E1KG1YrOQW/OXU FK+IJNsIOrPUQy5xzLmzlLAWyLHZTHxPMjOKY7A8LbigRnpKlKSPzRlrdFGDw59eZw3B3rO0Tk1 oDEL6P6yCb531tLI5FgXeOGobR9TfGZ5s4jRI67w== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--6.597500-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 58464CF1B375E7C7A1A7FCED43898921631384C4101B1AD1B6CD48165337C7AE2000:8 X-MTK: N From: "Jason-JH.Lin" 1. Add a loop flag for CMDQ packet struct. CMDQ helper will use a loop flag to mark CMDQ packet as lopping command and make current command buffer jumps to the beginning when GCE executes to the end of command buffer. 2. Add a looping task handle flow in irq handler. GCE irq occurs when GCE executes to the end of command(EOC) instruction. If the CMDQ packet is a loopping command, GCE irq handler can not delete the CMDQ task and disable the GCE thread. Signed-off-by: Jason-JH.Lin Signed-off-by: Hsiao Chien Sung --- drivers/mailbox/mtk-cmdq-mailbox.c | 11 +++++++++++ include/linux/mailbox/mtk-cmdq-mailbox.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index ead2200f39ba0..5906e0343d1fc 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -267,6 +267,17 @@ static void cmdq_thread_irq_handler(struct cmdq *cmdq, curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR) << cmdq->pdata->shift; + task = list_first_entry_or_null(&thread->task_busy_list, + struct cmdq_task, list_entry); + if (task && task->pkt->loop) { + struct cmdq_cb_data data; + + data.sta = err; + data.pkt = task->pkt; + mbox_chan_received_data(task->thread->chan, &data); + return; + } + list_for_each_entry_safe(task, tmp, &thread->task_busy_list, list_entry) { task_end_pa = task->pa_base + task->pkt->cmd_buf_size; diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h index a8f0070c7aa98..f78a08e7c6ede 100644 --- a/include/linux/mailbox/mtk-cmdq-mailbox.h +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h @@ -76,6 +76,7 @@ struct cmdq_pkt { size_t cmd_buf_size; /* command occupied size */ size_t buf_size; /* real buffer size */ void *cl; + bool loop; }; u8 cmdq_get_shift_pa(struct mbox_chan *chan); -- 2.18.0