[XEN PATCH v5 4/7] xen/arm: allow dynamically assigned SGI handlers

2024-05-29 Thread Jens Wiklander
he statically assigned SGI handlers like for instance GIC_SGI_CALL_FUNCTION. [1] https://developer.arm.com/documentation/den0094/ Signed-off-by: Jens Wiklander --- v3->v4 - Use IRQ_TYPE_EDGE_RISING instead of DT_IRQ_TYPE_EDGE_RISING v2->v3 - Rename GIC_SGI_MAX to GIC_SGI_STATIC_MA

[XEN PATCH v5 6/7] xen/arm: add and call tee_free_domain_ctx()

2024-05-29 Thread Jens Wiklander
Add tee_free_domain_ctx() to the TEE mediator framework. tee_free_domain_ctx() is called from arch_domain_destroy() to allow late freeing of the d->arch.tee context. This will simplify access to d->arch.tee for domains retrieved with rcu_lock_domain_by_id(). Signed-off-by: Jens Wik

[XEN PATCH v5 0/7] FF-A notifications

2024-05-29 Thread Jens Wiklander
as requestsed, details in each patch. - Added Bertrands R-B for "xen/arm: ffa: refactor ffa_handle_call()", "xen/arm: ffa: use ACCESS_ONCE()", and "xen/arm: ffa: simplify ffa_handle_mem_share()" Jens Wiklander (7): xen/arm: ffa: refactor ffa_handle_call() x

[XEN PATCH v5 2/7] xen/arm: ffa: use ACCESS_ONCE()

2024-05-29 Thread Jens Wiklander
Replace read_atomic() with ACCESS_ONCE() to match the intended use, that is, to prevent the compiler from (via optimization) reading shared memory more than once. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa_shm.c | 15 --- 1 file changed, 8

[XEN PATCH v5 7/7] xen/arm: ffa: support notification

2024-05-29 Thread Jens Wiklander
-A ABI and deliver them to their destinations. Update ffa_partinfo_domain_init() to return error code like ffa_notif_domain_init(). Signed-off-by: Jens Wiklander --- v4->v5: - Move the freeing of d->arch.tee to the new TEE mediator free_domain_ctx callback to make the context accessible

[XEN PATCH v5 5/7] xen/arm: add and call init_tee_interrupt()

2024-05-29 Thread Jens Wiklander
Add init_tee_interrupt() to the TEE mediator framework and call it from start_secondary() late enough that per-cpu interrupts can be configured on CPUs as they are initialized. This is needed in later patches. Signed-off-by: Jens Wiklander --- xen/arch/arm/include/asm/tee/tee.h | 8

[XEN PATCH v5 3/7] xen/arm: ffa: simplify ffa_handle_mem_share()

2024-05-29 Thread Jens Wiklander
Simplify ffa_handle_mem_share() by removing the start_page_idx and last_page_idx parameters from get_shm_pages() and check that the number of pages matches expectations at the end of get_shm_pages(). Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa_shm.c

[XEN PATCH v5 1/7] xen/arm: ffa: refactor ffa_handle_call()

2024-05-29 Thread Jens Wiklander
Refactors the large switch block in ffa_handle_call() to use common code for the simple case where it's either an error code or success with no further parameters. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa.c | 30 ++ 1 file

Re: Referencing domain struct from interrupt handler

2024-05-15 Thread Jens Wiklander
On Tue, May 14, 2024 at 9:12 AM Jan Beulich wrote: > > On 08.05.2024 09:10, Jens Wiklander wrote: > > On Fri, May 3, 2024 at 12:32 PM Jan Beulich wrote: > >> Furthermore, is it guaranteed that the IRQ handler won't interrupt code > >> fiddling with the domain li

Re: Referencing domain struct from interrupt handler

2024-05-08 Thread Jens Wiklander
Hi Jan, On Fri, May 3, 2024 at 12:32 PM Jan Beulich wrote: > > On 03.05.2024 09:45, Jens Wiklander wrote: > > Hi Xen maintainers, > > > > In my patch series [XEN PATCH v4 0/5] FF-A notifications [1] I need to > > get a reference to a domain struct from a domain

Re: [XEN PATCH v4 5/5] xen/arm: ffa: support notification

