Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp582951rdb; Thu, 21 Dec 2023 20:55:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1c4QluxKWNGm6dLIDvSBqlSm9MStUbjU9o43OxGLPdB94V7LrDWHZyiPGdfjwtclIU29i X-Received: by 2002:a05:600c:1798:b0:40c:2b16:1dd with SMTP id x24-20020a05600c179800b0040c2b1601ddmr372951wmo.93.1703220938088; Thu, 21 Dec 2023 20:55:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703220938; cv=none; d=google.com; s=arc-20160816; b=cn8sqKqOKMVaFceFN1HFEFDEr4Own4yOZGmw4b5x0SkXAYTgSoveujR0IeZNaD0GYv fwCDP+KBm9zXQJ4sGQw3CxICrEfgYeb/ewu/xd9ZfEV8NT3Ad7gaHE8fTu4MgEgDdyL4 RSHNbyaKG6MXQanKrPb3Y1HNwnZ6Pnt6Nrz0l+IPxzER2SRITcMLN9r551iLHNuZHMIn SgfZ0bnCmRHO/dN2CQfTi4GgbCS3nbaW50w0lDTj+fLAUDbBRJaeflsx2gtY2u2PZoYd bWuJFhWl+4uz/zVcCYsddCW+s1JWi/E/s3PXcJd5+YMcBm8ZDT7oBdNAnH6Soz8Ott/T 5CXA== ARC-Message-Signature: i=1; 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=Vo7/8SdJTy6PD+1QaQcWVlel/mcBE+WmrpBeWZ3cneU=; fh=9GXooidGHdC4mKy+YjbRPS9j3Njre1sTa37NFoEebi8=; b=KuFQj/0tvS1Z5/t9vNhfVxDssSo35jxKtZPvnZ7VJS+N5FXC5tHOLnsKk727DSMFFk RY8Eqfz/vQIezdm1OBw2ip1foI0nYIjrnnluot82vx+sYoSW03/LNefJf4PxtARt/FUH V6LOSbbQSeq1l5VVtmgWWJu5CqU+NWvYHLQeyFr/pWWoO4tRlqhS5HuKA3KzsKfBPeD/ A5zJtAE/9mPLiqoGp9vdCpVyOVffl8KF73N+Z1FPp2Dm+hnLWegcXhUHcwZAY1T6hker x6YWEMzyntgjqc1zdRjdUH7usxRRHHHG2FTLldzOeEbno8L6sfl0uI/RZR4bdrJhpyup 4Y/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=eY6sUOpf; spf=pass (google.com: domain of linux-kernel+bounces-9352-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9352-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h2-20020a17090634c200b00a26adbd5c82si865992ejb.29.2023.12.21.20.55.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 20:55:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9352-linux.lists.archive=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=@mediatek.com header.s=dk header.b=eY6sUOpf; spf=pass (google.com: domain of linux-kernel+bounces-9352-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9352-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 am.mirrors.kernel.org (Postfix) with ESMTPS id ABEB01F2503D for ; Fri, 22 Dec 2023 04:55:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8666E18047; Fri, 22 Dec 2023 04:52:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="eY6sUOpf" X-Original-To: linux-kernel@vger.kernel.org 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 CDA91D306; Fri, 22 Dec 2023 04:52:42 +0000 (UTC) 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: eaf843a4a08511eeba30773df0976c77-20231222 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=Vo7/8SdJTy6PD+1QaQcWVlel/mcBE+WmrpBeWZ3cneU=; b=eY6sUOpfqyatahaw++pVC3GYiWQy2Fnm/0hvpaa+q7USWTpWbv8kdifzzNNrRxNcIPiB2aCBJ21jAT3mkbUEN6z3QTjhICQNONEbI0C3lGsaQjvUU/uQirmISkrC1SojrUYM3zDhhprs7Kr1QzO0w8pof5jlp6/zEoOVupPFRPQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:c68073c6-e522-4887-ac6c-70643eeae8cc,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5d391d7,CLOUDID:a4b8738d-e2c0-40b0-a8fe-7c7e47299109,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: eaf843a4a08511eeba30773df0976c77-20231222 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2030041288; Fri, 22 Dec 2023 12:52:32 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 22 Dec 2023 12:52:31 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 22 Dec 2023 12:52:31 +0800 From: Jason-JH.Lin To: Jassi Brar , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Chun-Kuang Hu CC: Conor Dooley , Mauro Carvalho Chehab , , , , , , Jason-ch Chen , Johnson Wang , "Jason-JH . Lin" , Singo Chang , Nancy Lin , Shawn Sung , Subject: [PATCH v3 7/9] mailbox: mediatek: Move reuseable definition to header for secure driver Date: Fri, 22 Dec 2023 12:52:26 +0800 Message-ID: <20231222045228.27826-8-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231222045228.27826-1-jason-jh.lin@mediatek.com> References: <20231222045228.27826-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-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--8.411300-8.000000 X-TMASE-MatchedRID: K02MXwpCiCtLbaTfilVXfTPDkSOzeDWWf6/Md8Lb2l/1gF7PCEF9bli5 r+TKtIsr64Ta3P14gV2y7ec+ITUwMzW+K/PcvqBra0aUozXm0DYh9mNF8ZPJ2Cz+5QCTrE/sgK6 qCGa1Z9euDlY3VLd7CFn74Xleqcq0QBI3/CURWxx05zsoB1UKTqk89YpdLgI7DpCUEeEFm7AtiD c0qML5ZNwAFNNtZv2wtcF3I8fd45iXBXaJoB9JZxRFJJyf5BJe3QfwsVk0UbuGrPnef/I+eqzZI n3r7BwhnZgsMwbJ9WzENc1hpwdtvClyqLZvurBwC8XKjsVbJjU= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--8.411300-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: ACEFB8A57DD322DB60FA41F160643FA22A28B778E24856E957B2F5837CA286092000:8 X-MTK: N To support CMDQ secure driver, move some reuseable definition to header. - define: e.g. CMDQ_GCE_NUM_MAX, CMDQ_THR_BASE, CMDQ_THR_SIZE. - struct: e.g. cmdq_thread, cmdq, cmdq_task. - include: e.g. . Add "#include " for the function that takes "struct mbox_chan * chan" as a parameter. That may occur a build error if secure driver header includes the mtk-cmdq-mailbox.h. - function: e.g. cmdq_get_shift_pa(struct mbox_chan *chan). Signed-off-by: Jason-JH.Lin --- drivers/mailbox/mtk-cmdq-mailbox.c | 30 --------------------- include/linux/mailbox/mtk-cmdq-mailbox.h | 33 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index 5390b6488ebc..04321f7e10c3 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -3,7 +3,6 @@ // Copyright (c) 2018 MediaTek Inc. #include -#include #include #include #include @@ -22,13 +21,10 @@ #define CMDQ_OP_CODE_MASK (0xff << CMDQ_OP_CODE_SHIFT) #define CMDQ_NUM_CMD(t) (t->cmd_buf_size / CMDQ_INST_SIZE) -#define CMDQ_GCE_NUM_MAX (2) #define CMDQ_CURR_IRQ_STATUS 0x10 #define CMDQ_SYNC_TOKEN_UPDATE 0x68 #define CMDQ_THR_SLOT_CYCLES 0x30 -#define CMDQ_THR_BASE 0x100 -#define CMDQ_THR_SIZE 0x80 #define CMDQ_THR_WARM_RESET 0x00 #define CMDQ_THR_ENABLE_TASK 0x04 #define CMDQ_THR_SUSPEND_TASK 0x08 @@ -59,32 +55,6 @@ #define CMDQ_JUMP_BY_OFFSET 0x10000000 #define CMDQ_JUMP_BY_PA 0x10000001 -struct cmdq_thread { - struct mbox_chan *chan; - void __iomem *base; - struct list_head task_busy_list; - u32 priority; -}; - -struct cmdq_task { - struct cmdq *cmdq; - struct list_head list_entry; - dma_addr_t pa_base; - struct cmdq_thread *thread; - struct cmdq_pkt *pkt; /* the packet sent from mailbox client */ -}; - -struct cmdq { - struct mbox_controller mbox; - void __iomem *base; - int irq; - u32 irq_mask; - const struct gce_plat *pdata; - struct cmdq_thread *thread; - struct clk_bulk_data clocks[CMDQ_GCE_NUM_MAX]; - bool suspended; -}; - struct gce_plat { u32 thread_nr; u8 shift; diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h index f78a08e7c6ed..43eae45a08c9 100644 --- a/include/linux/mailbox/mtk-cmdq-mailbox.h +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h @@ -7,10 +7,17 @@ #ifndef __MTK_CMDQ_MAILBOX_H__ #define __MTK_CMDQ_MAILBOX_H__ +#include +#include #include #include #include +#define CMDQ_GCE_NUM_MAX 2 + +#define CMDQ_THR_BASE 0x100 +#define CMDQ_THR_SIZE 0x80 + #define CMDQ_INST_SIZE 8 /* instruction is 64-bit */ #define CMDQ_SUBSYS_SHIFT 16 #define CMDQ_OP_CODE_SHIFT 24 @@ -79,6 +86,32 @@ struct cmdq_pkt { bool loop; }; +struct cmdq_thread { + struct mbox_chan *chan; + void __iomem *base; + struct list_head task_busy_list; + u32 priority; +}; + +struct cmdq { + struct mbox_controller mbox; + void __iomem *base; + int irq; + u32 irq_mask; + const struct gce_plat *pdata; + struct cmdq_thread *thread; + struct clk_bulk_data clocks[CMDQ_GCE_NUM_MAX]; + bool suspended; +}; + +struct cmdq_task { + struct cmdq *cmdq; + struct list_head list_entry; + dma_addr_t pa_base; + struct cmdq_thread *thread; + struct cmdq_pkt *pkt; /* the packet sent from mailbox client */ +}; + u8 cmdq_get_shift_pa(struct mbox_chan *chan); #endif /* __MTK_CMDQ_MAILBOX_H__ */ -- 2.18.0