Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1585773lqb; Sun, 26 May 2024 07:45:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW4hVBZvCMiXn/kml3fW8stEkVL87Ddo/N+sf2ICFqbqGeGILJ55CP/Gl6nTkSWXpEtcrwvwXPIfuycKURtX+aBPxSWIBNuG/BRaurnpA== X-Google-Smtp-Source: AGHT+IHiXvQekJ2VLFDypU8cV13RRh/vFunXvFf+1B0OSIK8ff0BMrCSqfObFhuNh0Fg1caivpXL X-Received: by 2002:a05:6830:2b2a:b0:6f1:18da:603 with SMTP id 46e09a7af769-6f8d0a7e430mr8751960a34.4.1716734744220; Sun, 26 May 2024 07:45:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716734744; cv=pass; d=google.com; s=arc-20160816; b=yeC8/zktywwYktFoti+L1CVnY6KntyKAbeT2TAQmKx7zBDLdUAynX5NIdzK8IJma4k JIN0DopTp5obW9LoirduJPZ6QOIpUT9sCgF0h7PUWhdsOcSW3E5SHsY3a5Ze2T+z6PyV L3zRXGPyVhVL9jRIve1xTg9dWngz0G2uRMOB9mofeSk++AYNpIhfesVT9iajYml2fHML Tjns0zyAxSyDb2OLopzNiBigfTAa1U2Is5sMBOP7K9WofdOgUonnv9kYpbEMu+n05lwR 4DDlxRFcJlcitSHIOd2FOPq5J0q8HIv9lSvjmaEbMHVQkDHKz09XbR0yt8+7SXDb7rfe wzLg== 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=KxN0Cn2UnxKhpBITEVR5MpMye8qsppNfTxaYmd0XbS0=; fh=CiF6JGGVH3Hu9hr8h+4ZhiE5t9kmJcq2jSE2QKKRHfw=; b=SyERN0C1uUphuv8jGVtpbRlN5dmNSxeh2iM6E2NghxrbyKZOeT1bEdHqaL8csUFTNG I3SmDrd+7YA7+yg2gvlG/aw7wTacSxRGxS/DUb4REXcM6KQQDt7gASsQRpTfSObSuEfr tzs66WiqNuGeGJe608MKQ9O7olcL07aD1UogZrRMEoHZAJTa5kdzSvExYfgwXyh4Bt8S kWEm/FSKPfM4yvKLO7ay+Y/uLR4ojpwkx6gOw8AnoQv8IhEgEUv+f+e8TINUZBDE9CfM 23TsBpS68QLTPb2I92H0pZMcZDgrLMqPRx6BWT2u97IJT62uF2e9waoi1Yu/V7XQ8Y5C Jw5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rzbDQHoq; 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-189758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189758-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fb18c7e28si61532881cf.632.2024.05.26.07.45.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 07:45:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rzbDQHoq; 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-189758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189758-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B1FB51C20BBD for ; Sun, 26 May 2024 14:45:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE70024215; Sun, 26 May 2024 14:44:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="rzbDQHoq" Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (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 3ECFC17C69; Sun, 26 May 2024 14:44:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716734696; cv=none; b=ie3C4cNTvrLSdWO4kUGvjXBiH2wOqezKZUiY507Y6PPDmBTnYgtdTjRXIZPQ9SPSHqvVN3MVD734X5G7xS/eUhIFy1+4QhBAdvQGpwkxzwfhE4jv0dqeStV5rdyOLYPgBtMAyD7bpwbAiyQBVHELB3DNrFcfpb9tA98fMsqBKfo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716734696; c=relaxed/simple; bh=9euSA4jHUb3p7wBq4f/MU/OK495sqi86B0XSBvvvWBM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VCtq9t8ZTuB0MgYrr3fINuqq0nC4ut8hUERAsepz7Eu7zp7YxTywKYR7AmvskKbNLJ2dJDMkW5DXNpOl2PmtMgWiq3CC/Uyl2YQnGnE183agMIOvlUUfG9DhLov5kkfl4LZ08xcPnE3tOu09mVSwA2xyj2rZEH3KSeV+dXi3S/w= 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=rzbDQHoq; arc=none smtp.client-ip=210.61.82.184 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: 7eca82821b6e11efbfff99f2466cf0b4-20240526 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=KxN0Cn2UnxKhpBITEVR5MpMye8qsppNfTxaYmd0XbS0=; b=rzbDQHoqIvdehwom7Le194PuqOZ73zixMk6Q5K2zgcVX669qdWLJ6zDBpSyaQcszd3eR223+dlkVtbtYgrUtr2h936tDbv/v9+LvGfblFuBTPbp2Hfxiiaz4VxWEo1/wQFAn31AHpc9qMivQ7nJEIje/zGXZMYtV9NShj075h/Y=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.38,REQID:369f1146-9369-4b0e-86e7-1e7b659ce345,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:82c5f88,CLOUDID:d6a85384-4f93-4875-95e7-8c66ea833d57,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: 7eca82821b6e11efbfff99f2466cf0b4-20240526 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 53952760; Sun, 26 May 2024 22:44:45 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by MTKMBS09N2.mediatek.inc (172.21.101.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Sun, 26 May 2024 07:44:44 -0700 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Sun, 26 May 2024 22:44:44 +0800 From: Jason-JH.Lin To: Jassi Brar , Krzysztof Kozlowski , Rob Herring , Matthias Brugger , Chun-Kuang Hu , AngeloGioacchino Del Regno CC: Conor Dooley , Jason-ch Chen , "Jason-JH . Lin" , Singo Chang , Nancy Lin , Shawn Sung , , , , , , Subject: [PATCH RESEND,v6 4/8] mailbox: mtk-cmdq: Support GCE loop packets in interrupt handler Date: Sun, 26 May 2024 22:44:39 +0800 Message-ID: <20240526144443.14345-5-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240526144443.14345-1-jason-jh.lin@mediatek.com> References: <20240526144443.14345-1-jason-jh.lin@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-MTK: N 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 4aa394e91109..618023011d31 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 a8f0070c7aa9..f78a08e7c6ed 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