[dpdk-dev] [PATCH v1 1/2] eal/x86: add WC store function
Ananyev, Konstantin
konstantin.ananyev at intel.com
Mon Jun 15 13:11:28 CEST 2020
Hi Radu,
>
> Add rte_write32_wc function that implements a WC store
> using movdiri instruction.
Probably worth to add 1-2 lines of text
explaining what are the advantages (perf improvement or whatever).
>
> Signed-off-by: Radu Nicolau <radu.nicolau at intel.com>
> ---
> lib/librte_eal/x86/include/rte_io.h | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/lib/librte_eal/x86/include/rte_io.h b/lib/librte_eal/x86/include/rte_io.h
> index 2db71b1..3d74bec 100644
> --- a/lib/librte_eal/x86/include/rte_io.h
> +++ b/lib/librte_eal/x86/include/rte_io.h
> @@ -11,6 +11,26 @@ extern "C" {
>
> #include "generic/rte_io.h"
>
> +/**
> + * Write a 32-bit value to I/O device memory address *addr*.
> + * Uses MOVDIRI instruction to perform a direct-store operation using WC
> + * memory write protocol.
> + *
> + * @param value
> + * Value to write
> + * @param addr
> + * I/O memory address to write the value to
> + */
> +static __rte_always_inline void
> +rte_write32_wc(uint32_t value, volatile void *addr)
> +{
> + asm volatile("sfence\n\t"
Why not rte_wmb()?
> + /* MOVDIRI */
> + ".byte 0x40, 0x0f, 0x38, 0xf9, 0x02"
> + :
> + : "a" (value), "d" (addr));
> +}
> +
> #ifdef __cplusplus
> }
> #endif
> --
> 2.7.4
More information about the dev
mailing list