[PATCH v2 11/18] powerpc/vas: Export HVWC to debugfs

Michael Ellerman mpe at ellerman.id.au
Tue Nov 7 23:19:48 AEDT 2017


Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com> writes:

> diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c
> index 23c13a7..088ce56 100644
> --- a/arch/powerpc/platforms/powernv/vas-window.c
> +++ b/arch/powerpc/platforms/powernv/vas-window.c
> @@ -145,24 +145,42 @@ static void unmap_paste_region(struct vas_window *window)
>  }
>  
>  /*
> - * Unmap the MMIO regions for a window.
> + * Unmap the MMIO regions for a window. Hold the vas_mutex so we don't
> + * unmap when the window's debugfs dir is in use. This serializes close
> + * of a window even on another VAS instance but since its not a critical
> + * path, just minimize the time we hold the mutex for now. We can add
> + * a per-instance mutex later if necessary.
>   */
>  static void unmap_winctx_mmio_bars(struct vas_window *window)
>  {
>  	int len;
> +	void *uwc_map;
> +	void *hvwc_map;
>  	u64 busaddr_start;
>  
> +	mutex_lock(&vas_mutex);
> +
>  	if (window->hvwc_map) {
> -		get_hvwc_mmio_bar(window, &busaddr_start, &len);
> -		unmap_region(window->hvwc_map, busaddr_start, len);
> +		hvwc_map = window->hvwc_map;
>  		window->hvwc_map = NULL;
>  	}
>  
>  	if (window->uwc_map) {
> -		get_uwc_mmio_bar(window, &busaddr_start, &len);
> -		unmap_region(window->uwc_map, busaddr_start, len);
> +		uwc_map = window->uwc_map;
>  		window->uwc_map = NULL;
>  	}
> +
> +	mutex_unlock(&vas_mutex);
> +
> +	if (hvwc_map) {
> +		get_hvwc_mmio_bar(window, &busaddr_start, &len);
> +		unmap_region(hvwc_map, busaddr_start, len);
> +	}
> +
> +	if (uwc_map) {
> +		get_uwc_mmio_bar(window, &busaddr_start, &len);
> +		unmap_region(uwc_map, busaddr_start, len);
> +	}

arch/powerpc/platforms/powernv/vas-window.c: In function 'unmap_winctx_mmio_bars':
arch/powerpc/platforms/powernv/vas-window.c:137:2: error: 'uwc_map' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  iounmap(addr);
  ^
arch/powerpc/platforms/powernv/vas-window.c:168:8: note: 'uwc_map' was declared here
  void *uwc_map;
        ^
arch/powerpc/platforms/powernv/vas-window.c:137:2: error: 'hvwc_map' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  iounmap(addr);
  ^
arch/powerpc/platforms/powernv/vas-window.c:169:8: note: 'hvwc_map' was declared here
  void *hvwc_map;
        ^
cc1: all warnings being treated as errors


cheers


More information about the Linuxppc-dev mailing list