2024-05-07 Thread Jens Wiklander
Hi Julien, On Fri, May 3, 2024 at 4:25 PM Julien Grall wrote: > > Hi Jens, > > On 03/05/2024 14:54, Jens Wiklander wrote: > >>> +static int ffa_setup_irq_callback(struct notifier_block *nfb, > >>> + unsigned long action, void

Re: [XEN PATCH v4 5/5] xen/arm: ffa: support notification

2024-05-03 Thread Jens Wiklander
Hi Julien, On Fri, May 3, 2024 at 11:59 AM Julien Grall wrote: > > Hi Jens, > > On 02/05/2024 15:56, Jens Wiklander wrote: > > -static bool ffa_probe(void) > > +static int __init ffa_init(void) > > { > > uint32_t vers; > > unsigned int ma

Referencing domain struct from interrupt handler

2024-05-03 Thread Jens Wiklander
Hi Xen maintainers, In my patch series [XEN PATCH v4 0/5] FF-A notifications [1] I need to get a reference to a domain struct from a domain ID and keep it from being destroyed while using it in the interrupt handler notif_irq_handler() (introduced in the last patch "[XEN PATCH v4 5/5] xen/arm:

[XEN PATCH v4 4/5] xen/arm: allow dynamically assigned SGI handlers

2024-05-02 Thread Jens Wiklander
he statically assigned SGI handlers like for instance GIC_SGI_CALL_FUNCTION. [1] https://developer.arm.com/documentation/den0094/ Signed-off-by: Jens Wiklander --- v3->v4 - Use IRQ_TYPE_EDGE_RISING instead of DT_IRQ_TYPE_EDGE_RISING v2->v3 - Rename GIC_SGI_MAX to GIC_SGI_STATIC_MA

[XEN PATCH v4 2/5] xen/arm: ffa: use ACCESS_ONCE()

2024-05-02 Thread Jens Wiklander
Replace read_atomic() with ACCESS_ONCE() to match the intended use, that is, to prevent the compiler from (via optimization) reading shared memory more than once. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa_shm.c | 15 --- 1 file changed, 8

[XEN PATCH v4 0/5] FF-A notifications

2024-05-02 Thread Jens Wiklander
requestsed, details in each patch. v1->v2: - "xen/arm: ffa: support notification" and "xen/arm: allow dynamically assigned SGI handlers" updated as requestsed, details in each patch. - Added Bertrands R-B for "xen/arm: ffa: refactor ffa_handle_call()", "

[XEN PATCH v4 5/5] xen/arm: ffa: support notification

2024-05-02 Thread Jens Wiklander
to install the interrupt handler on each CPU through a function registered with register_cpu_notifier(). Signed-off-by: Jens Wiklander --- v3->v4: - Add another note on FF-A limitations - Clear secure_pending in ffa_handle_notification_get() if both SP and SPM bitmaps are retrieved - ASS

[XEN PATCH v4 3/5] xen/arm: ffa: simplify ffa_handle_mem_share()

2024-05-02 Thread Jens Wiklander
Simplify ffa_handle_mem_share() by removing the start_page_idx and last_page_idx parameters from get_shm_pages() and check that the number of pages matches expectations at the end of get_shm_pages(). Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa_shm.c

[XEN PATCH v4 1/5] xen/arm: ffa: refactor ffa_handle_call()

2024-05-02 Thread Jens Wiklander
Refactors the large switch block in ffa_handle_call() to use common code for the simple case where it's either an error code or success with no further parameters. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa.c | 30 ++ 1 file

Re: [XEN PATCH v3 5/5] xen/arm: ffa: support notification

2024-04-29 Thread Jens Wiklander
Hi Julien, On Fri, Apr 26, 2024 at 7:58 PM Julien Grall wrote: > > Hi Jens, > > On 26/04/2024 09:47, Jens Wiklander wrote: > > +static void notif_irq_enable(void *info) > > +{ > > +struct notif_irq_info *irq_info = info; > > + > > +irq_info-&

Re: [XEN PATCH v3 5/5] xen/arm: ffa: support notification

2024-04-29 Thread Jens Wiklander
Hi Bertrand, On Mon, Apr 29, 2024 at 9:20 AM Bertrand Marquis wrote: [...] > >> +static void notif_irq_handler(int irq, void *data) > >> +{ > >> +const struct arm_smccc_1_2_regs arg = { > >> +.a0 = FFA_NOTIFICATION_INFO_GET_64, > >> +}; > >> +struct arm_smccc_1_2_regs resp; >

Re: [XEN PATCH v3 5/5] xen/arm: ffa: support notification

2024-04-29 Thread Jens Wiklander
Hi Julien, On Fri, Apr 26, 2024 at 9:07 PM Julien Grall wrote: > > Hi Jens, > > On 26/04/2024 09:47, Jens Wiklander wrote: > > diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c > > index d7306aa64d50..5224898265a5 100644 > > --- a/xen/arch/arm/irq.c > > ++

Re: [XEN PATCH v3 5/5] xen/arm: ffa: support notification

2024-04-26 Thread Jens Wiklander
On Fri, Apr 26, 2024 at 2:41 PM Bertrand Marquis wrote: > > Hi Jens, > > > On 26 Apr 2024, at 14:32, Jens Wiklander wrote: > > > > Hi Bertrand, > > > > On Fri, Apr 26, 2024 at 2:19 PM Bertrand Marquis > > wrote: > >> > >&g

Re: [XEN PATCH v3 5/5] xen/arm: ffa: support notification

2024-04-26 Thread Jens Wiklander
Hi Bertrand, On Fri, Apr 26, 2024 at 2:19 PM Bertrand Marquis wrote: > > Hi Jens, > > > On 26 Apr 2024, at 14:11, Jens Wiklander wrote: > > > > Hi Bertrand, > > > > On Fri, Apr 26, 2024 at 11:20 AM Bertrand Marquis > > wrote: > >> &

Re: [XEN PATCH v3 5/5] xen/arm: ffa: support notification

2024-04-26 Thread Jens Wiklander
Hi Bertrand, On Fri, Apr 26, 2024 at 11:20 AM Bertrand Marquis wrote: > > Hi Jens, > > > On 26 Apr 2024, at 10:47, Jens Wiklander wrote: > > > > Add support for FF-A notifications, currently limited to an SP (Secure > > Partition) sending an asynchronous notifi

[XEN PATCH v3 5/5] xen/arm: ffa: support notification

2024-04-26 Thread Jens Wiklander
to their destinations. Update ffa_partinfo_domain_init() to return error code like ffa_notif_domain_init(). Signed-off-by: Jens Wiklander --- v2->v3: - Add a GUEST_ prefix and move FFA_NOTIF_PEND_INTR_ID and FFA_SCHEDULE_RECV_INTR_ID to public/arch-arm.h - Register the Xen SRI handler on e

[XEN PATCH v3 1/5] xen/arm: ffa: refactor ffa_handle_call()

2024-04-26 Thread Jens Wiklander
Refactors the large switch block in ffa_handle_call() to use common code for the simple case where it's either an error code or success with no further parameters. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa.c | 30 ++ 1 file

[XEN PATCH v3 3/5] xen/arm: ffa: simplify ffa_handle_mem_share()

2024-04-26 Thread Jens Wiklander
Simplify ffa_handle_mem_share() by removing the start_page_idx and last_page_idx parameters from get_shm_pages() and check that the number of pages matches expectations at the end of get_shm_pages(). Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa_shm.c

[XEN PATCH v3 0/5] FF-A notifications

2024-04-26 Thread Jens Wiklander
fication" and "xen/arm: allow dynamically assigned SGI handlers" updated as requestsed, details in each patch. - Added Bertrands R-B for "xen/arm: ffa: refactor ffa_handle_call()", "xen/arm: ffa: use ACCESS_ONCE()", and "xen/arm: ffa: simplify ffa_handle_mem

[XEN PATCH v3 4/5] xen/arm: allow dynamically assigned SGI handlers

2024-04-26 Thread Jens Wiklander
he statically assigned SGI handlers like for instance GIC_SGI_CALL_FUNCTION. [1] https://developer.arm.com/documentation/den0094/ Signed-off-by: Jens Wiklander --- v2->v3 - Rename GIC_SGI_MAX to GIC_SGI_STATIC_MAX and rename do_sgi() to do_static_sgi() - Update comment in setup_irq() to

[XEN PATCH v3 2/5] xen/arm: ffa: use ACCESS_ONCE()

2024-04-26 Thread Jens Wiklander
Replace read_atomic() with ACCESS_ONCE() to match the intended use, that is, to prevent the compiler from (via optimization) reading shared memory more than once. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa_shm.c | 15 --- 1 file changed, 8

Re: [XEN PATCH v2 5/5] xen/arm: ffa: support notification

2024-04-23 Thread Jens Wiklander
Hi Julien, On Mon, Apr 22, 2024 at 1:40 PM Julien Grall wrote: > > Hi Jens, > > This is not a full review of the code. I will let Bertrand doing it. > > On 22/04/2024 08:37, Jens Wiklander wrote: > > +void ffa_notif_init(void) > > +{ > > +

Re: [XEN PATCH v2 4/5] xen/arm: allow dynamically assigned SGI handlers

2024-04-23 Thread Jens Wiklander
On Tue, Apr 23, 2024 at 1:05 PM Julien Grall wrote: > > > > On 23/04/2024 10:35, Jens Wiklander wrote: > > Hi Julien, > > Hi Jens, > > > On Mon, Apr 22, 2024 at 12:57 PM Julien Grall wrote: > >> > >> Hi Jens, > >> > >> On 22/04

Re: [XEN PATCH v2 4/5] xen/arm: allow dynamically assigned SGI handlers

2024-04-23 Thread Jens Wiklander
en, > >> > >>> On 23 Apr 2024, at 13:05, Julien Grall wrote: > >>> > >>> > >>> > >>> On 23/04/2024 10:35, Jens Wiklander wrote: > >>>> Hi Julien, > >>> > >>> Hi Jens, > >>> > >&

Re: [XEN PATCH v2 4/5] xen/arm: allow dynamically assigned SGI handlers

2024-04-23 Thread Jens Wiklander
Hi Julien, On Mon, Apr 22, 2024 at 12:57 PM Julien Grall wrote: > > Hi Jens, > > On 22/04/2024 08:37, Jens Wiklander wrote: > > Updates so request_irq() can be used with a dynamically assigned SGI irq > > as input. This prepares for a later patch where an FF-A schedul

[XEN PATCH v2 4/5] xen/arm: allow dynamically assigned SGI handlers

2024-04-22 Thread Jens Wiklander
they are always edge triggered. gic_interrupt() is updated to route the dynamically assigned SGIs to do_IRQ() instead of do_sgi(). The latter still handles the statically assigned SGI handlers like for instance GIC_SGI_CALL_FUNCTION. Signed-off-by: Jens Wiklander --- v1->v2 - Update patch descript

[XEN PATCH v2 5/5] xen/arm: ffa: support notification

2024-04-22 Thread Jens Wiklander
to their destinations. Update ffa_partinfo_domain_init() to return error code like ffa_notif_domain_init(). Signed-off-by: Jens Wiklander --- v1->v2: - Addressing review comments - Change ffa_handle_notification_{bind,unbind,set}() to take struct cpu_user_regs *regs as argument. - Upd

[XEN PATCH v2 2/5] xen/arm: ffa: use ACCESS_ONCE()

2024-04-22 Thread Jens Wiklander
Replace read_atomic() with ACCESS_ONCE() to match the intended use, that is, to prevent the compiler from (via optimization) reading shared memory more than once. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa_shm.c | 15 --- 1 file changed, 8

[XEN PATCH v2 0/5] FF-A notifications

2024-04-22 Thread Jens Wiklander
r ffa_handle_call()", "xen/arm: ffa: use ACCESS_ONCE()", and "xen/arm: ffa: simplify ffa_handle_mem_share()" Jens Wiklander (5): xen/arm: ffa: refactor ffa_handle_call() xen/arm: ffa: use ACCESS_ONCE() xen/arm: ffa: simplify ffa_handle_mem_share() xen/arm: a

[XEN PATCH v2 3/5] xen/arm: ffa: simplify ffa_handle_mem_share()

2024-04-22 Thread Jens Wiklander
Simplify ffa_handle_mem_share() by removing the start_page_idx and last_page_idx parameters from get_shm_pages() and check that the number of pages matches expectations at the end of get_shm_pages(). Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa_shm.c

[XEN PATCH v2 1/5] xen/arm: ffa: refactor ffa_handle_call()

2024-04-22 Thread Jens Wiklander
Refactors the large switch block in ffa_handle_call() to use common code for the simple case where it's either an error code or success with no further parameters. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa.c | 30 ++ 1 file

Re: [XEN PATCH v1 4/5] xen/arm: allow dynamically assigned SGI handlers

2024-04-11 Thread Jens Wiklander
Hi Michal, On Thu, Apr 11, 2024 at 8:44 AM Michal Orzel wrote: > > Hi Jens, > > On 11/04/2024 08:12, Jens Wiklander wrote: > > > > > > Hi Michal, > > > > On Wed, Apr 10, 2024 at 3:24 PM Michal Orzel wrote: > >> > >>

Re: [XEN PATCH v1 4/5] xen/arm: allow dynamically assigned SGI handlers

2024-04-11 Thread Jens Wiklander
Hi Michal, On Wed, Apr 10, 2024 at 3:24 PM Michal Orzel wrote: > > Hi Jens, > > On 09/04/2024 17:36, Jens Wiklander wrote: > > > > > > Updates so request_irq() can be used with a dynamically assigned SGI irq > > as input. > At this point it would be hand

Re: [XEN PATCH v1 5/5] xen/arm: ffa: support notification

2024-04-10 Thread Jens Wiklander
Hi Bertrand, On Wed, Apr 10, 2024 at 6:30 PM Bertrand Marquis wrote: > > Hi Jens, > > > On 10 Apr 2024, at 17:45, Jens Wiklander wrote: > > > > On Tue, Apr 9, 2024 at 5:36 PM Jens Wiklander > > wrote: > >> > >> Add support for FF-

Re: [XEN PATCH v1 5/5] xen/arm: ffa: support notification

2024-04-10 Thread Jens Wiklander
Hi Bertrand, On Wed, Apr 10, 2024 at 5:41 PM Bertrand Marquis wrote: > > Hi Jens, > > > On 10 Apr 2024, at 16:27, Jens Wiklander wrote: > > > > On Wed, Apr 10, 2024 at 9:49 AM Bertrand Marquis > > wrote: > >> > >> Hi Jens, > &

Re: [XEN PATCH v1 5/5] xen/arm: ffa: support notification

2024-04-10 Thread Jens Wiklander
On Tue, Apr 9, 2024 at 5:36 PM Jens Wiklander wrote: > > Add support for FF-A notifications, currently limited to an SP (Secure > Partition) sending an asynchronous notification to a guest. > > Guests and Xen itself are made aware of pending notifications with an > interr

Re: [XEN PATCH v1 5/5] xen/arm: ffa: support notification

2024-04-10 Thread Jens Wiklander
On Wed, Apr 10, 2024 at 9:49 AM Bertrand Marquis wrote: > > Hi Jens, > > > On 9 Apr 2024, at 17:36, Jens Wiklander wrote: > > > > Add support for FF-A notifications, currently limited to an SP (Secure > > Partition) sending an asynchronous notification to a gue

[XEN PATCH v1 2/5] xen/arm: ffa: use ACCESS_ONCE()

2024-04-09 Thread Jens Wiklander
Replace read_atomic() with ACCESS_ONCE() to match the intended use, that is, to prevent the compiler from (via optimization) reading shared memory more than once. Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa_shm.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions

[XEN PATCH v1 3/5] xen/arm: ffa: simplify ffa_handle_mem_share()

2024-04-09 Thread Jens Wiklander
Simplify ffa_handle_mem_share() by removing the start_page_idx and last_page_idx parameters from get_shm_pages() and check that the number of pages matches expectations at the end of get_shm_pages(). Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa_shm.c | 18 ++ 1 file

[XEN PATCH v1 0/5] FF-A notifications

2024-04-09 Thread Jens Wiklander
statically assigned, that is, SGI IDs above GIC_SGI_MAX. Thanks, Jens Jens Wiklander (5): xen/arm: ffa: refactor ffa_handle_call() xen/arm: ffa: use ACCESS_ONCE() xen/arm: ffa: simplify ffa_handle_mem_share() xen/arm: allow dynamically assigned SGI handlers xen/arm: ffa: support

[XEN PATCH v1 4/5] xen/arm: allow dynamically assigned SGI handlers

2024-04-09 Thread Jens Wiklander
(). The latter still handles the statically assigned SGI handlers like for instance GIC_SGI_CALL_FUNCTION. Signed-off-by: Jens Wiklander --- xen/arch/arm/gic.c | 5 +++-- xen/arch/arm/irq.c | 7 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm

[XEN PATCH v1 5/5] xen/arm: ffa: support notification

2024-04-09 Thread Jens Wiklander
to their destinations. Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/Makefile | 1 + xen/arch/arm/tee/ffa.c | 58 ++ xen/arch/arm/tee/ffa_notif.c | 319 + xen/arch/arm/tee/ffa_private.h | 71 4 files changed, 449 insertions

[XEN PATCH v1 1/5] xen/arm: ffa: refactor ffa_handle_call()

2024-04-09 Thread Jens Wiklander
Refactors the large switch block in ffa_handle_call() to use common code for the simple case where it's either an error code or success with no further parameters. Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa.c | 30 ++ 1 file changed, 10 insertions(+), 20

[XEN PATCH 3/6] xen/arm: ffa: separate memory sharing routines

2024-03-25 Thread Jens Wiklander
Move memory sharing routines into a separate file for easier navigation in the source code. Add ffa_shm_domain_destroy() to isolate the ffa_shm things in ffa_domain_teardown_continue(). Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/Makefile | 1 + xen/arch/arm/tee/ffa.c

[XEN PATCH 1/6] xen/arm: ffa: rename functions to use ffa_ prefix

2024-03-25 Thread Jens Wiklander
Prepare to separate into modules by renaming functions that will need new names when becoming non-static in the following commit. Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa.c | 125 + 1 file changed, 65 insertions(+), 60 deletions(-) diff

[XEN PATCH 4/6] xen/arm: ffa: separate partition info get routines

2024-03-25 Thread Jens Wiklander
Move partition info get routines into a separate file for easier navigation in the source code. Add ffa_partinfo_init(), ffa_partinfo_domain_init(), and ffa_partinfo_domain_destroy() to handle the ffa_partinfo internal things on initialization and teardown. Signed-off-by: Jens Wiklander

[XEN PATCH 6/6] xen/arm: ffa: support FFA_FEATURES

2024-03-25 Thread Jens Wiklander
Add support for the mandatory FF-A ABI function FFA_FEATURES. Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa.c | 57 ++ 1 file changed, 57 insertions(+) diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c index 4f7775b8c890..8665201e34a9

[XEN PATCH 5/6] xen/arm: ffa: separate rxtx buffer routines

2024-03-25 Thread Jens Wiklander
Move rxtx buffer routines into a spearate file for easier navigation in the source code. Add ffa_rxtx_init(), ffa_rxtx_destroy(), and ffa_rxtx_domain_destroy() to handle the ffa_rxtx internal things on initialization and teardown. Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/Makefile

[XEN PATCH 0/6] FF-A mediator reorganisation

2024-03-25 Thread Jens Wiklander
Hi, The FF-A mediator is reorganized into modules for easier maintenance and to prepare for future changes. This patch set is not expected add any changed behaviour, except for the "xen/arm: ffa: support FFA_FEATURES" patch. Thanks, Jens Jens Wiklander (6): xen/arm: ffa: rename

[XEN PATCH 2/6] xen/arm: ffa: move common things to ffa_private.h

2024-03-25 Thread Jens Wiklander
Prepare to separate ffa.c into modules by moving common things into the new internal header file ffa_private.h. Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa.c | 298 +- xen/arch/arm/tee/ffa_private.h | 318 + 2 files

[XEN PATCH v5] xen/arm: ffa: reclaim shared memory on guest destroy

2024-02-13 Thread Jens Wiklander
the memory is reclaimed. A few minor style fixes with a removed empty line here and an added new line there. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- v5: - Move the put_domain() call after the spinlock section in dec_ctx_shm_count() - Move the get_knownalive_domain() call

Re: [XEN PATCH v4] xen/arm: ffa: reclaim shared memory on guest destroy

2024-02-05 Thread Jens Wiklander
On Mon, Feb 5, 2024 at 5:54 PM Andrew Cooper wrote: > > On 05/02/2024 3:49 pm, Jens Wiklander wrote: > > diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c > > index 0793c1c7585d..bbb6b819ee2b 100644 > > --- a/xen/arch/arm/tee/ffa.c > > +++ b/xen/arc

[XEN PATCH v4] xen/arm: ffa: reclaim shared memory on guest destroy

2024-02-05 Thread Jens Wiklander
the memory is reclaimed. A few minor style fixes with a removed empty line here and an added new line there. Signed-off-by: Jens Wiklander --- v4: - Retry FFA_MSG_SEND_VM_DESTROYED on the returned errors FFA_RET_INTERRUPTED and FFA_RET_RETRY even after all shared memory handles has been

Re: [XEN PATCH v3] xen/arm: ffa: reclaim shared memory on guest destroy

2024-02-05 Thread Jens Wiklander
Hi Bertrand, On Thu, Feb 1, 2024 at 2:57 PM Bertrand Marquis wrote: > > Hi Jens, > > > On 17 Jan 2024, at 12:06, Jens Wiklander wrote: > > > > When an FF-A enabled guest is destroyed it may leave behind memory > > shared with SPs. This memory must be reclaime

[XEN PATCH v3] xen/arm: ffa: reclaim shared memory on guest destroy

2024-01-17 Thread Jens Wiklander
the memory is reclaimed. A few minor style fixes with a removed empty line here and an added new line there. Signed-off-by: Jens Wiklander --- v3: - Mentioning in the commit message that there are some style fixes - Addressing review comments - Refactor the ffa_domain_teardown() path to let

Re: [XEN PATCH v2] xen/arm: ffa: reclaim shared memory on guest destroy

2024-01-17 Thread Jens Wiklander
Hi Bertrand, On Mon, Jan 15, 2024 at 12:15 PM Bertrand Marquis wrote: > > Hi Jens, > > Very sorry for the long delay. > > > On 13 Dec 2023, at 12:25, Jens Wiklander wrote: > > > > When an FF-A enabled guest is destroyed it may leave behind memory >

[XEN PATCH v2] xen/arm: ffa: reclaim shared memory on guest destroy

2023-12-13 Thread Jens Wiklander
the memory is reclaimed. Signed-off-by: Jens Wiklander --- Hi, This is a follow-up to the RFC patch. In this patch, I take an explicit reference on the domain when FF-A shared memory is registered. I've discovered that it might not be strictly necessary until all the shared pages are released

[XEN PATCH] xen/arm: ffa: return FFA_RET_NOT_SUPPORTED on unhandled calls

2023-12-13 Thread Jens Wiklander
("xen/arm: tee: add a primitive FF-A mediator") Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c index 183528d13388..98905fec7967 100644 --- a/xen/arch/arm/tee/ffa.c

[XEN PATCH] xen/arm: ffa: return fpi size from FFA_PARTITION_INFO_GET

2023-12-13 Thread Jens Wiklander
the each partition information descriptor returned so fix this by passing along the same value. Fixes: caf6491e95a9 ("xen/arm: ffa: support guest FFA_PARTITION_INFO_GET") Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa.c | 21 + 1 file changed, 13 insertions(+), 8

Re: [RFC XEN PATCH] xen/arm: ffa: reclaim shared memory on guest destroy

2023-12-05 Thread Jens Wiklander
: > >> > >> Hi Jens, > >> > >> On 04/12/2023 07:55, Jens Wiklander wrote: > >>>if ( ctx->rx ) > >>> rxtx_unmap(ctx); > >>> + > >>> +list_for_each_entry_safe(shm, tmp, >shm_list, list) &g

Re: [RFC XEN PATCH] xen/arm: ffa: reclaim shared memory on guest destroy

2023-12-05 Thread Jens Wiklander
Hi, On Tue, Dec 5, 2023 at 9:14 AM Bertrand Marquis wrote: > > Hi Julien, > > Thanks a lot for your review and comment, this is very helpful. > > > On 4 Dec 2023, at 20:24, Julien Grall wrote: > > > > Hi Jens, > > > > On 04/12/2023 07:55, Jens Wik

Re: [RFC XEN PATCH] xen/arm: ffa: reclaim shared memory on guest destroy

2023-12-05 Thread Jens Wiklander
Hi Julien, Thanks for the feedback. I'm answering the straightforward issues here and saving the rest for the emerging thread. On Mon, Dec 4, 2023 at 8:24 PM Julien Grall wrote: > > Hi Jens, > > On 04/12/2023 07:55, Jens Wiklander wrote: > > When an FF-A enabled guest is dest

[RFC XEN PATCH] xen/arm: ffa: reclaim shared memory on guest destroy

2023-12-03 Thread Jens Wiklander
reclaim request fails, return -ERESTART to retry again. This will effectively block the destruction of the guest until all memory has been reclaimed. Signed-off-by: Jens Wiklander --- Hi, This patch is a bit crude, but gets the job done. In a well designed system this might even be good enough since

[PATCH] xen/arm: ffa: fix guest map RX/TX error code

2023-09-04 Thread Jens Wiklander
that the function is not implemented. Of all the other defined error codes, the least bad is FFA_RET_INVALID_PARAMETERS, so use that instead. Fixes: 38d81e7ccb11 ("xen/arm: ffa: support mapping guest RX/TX buffers") Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa.c | 2 +- 1 file

Re: [XEN PATCH v11 00/14] Xen FF-A mediator

2023-08-21 Thread Jens Wiklander
Hi Julien, On Fri, Aug 18, 2023 at 10:32 AM Julien Grall wrote: > > Hi Jens, > > On 31/07/2023 13:15, Jens Wiklander wrote: > > Jens Wiklander (14): > >xen/arm: ffa: add direct request support > >xen/arm: ffa: map SPMC rx/tx buffers > >xen/a

[XEN PATCH v11 13/14] tools: add Arm FF-A mediator

2023-07-31 Thread Jens Wiklander
Adds a new "ffa" value to the Enumeration "tee_type" to indicate if a guest is trusted to use FF-A. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis Reviewed-by: Henry Wang --- v10->v11 - No changes --- tools/include/libxl.h| 5 + tools

[XEN PATCH v11 14/14] docs: add Arm FF-A mediator

2023-07-31 Thread Jens Wiklander
Describes a FF-A version 1.1 [1] mediator to communicate with a Secure Partition in secure world. [1] https://developer.arm.com/documentation/den0077/latest Signed-off-by: Jens Wiklander Reviewed-by: Henry Wang --- v10->v11 - Add a CHANGELOG.md entry as requested --- CHANGELOG

[XEN PATCH v11 10/14] xen/arm: ffa: add support to reclaim shared memory

2023-07-31 Thread Jens Wiklander
supports the needed FF-A feature FFA_MEM_RECLAIM. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- v10->v11 - No changes --- xen/arch/arm/tee/ffa.c | 53 ++ 1 file changed, 53 insertions(+) diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/

[XEN PATCH v11 12/14] xen/arm: ffa: list current limitations

2023-07-31 Thread Jens Wiklander
Adds comments with a list of unsupported FF-A interfaces and limitations in the implemented FF-A interfaces. Signed-off-by: Jens Wiklander Reviewed-by: Henry Wang --- v10->v11 - No changes --- xen/arch/arm/tee/ffa.c | 31 +++ 1 file changed, 31 insertions(+) d

[XEN PATCH v11 11/14] xen/arm: ffa: improve lock granularity

2023-07-31 Thread Jens Wiklander
succeed. Guests using the RX and TX buffers are expected to serialize accesses before doing the FF-A request. Signed-off-by: Jens Wiklander --- v10->v11 - No changes except resolving conflicts since "xen/arm: ffa: support sharing large memory ranges" was dropped. --- xen/arch/arm/te

[XEN PATCH v11 09/14] xen/arm: ffa: support sharing memory

2023-07-31 Thread Jens Wiklander
shared memory. The secure world must use FF-A version 1.1, but the guest is free to use version 1.0 or version 1.1. Adds a check that the SP supports the needed FF-A features FFA_MEM_SHARE_64 or FFA_MEM_SHARE_32. [1] https://developer.arm.com/documentation/den0077/latest Signed-off-by: Jens Wiklander

[XEN PATCH v11 06/14] xen/arm: move regpair_to_uint64() and uint64_to_regpair() to regs.h

2023-07-31 Thread Jens Wiklander
Moves the two helper functions regpair_to_uint64() and uint64_to_regpair() from xen/arch/arm/tee/optee.c to the common arm specific regs.h. This enables reuse of these functions in the FF-A mediator in a subsequent patch. Signed-off-by: Jens Wiklander Reviewed-by: Michal Orzel Reviewed

[XEN PATCH v11 08/14] xen/arm: ffa: add ABI structs for sharing memory

2023-07-31 Thread Jens Wiklander
Adds the ABI structs used by function FFA_MEM_SHARE and friends for sharing memory. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- v10->v11 - No changes --- xen/arch/arm/tee/ffa.c | 69 ++ 1 file changed, 69 insertions(+) diff --

[XEN PATCH v11 07/14] xen/arm: ffa: add defines for sharing memory

2023-07-31 Thread Jens Wiklander
buffers that a guest can have at once and how large a shared buffer can be at most. Signed-off-by: Jens Wiklander Reviewed-by: Henry Wang Reviewed-by: Bertrand Marquis --- v10->v11 - Adding Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa.c |

[XEN PATCH v11 02/14] xen/arm: ffa: map SPMC rx/tx buffers

2023-07-31 Thread Jens Wiklander
When initializing the FF-A mediator map the RX and TX buffers shared with the SPMC. These buffer are later used to to transmit data that cannot be passed in registers only. Adds a check that the SP supports the needed FF-A features FFA_RXTX_MAP_64 and FFA_RXTX_UNMAP. Signed-off-by: Jens

[XEN PATCH v11 01/14] xen/arm: ffa: add direct request support

2023-07-31 Thread Jens Wiklander
Adds support for sending a FF-A direct request. Checks that the SP also supports handling a 32-bit direct request. 64-bit direct requests are not used by the mediator itself so there is not need to check for that. Signed-off-by: Jens Wiklander Reviewed-by: Henry Wang --- v10->

[XEN PATCH v11 05/14] xen/arm: ffa: support guest FFA_PARTITION_INFO_GET

2023-07-31 Thread Jens Wiklander
in this case), so once it is done with the buffer it must be released using FFA_RX_RELEASE before another call can be made. Signed-off-by: Jens Wiklander --- v10->v11 - Fixing a typo in a comment and adding another comment as requested --- xen/arch/arm/tee/ffa.c |

[XEN PATCH v11 03/14] xen/arm: ffa: send guest events to Secure Partitions

2023-07-31 Thread Jens Wiklander
(us), so once we're done with the buffer it must be released using FFA_RX_RELEASE before another call can be made. Signed-off-by: Jens Wiklander --- v10->v11: - Addressing comments and fixing a few style issues - Fixing how is_in_subscr_list() is used, it's supposed to take an sp_id, not a vm

[XEN PATCH v11 00/14] Xen FF-A mediator

2023-07-31 Thread Jens Wiklander
arm_smccc_1_2_regs with asm-offsets.c in order to avoid hard coded offsets in the assembly function arm_smccc_1_2_smc() * Adds an entry in SUPPORT.md on the FF-A status * Adds a configuration variable "ffa_enabled" to tell if FF-A should be enabled for a particular domu guest * Moves t

[XEN PATCH v11 04/14] xen/arm: ffa: support mapping guest RX/TX buffers

2023-07-31 Thread Jens Wiklander
Adds support in the mediator to map and unmap the RX and TX buffers provided by the guest using the two FF-A functions FFA_RXTX_MAP and FFA_RXTX_UNMAP. These buffer are later used to transmit data that cannot be passed in registers only. Signed-off-by: Jens Wiklander --- v10->v11 - Fix

Re: [XEN PATCH v10 20/24] xen/arm: ffa: support sharing large memory ranges

2023-07-19 Thread Jens Wiklander
Hi Bertrand, On Wed, Jul 19, 2023 at 11:37 AM Bertrand Marquis wrote: > > Hi Jens, > > > On 17 Jul 2023, at 09:21, Jens Wiklander wrote: > > > > Adds support for sharing large memory ranges transmitted in fragments > > using FFA_MEM_FRAG_TX. > > >

Re: [XEN PATCH v10 14/24] xen/arm: ffa: support guest FFA_PARTITION_INFO_GET

2023-07-19 Thread Jens Wiklander
On Tue, Jul 18, 2023 at 12:22 PM Bertrand Marquis wrote: > > Hi Jens, > > > On 17 Jul 2023, at 09:20, Jens Wiklander wrote: > > > > Adds support in the mediator to handle FFA_PARTITION_INFO_GET requests > > from a guest. The requests are forwarded to the SPMC a

Re: [XEN PATCH v10 13/24] xen/arm: ffa: support mapping guest RX/TX buffers

2023-07-19 Thread Jens Wiklander
Hi Bertrand, On Tue, Jul 18, 2023 at 12:10 PM Bertrand Marquis wrote: > > Hi Jens, > > > On 17 Jul 2023, at 09:20, Jens Wiklander wrote: > > > > Adds support in the mediator to map and unmap the RX and TX buffers > > provided by the guest using th

Re: [XEN PATCH v10 12/24] xen/arm: ffa: send guest events to Secure Partitions

2023-07-19 Thread Jens Wiklander
Hi, On Wed, Jul 19, 2023 at 11:19 AM Bertrand Marquis wrote: > > Hi Jens, > > > On 19 Jul 2023, at 10:27, Jens Wiklander wrote: > > > > Hi Bertrand, > > > > On Tue, Jul 18, 2023 at 12:05 PM Bertrand Marquis > > wrote: > >> > >&g

Re: [XEN PATCH v10 12/24] xen/arm: ffa: send guest events to Secure Partitions

2023-07-19 Thread Jens Wiklander
Hi Bertrand, On Tue, Jul 18, 2023 at 12:05 PM Bertrand Marquis wrote: > > Hi Jens, > > > On 17 Jul 2023, at 09:20, Jens Wiklander wrote: > > > > The FF-A specification defines framework messages sent as direct > > requests when certain events occu

Re: [XEN PATCH v10 10/24] xen/arm: ffa: add direct request support

2023-07-19 Thread Jens Wiklander
Hi Bertrand, On Tue, Jul 18, 2023 at 11:41 AM Bertrand Marquis wrote: > > Hi Jens, > > > On 17 Jul 2023, at 09:20, Jens Wiklander wrote: > > > > Adds support for sending a FF-A direct request. Checks that the SP also > > supports handling a 32-bit direc

[XEN PATCH v10 21/24] xen/arm: ffa: improve lock granularity

2023-07-17 Thread Jens Wiklander
succeed. Guests using the RX and TX buffers are expected to serialize accesses before doing the FF-A request. Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa.c | 121 ++--- 1 file changed, 89 insertions(+), 32 deletions(-) diff --git a/xen/arch/arm/tee/ffa.c

[XEN PATCH v10 24/24] docs: add Arm FF-A mediator

2023-07-17 Thread Jens Wiklander
Describes a FF-A version 1.1 [1] mediator to communicate with a Secure Partition in secure world. [1] https://developer.arm.com/documentation/den0077/latest Signed-off-by: Jens Wiklander Reviewed-by: Henry Wang --- SUPPORT.md | 9 + docs/man/xl.cfg.5.pod.in | 15

[XEN PATCH v10 22/24] xen/arm: ffa: list current limitations

2023-07-17 Thread Jens Wiklander
Adds comments with a list of unsupported FF-A interfaces and limitations in the implemented FF-A interfaces. Signed-off-by: Jens Wiklander Reviewed-by: Henry Wang --- xen/arch/arm/tee/ffa.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/xen/arch/arm/tee

[XEN PATCH v10 18/24] xen/arm: ffa: support sharing memory

2023-07-17 Thread Jens Wiklander
shared memory. The secure world must use FF-A version 1.1, but the guest is free to use version 1.0 or version 1.1. Adds a check that the SP supports the needed FF-A features FFA_MEM_SHARE_64 or FFA_MEM_SHARE_32. [1] https://developer.arm.com/documentation/den0077/latest Signed-off-by: Jens Wiklander

  1   2   3   >