Message ID | 6c0ef5d2174bfa8c25aeb94395160ab9d863b63a.1677079672.git.jens.wiklander@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Xen FF-A mediator | expand |
HI Jens, > On 22 Feb 2023, at 16:33, Jens Wiklander <jens.wiklander@linaro.org> wrote: > > Adds a BUILD_BUG_ON() to assert the dependency on 4k pages in the FF-A > mediator. > > Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> NIT: I would s/note/enforce/ in the title: xen/arm: ffa: enforce 4k pages Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> Cheers Bertrand > --- > xen/arch/arm/tee/ffa.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c > index d04bac9cc47f..8b0b80ce1ff5 100644 > --- a/xen/arch/arm/tee/ffa.c > +++ b/xen/arch/arm/tee/ffa.c > @@ -56,6 +56,16 @@ > #define FFA_MY_VERSION MAKE_FFA_VERSION(FFA_MY_VERSION_MAJOR, \ > FFA_MY_VERSION_MINOR) > > +/* > + * The FF-A specification explicitly works with 4K pages as a measure of > + * memory size, for example, FFA_RXTX_MAP takes one parameter "RX/TX page > + * count" which is the number of contiguous 4K pages allocated. Xen may use > + * a different page size depending on the configuration to avoid confusion > + * with PAGE_SIZE use a special define when it's a page size as in the FF-A > + * specification. > + */ > +#define FFA_PAGE_SIZE SZ_4K > + > /* Framework direct request/response */ > #define FFA_MSG_FLAG_FRAMEWORK BIT(31, U) > #define FFA_MSG_TYPE_MASK 0xFFU; > @@ -242,6 +252,17 @@ static bool ffa_probe(void) > unsigned int major_vers; > unsigned int minor_vers; > > + /* > + * FF-A often works in units of 4K pages and currently it's assumed > + * that we can map memory using that granularity. See also the comment > + * above the FFA_PAGE_SIZE define. > + * > + * It is possible to support a PAGE_SIZE larger than 4K in Xen, but > + * until that is fully handled in this code make sure that we only use > + * 4K page sizes. > + */ > + BUILD_BUG_ON(PAGE_SIZE != FFA_PAGE_SIZE); > + > /* > * psci_init_smccc() updates this value with what's reported by EL-3 > * or secure world. > -- > 2.34.1 >
Hi Bertrand, On Fri, Feb 24, 2023 at 4:27 PM Bertrand Marquis <Bertrand.Marquis@arm.com> wrote: > > HI Jens, > > > On 22 Feb 2023, at 16:33, Jens Wiklander <jens.wiklander@linaro.org> wrote: > > > > Adds a BUILD_BUG_ON() to assert the dependency on 4k pages in the FF-A > > mediator. > > > > Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> > > NIT: I would s/note/enforce/ in the title: > xen/arm: ffa: enforce 4k pages OK, I'll fix it. Thanks, Jens > > Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> > > Cheers > Bertrand > > > --- > > xen/arch/arm/tee/ffa.c | 21 +++++++++++++++++++++ > > 1 file changed, 21 insertions(+) > > > > diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c > > index d04bac9cc47f..8b0b80ce1ff5 100644 > > --- a/xen/arch/arm/tee/ffa.c > > +++ b/xen/arch/arm/tee/ffa.c > > @@ -56,6 +56,16 @@ > > #define FFA_MY_VERSION MAKE_FFA_VERSION(FFA_MY_VERSION_MAJOR, \ > > FFA_MY_VERSION_MINOR) > > > > +/* > > + * The FF-A specification explicitly works with 4K pages as a measure of > > + * memory size, for example, FFA_RXTX_MAP takes one parameter "RX/TX page > > + * count" which is the number of contiguous 4K pages allocated. Xen may use > > + * a different page size depending on the configuration to avoid confusion > > + * with PAGE_SIZE use a special define when it's a page size as in the FF-A > > + * specification. > > + */ > > +#define FFA_PAGE_SIZE SZ_4K > > + > > /* Framework direct request/response */ > > #define FFA_MSG_FLAG_FRAMEWORK BIT(31, U) > > #define FFA_MSG_TYPE_MASK 0xFFU; > > @@ -242,6 +252,17 @@ static bool ffa_probe(void) > > unsigned int major_vers; > > unsigned int minor_vers; > > > > + /* > > + * FF-A often works in units of 4K pages and currently it's assumed > > + * that we can map memory using that granularity. See also the comment > > + * above the FFA_PAGE_SIZE define. > > + * > > + * It is possible to support a PAGE_SIZE larger than 4K in Xen, but > > + * until that is fully handled in this code make sure that we only use > > + * 4K page sizes. > > + */ > > + BUILD_BUG_ON(PAGE_SIZE != FFA_PAGE_SIZE); > > + > > /* > > * psci_init_smccc() updates this value with what's reported by EL-3 > > * or secure world. > > -- > > 2.34.1 > > >
diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c index d04bac9cc47f..8b0b80ce1ff5 100644 --- a/xen/arch/arm/tee/ffa.c +++ b/xen/arch/arm/tee/ffa.c @@ -56,6 +56,16 @@ #define FFA_MY_VERSION MAKE_FFA_VERSION(FFA_MY_VERSION_MAJOR, \ FFA_MY_VERSION_MINOR) +/* + * The FF-A specification explicitly works with 4K pages as a measure of + * memory size, for example, FFA_RXTX_MAP takes one parameter "RX/TX page + * count" which is the number of contiguous 4K pages allocated. Xen may use + * a different page size depending on the configuration to avoid confusion + * with PAGE_SIZE use a special define when it's a page size as in the FF-A + * specification. + */ +#define FFA_PAGE_SIZE SZ_4K + /* Framework direct request/response */ #define FFA_MSG_FLAG_FRAMEWORK BIT(31, U) #define FFA_MSG_TYPE_MASK 0xFFU; @@ -242,6 +252,17 @@ static bool ffa_probe(void) unsigned int major_vers; unsigned int minor_vers; + /* + * FF-A often works in units of 4K pages and currently it's assumed + * that we can map memory using that granularity. See also the comment + * above the FFA_PAGE_SIZE define. + * + * It is possible to support a PAGE_SIZE larger than 4K in Xen, but + * until that is fully handled in this code make sure that we only use + * 4K page sizes. + */ + BUILD_BUG_ON(PAGE_SIZE != FFA_PAGE_SIZE); + /* * psci_init_smccc() updates this value with what's reported by EL-3 * or secure world.
Adds a BUILD_BUG_ON() to assert the dependency on 4k pages in the FF-A mediator. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> --- xen/arch/arm/tee/ffa.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)