Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1165510AbdDXG3R (ORCPT ); Mon, 24 Apr 2017 02:29:17 -0400 Received: from gate.crashing.org ([63.228.1.57]:49771 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1165434AbdDXG3K (ORCPT ); Mon, 24 Apr 2017 02:29:10 -0400 Message-ID: <1493015287.25766.213.camel@kernel.crashing.org> Subject: Re: [PATCH v4 05/11] VAS: Define helpers for access MMIO regions From: Benjamin Herrenschmidt To: Sukadev Bhattiprolu , Michael Ellerman Cc: michael.neuling@au1.ibm.com, stewart@linux.vnet.ibm.com, apopple@au1.ibm.com, hbabu@us.ibm.com, oohall@gmail.com, bsingharora@gmail.com, linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org Date: Mon, 24 Apr 2017 16:28:07 +1000 In-Reply-To: <1490937224-29149-6-git-send-email-sukadev@linux.vnet.ibm.com> References: <1490937224-29149-1-git-send-email-sukadev@linux.vnet.ibm.com> <1490937224-29149-6-git-send-email-sukadev@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-1.fc25) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1294 Lines: 38 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.