On 16/10/2024 10:21 am, Bertrand Marquis wrote:
> diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
> index fde187dba4e5..d699a267cc76 100644
> --- a/xen/arch/arm/tee/ffa_partinfo.c
> +++ b/xen/arch/arm/tee/ffa_partinfo.c
> @@ -77,7 +77,21 @@ void ffa_handle_partition_info_get(struct cpu_user_regs 
> *regs)
>      };
>      uint32_t src_size, dst_size;
>      void *dst_buf;
> -    uint32_t ffa_sp_count = 0;
> +    uint32_t ffa_vm_count = 0, ffa_sp_count = 0;
> +#ifdef CONFIG_FFA_VM_TO_VM
> +    struct domain *dom;
> +
> +    /* Count the number of VM with FF-A support */
> +    rcu_read_lock(&domlist_read_lock);
> +    for_each_domain( dom )
> +    {
> +        struct ffa_ctx *vm = dom->arch.tee;
> +
> +        if (dom != d && vm != NULL && vm->guest_vers != 0)
> +            ffa_vm_count++;
> +    }
> +    rcu_read_unlock(&domlist_read_lock);
> +#endif

...
struct domain *dom;

if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
{
    /* Count the number of VM with FF-A support */
    rcu_read_lock(&domlist_read_lock);
    ...
    rcu_read_unlock(&domlist_read_lock);
}

drops the explicit ifdef.  Hiding function-level variable declarations
behind an ifdef like that works exactly once, and it doesn't make
pleasant code.

~Andrew

Reply via email to