Re: [PATCH RFC v2 2/6] firmware: arm_firme: introduce arm_firme

From: Jason Gunthorpe

Date: Thu Dec 03 2026 - 10:44:25 EST


On Wed, Dec 02, 2026 at 04:49:41PM -0800, Jonathan Cameron wrote:
> > +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.

It is a helper "library" it should be a hidden kconfig selected by the
actual FIRME using subsystem drivers, like attestation and TSM.

> Use the enum you have so we match them up directly
> [FIRME_ATTEST_SERVICE_ID] = { .dev_name = "arm-firme-attest" },

+1

> > +/*
> > + * 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.

+1

And if you do want further wrappers use a static inline function.

Jason