From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71579606A335 for ; Thu, 3 Dec 2026 13:06:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=UkoNie3F; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=ZPfBbJHf DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=QQLEMOfhpZ3wv8zg6hnHn4fPp73InQNxirU5MI+JSS0=; b=UkoNie3Fk5mDmctbf7lS9gAVat jejYhB5gCYOSfwy9UZfJNl3tQLTrgyUNuT1xs9QDr37/zFHKGy6aihj6ER15QJtfE4aEfa2zMmuM+ 7pyTQ4pFxGROA//Opqw/58PL1OfVNHSW9JVqNIF22nSP3ediFTsToyEk+maElygRRZeWqPzGRiR8V LV3fujS2HhRF6fluf7B/MFoU9zxDWYnHvX4BVyMtNX/sT574wIKcIsi885jNc2Smm6u6/Xu28Apd5 D3jcNBQP3xWFWXwC/lZ8ZoaeBD4rvLE5/JjQhNfzS1cgPrS6LEgOHlxGlzm5qxGzccopW10/8P1Ap +yW5HL4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ6W6-0000000Eg3e-2v6w; Thu, 03 Dec 2026 13:06:30 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ6W1-0000000Eg0I-3AIv for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 13:06:28 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 40A7E14BF; Thu, 3 Dec 2026 05:06:21 -0800 (PST) Received: from e129823.arm.com (e129823.arm.com [10.2.213.3]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AB4E93F7D8; Thu, 3 Dec 2026 05:06:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796303184; bh=rR6zeAtdUtH00N2xUtD6oVeAte2i9FSyRjjlAd1on6U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZPfBbJHfQSD4eXhv//07B9aCifLM2qWsToAlgK8ePFQHL1FBcQ0TzNvBhWa4oN6Ch nMlJ+Y2INi6Z4HjXem1STNDY3qw8kRPw3EX1wgNiJlCW5yHNP/fGKh6KrA5dudaGw/ OIIoTDaieAoVIcsYUTQmHAGqTvh5IC3naPeiZl4g= Date: Thu, 3 Dec 2026 13:06:17 +0000 From: Yeoreum Yun To: Jonathan Cameron Cc: Yeoreum Yun , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Lorenzo Pieralisi , Catalin Marinas , Suzuki Poulose , Steven Price , Sami Mujawar , "Aneesh Kumar K.V" , Jiri Pirko , GONG Ruiqi , Jason Gunthorpe , Mark Brown Subject: Re: [PATCH RFC v2 2/6] firmware: arm_firme: introduce arm_firme Message-ID: References: <20261127-firme_interface-v2-0-ab88b2d0b4e0@arm.com> <20261127-firme_interface-v2-2-ab88b2d0b4e0@arm.com> <20261202164941.0000329b@oss.qualcomm.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261202164941.0000329b@oss.qualcomm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261203_050625_964650_0735D659 X-CRM114-Status: GOOD ( 67.62 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi Jonathan, Thanks for your review. [...] > > > > FIRME interfaces are implemented at the EL3 boundary between the > > Non-secure, Realm, and Secure states. They may also be used on systems > > without FEAT_RME, for example to provide firmware-based attestation or > > security services. > > > > arm_firme.c provides the common APIs to be used for FIRME device/driver > > to support for FIRME services > Provide common APIs... > > No need to state the filename. okay. > > > > Signed-off-by: Yeoreum Yun > > Various comments inline. > > > --- > > drivers/firmware/Kconfig | 36 ++++++ > > drivers/firmware/Makefile | 1 + > > drivers/firmware/arm_firme.c | 275 +++++++++++++++++++++++++++++++++++++++++++ > > include/linux/arm-smccc.h | 1 + > > include/linux/arm_firme.h | 261 ++++++++++++++++++++++++++++++++++++++++ > > 5 files changed, 574 insertions(+) > > > > diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig > > index 43e2e2a645945..d031c36c44dcc 100644 > > --- a/drivers/firmware/Kconfig > > +++ b/drivers/firmware/Kconfig > > @@ -60,6 +60,42 @@ config ARM_SDEI_NMI > > > > If unsure, say N. > > > > +config ARM_FIRME > > + bool "Arm Firmware Interfaces for Realm Management Extension (FIRME)" > > + depends on ARM64 && HAVE_ARM_SMCCC_DISCOVERY > > + default n > > Unless something else is forcing things, everything is default n so don't > specify it. Acked. > > > + help > > + The Realm Management Extension (FEAT_RME) is part of Arm Confidential > > + Compute Architecture (CCA) and enables support for dynamic, attestable > > + trusted execution environments ("Realms") on Arm systems. > > + > > + Realm management flows depend on EL3 firmware for operations such as > > + Realm construction, resource allocation and isolation, and attestation > > + of initial Realm state. > > + > > + The FIRME defines standard interfaces provided by EL3 firmware to > > + satisfy these dependencies. These interfaces include: > > + > > + - Granule Protection Table management > > + - IDE key management for PCIe and CXL Root Ports > > + - Memory Encryption Context management > > + - Attestation token management > > + - Integrated device management > > + > > + Each group of interfaces forms a FIRME service. A base FIRME service > > + is also defined to provide common concepts, service discovery, and > > + feature discovery across services. > > + > > + FIRME interfaces are implemented at the EL3 boundary between the > > + Non-secure, Realm, and Secure states. They may also be used on > > + systems without FEAT_RME, for example to provide firmware-based > > + attestation or security services. > > + > > + This opions provides the common APIs used for FIRME service > > + implementation driver. > > + > > + If unsure, say N. > > Why? I'd think we'd want this on any platform that supports it. See. Let me change with Y. > > > + > > > diff --git a/drivers/firmware/arm_firme.c b/drivers/firmware/arm_firme.c > > new file mode 100644 > > index 0000000000000..fafed19121141 > > --- /dev/null > > +++ b/drivers/firmware/arm_firme.c > > > +int firme_get_shared_buffer_info(struct firme_shared_buf_info *info) > > +{ > > + if (static_branch_unlikely(&firme_disabled)) > > + return -EOPNOTSUPP; > > + > > + if (!info) > > + return -EINVAL; > > + > > + memcpy(info, &base_service_info.shbuf_info, > > + sizeof(struct firme_shared_buf_info)); > sizeof(base_service_info.shbuf_info)); > > as then no one has to check for anything odd about the type. Acked. > > > > + > > + return 0; > > +} > > +EXPORT_SYMBOL_GPL(firme_get_shared_buffer_info); > > > > + > > +static int firme_smccc_dev_create(void) > > +{ > > + int ret; > > + unsigned long feature, service_list; > > + int i, j; > > + > > + struct firme_dev_info { > > + const char *dev_name; > > + struct arm_smccc_device *sdev; > > + } sdev_info[] = { > > + { .dev_name = NULL, }, > > > + { .dev_name = NULL, }, > > + { .dev_name = "arm-firme-ide-keyset", }, > > + { .dev_name = NULL, }, > > + { .dev_name = "arm-firme-attest", }, > > + { .dev_name = NULL, }, > > + /* ID_MAX */ > > Is the comment helpful? I have no idea what it is referring to here. > If you want to ensure the size matches FIRME_SERIVCE_ID_MAX then > put an assert in or size the array (which would then zero fill anything > missing which might not be good). > > Use the enum you have so we match them up directly > [FIRME_ATTEST_SERVICE_ID] = { .dev_name = "arm-firme-attest" }, > and only set ones you don't want to be NULL. > Let C fill the others in for you as I'm not really seeing them adding > much value. That does require sizing the array with > sdev_info[FIRME_SERVICE_ID_MAX] = { > ... Yes. This would be much better. > > > + }; > > + > > + ret = __firme_get_feature(FIRME_BASE_SERVICE_ID, 0x01, &feature); > > + if (ret) > > + return ret; > > + > > + service_list = FIELD_GET(FIRME_BASE_FEAT1_SERVICE_LIST_MASK, feature); > > + service_list = (service_list << 1) | 0x01; > > Add a comment on why the shift and setting of the bottom bit. Even if in the > spec that's a bit unusual. Okay. > > > + > > + for (i = FIRME_BASE_SERVICE_ID; i < FIRME_SERVICE_ID_MAX; i++) { > > + if (!sdev_info[i].dev_name || !test_bit(i, &service_list)) > > + continue; > > + sdev_info[i].sdev = arm_smccc_device_register(sdev_info[i].dev_name, > > + FIRME_SERVICE_VERSION, > > + (void *)i); > > + if (IS_ERR(sdev_info[i].sdev)) { > > + ret = PTR_ERR(sdev_info[i].sdev); > > + break; > > + } > > + } > > + > > + if (!ret) > > + return 0; > > Use standard kernel style of errors out of line - may seem more complex, but > it is what the average kernel reviewer expects so be nice to them! > > > if (ret) > goto unregister; > > return 0; > > unregister: Okay. > > > + > > + for (j = i - 1; j >= FIRME_BASE_SERVICE_ID; j--) { > > + arm_smccc_device_unregister(sdev_info[j].sdev); > > + } > > + > > + return ret; > > +} > > > > > diff --git a/include/linux/arm_firme.h b/include/linux/arm_firme.h > > new file mode 100644 > > index 0000000000000..c070eb6a4bb08 > > --- /dev/null > > +++ b/include/linux/arm_firme.h > > @@ -0,0 +1,261 @@ > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > +/* > > + * Copyright (C) 2026 Arm Ltd. > > + */ > > + > > +#ifndef _LINUX_ARM_FIRME_H > > +#define _LINUX_ARM_FIRME_H > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +/* > > + * This file provides common defines for Fimware Interface for Realm > > + * Management Extension (FIRME) as specified in > > + * https://developer.arm.com/documentation/den0149/latest > I'd pick a version rather than Latest... > Tends to set a baseline for what you have implemented. > I guess this makes sense during RFCs perhaps? > > > + */ > > > +/* > > + * FIRME IDE key mangement service function ids. > > + * > > + * NOTE: > > + * Other functions except FIRME_ATTEST_PAT_GET are not supported > > + * by normal world instance. > > In general or a specific FIRME implementation? According to specificaiton. I'll clarify it. > > > + */ > > +#define FIRME_ATTEST_PAT_GET FIRME_SMC(0x408) > > + > > +/* > > + * FIRME error codes. > > + */ > > +#define FIRME_RET_SUCCESS (0) > > +#define FIRME_RET_NOT_SUPPORTED (-1) > > +#define FIRME_RET_INVALID_PARAMETER (-2) > > +#define FIRME_RET_ABORTED (-3) > > +#define FIRME_RET_INCOMPLETE (-4) > > +#define FIRME_RET_DENIED (-5) > > +#define FIRME_RET_BUSY (-6) > > +#define FIRME_RET_OP_CONFLICT (-7) > > +#define FIRME_RET_ALREADY_EXISTS (-8) > > +#define FIRME_RET_NOT_FOUND (-9) > > +#define FIRME_RET_NO_MEMORY (-10) > > +#define FIRME_RET_BAD_DATA (-11) > > + > > +/* > > + * GPI attributes in GPT for FIRME granule management service. > > + */ > > +#define GPT_GPI_NO_ACCESS (0x0) > > No brackets around simple numbers. > > Given these are ARM arm things rather than firme, (D9.6.5 in M.C) I'd > add a reference. Acekd. > > > +#define GPT_GPI_SA (0x4) > > +#define GPT_GPI_NSP (0x5) > > +#define GPT_GPI_SECURE (0x8) > > +#define GPT_GPI_NS (0x9) > > +#define GPT_GPI_ROOT (0xa) > > +#define GPT_GPI_REALM (0xb) > > +#define GPT_GPI_NS_BY_NS_OR_ROOT (0xd) > > +#define GPT_GPI_ANY (0xf) > > +#define GPT_GPI_MASK GENMASK(3, 0) > > + > > +/* > > + * FIRME version encoding > > + */ > > +#define FIRME_MAJOR_VERSION_MASK GENMASK(30, 16) > > +#define FIRME_MINOR_VERSION_MASK GENMASK(15, 0) > > +#define FIRME_MAJOR_VERSION(x) ((u16)(FIELD_GET(FIRME_MAJOR_VERSION_MASK, (x)))) > > +#define FIRME_MINOR_VERSION(x) ((u16)(FIELD_GET(FIRME_MINOR_VERSION_MASK, (x)))) > > +#define FIRME_PACK_VERSION_INFO(major, minor) \ > > + (FIELD_PREP(FIRME_MAJOR_VERSION_MASK, (major)) | \ > > + FIELD_PREP(FIRME_MINOR_VERSION_MASK, (minor))) > > I'd just use FIELD_PREP / FIELD_GET inline. These sorts of macros > often just obscure things. Only introduce them if they save a lot of code. Well for each service driver should check it own version and this macro will be used by them. So I'd like to keep this. > > > + > > +#define FIRME_VERSION_1_0 FIRME_PACK_VERSION_INFO(1, 0) > > + > > I'd add some spec references such as R0206 for this one. > That spec is somewhat hard to navigate. This should be removed. I'll get rid of it. Thanks! > > > +#define FIRME_KEYSET_ID_KEYSET_MASK BIT(0) > > +#define FIRME_KEYSET_ID_DIRECTION_MASK BIT(1) > > +#define FIRME_KEYSET_ID_SUBSTREAM_MASK GENMASK(5, 2) > > +#define FIRME_KEYSET_ID_STREAM_MASK GENMASK(13, 6) > > +#define FIRME_KEYSET_ID_ROOT_PORT_MASK GENMASK(29, 14) > > +#define FIRME_KEYSET_ID_SEGMENT_MASK GENMASK(37, 30) > > +#define FIRME_PACK_KEYSET_ID(ks, d, ss_id, s_id, rp_id, sg_id) \ > > + (FIELD_PREP(FIRME_KEYSET_ID_KEYSET_MASK, ks) | \ > > + FIELD_PREP(FIRME_KEYSET_ID_DIRECTION_MASK, d) | \ > > + FIELD_PREP(FIRME_KEYSET_ID_SUBSTREAM_MASK, ss_id) | \ > > + FIELD_PREP(FIRME_KEYSET_ID_STREAM_MASK, s_id) | \ > > + FIELD_PREP(FIRME_KEYSET_ID_ROOT_PORT_MASK, rp_id) | \ > > + FIELD_PREP(FIRME_KEYSET_ID_SEGMENT_MASK, sg_id)) > > I haven't read on, but unless that is frequently used I'd not > have the macro -better to see what goes where inline. But for KEYSET_ID, might this macro will be used. so I'd like to keep as-is. > > > + > > +#define FIRME_PGS_4K (0) > > +#define FIRME_PGS_64K (1) > > +#define FIRME_PGS_16K (2) > > + > > +#define FIRME_L0GPTSZ_1GB (0) > > +#define FIRME_L0GPTSZ_16GB (4) > > +#define FIRME_L0GPTSZ_64GB (6) > > +#define FIRME_L0GPTSZ_512GB (9) > > These are references to encodings in GPCCR_EL3.L0GPTZ. I'd be > tempted to name them to make that clearer rather than prefix > them with FIRME. > > > + > > +#define FIRME_PPS_4GB (0) > > +#define FIRME_PPS_64GB (1) > > +#define FIRME_PPS_1TB (2) > > +#define FIRME_PPS_4TB (3) > > +#define FIRME_PPS_16TB (4) > > +#define FIRME_PPS_256TB (5) > > +#define FIRME_PPS_4PB (6) > > +#define FIRME_PPS_64PB (7) > Similar with these. > > Would be odd to have kernel defs for EL3 registers anywhere central > but maybe we can make that association with naming despite keeping them > here? Agree but currently there is no one who checking this value according to the CPCCR_EL3 value except the firme return. So let's keep this define in here. > > > + > > +/* > > + * FIRME Base service features. > > + */ > > +#define FIRME_BASE_FEAT0_FUNC_VERSION BIT(0) > > +#define FIRME_BASE_FEAT0_FUNC_FEATURE BIT(1) > > +#define FIRME_BASE_FEAT0_FUNC_MASK GENMASK(2, 0) > This seems random. What is the FUNC_MASK for? It covers one more > bit than defined values today yet there is nothing > table 2.8 that says bit 2 is any different from the remaining bits. Oops, I think this is typo. thanks ;) > > > +/* > > + * FIRME Granule management service features. > > + */ > > +#define FIRME_GM_FEAT0_FUNC_GPI_SET BIT(0) > > +#define FIRME_GM_FEAT0_FUNC_GPI_OP_COUTINUME BIT(1) > I'd add the reset of the values in the spec as that will make it clearer why > you have the mask as below... But, I don't think we don't need to define functions which are not supported by spec. so I think we don't need to add macros for unspported functions. > > +#define FIRME_GM_FEAT0_FUNC_MASK GENMASK(3, 0) > > particularly as this is one bit shorter than the version I'm looking > at which has FIRME_GM_GPT_INFO. Yes. I've forgotten to update with it. Thanks. > > > + > > +#define FIRME_GM_FEAT1_PGS_MASK GENMASK(1, 0) > > +#define FIRME_GM_FEAT1_L0GPTSZ_MASK GENMASK(5, 2) > > +#define FIRME_GM_FEAT1_PPS_MASK GENMASK(8, 6) > More fields exist in the current spec, so I can now see why this is > an RFC. In next cover letter talk a bit more on that and when we can > expect some stability. Thanks. I've forgotten to update with MAX_CONCURRENT_OP_CNT. > > > + > > +/* > > + * FIRME IDE key management service features. > > + */ > > +#define FIRME_IDE_KEYSET_FEAT0_FUNC_PROG BIT(0) > > +#define FIRME_IDE_KEYSET_FEAT0_FUNC_GO BIT(1) > > +#define FIRME_IDE_KEYSET_FEAT0_FUNC_STOP BIT(2) > > +#define FIRME_IDE_KEYSET_FEAT0_FUNC_POLL BIT(3) > > +#define FIRME_IDE_KEYSET_FEAT0_FUNC_MASK GENMASK(3, 0) > > No FIRME_IDE_KEYSET_FEAT1_MAX_CONCURRENT_OP_CNT ? Yeap. I'll add it. Thanks! > > > + > > +/* > > + * FIRME IDE key management service features. > > Same comment as the one above, but different thing... Oops. I'll change it. > > > + */ > > +#define FIRME_ATTEST_FEAT0_FUNC_PAT_GET BIT(0) > > +#define FIRME_ATTEST_FEAT0_FUNC_MASK GENMASK(5, 0) > > As above. If you are going to define the full mask, put defines for > all the bits so that makes more sense. As I said above, I think we don't need to add unsupported function for the normal world. > > > + > > +#define FIRME_ATTEST_FEAT1_MAX_PAT_PG_CNT_MASK GENMASK(7, 0) > > Similar here. Maybe this is a spec version thing but I'd like to Yes. but except the MAX_CONCURRENT_OP_CNT and MAX_PAT_PG_CNT, other fields doesn't relevant with normal world instance. So I think we don't need to add those kinda. > see all the fields in that register here. > > > + > > +typedef struct arm_smccc_1_2_regs firme_value_t; > > +typedef long firme_status_t; > > I'm not immediately seeing a lot of value in this type, but maybe it makes > more sense in later patches. ... > > > + > > +/* > > + * FIRME Service ID > > Given name of enum, comment doesn't add anything! Yes. I'll remove it. > > > + */ > > +enum firme_service_id { > > + FIRME_BASE_SERVICE_ID = 0, > > + FIRME_GM_SERVICE_ID, > > + FIRME_IDE_KEYSET_SERVICE_ID, > > + FIRME_MEC_SERVICE_ID, > > + FIRME_ATTEST_SERVICE_ID, > > + FIRME_IDEV_SERVICE_ID, > > + FIRME_SERVICE_ID_MAX, > > No trailing comma if that's there simply for sizing. We don't want it to > be easy to accidentally put anything after it. Okay. > > > +}; > > + > > +enum firme_ide_type { > > + FIRME_IDE_TYPE_SELECTIVE, > > I guess perhaps out of the spec, but odd to call out PCIE for link > but not SELECTIVE as both only apply to PCIE today. No this is based on the IDE type arguemnts used in FIRME_IDE_KEYSET_*. but the FIRME_IDE_TYPE_CXL_CACHEMEM should be 0x03. I'll fix it. Thanks! > > > + FIRME_IDE_TYPE_PCIE_LINK, > > + FIRME_IDE_TYPE_CXL_CACHEMEM, > > +}; > > + > > +struct firme_shared_buf_info { > > + size_t min_size; > > + size_t max_size; > > +}; > > + > > +static __always_inline int firme_status_to_errno(firme_status_t status) > > +{ > > + static int firme_status_errno_map[] = { > > + 0, /* FIRME_RET_SUCCESS */ > Can we do > [-FIRME_RET_SUCESS] = 0, > [-FIRME_REG_NOT_SUPPORTED] = -EOPNOTSUPP, > etc? > > Nicer to enforce the relationship rather than rely on comments. > > > > + -EOPNOTSUPP, /* FIRME_RET_NOT_SUPPORTED */ > > + -EINVAL, /* FIRME_RET_INVALID_PARAMETER */ > > + -ECANCELED, /* FIRME_RET_ABORTED */ > > + -EAGAIN, /* FIRME_RET_INCOMPLETE */ > > + -EACCES, /* FIRME_RET_DENIED */ > > + -EBUSY, /* FIRME_RET_BUSY */ > > + -EALREADY, /* FIRME_RET_OP_CONFLICT */ > > + -EEXIST, /* FIRME_RET_ALREDAY_EXISTS */ > > ALREADY That would be better. Thanks! > > + -ENOENT, /* FIRME_RET_NOT_FOUND */ > > + -ENOMEM, /* FIRME_RET_NO_MEMORY */ > > + -EBADMSG, /* FIRME_RET_BAD_DATA */ > > + }; > > + > > + status = -status; > > + > > + if (status >= 0 && status < ARRAY_SIZE(firme_status_errno_map)) > > + return firme_status_errno_map[status]; > > + > > + return -EINVAL; > > +}; > > + > > +static __always_inline void invoke_firme_service(firme_value_t args, > > + firme_value_t *res) > > +{ > > + arm_smccc_1_2_smc(&args, res); > > +} > > + > > +#if IS_ENABLED(CONFIG_ARM_FIRME) > > +extern int firme_get_version(enum firme_service_id service_id, u32 *version); > > +extern int firme_get_feature(enum firme_service_id service_id, > > + uint8_t feat_idx, unsigned long *feature); > > +extern int firme_get_shared_buffer_info(struct firme_shared_buf_info *info); > > +extern void *firme_alloc_shared_buffer(size_t *size, gfp_t gfp_flags); > > +extern void firme_free_shared_buffer(void *buf, size_t size); > > +#else > > +static __always_inline int firme_get_version(enum firme_service_id service_id, > > + u32 *version) > > +{ > > + return -EOPNOTSUPP; > > +} > > + > > +static __always_inline int firme_get_feature(enum firme_service_id service_id, > > + uint8_t feat_idx, unsigned long *feature) > > +{ > > + return -EOPNOTSUPP; > > +} > > + > > +static __always_inline int firme_get_shared_buffer_info(struct firme_shared_buf_info *info) > > +{ > > + return -EOPNOTSUPP; > > +} > > + > > +static __always_inline void *firme_alloc_shared_buffer(size_t *size, gfp_t gfp_flags) > > +{ > > + return NULL; > > +} > > + > > +static __always_inline void firme_free_shared_buffer(void *buf, size_t size) > > +{ > > +} > > Common practice to just put the {} at the end of the line when the stub does > nothing. Why do we need __always_inline markings? inline normally enough for stubs. > > For that matter, if you need __always inline for anything in here there should > probably be some info on why. Okay. I'll change them with inline. > > > +#endif > > + > > +#endif /* _LINUX_ARM_FIRME_H */ > > > Thanks for your review ;) -- Sincerely, Yeoreum Yun