Re: [PATCH v4 05/11] VAS: Define helpers for access MMIO regions
From: Benjamin Herrenschmidt
Date: Mon Apr 24 2017 - 02:29:20 EST
On Thu, 2017-03-30 at 22:13 -0700, Sukadev Bhattiprolu wrote:
> +static void *map_mmio_region(char *name, uint64_t start, int len)
> +{
> +ÂÂÂÂÂÂÂvoid *map;
> +
> +ÂÂÂÂÂÂÂif (!request_mem_region(start, len, name)) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂpr_devel("%s(): request_mem_region(0x%llx, %d) failed\n",
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ__func__, start, len);
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn NULL;
> +ÂÂÂÂÂÂÂ}
> +
> +ÂÂÂÂÂÂÂmap = __ioremap(start, len, pgprot_val(pgprot_cached(__pgprot(0))));
> +ÂÂÂÂÂÂÂif (!map) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂpr_devel("%s(): ioremap(0x%llx, %d) failed\n", __func__, start,
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂlen);
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn NULL;
> +ÂÂÂÂÂÂÂ}
> +
> +ÂÂÂÂÂÂÂreturn map;
> +}
That's very wrong. I assume this never worked right ?
MMIO regions must be mapped non-cachable. Only the paste region
requires being mapped cachable. Ask Aneesh for a cleaner way of
doing it too while at it.
> +/*
> + * Unmap the MMIO regions for a window.
> + */
> +static void unmap_wc_paste_kaddr(struct vas_window *window)
> +{
> +ÂÂÂÂÂÂÂint len;
Don't use "wc"... that usually means "write combine".
Cheers,
Ben.