All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	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
Date: Mon, 24 Apr 2017 10:25:27 -0700	[thread overview]
Message-ID: <20170424172527.GA15532@us.ibm.com> (raw)
In-Reply-To: <1493015287.25766.213.camel@kernel.crashing.org>

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)
> > +{
> > +=A0=A0=A0=A0=A0=A0=A0void *map;
> > +
> > +=A0=A0=A0=A0=A0=A0=A0if (!request_mem_region(start, len, name)) {
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0pr_devel("%s(): request_m=
em_region(0x%llx, %d) failed\n",
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0__func__, start, len);
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0return NULL;
> > +=A0=A0=A0=A0=A0=A0=A0}
> > +
> > +=A0=A0=A0=A0=A0=A0=A0map =3D __ioremap(start, len, pgprot_val(pgprot_c=
ached(__pgprot(0))));
> > +=A0=A0=A0=A0=A0=A0=A0if (!map) {
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0pr_devel("%s(): ioremap(0=
x%llx, %d) failed\n", __func__, start,
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0len);
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0return NULL;
> > +=A0=A0=A0=A0=A0=A0=A0}
> > +
> > +=A0=A0=A0=A0=A0=A0=A0return map;
> > +}
>=20
> 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...
>=20
> 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.

>=20
> > +/*
> > + * Unmap the MMIO regions for a window.
> > + */
> > +static void unmap_wc_paste_kaddr(struct vas_window *window)
> > +{
> > +=A0=A0=A0=A0=A0=A0=A0int len;
>=20
> Don't use "wc"... that usually means "write combine".

Ok.

Thanks,

Sukadev

WARNING: multiple messages have this Message-ID (diff)
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	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
Date: Mon, 24 Apr 2017 10:25:27 -0700	[thread overview]
Message-ID: <20170424172527.GA15532@us.ibm.com> (raw)
In-Reply-To: <1493015287.25766.213.camel@kernel.crashing.org>

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

  reply	other threads:[~2017-04-24 17:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31  5:13 [PATCH v4 00/11] Enable VAS Sukadev Bhattiprolu
2017-03-31  5:13 ` [PATCH v4 01/11] Add Power9 PVR Sukadev Bhattiprolu
2017-03-31  5:13 ` [PATCH v4 02/11] VAS: Define macros, register fields and structures Sukadev Bhattiprolu
2017-04-04 17:17   ` Sukadev Bhattiprolu
2017-03-31  5:13 ` [PATCH v4 03/11] Move GET_FIELD/SET_FIELD to vas.h Sukadev Bhattiprolu
2017-03-31  5:13 ` [PATCH v4 04/11] VAS: Define vas_init() and vas_exit() Sukadev Bhattiprolu
2017-04-02 20:23   ` kbuild test robot
2017-04-04 17:20   ` Sukadev Bhattiprolu
2017-04-24  6:18   ` Benjamin Herrenschmidt
2017-04-24  6:25   ` Benjamin Herrenschmidt
2017-04-24 20:32   ` Tyrel Datwyler
2017-05-25  5:29     ` Sukadev Bhattiprolu
2017-03-31  5:13 ` [PATCH v4 05/11] VAS: Define helpers for access MMIO regions Sukadev Bhattiprolu
2017-04-24  6:28   ` Benjamin Herrenschmidt
2017-04-24 17:25     ` Sukadev Bhattiprolu [this message]
2017-04-24 17:25       ` Sukadev Bhattiprolu
2017-04-24 23:19       ` Benjamin Herrenschmidt
2017-03-31  5:13 ` [PATCH v4 06/11] VAS: Define helpers to init window context Sukadev Bhattiprolu
2017-03-31  5:13 ` [PATCH v4 07/11] VAS: Define helpers to alloc/free windows Sukadev Bhattiprolu
2017-03-31  5:13 ` [PATCH v4 08/11] VAS: Define vas_rx_win_open() interface Sukadev Bhattiprolu
2017-03-31  5:13 ` [PATCH v4 09/11] VAS: Define vas_win_close() interface Sukadev Bhattiprolu
2017-03-31  5:13 ` [PATCH v4 10/11] VAS: Define vas_tx_win_open() Sukadev Bhattiprolu
2017-03-31  5:13 ` [PATCH v4 11/11] VAS: Define copy/paste interfaces Sukadev Bhattiprolu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170424172527.GA15532@us.ibm.com \
    --to=sukadev@linux.vnet.ibm.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=apopple@au1.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bsingharora@gmail.com \
    --cc=hbabu@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael.neuling@au1.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=oohall@gmail.com \
    --cc=stewart@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.