From patchwork Tue Jul 5 01:15:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12905888 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BD41C43334 for ; Tue, 5 Jul 2022 01:13:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231664AbiGEBNx (ORCPT ); Mon, 4 Jul 2022 21:13:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbiGEBNv (ORCPT ); Mon, 4 Jul 2022 21:13:51 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80083.outbound.protection.outlook.com [40.107.8.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B781DE83; Mon, 4 Jul 2022 18:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L8JEmhnw/XLG+rbP+2xgNPa1/AHxfd2XkcvRAqw89aKM76FWuhZhLHnGweorliYN2P9PnHAuz349ubh3FohF7G+KCJvh4R1+bzgEtZ6qF4e0oosP3bhdNvEXfDfUXfTSDlMMcSD8WmOK9KNVeQebGp6RThZ1eqE5Q7Nz3VThYVc9IUxJMfpXz9HcwvNHlO0/3jNVeRQ2LPzHA9nq2UMIReB1uG85em5EvzoBnwKNE91+8stTbqDcd6n/DufuL0qWLhNbGbfbOa8tDF6lYFfjh8vAJeTIUW/glBxHd5puTXkDflOEP9Xrcw7qDfy0p7dJFDp22Q9WJ6rrno6Vgb4ddQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wOu05O4LPNwJdNIi00SmXbN2GkM0DgItVxF4qTyK0HY=; b=YeJCJIZp4LXxUAOJFtY/g46jgFxrRaqcVJZeNvxJlPGWpQ0TXrzxOUZ5+d0xhOCAFcAYSWCZcwu3kDhqKy8jStqXn1Sm8kXJgK4N0WAAdjitjaYJhnz6cTaQ/OT3z9DEst33cggl9cmbZfHG50VVt3pwvR1t+jza9/eU7UgsByU70EnecJTPdUrk0+UK+4o5hpjBSw5xohzAGH5kg9MKw8I0TnBuTzIb/As/pVnghSD6qbh/xmXkn+eARvRLrO5OTjiC+wgNO1b7zAf4yw6LAYrm9NTfN1/krt6dyCm4HqZ9bZmPyElKwb/s+/FOPJQfirGysS/sigRCWaMTa5XBLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wOu05O4LPNwJdNIi00SmXbN2GkM0DgItVxF4qTyK0HY=; b=GBbyiwdljHA+6vu4zSHSGUnyxlJTIv2+1H6BEs7MYqY7JMn2+jpiMvbbSoedZfa3ni1X8PYSHR/MlyfGHS6+04vE5DqQpk6WYojU3LxjUm6XnZJbe6SNgP5ZAaSQmpO4BenC5OXTIKGboERlmDMUOFv1TXrj95b2SQCqynvlhwQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by VI1PR04MB4365.eurprd04.prod.outlook.com (2603:10a6:803:49::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.20; Tue, 5 Jul 2022 01:13:48 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::fdd4:8557:334b:180d%7]) with mapi id 15.20.5395.020; Tue, 5 Jul 2022 01:13:48 +0000 From: "Peng Fan (OSS)" To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, arnaud.pouliquen@foss.st.com Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH V7 1/2] remoteproc: introduce rproc features Date: Tue, 5 Jul 2022 09:15:26 +0800 Message-Id: <20220705011527.2849057-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220705011527.2849057-1-peng.fan@oss.nxp.com> References: <20220705011527.2849057-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2PR01CA0053.apcprd01.prod.exchangelabs.com (2603:1096:4:193::7) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c2a4e50e-aea0-49d8-ce1c-08da5e239d86 X-MS-TrafficTypeDiagnostic: VI1PR04MB4365:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cnKaf2ejGha6NrqG0J1750MeI+pOgH4kpImf7zK5ONU9ZJ/bdoHzyUtRPBns6yADBT89y0LngM0OG8V1OCosmBCmaO99fSSy/NwQ6l93TGBwPe7do6yIRGYYs7OSt7FvXqusyRe7SGnCWAaJ6NYtBhFVe8OTQZkAaxfwgCIWy9yBV0Ak8AT5flIWXDGa4MNiVb4LUff9gj9nqLsIrK4by8nlH2/DQtu7rx/+qzNweq9kyWsyEUHGuj/YCWjbEsoOJYdwy4UvZ10BOMjN0ZEKgkTtLwDctT0k9iclkQgI7X6KjW7w/gZ4WdIDAUkP3yYW6EINHzf7JntC/PUjuqhLUhUKnXIPxUHjSMKBTeVa17eB/muQliDjGhsdBOPAgM3GIdFbyw/KPDfLbInefty1ws5wBLUcONDLTofv3XnOGW2zbZc0esKXljJLEP8aRUYVQtZr4z6C5s1UMrzhdNi2ULLYTJqIJ0INFtjibQlrL6+Lkp8kRqSGBK7ssqILsJsGZwm46lmvO9uCQZ/Jjy31bGVCkK88yEfTi2JdHgu4XrnEKNUrOuSofrddG9NqI9cmOMkTL4KUWp59oS/CASvGY1bJnf81jSmagRQROWJHod1k2ZPeAN2rLt6rPmLev8nediKWfz9VyHic2pUMNHDdYL1yIMrjhQeC49NtJ5BqArqounPtegOHFof1T4Gz0O6pW5pXXlJflZ/0UYp3rFGWa/S/lE2YXfsssc+Dh88wndYRSREnEMH3MAv6Obt8SuJHOJ6zjs5P1ignostcH4+wZpJkdGGriBrjoCHdHHlOgf1rjCwZdQeCJ8ehuX+HBrE2 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(376002)(366004)(136003)(396003)(39860400002)(346002)(6666004)(52116002)(2616005)(6506007)(4326008)(66946007)(8676002)(66476007)(41300700001)(86362001)(6512007)(66556008)(26005)(6486002)(316002)(38350700002)(1076003)(478600001)(38100700002)(2906002)(8936002)(186003)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YAQlmWXsbuerkti93IkXNrqjEtbf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F6IUlu6HlmC45fhKDfN0UXpPwguXjpMJ8cM16dyev49Cc79VSLiFIAP2U1YTC19cX5XlFtZZOc+wQBZO1zSETOP47EGtVpo7crJl8LoN63dZLEVQuPhCMMMa3veGuEXtfewrDffu4buBFqDXFGwjon+BWU55dtIMYhrnxO7qf3Q50CWpX66c6v2o4hMGnGowTHGV5fcb5EqvYegt6l4RrbXWN76akt8L9JUaDfVZtlLy5+Doi2K3LZTaKCH60tpF79U4L3gxC6Ocf4UcBFi8/lpFvkGSoeusu4bPQVSh/OBQM1RdxdDxeANe1oB3n77B6jyMbo4y1UDo3JaKIAy0q4uHS5FDetIeiZ4Jups5nm4UOy44C9DlcI+7Co8GljbCe3V6acuJieC7oaCB7dbkL/SXN7VPhzl+SpJaDBcUtMSsbZtFMwHwtid0wE62xRhOxVzgBuSl6VHtXUORmME8ucnO02PRDkzJwzKZIuDzdr0P/KMMPrL5xlkoO6y5IljEEd X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2a4e50e-aea0-49d8-ce1c-08da5e239d86 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2022 01:13:48.7788 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eG+2Qspcw2iQystJ0znZwWu8GJHc3rHLyg0Op2fJR71VHyKVdF72lluUy3FMMT6uqB3UuQDfNmOU9mqpfV8nQA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4365 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Peng Fan remote processor may support: - boot recovery with help from main processor - self recovery without help from main processor - iommu - etc Introduce rproc features could simplify code to avoid adding more bool flags Acked-by: Arnaud Pouliquen Signed-off-by: Peng Fan --- drivers/remoteproc/remoteproc_internal.h | 15 +++++++++++++++ include/linux/remoteproc.h | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 72d4d3d7d94d..82247cb5d0c2 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -24,6 +24,21 @@ struct rproc_debug_trace { struct rproc_mem_entry trace_mem; }; +static inline bool rproc_has_feature(struct rproc *rproc, unsigned int feature) +{ + return test_bit(feature, rproc->features); +} + +static inline int rproc_set_feature(struct rproc *rproc, unsigned int feature) +{ + if (feature >= RPROC_MAX_FEATURES) + return -EINVAL; + + set_bit(feature, rproc->features); + + return 0; +} + /* from remoteproc_core.c */ void rproc_release(struct kref *kref); irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int vq_id); diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index aea79c77db0f..18869924e299 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -489,6 +489,20 @@ struct rproc_dump_segment { loff_t offset; }; +/** + * enum rproc_features - features supported + * + * @RPROC_FEAT_ATTACH_ON_RECOVERY: The remote processor does not need help + * from Linux to recover, such as firmware + * loading. Linux just needs to attach after + * recovery. + */ + +enum rproc_features { + RPROC_FEAT_ATTACH_ON_RECOVERY, + RPROC_MAX_FEATURES, +}; + /** * struct rproc - represents a physical remote processor device * @node: list node of this rproc object @@ -530,6 +544,7 @@ struct rproc_dump_segment { * @elf_machine: firmware ELF machine * @cdev: character device of the rproc * @cdev_put_on_release: flag to indicate if remoteproc should be shutdown on @char_dev release + * @features: indicate remoteproc features */ struct rproc { struct list_head node; @@ -570,6 +585,7 @@ struct rproc { u16 elf_machine; struct cdev cdev; bool cdev_put_on_release; + DECLARE_BITMAP(features, RPROC_MAX_FEATURES); }; /**