Re: [PATCH] ACPI: sysfs: copy ACPI data using io memory copying

From: Colin Ian King
Date: Wed Sep 02 2020 - 07:50:28 EST


On 02/09/2020 12:13, David Laight wrote:
> From: Colin Ian King
>> Sent: 02 September 2020 11:27
>>
>> On 14/03/2020 10:23, Rafael J. Wysocki wrote:
>>> On Thursday, March 12, 2020 12:13:45 PM CET Colin King wrote:
>>>> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>>>>
>>>> Reading ACPI data on ARM64 at a non-aligned offset from
>>>> /sys/firmware/acpi/tables/data/BERT will cause a splat because
>>>> the data is I/O memory mapped and being read with just a memcpy.
>>>> Fix this by introducing an I/O variant of memory_read_from_buffer
>>>> and using I/O memory mapped copies instead.
> ..
>>>> +/**
>>>> + * memory_read_from_io_buffer - copy data from a io memory mapped buffer
>>>> + * @to: the kernel space buffer to read to
>>>> + * @count: the maximum number of bytes to read
>>>> + * @ppos: the current position in the buffer
>>>> + * @from: the buffer to read from
>>>> + * @available: the size of the buffer
>>>> + *
>>>> + * The memory_read_from_buffer() function reads up to @count bytes from the
>>>> + * io memory mappy buffer @from at offset @ppos into the kernel space address
>>>> + * starting at @to.
>>>> + *
>>>> + * On success, the number of bytes read is returned and the offset @ppos is
>>>> + * advanced by this number, or negative value is returned on error.
>>>> + **/
>
> Apart from the return value how is this different from the generic
> memcpy_from_io() ?
>
> David


The intention is to be semantically the same as
memory_read_from_buffer(), so in that respect quite a bit different from
memcpy_fromio()

Colin

>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>