Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2104603pxb; Fri, 25 Mar 2022 11:09:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOLIc+P4dyAyAsUBN352Kon3Wg87O11jhgA8M0gTg7S7LGcyJPMYgt9QOEj/995mtyI7et X-Received: by 2002:a17:90a:528b:b0:1bc:c5f9:82a with SMTP id w11-20020a17090a528b00b001bcc5f9082amr26172469pjh.210.1648231781773; Fri, 25 Mar 2022 11:09:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1648231781; cv=pass; d=google.com; s=arc-20160816; b=foHkq473PeUkYPtf15nUAK+ptyE1tSAL6FBIH/p5/e0GcNVhqW0QAYurhbZZuZzEke xL9YPMTVNlB3ffqLmBbfpzBNSCIuScefuN9kn76GHg1mK4iReaCcvPo/EIIJzJDOTYuh xs/DND3AQmGYyQmBJAyF8dRlLb58Z3ncrOe8tbPODA6mdP5Xv7o2lQYQ2EVChNawUQ3s Zx38rHS8JclYH4KJDy6xjeHXPzcHo+Lg5xduGlY10v+/7sqUiIxqxhOJHAeU4v7lmyVD 0djDkBb8+ks/jY35h6Hz/fgqvpEvQ8XeYMFO2+rt6UUL37Gpc/vNBSGkyiXXI2deiIk3 WS1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2zsBUw2ZzVw/TdhfoZEZuFjx0pPfrRdO/0TtQzBg4QA=; b=is+KCfRqzVlvaCTWZr1fvnahKgFlMSQHmdeCfHz3mOSr+7na0CCTkSRUWj1xNeKfYi pLCIOhlOguleg52+je2WHfen93oiSzYqGVqEr9bJSexs2901I5T/OKst259XFiUYK9lM ib9auykdlBnwiTSYKI4UKe/SLuJYPIcwVDqCZ4dQjZd60B0oiZ5Jt7aosj24TmZVnhIc FyEVpIbfwYB6IW0LZHKdbEFJA7AKGErxnRTHRzerMFbmO+Nf9gQuwkK8vlbZmf+fZ/O9 aXa/seTsLHInpjItfuxl/e76r1m+zZim9JIXeEKGoophNFauqq6jLTXBO6ijUuvzXnU0 ye8A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=fAhijZGm; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ij26-20020a170902ab5a00b00154c1348e40si2692365plb.497.2022.03.25.11.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 11:09:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=fAhijZGm; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 11E87147ADF; Fri, 25 Mar 2022 10:43:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241652AbiCWDn7 (ORCPT + 99 others); Tue, 22 Mar 2022 23:43:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231596AbiCWDnv (ORCPT ); Tue, 22 Mar 2022 23:43:51 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2054.outbound.protection.outlook.com [40.107.20.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 161796CA5A; Tue, 22 Mar 2022 20:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BgwSPSVO0Mjq7w1k/8/9L5CnHATBQYftXvdsP43thGL+RgpsD+dTKaaQD+yy6P4Q7xnjFqXuDPBKpWCRAIYunhoo6R3cYqEWLvMIwFMc1TLXjBdtY8l1BMcyVh1uNU3vULZ+QGxhzI1MWoTAX6SB56pk7toY5go+BQRo/IJsG3igXfX4NdF2ASJ6uoc2ktK7qLek2UeZim/vh7EprSBqxDSsPXx9KBWOYWCzb3Bv2QDDcsX/whEc3P6D3103rf6gB5kPf+2Nv2BVvaofVd/ROcQ2vkZL3SD9SRUZW/pY8xMPcPHUOHproDR1AdxbCpGUwKr47/iEB+l3JGl531iETg== 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=2zsBUw2ZzVw/TdhfoZEZuFjx0pPfrRdO/0TtQzBg4QA=; b=Ae3JD3fejPw8VH5aDFKoNG+QVPPRGpD2kd5psR6uDl5i4nx2CSlR7iQ9HDYtw/qTYCt10f9Ctmc95NKLRRmXzoY7/MU/oOJnlVw6jNBQz2+oQm/CI/EWsIUJ74VT1uXBNIJ60W6qS3iE1xtIgYv8tgPBxxoyaaQ4kDFMSXcS2hHNxjmF6+MALL+hmkFH17mlJ699/NsxKca3oItMg+OFPjo8nBKnp3QidCJ8CchtmSCZZJHOT/tcVb2s9ks2jMsl6Lc8w5j6IQnG8VqZQbToJcoE5v7me2PtIVepDpRzQAzxZJKQ/h+IdCrMXjrxAal9IJ8nvvIqS1M5NojctYJBBA== 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=2zsBUw2ZzVw/TdhfoZEZuFjx0pPfrRdO/0TtQzBg4QA=; b=fAhijZGmfYuh9tvKJ741JHKOiodEejutW74V2T2haZDsZM+D59hfAg7dpl7Z2vwy7jUgk140LC/0QbGPcDF7noquhG0+ciX/044dqoGKNIqNcBDH6MpC1qMaDCBo71deq752XZPYXly8SsG4vhI/pZWIp7+TkyyoIScDnCE7uJg= 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 AM0PR04MB6868.eurprd04.prod.outlook.com (2603:10a6:208:18c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17; Wed, 23 Mar 2022 03:42:21 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::1d8b:d8d8:ca2b:efff]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::1d8b:d8d8:ca2b:efff%3]) with mapi id 15.20.5102.016; Wed, 23 Mar 2022 03:42:21 +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@nxp.com Subject: [PATCH V4 1/2] remoteproc: introduce rproc features Date: Wed, 23 Mar 2022 11:44:04 +0800 Message-Id: <20220323034405.976643-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220323034405.976643-1-peng.fan@oss.nxp.com> References: <20220323034405.976643-1-peng.fan@oss.nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0111.apcprd06.prod.outlook.com (2603:1096:1:1d::13) 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: 5c6b4f07-a47f-470c-02de-08da0c7f22a8 X-MS-TrafficTypeDiagnostic: AM0PR04MB6868:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RtCQBwYrPVzAsm4Caoq8t0BnySsIIXB2b5l0fa0GlYI4nzIMuDMjvWqJLZZQRiH31+goGUGn/aW+Tvqx7nKMG+5RYRinyQ+JN1guS7sV4r0jtOZuBiIrfM+QFXoJ9jXrJ7ATyesE3R6HPENZW+znm9vUMmSZkR/vlDD0p1N6ez/8DSEp1kGFYjq/G/4GnPjFpmEXvGMIG0oC2XPk5xLdBWUcoI3L2xCwZd6OtejZhBFEHlYxUdP/Rt7q1kKxNSk224GskdDZjTDsJFoFWRLY1BMIpp3LNTtxYpG/aiYN87p7LGYMCC8G90bD/5a3N7klaGWQDVYFMzY95Eu6mo/TiIoL5BJTsovNQAkAEWYcNbZlTt9T8lD5g8orFjh6dK3KpaklKuHUocqHgIBJX3akroZfhRdekoJSdPrrcjhnsKb8ZlCqt0nBZCnwB93sMHxWEQEve0bgcqI30bEwkn99jqoEsPki6AmJSVRJ9lG2gA95PrIdBGQ6ZHr12GLK5ERMQ6VVQ1rrsfp3vGAiaYmvlbxsd1nqgGer8Jj9OggDO13suuUFV5idO2poBT+K5QNA/DyfFb8plPQtYKV3jzHeXzvV/UySpeLv1CplfGwdNgWN00N1PFbK57ir8QlmK4oQqpJIPmX9rl7TL7NV7z2t35cIHsj/Hd3/AuNcORUeK8iziRvMJRNpCsfxt3IfoqrteU2WcJT7UXjp0nHXufsQ/g== 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:(13230001)(4636009)(366004)(52116002)(38350700002)(38100700002)(26005)(186003)(6512007)(8936002)(2616005)(5660300002)(2906002)(66476007)(66556008)(66946007)(508600001)(6486002)(6506007)(6666004)(316002)(1076003)(86362001)(8676002)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?sh9Lh75u7VH/Qrj0y8osjEz3LgGn+LrE52xl2ZS/h75pOGxnPfLLKF7FsyRU?= =?us-ascii?Q?CttZdnvNyLXfClD1RXz55g2LlZxRc00Di8qk+FP/kknnEfe6FoMFThuvfMtO?= =?us-ascii?Q?uR/buTJVZMm8FV4A/VMsQohrDR79XYTrP9XERbbVtQHquThwThbPafTqRmAW?= =?us-ascii?Q?hD7cHcvsRup2kH2ezXQPV/dd5TphUPvq9pp4VTrfCo4yPJlndOXvcibkyJ1O?= =?us-ascii?Q?BBwKqG3r3KLn22dibPh5b12pss/3PXvZ63iuvDMAoyKdgna7Q0tP7HwZZX81?= =?us-ascii?Q?5pbrGypsF1f95hk1RmDclgqmxmNjr1TEgMOQwjuAlqB2Ozg3bE8rI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Vke7x5J2WOgXHVaF49ufSCKffln?= =?us-ascii?Q?hpUfKbNuR/HWIQ8C8tt4fs5tIhqaVO3d6szv5zWTeP+U/Yr5NaT34/HAZ3Wq?= =?us-ascii?Q?nKapZrnG72OWBcDlQm+GVgo7iKldVavTiVs+h9M9o8djmHWKxdzLCQpzxB0Q?= =?us-ascii?Q?BqZqkD8EMIQ+PiZ0OakXLrQUfEEfMsCNEATXpdSdvJsU5G2A4cp5zoUKuaH+?= =?us-ascii?Q?eJB1jS9Hs6NMqro2tOUCD5UHvbf7llHQ?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c6b4f07-a47f-470c-02de-08da0c7f22a8 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2022 03:42:21.0817 (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: Isgqnp6D9P3aLd+C8r2nC6pjLwRQWza4jBHYQtTSvIyCZDb4xIAX0kMn2JjeyAiwWPIpdaCdBTb/ZlQ2l/0zuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6868 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Fan remote processor may support: - firmware 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 Signed-off-by: Peng Fan --- drivers/remoteproc/remoteproc_internal.h | 10 ++++++++++ include/linux/remoteproc.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 72d4d3d7d94d..e9ae743c5587 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -24,6 +24,16 @@ 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 void rproc_set_feature(struct rproc *rproc, unsigned int feature) +{ + set_bit(feature, rproc->features); +} + /* 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 7c943f0a2fc4..7847c6b10a69 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -489,6 +489,11 @@ struct rproc_dump_segment { loff_t offset; }; +enum rproc_features { + RPROC_FEAT_ATTACH_RECOVERY, + RPROC_MAX_FEATURES, +}; + /** * struct rproc - represents a physical remote processor device * @node: list node of this rproc object @@ -530,6 +535,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 +576,7 @@ struct rproc { u16 elf_machine; struct cdev cdev; bool cdev_put_on_release; + DECLARE_BITMAP(features, RPROC_MAX_FEATURES); }; /** -- 2.25.1