Subject: Re: [PATCH v4 03/16] powerpc/vas: Add platform specific user window operations

From: Nicholas Piggin <[email-masked]>
Date: Thu, 03 Jun 2021 14:05:20 +1000

Excerpts from Haren Myneni's message of May 21, 2021 7:30 pm:
> 
> PowerNV uses registers to open/close VAS windows, and getting the
> paste address. Whereas the hypervisor calls are used on PowerVM.
> 
> This patch adds the platform specific user space window operations
> and register with the common VAS user space interface.

Basic idea makes sense. I don't understand this code in detail though.
A couple of things,

> 
> Signed-off-by: Haren Myneni <[email-masked]>
> ---
>  arch/powerpc/include/asm/vas.h              | 14 +++++-
>  arch/powerpc/platforms/book3s/vas-api.c     | 52 ++++++++++++---------
>  arch/powerpc/platforms/powernv/vas-window.c | 46 +++++++++++++++++-
>  3 files changed, 89 insertions(+), 23 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h
> index 6076adf9ab4f..668303198772 100644
> --- a/arch/powerpc/include/asm/vas.h
> +++ b/arch/powerpc/include/asm/vas.h
> @@ -5,6 +5,7 @@
>  
>  #ifndef _ASM_POWERPC_VAS_H
>  #define _ASM_POWERPC_VAS_H
> +#include <uapi/asm/vas-api.h>
>  
>  struct vas_window;
>  
> @@ -48,6 +49,16 @@ enum vas_cop_type {
>  	VAS_COP_TYPE_MAX,
>  };
>  
> +/*
> + * User space window operations used for powernv and powerVM
> + */
> +struct vas_user_win_ops {
> +	struct vas_window * (*open_win)(struct vas_tx_win_open_attr *,
> +				enum vas_cop_type);
> +	u64 (*paste_addr)(void *);
> +	int (*close_win)(void *);

Without looking further into the series, why do these two take void * 
when the first returns a vas_window * which appears to be the required
argument to these?

> +static struct vas_user_win_ops vops =  {
> +	.open_win	=	vas_user_win_open,
> +	.paste_addr	=	vas_user_win_paste_addr,
> +	.close_win	=	vas_user_win_close,
> +};

const?

Thanks,
Nick