2015-04-21 20:38:20

by Luis Chamberlain

[permalink] [raw]
Subject: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

From: "Luis R. Rodriguez" <[email protected]>

This driver already makes use of ioremap_wc() on PIO buffers,
so convert it to use arch_phys_wc_add().

Cc: Toshi Kani <[email protected]>
Cc: Rickard Strandqvist <[email protected]>
Cc: Mike Marciniszyn <[email protected]>
Cc: Roland Dreier <[email protected]>
Cc: Sean Hefty <[email protected]>
Cc: Hal Rosenstock <[email protected]>
Cc: Dennis Dalessandro <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Suresh Siddha <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Dave Airlie <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Antonino Daplas <[email protected]>
Cc: Jean-Christophe Plagniol-Villard <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Stefan Bader <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Roger Pau MonnĂ© <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/infiniband/hw/qib/qib_wc_x86_64.c | 31 ++++---------------------------
1 file changed, 4 insertions(+), 27 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_wc_x86_64.c b/drivers/infiniband/hw/qib/qib_wc_x86_64.c
index fe0850a..6d61ef9 100644
--- a/drivers/infiniband/hw/qib/qib_wc_x86_64.c
+++ b/drivers/infiniband/hw/qib/qib_wc_x86_64.c
@@ -116,21 +116,9 @@ int qib_enable_wc(struct qib_devdata *dd)
}

if (!ret) {
- int cookie;
-
- cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 1);
- if (cookie < 0) {
- {
- qib_devinfo(dd->pcidev,
- "mtrr_add() WC for PIO bufs failed (%d)\n",
- cookie);
- ret = -EINVAL;
- }
- } else {
- dd->wc_cookie = cookie;
- dd->wc_base = (unsigned long) pioaddr;
- dd->wc_len = (unsigned long) piolen;
- }
+ dd->wc_cookie = arch_phys_wc_add(pioaddr, piolen);
+ if (dd->wc_cookie < 0)
+ ret = -EINVAL;
}

return ret;
@@ -142,18 +130,7 @@ int qib_enable_wc(struct qib_devdata *dd)
*/
void qib_disable_wc(struct qib_devdata *dd)
{
- if (dd->wc_cookie) {
- int r;
-
- r = mtrr_del(dd->wc_cookie, dd->wc_base,
- dd->wc_len);
- if (r < 0)
- qib_devinfo(dd->pcidev,
- "mtrr_del(%lx, %lx, %lx) failed: %d\n",
- dd->wc_cookie, dd->wc_base,
- dd->wc_len, r);
- dd->wc_cookie = 0; /* even on failure */
- }
+ arch_phys_wc_del(dd->wc_cookie);
}

/**
--
2.3.2.209.gd67f9d5.dirty


2015-04-21 20:58:21

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

On Tue, Apr 21, 2015 at 01:37:55PM -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <[email protected]>
>
> This driver already makes use of ioremap_wc() on PIO buffers,
> so convert it to use arch_phys_wc_add().

This is probably OK, but I think you should also remove the qib_wc_pat
module parameter.

Jason

2015-04-21 20:59:49

by Marciniszyn, Mike

[permalink] [raw]
Subject: RE: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

> > This driver already makes use of ioremap_wc() on PIO buffers, so
> > convert it to use arch_phys_wc_add().
>
> This is probably OK, but I think you should also remove the qib_wc_pat module
> parameter.
>
> Jason

Revise based on Jason's request and I will do some testing.

Mike

2015-04-21 21:10:26

by Luis Chamberlain

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

On Tue, Apr 21, 2015 at 1:59 PM, Marciniszyn, Mike
<[email protected]> wrote:
>> > This driver already makes use of ioremap_wc() on PIO buffers, so
>> > convert it to use arch_phys_wc_add().
>>
>> This is probably OK, but I think you should also remove the qib_wc_pat module
>> parameter.
>>
>> Jason
>
> Revise based on Jason's request and I will do some testing.

I did thiink about this -- but removal of module parameters can often
times break users of the module parameter, I figured its best to leave
it to you guys to decide what to do with that, so this leaves it as a
no-op. Can this series be applied and then you can decide what to do
to not affect your users on top of this?

Luis

2015-04-21 21:12:54

by Andy Lutomirski

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

On Tue, Apr 21, 2015 at 2:09 PM, Luis R. Rodriguez
<[email protected]> wrote:
> On Tue, Apr 21, 2015 at 1:59 PM, Marciniszyn, Mike
> <[email protected]> wrote:
>>> > This driver already makes use of ioremap_wc() on PIO buffers, so
>>> > convert it to use arch_phys_wc_add().
>>>
>>> This is probably OK, but I think you should also remove the qib_wc_pat module
>>> parameter.
>>>
>>> Jason
>>
>> Revise based on Jason's request and I will do some testing.
>
> I did thiink about this -- but removal of module parameters can often
> times break users of the module parameter, I figured its best to leave
> it to you guys to decide what to do with that, so this leaves it as a
> no-op. Can this series be applied and then you can decide what to do
> to not affect your users on top of this?

As of a few kernel versions ago, unrecognized module parameters no
longer cause the module to refuse to load.

--Andy

>
> Luis



--
Andy Lutomirski
AMA Capital Management, LLC

2015-04-21 21:15:19

by Luis Chamberlain

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

On Tue, Apr 21, 2015 at 2:12 PM, Andy Lutomirski <[email protected]> wrote:
> On Tue, Apr 21, 2015 at 2:09 PM, Luis R. Rodriguez
> <[email protected]> wrote:
>> On Tue, Apr 21, 2015 at 1:59 PM, Marciniszyn, Mike
>> <[email protected]> wrote:
>>>> > This driver already makes use of ioremap_wc() on PIO buffers, so
>>>> > convert it to use arch_phys_wc_add().
>>>>
>>>> This is probably OK, but I think you should also remove the qib_wc_pat module
>>>> parameter.
>>>>
>>>> Jason
>>>
>>> Revise based on Jason's request and I will do some testing.
>>
>> I did thiink about this -- but removal of module parameters can often
>> times break users of the module parameter, I figured its best to leave
>> it to you guys to decide what to do with that, so this leaves it as a
>> no-op. Can this series be applied and then you can decide what to do
>> to not affect your users on top of this?
>
> As of a few kernel versions ago, unrecognized module parameters no
> longer cause the module to refuse to load.

Sexy, I'll respin the changes only to the qib driver. Can the changes
to ipath still be applied?

Luis