2020-10-13 12:02:58

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 07/18] regmap: mmio: add config option to allow relaxed MMIO accesses

On Mon, Oct 12, 2020 at 11:59:46PM +0300, Adrian Ratiu wrote:

> - writeb(val, ctx->regs + reg);
> + if (ctx->relaxed_mmio)
> + writeb_relaxed(val, ctx->regs + reg);
> + else
> + writeb(val, ctx->regs + reg);

There is no point in doing a conditional operation on every I/O, it'd be
better to register a different set of ops when doing relaxed I/O.


Attachments:
(No filename) (361.00 B)
signature.asc (499.00 B)
Download all attachments

2020-10-14 23:03:22

by Adrian Ratiu

[permalink] [raw]
Subject: Re: [PATCH 07/18] regmap: mmio: add config option to allow relaxed MMIO accesses

Hello Mark,

On Tue, 13 Oct 2020, Mark Brown <[email protected]> wrote:
> On Mon, Oct 12, 2020 at 11:59:46PM +0300, Adrian Ratiu wrote:
>
>> - writeb(val, ctx->regs + reg); + if (ctx->relaxed_mmio) +
>> writeb_relaxed(val, ctx->regs + reg); + else +
>> writeb(val, ctx->regs + reg);
>
> There is no point in doing a conditional operation on every I/O,
> it'd be better to register a different set of ops when doing
> relaxed I/O.

Indeed I have considered adding new functions but went with this
solution because it's easier for the users to only have to define
a "relaxed" config then test the regmap ctx as above.

Thinking a bit more about it, yes, it makes more sense to have
dedicated ops: this way users don't have to be explicit about
adding membarriers and can combine relaxed and non-relaxed more
easily, so it's also a better API trade-off in addition to
avoiding the conditional. Thanks!

Question: Do you want me to split this patch from the series and
send it separately just for the regmap subsystem to be easier to
review / apply?

Kind regards,
Adrian