[v2 3/5] arm64: mte: implement CONFIG_ARM64_MTE_COMP

Alexander Potapenko glider at google.com
Thu Jul 13 09:37:43 PDT 2023


> +/* Compress the data inline. */
> +static u64 ea0_compress_inline(int len, u8 *tags, short *sizes)
> +{
> +       u64 result;
> +
> +       ea0_compress_to_buf(len, tags, sizes, (u8 *)&result, sizeof(result));
> +       result = be64_to_cpu(result);
This be64_to_cpu() is leftover from the previous compressor
implementation which treated u64 as u8[8] (i.e. big-endian).
The new implementation works with the native u64 representation, so
the conversion is not needed anymore (and actually produces invalid
handles that can't be stored in Xarray).
I will drop this call in v3.


> +bool ea0_decompress(u64 handle, u8 *tags)
> +{
> +       u8 *storage = ea0_storage(handle);
> +       int size = ea0_storage_size(handle);
> +
> +       if (size == 128) {
> +               memcpy(tags, storage, size);
> +               return true;
> +       }
> +       if (size == 8) {
> +               handle = cpu_to_be64(handle);
Ditto.



More information about the linux-arm-kernel mailing list