lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b6413a27-9cdf-9f60-be49-03398ee3f1f6@pengutronix.de>
Date:   Mon, 25 Jan 2021 12:57:27 +0100
From:   Ahmad Fatoum <a.fatoum@...gutronix.de>
To:     Marc Kleine-Budde <mkl@...gutronix.de>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...com>
Cc:     linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Fabrice Gasnier <fabrice.gasnier@...s.st.com>,
        kernel@...gutronix.de, Holger Assmann <has@...gutronix.de>,
        linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v3] iio: adc: stm32-adc: enable timestamping for non-DMA
 usage



On 25.01.21 12:49, Marc Kleine-Budde wrote:
> On 1/25/21 12:21 PM, Ahmad Fatoum wrote:
>> For non-DMA usage, we have an easy way to associate a timestamp with a
>> sample: iio_pollfunc_store_time stores a timestamp in the primary
>> trigger IRQ handler and stm32_adc_trigger_handler runs in the IRQ thread
>> to push out the buffer along with the timestamp.
>>
>> For this to work, the driver needs to register an IIO_TIMESTAMP channel.
>> Do this.
>>
>> For DMA, it's not as easy, because we don't push the buffers out of
>> stm32_adc_trigger, but out of stm32_adc_dma_buffer_done, which runs in
>> a tasklet scheduled after a DMA completion.
>>
>> Preferably, the DMA controller would copy us the timestamp into that buffer
>> as well. Until this is implemented, restrict timestamping support to
>> only PIO. For low-frequency sampling, PIO is probably good enough.
>>
>> Cc: Holger Assmann <has@...gutronix.de>
>> Acked-by: Fabrice Gasnier <fabrice.gasnier@...s.st.com>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@...gutronix.de>
>> ---
>> v2 -> v3:
>>   - explicitly specify alignment (Jonathan)
>>   - increase buffer size to hold additional timestamp
>> v1 -> v2:
>>   - Added comment about timestamping being PIO only (Fabrice)
>>   - Added missing DMA resource clean up in error path (Fabrice)
>>   - Added Fabrice's Acked-by
>> ---
>>  drivers/iio/adc/stm32-adc.c | 39 +++++++++++++++++++++++++++++--------
>>  1 file changed, 31 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
>> index c067c994dae2..ab2f440d7afb 100644
>> --- a/drivers/iio/adc/stm32-adc.c
>> +++ b/drivers/iio/adc/stm32-adc.c
>> @@ -177,7 +177,7 @@ struct stm32_adc_cfg {
>>   * @offset:		ADC instance register offset in ADC block
>>   * @cfg:		compatible configuration data
>>   * @completion:		end of single conversion completion
>> - * @buffer:		data buffer
>> + * @buffer:		data buffer + 8 bytes for timestamp if enabled
>                                       ^
>>   * @clk:		clock for this adc instance
>>   * @irq:		interrupt for this adc instance
>>   * @lock:		spinlock
>> @@ -200,7 +200,7 @@ struct stm32_adc {
>>  	u32			offset;
>>  	const struct stm32_adc_cfg	*cfg;
>>  	struct completion	completion;
>> -	u16			buffer[STM32_ADC_MAX_SQ];
>> +	u16			buffer[STM32_ADC_MAX_SQ + 8] __aligned(8);
>          ^^                                               ^
> 
> How does that fit together?

Ah indeed, that's a little longer than needed.
Thanks for catching.

> 
> Marc
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