1. 28 Sep, 2018 34 commits
  2. 21 Sep, 2018 6 commits
    • Stefan Agner's avatar
      crypto: arm/crc32 - avoid warning when compiling with Clang · cd560235
      Stefan Agner authored
      The table id (second) argument to MODULE_DEVICE_TABLE is often
      referenced otherwise. This is not the case for CPU features. This
      leads to a warning when building the kernel with Clang:
        arch/arm/crypto/crc32-ce-glue.c:239:33: warning: variable
          'crc32_cpu_feature' is not needed and will not be emitted
          [-Wunneeded-internal-declaration]
        static const struct cpu_feature crc32_cpu_feature[] = {
                                        ^
      
      Avoid warnings by using __maybe_unused, similar to commit 1f318a8b
      ("modules: mark __inittest/__exittest as __maybe_unused").
      
      Fixes: 2a9faf8b ("crypto: arm/crc32 - enable module autoloading based on CPU feature bits")
      Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
      Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      cd560235
    • Stefan Agner's avatar
      cpufeature: avoid warning when compiling with clang · c785896b
      Stefan Agner authored
      The table id (second) argument to MODULE_DEVICE_TABLE is often
      referenced otherwise. This is not the case for CPU features. This
      leads to warnings when building the kernel with Clang:
        arch/arm/crypto/aes-ce-glue.c:450:1: warning: variable
          'cpu_feature_match_AES' is not needed and will not be emitted
          [-Wunneeded-internal-declaration]
        module_cpu_feature_match(AES, aes_init);
        ^
      
      Avoid warnings by using __maybe_unused, similar to commit 1f318a8b
      ("modules: mark __inittest/__exittest as __maybe_unused").
      
      Fixes: 67bad2fd ("cpu: add generic support for CPU feature based module autoloading")
      Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
      Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c785896b
    • Janakarajan Natarajan's avatar
      crypto: ccp - Allow SEV firmware to be chosen based on Family and Model · e9372060
      Janakarajan Natarajan authored
      During PSP initialization, there is an attempt to update the SEV firmware
      by looking in /lib/firmware/amd/. Currently, sev.fw is the expected name
      of the firmware blob.
      
      This patch will allow for firmware filenames based on the family and
      model of the processor.
      
      Model specific firmware files are given highest priority. Followed by
      firmware for a subset of models. Lastly, failing the previous two options,
      fallback to looking for sev.fw.
      Signed-off-by: default avatarJanakarajan Natarajan <Janakarajan.Natarajan@amd.com>
      Reviewed-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Acked-by: default avatarGary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e9372060
    • Janakarajan Natarajan's avatar
      crypto: ccp - Fix static checker warning · b78d3795
      Janakarajan Natarajan authored
      Under certain configuration SEV functions can be defined as no-op.
      In such a case error can be uninitialized.
      
      Initialize the variable to 0.
      
      Cc: Dan Carpenter <Dan.Carpenter@oracle.com>
      Reported-by: default avatarDan Carpenter <Dan.Carpenter@oracle.com>
      Signed-off-by: default avatarJanakarajan Natarajan <Janakarajan.Natarajan@amd.com>
      Acked-by: default avatarGary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      b78d3795
    • Ondrej Mosnacek's avatar
      crypto: lrw - Do not use auxiliary buffer · ac3c8f36
      Ondrej Mosnacek authored
      This patch simplifies the LRW template to recompute the LRW tweaks from
      scratch in the second pass and thus also removes the need to allocate a
      dynamic buffer using kmalloc().
      
      As discussed at [1], the use of kmalloc causes deadlocks with dm-crypt.
      
      PERFORMANCE MEASUREMENTS (x86_64)
      Performed using: https://gitlab.com/omos/linux-crypto-bench
      Crypto driver used: lrw(ecb-aes-aesni)
      
      The results show that the new code has about the same performance as the
      old code. For 512-byte message it seems to be even slightly faster, but
      that might be just noise.
      
      Before:
             ALGORITHM KEY (b)        DATA (B)   TIME ENC (ns)   TIME DEC (ns)
              lrw(aes)     256              64             200             203
              lrw(aes)     320              64             202             204
              lrw(aes)     384              64             204             205
              lrw(aes)     256             512             415             415
              lrw(aes)     320             512             432             440
              lrw(aes)     384             512             449             451
              lrw(aes)     256            4096            1838            1995
              lrw(aes)     320            4096            2123            1980
              lrw(aes)     384            4096            2100            2119
              lrw(aes)     256           16384            7183            6954
              lrw(aes)     320           16384            7844            7631
              lrw(aes)     384           16384            8256            8126
              lrw(aes)     256           32768           14772           14484
              lrw(aes)     320           32768           15281           15431
              lrw(aes)     384           32768           16469           16293
      
      After:
             ALGORITHM KEY (b)        DATA (B)   TIME ENC (ns)   TIME DEC (ns)
              lrw(aes)     256              64             197             196
              lrw(aes)     320              64             200             197
              lrw(aes)     384              64             203             199
              lrw(aes)     256             512             385             380
              lrw(aes)     320             512             401             395
              lrw(aes)     384             512             415             415
              lrw(aes)     256            4096            1869            1846
              lrw(aes)     320            4096            2080            1981
              lrw(aes)     384            4096            2160            2109
              lrw(aes)     256           16384            7077            7127
              lrw(aes)     320           16384            7807            7766
              lrw(aes)     384           16384            8108            8357
              lrw(aes)     256           32768           14111           14454
              lrw(aes)     320           32768           15268           15082
              lrw(aes)     384           32768           16581           16250
      
      [1] https://lkml.org/lkml/2018/8/23/1315Signed-off-by: default avatarOndrej Mosnacek <omosnace@redhat.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ac3c8f36
    • Ondrej Mosnacek's avatar
      crypto: lrw - Optimize tweak computation · c778f96b
      Ondrej Mosnacek authored
      This patch rewrites the tweak computation to a slightly simpler method
      that performs less bswaps. Based on performance measurements the new
      code seems to provide slightly better performance than the old one.
      
      PERFORMANCE MEASUREMENTS (x86_64)
      Performed using: https://gitlab.com/omos/linux-crypto-bench
      Crypto driver used: lrw(ecb-aes-aesni)
      
      Before:
             ALGORITHM KEY (b)        DATA (B)   TIME ENC (ns)   TIME DEC (ns)
              lrw(aes)     256              64             204             286
              lrw(aes)     320              64             227             203
              lrw(aes)     384              64             208             204
              lrw(aes)     256             512             441             439
              lrw(aes)     320             512             456             455
              lrw(aes)     384             512             469             483
              lrw(aes)     256            4096            2136            2190
              lrw(aes)     320            4096            2161            2213
              lrw(aes)     384            4096            2295            2369
              lrw(aes)     256           16384            7692            7868
              lrw(aes)     320           16384            8230            8691
              lrw(aes)     384           16384            8971            8813
              lrw(aes)     256           32768           15336           15560
              lrw(aes)     320           32768           16410           16346
              lrw(aes)     384           32768           18023           17465
      
      After:
             ALGORITHM KEY (b)        DATA (B)   TIME ENC (ns)   TIME DEC (ns)
              lrw(aes)     256              64             200             203
              lrw(aes)     320              64             202             204
              lrw(aes)     384              64             204             205
              lrw(aes)     256             512             415             415
              lrw(aes)     320             512             432             440
              lrw(aes)     384             512             449             451
              lrw(aes)     256            4096            1838            1995
              lrw(aes)     320            4096            2123            1980
              lrw(aes)     384            4096            2100            2119
              lrw(aes)     256           16384            7183            6954
              lrw(aes)     320           16384            7844            7631
              lrw(aes)     384           16384            8256            8126
              lrw(aes)     256           32768           14772           14484
              lrw(aes)     320           32768           15281           15431
              lrw(aes)     384           32768           16469           16293
      Signed-off-by: default avatarOndrej Mosnacek <omosnace@redhat.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c778f96b