Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1721009
| From | Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v7 04/12] powerpc/vas: Define helpers to access MMIO regions |
| Date | 2017-08-28 06:40 +0200 |
| Message-ID | <ujk09-Su-5@gated-at.bofh.it> (permalink) |
| References | <uhTY5-2SA-5@gated-at.bofh.it> <uhTY7-2SA-25@gated-at.bofh.it> <uidDr-7cw-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Michael Ellerman [mpe@ellerman.id.au] wrote:
> Hi Suka,
>
> Comments inline.
>
> Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> writes:
> > diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c
> > index 6156fbe..a3a705a 100644
> > --- a/arch/powerpc/platforms/powernv/vas-window.c
> > +++ b/arch/powerpc/platforms/powernv/vas-window.c
> > @@ -9,9 +9,182 @@
> >
> > #include <linux/types.h>
> > #include <linux/mutex.h>
> > +#include <linux/slab.h>
> > +#include <linux/io.h>
> >
> > #include "vas.h"
> >
> > +/*
> > + * Compute the paste address region for the window @window using the
> > + * ->paste_base_addr and ->paste_win_id_shift we got from device tree.
> > + */
> > +void compute_paste_address(struct vas_window *window, uint64_t *addr, int *len)
> > +{
> > + uint64_t base, shift;
>
> Please use the kernel types, so u64 here.
Ok.
>
> > + int winid;
> > +
> > + base = window->vinst->paste_base_addr;
> > + shift = window->vinst->paste_win_id_shift;
> > + winid = window->winid;
> > +
> > + *addr = base + (winid << shift);
> > + if (len)
> > + *len = PAGE_SIZE;
>
> Having multiple output parameters makes for a pretty awkward API. Is it
> really necesssary given len is a constant PAGE_SIZE anyway.
>
> If you didn't return len, then you could just make the function return
> the addr, and you wouldn't need any output parameters.
I agree, I went back and forth on it. I was trying to avoid callers
making assumptions on the size. But since there are just a couple
of places, I guess we could have them assume PAGE_SIZE.
>
> One of the callers that passes len is unmap_paste_region(), but that
> is a bit odd. It would be more natural I think if once a window is
> mapped it knows its size. Or if the mapping will always just be one page
> then we can just know that.
Agree, since the len values are constant I was trying to avoid saving
them in each of the 64K windows - so the compute during unmap. Will change
to assume PAGE_SIZE.
Also agree with other comments here.
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH v7 04/12] powerpc/vas: Define helpers to access MMIO regions Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2017-08-28 06:40 +0200
csiph-web