[PATCH 4/6] platform/apple: Add new Apple Mac SMC driver

Sven Peter sven at svenpeter.dev
Thu Sep 1 23:45:16 PDT 2022


On Thu, Sep 1, 2022, at 21:26, Andy Shevchenko wrote:
> On Thu, Sep 1, 2022 at 5:18 PM Russell King <rmk+kernel at armlinux.org.uk> wrote:
[...]
>
> ...
>
>> +       if (size <= 4)
>> +               memcpy(buf, &rdata, size);
>> +       else
>> +               memcpy_fromio(buf, smc->shmem.iomem, size);
>
> This is unclear why plain memcpy() for the small size and what are the
> side effects of the memory. Maybe you wanted memremap() instead of
> ioremap() to begin with?

rdata is used for small buffers, comes directly as part of a message sent on the
underlying hardware FIFO and is on the stack (and thus mapped as as Normal memory)
while smc->shmem.iomem has to be Device-nGnRnE. Mapping it with any other attributes
will generate SErrors for each access.




Sven



More information about the linux-arm-kernel mailing list