Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1172733AbdDXRZw convert rfc822-to-8bit (ORCPT ); Mon, 24 Apr 2017 13:25:52 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39776 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1171981AbdDXRZp (ORCPT ); Mon, 24 Apr 2017 13:25:45 -0400 Date: Mon, 24 Apr 2017 10:25:27 -0700 From: Sukadev Bhattiprolu To: Benjamin Herrenschmidt Cc: Michael Ellerman , 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, aneesh.kumar@linux.vnet.ibm.com Subject: Re: [PATCH v4 05/11] VAS: Define helpers for access MMIO regions References: <1490937224-29149-1-git-send-email-sukadev@linux.vnet.ibm.com> <1490937224-29149-6-git-send-email-sukadev@linux.vnet.ibm.com> <1493015287.25766.213.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <1493015287.25766.213.camel@kernel.crashing.org> X-Operating-System: Linux 2.0.32 on an i486 User-Agent: Mutt/1.7.1 (2016-10-04) X-TM-AS-GCONF: 00 x-cbid: 17042417-0024-0000-0000-00000254802E X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006966; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000208; SDB=6.00851857; UDB=6.00421011; IPR=6.00630695; BA=6.00005311; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015158; XFM=3.00000013; UTC=2017-04-24 17:25:41 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042417-0025-0000-0000-0000439FE47C Message-Id: <20170424172527.GA15532@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-24_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704240296 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1473 Lines: 52 Benjamin Herrenschmidt [benh@kernel.crashing.org] wrote: > 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 ? Untl recently, only tested on simics and has been working there. On the hardware, hitting a crash on the first mmio write... > > MMIO regions must be mapped non-cachable. Only the paste region which maybe due to this :-) Should I change to pgprot_noncached() for the MMIO writes? > requires being mapped cachable. Ask Aneesh for a cleaner way of > doing it too while at it. Ok. > > > +/* > > + * 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". Ok. Thanks, Sukadev