Merge 8617d7d629 ("Merge tag 'mips_6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux") into android-mainline
Steps on the way to 6.12-rc1 Bug: 367265496 Change-Id: I96031010350dd3e03be270e3804d280df8ed1ab2 Signed-off-by: Matthias Maennich <maennich@google.com>
This commit is contained in:
@@ -158,3 +158,72 @@ poisoned BTB entry and using that safe one for all function returns.
|
||||
In older Zen1 and Zen2, this is accomplished using a reinterpretation
|
||||
technique similar to Retbleed one: srso_untrain_ret() and
|
||||
srso_safe_ret().
|
||||
|
||||
Checking the safe RET mitigation actually works
|
||||
-----------------------------------------------
|
||||
|
||||
In case one wants to validate whether the SRSO safe RET mitigation works
|
||||
on a kernel, one could use two performance counters
|
||||
|
||||
* PMC_0xc8 - Count of RET/RET lw retired
|
||||
* PMC_0xc9 - Count of RET/RET lw retired mispredicted
|
||||
|
||||
and compare the number of RETs retired properly vs those retired
|
||||
mispredicted, in kernel mode. Another way of specifying those events
|
||||
is::
|
||||
|
||||
# perf list ex_ret_near_ret
|
||||
|
||||
List of pre-defined events (to be used in -e or -M):
|
||||
|
||||
core:
|
||||
ex_ret_near_ret
|
||||
[Retired Near Returns]
|
||||
ex_ret_near_ret_mispred
|
||||
[Retired Near Returns Mispredicted]
|
||||
|
||||
Either the command using the event mnemonics::
|
||||
|
||||
# perf stat -e ex_ret_near_ret:k -e ex_ret_near_ret_mispred:k sleep 10s
|
||||
|
||||
or using the raw PMC numbers::
|
||||
|
||||
# perf stat -e cpu/event=0xc8,umask=0/k -e cpu/event=0xc9,umask=0/k sleep 10s
|
||||
|
||||
should give the same amount. I.e., every RET retired should be
|
||||
mispredicted::
|
||||
|
||||
[root@brent: ~/kernel/linux/tools/perf> ./perf stat -e cpu/event=0xc8,umask=0/k -e cpu/event=0xc9,umask=0/k sleep 10s
|
||||
|
||||
Performance counter stats for 'sleep 10s':
|
||||
|
||||
137,167 cpu/event=0xc8,umask=0/k
|
||||
137,173 cpu/event=0xc9,umask=0/k
|
||||
|
||||
10.004110303 seconds time elapsed
|
||||
|
||||
0.000000000 seconds user
|
||||
0.004462000 seconds sys
|
||||
|
||||
vs the case when the mitigation is disabled (spec_rstack_overflow=off)
|
||||
or not functioning properly, showing usually a lot smaller number of
|
||||
mispredicted retired RETs vs the overall count of retired RETs during
|
||||
a workload::
|
||||
|
||||
[root@brent: ~/kernel/linux/tools/perf> ./perf stat -e cpu/event=0xc8,umask=0/k -e cpu/event=0xc9,umask=0/k sleep 10s
|
||||
|
||||
Performance counter stats for 'sleep 10s':
|
||||
|
||||
201,627 cpu/event=0xc8,umask=0/k
|
||||
4,074 cpu/event=0xc9,umask=0/k
|
||||
|
||||
10.003267252 seconds time elapsed
|
||||
|
||||
0.002729000 seconds user
|
||||
0.000000000 seconds sys
|
||||
|
||||
Also, there is a selftest which performs the above, go to
|
||||
tools/testing/selftests/x86/ and do::
|
||||
|
||||
make srso
|
||||
./srso
|
||||
|
||||
@@ -137,7 +137,10 @@ patternProperties:
|
||||
- const: fsl,sec-v4.0-rtic
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
items:
|
||||
- description: RTIC control and status register space.
|
||||
- description: RTIC recoverable error indication register space.
|
||||
minItems: 1
|
||||
|
||||
ranges:
|
||||
maxItems: 1
|
||||
|
||||
@@ -17,6 +17,7 @@ properties:
|
||||
- qcom,prng-ee # 8996 and later using EE
|
||||
- items:
|
||||
- enum:
|
||||
- qcom,sa8255p-trng
|
||||
- qcom,sa8775p-trng
|
||||
- qcom,sc7280-trng
|
||||
- qcom,sm8450-trng
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/rng/rockchip,rk3568-rng.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Rockchip RK3568 TRNG
|
||||
|
||||
description: True Random Number Generator on Rockchip RK3568 SoC
|
||||
|
||||
maintainers:
|
||||
- Aurelien Jarno <aurelien@aurel32.net>
|
||||
- Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- rockchip,rk3568-rng
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
items:
|
||||
- description: TRNG clock
|
||||
- description: TRNG AHB clock
|
||||
|
||||
clock-names:
|
||||
items:
|
||||
- const: core
|
||||
- const: ahb
|
||||
|
||||
resets:
|
||||
maxItems: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- clocks
|
||||
- clock-names
|
||||
- resets
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/clock/rk3568-cru.h>
|
||||
bus {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
|
||||
rng@fe388000 {
|
||||
compatible = "rockchip,rk3568-rng";
|
||||
reg = <0x0 0xfe388000 0x0 0x4000>;
|
||||
clocks = <&cru CLK_TRNG_NS>, <&cru HCLK_TRNG_NS>;
|
||||
clock-names = "core", "ahb";
|
||||
resets = <&cru SRST_TRNG_NS>;
|
||||
};
|
||||
};
|
||||
|
||||
...
|
||||
@@ -19814,6 +19814,13 @@ F: Documentation/userspace-api/media/v4l/metafmt-rkisp1.rst
|
||||
F: drivers/media/platform/rockchip/rkisp1
|
||||
F: include/uapi/linux/rkisp1-config.h
|
||||
|
||||
ROCKCHIP RK3568 RANDOM NUMBER GENERATOR SUPPORT
|
||||
M: Daniel Golle <daniel@makrotopia.org>
|
||||
M: Aurelien Jarno <aurelien@aurel32.net>
|
||||
S: Maintained
|
||||
F: Documentation/devicetree/bindings/rng/rockchip,rk3568-rng.yaml
|
||||
F: drivers/char/hw_random/rockchip-rng.c
|
||||
|
||||
ROCKCHIP RASTER 2D GRAPHIC ACCELERATION UNIT DRIVER
|
||||
M: Jacob Chen <jacob-chen@iotwrt.com>
|
||||
M: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
|
||||
|
||||
@@ -64,6 +64,7 @@ config ARM
|
||||
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
|
||||
select GENERIC_IRQ_IPI if SMP
|
||||
select GENERIC_CPU_AUTOPROBE
|
||||
select GENERIC_CPU_DEVICES
|
||||
select GENERIC_EARLY_IOREMAP
|
||||
select GENERIC_IDLE_POLL_SETUP
|
||||
select GENERIC_IRQ_MULTI_HANDLER
|
||||
|
||||
+10
-4
@@ -166,10 +166,9 @@ config CRYPTO_AES_ARM
|
||||
config CRYPTO_AES_ARM_BS
|
||||
tristate "Ciphers: AES, modes: ECB/CBC/CTR/XTS (bit-sliced NEON)"
|
||||
depends on KERNEL_MODE_NEON
|
||||
select CRYPTO_AES_ARM
|
||||
select CRYPTO_SKCIPHER
|
||||
select CRYPTO_LIB_AES
|
||||
select CRYPTO_AES
|
||||
select CRYPTO_CBC
|
||||
select CRYPTO_SIMD
|
||||
help
|
||||
Length-preserving ciphers: AES cipher algorithms (FIPS-197)
|
||||
@@ -183,8 +182,15 @@ config CRYPTO_AES_ARM_BS
|
||||
Bit sliced AES gives around 45% speedup on Cortex-A15 for CTR mode
|
||||
and for XTS mode encryption, CBC and XTS mode decryption speedup is
|
||||
around 25%. (CBC encryption speed is not affected by this driver.)
|
||||
This implementation does not rely on any lookup tables so it is
|
||||
believed to be invulnerable to cache timing attacks.
|
||||
|
||||
The bit sliced AES code does not use lookup tables, so it is believed
|
||||
to be invulnerable to cache timing attacks. However, since the bit
|
||||
sliced AES code cannot process single blocks efficiently, in certain
|
||||
cases table-based code with some countermeasures against cache timing
|
||||
attacks will still be used as a fallback method; specifically CBC
|
||||
encryption (not CBC decryption), the encryption of XTS tweaks, XTS
|
||||
ciphertext stealing when the message isn't a multiple of 16 bytes, and
|
||||
CTR when invoked in a context in which NEON instructions are unusable.
|
||||
|
||||
config CRYPTO_AES_ARM_CE
|
||||
tristate "Ciphers: AES, modes: ECB/CBC/CTS/CTR/XTS (ARMv8 Crypto Extensions)"
|
||||
|
||||
@@ -711,7 +711,7 @@ static int __init aes_init(void)
|
||||
algname = aes_algs[i].base.cra_name + 2;
|
||||
drvname = aes_algs[i].base.cra_driver_name + 2;
|
||||
basename = aes_algs[i].base.cra_driver_name;
|
||||
simd = simd_skcipher_create_compat(algname, drvname, basename);
|
||||
simd = simd_skcipher_create_compat(aes_algs + i, algname, drvname, basename);
|
||||
err = PTR_ERR(simd);
|
||||
if (IS_ERR(simd))
|
||||
goto unregister_simds;
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
#include <crypto/aes.h>
|
||||
#include <crypto/algapi.h>
|
||||
#include <linux/module.h>
|
||||
#include "aes-cipher.h"
|
||||
|
||||
asmlinkage void __aes_arm_encrypt(u32 *rk, int rounds, const u8 *in, u8 *out);
|
||||
asmlinkage void __aes_arm_decrypt(u32 *rk, int rounds, const u8 *in, u8 *out);
|
||||
EXPORT_SYMBOL_GPL(__aes_arm_encrypt);
|
||||
EXPORT_SYMBOL_GPL(__aes_arm_decrypt);
|
||||
|
||||
static void aes_arm_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef ARM_CRYPTO_AES_CIPHER_H
|
||||
#define ARM_CRYPTO_AES_CIPHER_H
|
||||
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
asmlinkage void __aes_arm_encrypt(const u32 rk[], int rounds,
|
||||
const u8 *in, u8 *out);
|
||||
asmlinkage void __aes_arm_decrypt(const u32 rk[], int rounds,
|
||||
const u8 *in, u8 *out);
|
||||
|
||||
#endif /* ARM_CRYPTO_AES_CIPHER_H */
|
||||
@@ -9,24 +9,22 @@
|
||||
#include <asm/simd.h>
|
||||
#include <crypto/aes.h>
|
||||
#include <crypto/ctr.h>
|
||||
#include <crypto/internal/cipher.h>
|
||||
#include <crypto/internal/simd.h>
|
||||
#include <crypto/internal/skcipher.h>
|
||||
#include <crypto/scatterwalk.h>
|
||||
#include <crypto/xts.h>
|
||||
#include <linux/module.h>
|
||||
#include "aes-cipher.h"
|
||||
|
||||
MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
|
||||
MODULE_DESCRIPTION("Bit sliced AES using NEON instructions");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
||||
MODULE_ALIAS_CRYPTO("ecb(aes)");
|
||||
MODULE_ALIAS_CRYPTO("cbc(aes)-all");
|
||||
MODULE_ALIAS_CRYPTO("cbc(aes)");
|
||||
MODULE_ALIAS_CRYPTO("ctr(aes)");
|
||||
MODULE_ALIAS_CRYPTO("xts(aes)");
|
||||
|
||||
MODULE_IMPORT_NS(CRYPTO_INTERNAL);
|
||||
|
||||
asmlinkage void aesbs_convert_key(u8 out[], u32 const rk[], int rounds);
|
||||
|
||||
asmlinkage void aesbs_ecb_encrypt(u8 out[], u8 const in[], u8 const rk[],
|
||||
@@ -52,13 +50,13 @@ struct aesbs_ctx {
|
||||
|
||||
struct aesbs_cbc_ctx {
|
||||
struct aesbs_ctx key;
|
||||
struct crypto_skcipher *enc_tfm;
|
||||
struct crypto_aes_ctx fallback;
|
||||
};
|
||||
|
||||
struct aesbs_xts_ctx {
|
||||
struct aesbs_ctx key;
|
||||
struct crypto_cipher *cts_tfm;
|
||||
struct crypto_cipher *tweak_tfm;
|
||||
struct crypto_aes_ctx fallback;
|
||||
struct crypto_aes_ctx tweak_key;
|
||||
};
|
||||
|
||||
struct aesbs_ctr_ctx {
|
||||
@@ -129,37 +127,49 @@ static int aesbs_cbc_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
unsigned int key_len)
|
||||
{
|
||||
struct aesbs_cbc_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
struct crypto_aes_ctx rk;
|
||||
int err;
|
||||
|
||||
err = aes_expandkey(&rk, in_key, key_len);
|
||||
err = aes_expandkey(&ctx->fallback, in_key, key_len);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ctx->key.rounds = 6 + key_len / 4;
|
||||
|
||||
kernel_neon_begin();
|
||||
aesbs_convert_key(ctx->key.rk, rk.key_enc, ctx->key.rounds);
|
||||
aesbs_convert_key(ctx->key.rk, ctx->fallback.key_enc, ctx->key.rounds);
|
||||
kernel_neon_end();
|
||||
memzero_explicit(&rk, sizeof(rk));
|
||||
|
||||
return crypto_skcipher_setkey(ctx->enc_tfm, in_key, key_len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cbc_encrypt(struct skcipher_request *req)
|
||||
{
|
||||
struct skcipher_request *subreq = skcipher_request_ctx(req);
|
||||
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
|
||||
struct aesbs_cbc_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
const struct aesbs_cbc_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
struct skcipher_walk walk;
|
||||
unsigned int nbytes;
|
||||
int err;
|
||||
|
||||
skcipher_request_set_tfm(subreq, ctx->enc_tfm);
|
||||
skcipher_request_set_callback(subreq,
|
||||
skcipher_request_flags(req),
|
||||
NULL, NULL);
|
||||
skcipher_request_set_crypt(subreq, req->src, req->dst,
|
||||
req->cryptlen, req->iv);
|
||||
err = skcipher_walk_virt(&walk, req, false);
|
||||
|
||||
return crypto_skcipher_encrypt(subreq);
|
||||
while ((nbytes = walk.nbytes) >= AES_BLOCK_SIZE) {
|
||||
const u8 *src = walk.src.virt.addr;
|
||||
u8 *dst = walk.dst.virt.addr;
|
||||
u8 *prev = walk.iv;
|
||||
|
||||
do {
|
||||
crypto_xor_cpy(dst, src, prev, AES_BLOCK_SIZE);
|
||||
__aes_arm_encrypt(ctx->fallback.key_enc,
|
||||
ctx->key.rounds, dst, dst);
|
||||
prev = dst;
|
||||
src += AES_BLOCK_SIZE;
|
||||
dst += AES_BLOCK_SIZE;
|
||||
nbytes -= AES_BLOCK_SIZE;
|
||||
} while (nbytes >= AES_BLOCK_SIZE);
|
||||
memcpy(walk.iv, prev, AES_BLOCK_SIZE);
|
||||
err = skcipher_walk_done(&walk, nbytes);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static int cbc_decrypt(struct skcipher_request *req)
|
||||
@@ -190,30 +200,6 @@ static int cbc_decrypt(struct skcipher_request *req)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int cbc_init(struct crypto_skcipher *tfm)
|
||||
{
|
||||
struct aesbs_cbc_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
unsigned int reqsize;
|
||||
|
||||
ctx->enc_tfm = crypto_alloc_skcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_NEED_FALLBACK);
|
||||
if (IS_ERR(ctx->enc_tfm))
|
||||
return PTR_ERR(ctx->enc_tfm);
|
||||
|
||||
reqsize = sizeof(struct skcipher_request);
|
||||
reqsize += crypto_skcipher_reqsize(ctx->enc_tfm);
|
||||
crypto_skcipher_set_reqsize(tfm, reqsize);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cbc_exit(struct crypto_skcipher *tfm)
|
||||
{
|
||||
struct aesbs_cbc_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
|
||||
crypto_free_skcipher(ctx->enc_tfm);
|
||||
}
|
||||
|
||||
static int aesbs_ctr_setkey_sync(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
unsigned int key_len)
|
||||
{
|
||||
@@ -271,16 +257,8 @@ static int ctr_encrypt(struct skcipher_request *req)
|
||||
static void ctr_encrypt_one(struct crypto_skcipher *tfm, const u8 *src, u8 *dst)
|
||||
{
|
||||
struct aesbs_ctr_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
unsigned long flags;
|
||||
|
||||
/*
|
||||
* Temporarily disable interrupts to avoid races where
|
||||
* cachelines are evicted when the CPU is interrupted
|
||||
* to do something else.
|
||||
*/
|
||||
local_irq_save(flags);
|
||||
aes_encrypt(&ctx->fallback, dst, src);
|
||||
local_irq_restore(flags);
|
||||
__aes_arm_encrypt(ctx->fallback.key_enc, ctx->key.rounds, src, dst);
|
||||
}
|
||||
|
||||
static int ctr_encrypt_sync(struct skcipher_request *req)
|
||||
@@ -302,45 +280,23 @@ static int aesbs_xts_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
return err;
|
||||
|
||||
key_len /= 2;
|
||||
err = crypto_cipher_setkey(ctx->cts_tfm, in_key, key_len);
|
||||
err = aes_expandkey(&ctx->fallback, in_key, key_len);
|
||||
if (err)
|
||||
return err;
|
||||
err = crypto_cipher_setkey(ctx->tweak_tfm, in_key + key_len, key_len);
|
||||
err = aes_expandkey(&ctx->tweak_key, in_key + key_len, key_len);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return aesbs_setkey(tfm, in_key, key_len);
|
||||
}
|
||||
|
||||
static int xts_init(struct crypto_skcipher *tfm)
|
||||
{
|
||||
struct aesbs_xts_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
|
||||
ctx->cts_tfm = crypto_alloc_cipher("aes", 0, 0);
|
||||
if (IS_ERR(ctx->cts_tfm))
|
||||
return PTR_ERR(ctx->cts_tfm);
|
||||
|
||||
ctx->tweak_tfm = crypto_alloc_cipher("aes", 0, 0);
|
||||
if (IS_ERR(ctx->tweak_tfm))
|
||||
crypto_free_cipher(ctx->cts_tfm);
|
||||
|
||||
return PTR_ERR_OR_ZERO(ctx->tweak_tfm);
|
||||
}
|
||||
|
||||
static void xts_exit(struct crypto_skcipher *tfm)
|
||||
{
|
||||
struct aesbs_xts_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
|
||||
crypto_free_cipher(ctx->tweak_tfm);
|
||||
crypto_free_cipher(ctx->cts_tfm);
|
||||
}
|
||||
|
||||
static int __xts_crypt(struct skcipher_request *req, bool encrypt,
|
||||
void (*fn)(u8 out[], u8 const in[], u8 const rk[],
|
||||
int rounds, int blocks, u8 iv[], int))
|
||||
{
|
||||
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
|
||||
struct aesbs_xts_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
const int rounds = ctx->key.rounds;
|
||||
int tail = req->cryptlen % AES_BLOCK_SIZE;
|
||||
struct skcipher_request subreq;
|
||||
u8 buf[2 * AES_BLOCK_SIZE];
|
||||
@@ -364,7 +320,7 @@ static int __xts_crypt(struct skcipher_request *req, bool encrypt,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
crypto_cipher_encrypt_one(ctx->tweak_tfm, walk.iv, walk.iv);
|
||||
__aes_arm_encrypt(ctx->tweak_key.key_enc, rounds, walk.iv, walk.iv);
|
||||
|
||||
while (walk.nbytes >= AES_BLOCK_SIZE) {
|
||||
unsigned int blocks = walk.nbytes / AES_BLOCK_SIZE;
|
||||
@@ -378,7 +334,7 @@ static int __xts_crypt(struct skcipher_request *req, bool encrypt,
|
||||
|
||||
kernel_neon_begin();
|
||||
fn(walk.dst.virt.addr, walk.src.virt.addr, ctx->key.rk,
|
||||
ctx->key.rounds, blocks, walk.iv, reorder_last_tweak);
|
||||
rounds, blocks, walk.iv, reorder_last_tweak);
|
||||
kernel_neon_end();
|
||||
err = skcipher_walk_done(&walk,
|
||||
walk.nbytes - blocks * AES_BLOCK_SIZE);
|
||||
@@ -396,9 +352,9 @@ static int __xts_crypt(struct skcipher_request *req, bool encrypt,
|
||||
crypto_xor(buf, req->iv, AES_BLOCK_SIZE);
|
||||
|
||||
if (encrypt)
|
||||
crypto_cipher_encrypt_one(ctx->cts_tfm, buf, buf);
|
||||
__aes_arm_encrypt(ctx->fallback.key_enc, rounds, buf, buf);
|
||||
else
|
||||
crypto_cipher_decrypt_one(ctx->cts_tfm, buf, buf);
|
||||
__aes_arm_decrypt(ctx->fallback.key_dec, rounds, buf, buf);
|
||||
|
||||
crypto_xor(buf, req->iv, AES_BLOCK_SIZE);
|
||||
|
||||
@@ -439,8 +395,7 @@ static struct skcipher_alg aes_algs[] = { {
|
||||
.base.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.base.cra_ctxsize = sizeof(struct aesbs_cbc_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL |
|
||||
CRYPTO_ALG_NEED_FALLBACK,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL,
|
||||
|
||||
.min_keysize = AES_MIN_KEY_SIZE,
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
@@ -449,8 +404,6 @@ static struct skcipher_alg aes_algs[] = { {
|
||||
.setkey = aesbs_cbc_setkey,
|
||||
.encrypt = cbc_encrypt,
|
||||
.decrypt = cbc_decrypt,
|
||||
.init = cbc_init,
|
||||
.exit = cbc_exit,
|
||||
}, {
|
||||
.base.cra_name = "__ctr(aes)",
|
||||
.base.cra_driver_name = "__ctr-aes-neonbs",
|
||||
@@ -500,8 +453,6 @@ static struct skcipher_alg aes_algs[] = { {
|
||||
.setkey = aesbs_xts_setkey,
|
||||
.encrypt = xts_encrypt,
|
||||
.decrypt = xts_decrypt,
|
||||
.init = xts_init,
|
||||
.exit = xts_exit,
|
||||
} };
|
||||
|
||||
static struct simd_skcipher_alg *aes_simd_algs[ARRAY_SIZE(aes_algs)];
|
||||
@@ -540,7 +491,7 @@ static int __init aes_init(void)
|
||||
algname = aes_algs[i].base.cra_name + 2;
|
||||
drvname = aes_algs[i].base.cra_driver_name + 2;
|
||||
basename = aes_algs[i].base.cra_driver_name;
|
||||
simd = simd_skcipher_create_compat(algname, drvname, basename);
|
||||
simd = simd_skcipher_create_compat(aes_algs + i, algname, drvname, basename);
|
||||
err = PTR_ERR(simd);
|
||||
if (IS_ERR(simd))
|
||||
goto unregister_simds;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <linux/cpu.h>
|
||||
|
||||
struct cpuinfo_arm {
|
||||
struct cpu cpu;
|
||||
u32 cpuid;
|
||||
#ifdef CONFIG_SMP
|
||||
unsigned int loops_per_jiffy;
|
||||
|
||||
@@ -24,7 +24,7 @@ struct dma_iommu_mapping {
|
||||
};
|
||||
|
||||
struct dma_iommu_mapping *
|
||||
arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size);
|
||||
arm_iommu_create_mapping(struct device *dev, dma_addr_t base, u64 size);
|
||||
|
||||
void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);
|
||||
|
||||
|
||||
@@ -106,6 +106,11 @@
|
||||
|
||||
/*
|
||||
* TTBCR register bits.
|
||||
*
|
||||
* The ORGN0 and IRGN0 bits enables different forms of caching when
|
||||
* walking the translation table. Clearing these bits (which is claimed
|
||||
* to be the reset default) means "normal memory, [outer|inner]
|
||||
* non-cacheable"
|
||||
*/
|
||||
#define TTBCR_EAE (1 << 31)
|
||||
#define TTBCR_IMP (1 << 30)
|
||||
|
||||
+2
-12
@@ -1201,20 +1201,10 @@ void __init setup_arch(char **cmdline_p)
|
||||
mdesc->init_early();
|
||||
}
|
||||
|
||||
|
||||
static int __init topology_init(void)
|
||||
bool arch_cpu_is_hotpluggable(int num)
|
||||
{
|
||||
int cpu;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
struct cpuinfo_arm *cpuinfo = &per_cpu(cpu_data, cpu);
|
||||
cpuinfo->cpu.hotpluggable = platform_can_hotplug_cpu(cpu);
|
||||
register_cpu(&cpuinfo->cpu, cpu);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return platform_can_hotplug_cpu(num);
|
||||
}
|
||||
subsys_initcall(topology_init);
|
||||
|
||||
#ifdef CONFIG_HAVE_PROC_CPU
|
||||
static int __init proc_cpu_init(void)
|
||||
|
||||
@@ -1532,7 +1532,7 @@ static const struct dma_map_ops iommu_ops = {
|
||||
|
||||
/**
|
||||
* arm_iommu_create_mapping
|
||||
* @bus: pointer to the bus holding the client device (for IOMMU calls)
|
||||
* @dev: pointer to the client device (for IOMMU calls)
|
||||
* @base: start address of the valid IO address space
|
||||
* @size: maximum size of the valid IO address space
|
||||
*
|
||||
@@ -1544,7 +1544,7 @@ static const struct dma_map_ops iommu_ops = {
|
||||
* arm_iommu_attach_device function.
|
||||
*/
|
||||
struct dma_iommu_mapping *
|
||||
arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size)
|
||||
arm_iommu_create_mapping(struct device *dev, dma_addr_t base, u64 size)
|
||||
{
|
||||
unsigned int bits = size >> PAGE_SHIFT;
|
||||
unsigned int bitmap_size = BITS_TO_LONGS(bits) * sizeof(long);
|
||||
@@ -1585,9 +1585,11 @@ arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size)
|
||||
|
||||
spin_lock_init(&mapping->lock);
|
||||
|
||||
mapping->domain = iommu_domain_alloc(bus);
|
||||
if (!mapping->domain)
|
||||
mapping->domain = iommu_paging_domain_alloc(dev);
|
||||
if (IS_ERR(mapping->domain)) {
|
||||
err = PTR_ERR(mapping->domain);
|
||||
goto err4;
|
||||
}
|
||||
|
||||
kref_init(&mapping->kref);
|
||||
return mapping;
|
||||
@@ -1718,7 +1720,7 @@ static void arm_setup_iommu_dma_ops(struct device *dev)
|
||||
dma_base = dma_range_map_min(dev->dma_range_map);
|
||||
size = dma_range_map_max(dev->dma_range_map) - dma_base;
|
||||
}
|
||||
mapping = arm_iommu_create_mapping(dev->bus, dma_base, size);
|
||||
mapping = arm_iommu_create_mapping(dev, dma_base, size);
|
||||
if (IS_ERR(mapping)) {
|
||||
pr_warn("Failed to create %llu-byte IOMMU mapping for device %s\n",
|
||||
size, dev_name(dev));
|
||||
|
||||
+4
-2
@@ -1638,7 +1638,7 @@ static void __init early_paging_init(const struct machine_desc *mdesc)
|
||||
{
|
||||
pgtables_remap *lpae_pgtables_remap;
|
||||
unsigned long pa_pgd;
|
||||
unsigned int cr, ttbcr;
|
||||
u32 cr, ttbcr, tmp;
|
||||
long long offset;
|
||||
|
||||
if (!mdesc->pv_fixup)
|
||||
@@ -1688,7 +1688,9 @@ static void __init early_paging_init(const struct machine_desc *mdesc)
|
||||
cr = get_cr();
|
||||
set_cr(cr & ~(CR_I | CR_C));
|
||||
ttbcr = cpu_get_ttbcr();
|
||||
cpu_set_ttbcr(ttbcr & ~(3 << 8 | 3 << 10));
|
||||
/* Disable all kind of caching of the translation table */
|
||||
tmp = ttbcr & ~(TTBCR_ORGN0_MASK | TTBCR_IRGN0_MASK);
|
||||
cpu_set_ttbcr(tmp);
|
||||
flush_cache_all();
|
||||
|
||||
/*
|
||||
|
||||
+24
-20
@@ -64,33 +64,37 @@
|
||||
|
||||
#ifdef CONFIG_AS_VFP_VMRS_FPINST
|
||||
|
||||
#define fmrx(_vfp_) ({ \
|
||||
u32 __v; \
|
||||
asm(".fpu vfpv2\n" \
|
||||
"vmrs %0, " #_vfp_ \
|
||||
: "=r" (__v) : : "cc"); \
|
||||
__v; \
|
||||
})
|
||||
#define fmrx(_vfp_) ({ \
|
||||
u32 __v; \
|
||||
asm volatile (".fpu vfpv2\n" \
|
||||
"vmrs %0, " #_vfp_ \
|
||||
: "=r" (__v) : : "cc"); \
|
||||
__v; \
|
||||
})
|
||||
|
||||
#define fmxr(_vfp_,_var_) \
|
||||
asm(".fpu vfpv2\n" \
|
||||
"vmsr " #_vfp_ ", %0" \
|
||||
: : "r" (_var_) : "cc")
|
||||
#define fmxr(_vfp_, _var_) ({ \
|
||||
asm volatile (".fpu vfpv2\n" \
|
||||
"vmsr " #_vfp_ ", %0" \
|
||||
: : "r" (_var_) : "cc"); \
|
||||
})
|
||||
|
||||
#else
|
||||
|
||||
#define vfpreg(_vfp_) #_vfp_
|
||||
|
||||
#define fmrx(_vfp_) ({ \
|
||||
u32 __v; \
|
||||
asm("mrc p10, 7, %0, " vfpreg(_vfp_) ", cr0, 0 @ fmrx %0, " #_vfp_ \
|
||||
: "=r" (__v) : : "cc"); \
|
||||
__v; \
|
||||
})
|
||||
#define fmrx(_vfp_) ({ \
|
||||
u32 __v; \
|
||||
asm volatile ("mrc p10, 7, %0, " vfpreg(_vfp_) "," \
|
||||
"cr0, 0 @ fmrx %0, " #_vfp_ \
|
||||
: "=r" (__v) : : "cc"); \
|
||||
__v; \
|
||||
})
|
||||
|
||||
#define fmxr(_vfp_,_var_) \
|
||||
asm("mcr p10, 7, %0, " vfpreg(_vfp_) ", cr0, 0 @ fmxr " #_vfp_ ", %0" \
|
||||
: : "r" (_var_) : "cc")
|
||||
#define fmxr(_vfp_, _var_) ({ \
|
||||
asm volatile ("mcr p10, 7, %0, " vfpreg(_vfp_) "," \
|
||||
"cr0, 0 @ fmxr " #_vfp_ ", %0" \
|
||||
: : "r" (_var_) : "cc"); \
|
||||
})
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -473,7 +473,8 @@ poly1305_blocks_neon:
|
||||
subs $len,$len,#64
|
||||
ldp x9,x13,[$inp,#48]
|
||||
add $in2,$inp,#96
|
||||
adr $zeros,.Lzeros
|
||||
adrp $zeros,.Lzeros
|
||||
add $zeros,$zeros,#:lo12:.Lzeros
|
||||
|
||||
lsl $padbit,$padbit,#24
|
||||
add x15,$ctx,#48
|
||||
@@ -885,10 +886,13 @@ poly1305_blocks_neon:
|
||||
ret
|
||||
.size poly1305_blocks_neon,.-poly1305_blocks_neon
|
||||
|
||||
.pushsection .rodata
|
||||
.align 5
|
||||
.Lzeros:
|
||||
.long 0,0,0,0,0,0,0,0
|
||||
.asciz "Poly1305 for ARMv8, CRYPTOGAMS by \@dot-asm"
|
||||
.popsection
|
||||
|
||||
.align 2
|
||||
#if !defined(__KERNEL__) && !defined(_WIN64)
|
||||
.comm OPENSSL_armcap_P,4,4
|
||||
|
||||
@@ -131,29 +131,6 @@ static const struct dma_dev dma_dev_table_bank2[DMA_NUM_DEV_BANK2] = {
|
||||
{ AU1100_SD1_PHYS_ADDR + 0x04, DMA_DS | DMA_DW8 | DMA_DR } /* coherent */
|
||||
};
|
||||
|
||||
void dump_au1000_dma_channel(unsigned int dmanr)
|
||||
{
|
||||
struct dma_chan *chan;
|
||||
|
||||
if (dmanr >= NUM_AU1000_DMA_CHANNELS)
|
||||
return;
|
||||
chan = &au1000_dma_table[dmanr];
|
||||
|
||||
printk(KERN_INFO "Au1000 DMA%d Register Dump:\n", dmanr);
|
||||
printk(KERN_INFO " mode = 0x%08x\n",
|
||||
__raw_readl(chan->io + DMA_MODE_SET));
|
||||
printk(KERN_INFO " addr = 0x%08x\n",
|
||||
__raw_readl(chan->io + DMA_PERIPHERAL_ADDR));
|
||||
printk(KERN_INFO " start0 = 0x%08x\n",
|
||||
__raw_readl(chan->io + DMA_BUFFER0_START));
|
||||
printk(KERN_INFO " start1 = 0x%08x\n",
|
||||
__raw_readl(chan->io + DMA_BUFFER1_START));
|
||||
printk(KERN_INFO " count0 = 0x%08x\n",
|
||||
__raw_readl(chan->io + DMA_BUFFER0_COUNT));
|
||||
printk(KERN_INFO " count1 = 0x%08x\n",
|
||||
__raw_readl(chan->io + DMA_BUFFER1_COUNT));
|
||||
}
|
||||
|
||||
/*
|
||||
* Finds a free channel, and binds the requested device to it.
|
||||
* Returns the allocated channel number, or negative on error.
|
||||
|
||||
@@ -77,24 +77,26 @@ static u32 crc32_mips_le_hw(u32 crc_, const u8 *p, unsigned int len)
|
||||
{
|
||||
u32 crc = crc_;
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
while (len >= sizeof(u64)) {
|
||||
u64 value = get_unaligned_le64(p);
|
||||
if (IS_ENABLED(CONFIG_64BIT)) {
|
||||
for (; len >= sizeof(u64); p += sizeof(u64), len -= sizeof(u64)) {
|
||||
u64 value = get_unaligned_le64(p);
|
||||
|
||||
CRC32(crc, value, d);
|
||||
p += sizeof(u64);
|
||||
len -= sizeof(u64);
|
||||
}
|
||||
CRC32(crc, value, d);
|
||||
}
|
||||
|
||||
if (len & sizeof(u32)) {
|
||||
#else /* !CONFIG_64BIT */
|
||||
while (len >= sizeof(u32)) {
|
||||
#endif
|
||||
u32 value = get_unaligned_le32(p);
|
||||
if (len & sizeof(u32)) {
|
||||
u32 value = get_unaligned_le32(p);
|
||||
|
||||
CRC32(crc, value, w);
|
||||
p += sizeof(u32);
|
||||
len -= sizeof(u32);
|
||||
CRC32(crc, value, w);
|
||||
p += sizeof(u32);
|
||||
}
|
||||
} else {
|
||||
for (; len >= sizeof(u32); len -= sizeof(u32)) {
|
||||
u32 value = get_unaligned_le32(p);
|
||||
|
||||
CRC32(crc, value, w);
|
||||
p += sizeof(u32);
|
||||
}
|
||||
}
|
||||
|
||||
if (len & sizeof(u16)) {
|
||||
@@ -117,24 +119,26 @@ static u32 crc32c_mips_le_hw(u32 crc_, const u8 *p, unsigned int len)
|
||||
{
|
||||
u32 crc = crc_;
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
while (len >= sizeof(u64)) {
|
||||
u64 value = get_unaligned_le64(p);
|
||||
if (IS_ENABLED(CONFIG_64BIT)) {
|
||||
for (; len >= sizeof(u64); p += sizeof(u64), len -= sizeof(u64)) {
|
||||
u64 value = get_unaligned_le64(p);
|
||||
|
||||
CRC32C(crc, value, d);
|
||||
p += sizeof(u64);
|
||||
len -= sizeof(u64);
|
||||
}
|
||||
CRC32(crc, value, d);
|
||||
}
|
||||
|
||||
if (len & sizeof(u32)) {
|
||||
#else /* !CONFIG_64BIT */
|
||||
while (len >= sizeof(u32)) {
|
||||
#endif
|
||||
u32 value = get_unaligned_le32(p);
|
||||
if (len & sizeof(u32)) {
|
||||
u32 value = get_unaligned_le32(p);
|
||||
|
||||
CRC32C(crc, value, w);
|
||||
p += sizeof(u32);
|
||||
len -= sizeof(u32);
|
||||
CRC32(crc, value, w);
|
||||
p += sizeof(u32);
|
||||
}
|
||||
} else {
|
||||
for (; len >= sizeof(u32); len -= sizeof(u32)) {
|
||||
u32 value = get_unaligned_le32(p);
|
||||
|
||||
CRC32(crc, value, w);
|
||||
p += sizeof(u32);
|
||||
}
|
||||
}
|
||||
|
||||
if (len & sizeof(u16)) {
|
||||
|
||||
@@ -7,12 +7,4 @@
|
||||
*/
|
||||
struct task_struct;
|
||||
|
||||
extern void cmp_smp_setup(void);
|
||||
extern void cmp_smp_finish(void);
|
||||
extern void cmp_boot_secondary(int cpu, struct task_struct *t);
|
||||
extern void cmp_init_secondary(void);
|
||||
extern void cmp_prepare_cpus(unsigned int max_cpus);
|
||||
|
||||
/* This is platform specific */
|
||||
extern void cmp_send_ipi(int cpu, unsigned int action);
|
||||
#endif /* _ASM_CMP_H */
|
||||
|
||||
@@ -160,6 +160,5 @@ extern void prom_identify_arch(u32);
|
||||
extern void prom_init_cmdline(s32, s32 *, u32);
|
||||
|
||||
extern void register_prom_console(void);
|
||||
extern void unregister_prom_console(void);
|
||||
|
||||
#endif /* _ASM_DEC_PROM_H */
|
||||
|
||||
@@ -124,7 +124,6 @@ extern int request_au1000_dma(int dev_id,
|
||||
extern void free_au1000_dma(unsigned int dmanr);
|
||||
extern int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
|
||||
int length, int *eof, void *data);
|
||||
extern void dump_au1000_dma_channel(unsigned int dmanr);
|
||||
extern spinlock_t au1000_dma_spin_lock;
|
||||
|
||||
static inline struct dma_chan *get_dma_chan(unsigned int dmanr)
|
||||
|
||||
@@ -73,7 +73,4 @@ extern void mips_pcibios_init(void);
|
||||
#define mips_pcibios_init() do { } while (0)
|
||||
#endif
|
||||
|
||||
extern void mips_scroll_message(void);
|
||||
extern void mips_display_message(const char *str);
|
||||
|
||||
#endif /* __ASM_MIPS_BOARDS_GENERIC_H */
|
||||
|
||||
@@ -17,8 +17,6 @@ extern int vpelimit;
|
||||
extern cpumask_t mt_fpu_cpumask;
|
||||
extern unsigned long mt_fpemul_threshold;
|
||||
|
||||
extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value);
|
||||
|
||||
#ifdef CONFIG_MIPS_MT
|
||||
extern void mips_mt_set_cpuoptions(void);
|
||||
#else
|
||||
|
||||
@@ -56,7 +56,6 @@ struct sigcontext {
|
||||
|
||||
#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
|
||||
|
||||
#include <linux/posix_types.h>
|
||||
/*
|
||||
* Keep this struct definition in sync with the sigcontext fragment
|
||||
* in arch/mips/kernel/asm-offsets.c
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#include <asm/reboot.h>
|
||||
#include <asm/tlbmisc.h>
|
||||
|
||||
extern asmlinkage void jazz_handle_int(void);
|
||||
|
||||
extern void jazz_machine_restart(char *command);
|
||||
|
||||
static struct resource jazz_io_resources[] = {
|
||||
|
||||
@@ -43,83 +43,6 @@ static int __init maxtcs(char *str)
|
||||
|
||||
__setup("maxtcs=", maxtcs);
|
||||
|
||||
/*
|
||||
* Dump new MIPS MT state for the core. Does not leave TCs halted.
|
||||
* Takes an argument which taken to be a pre-call MVPControl value.
|
||||
*/
|
||||
|
||||
void mips_mt_regdump(unsigned long mvpctl)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long vpflags;
|
||||
unsigned long mvpconf0;
|
||||
int nvpe;
|
||||
int ntc;
|
||||
int i;
|
||||
int tc;
|
||||
unsigned long haltval;
|
||||
unsigned long tcstatval;
|
||||
|
||||
local_irq_save(flags);
|
||||
vpflags = dvpe();
|
||||
printk("=== MIPS MT State Dump ===\n");
|
||||
printk("-- Global State --\n");
|
||||
printk(" MVPControl Passed: %08lx\n", mvpctl);
|
||||
printk(" MVPControl Read: %08lx\n", vpflags);
|
||||
printk(" MVPConf0 : %08lx\n", (mvpconf0 = read_c0_mvpconf0()));
|
||||
nvpe = ((mvpconf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
|
||||
ntc = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
|
||||
printk("-- per-VPE State --\n");
|
||||
for (i = 0; i < nvpe; i++) {
|
||||
for (tc = 0; tc < ntc; tc++) {
|
||||
settc(tc);
|
||||
if ((read_tc_c0_tcbind() & TCBIND_CURVPE) == i) {
|
||||
printk(" VPE %d\n", i);
|
||||
printk(" VPEControl : %08lx\n",
|
||||
read_vpe_c0_vpecontrol());
|
||||
printk(" VPEConf0 : %08lx\n",
|
||||
read_vpe_c0_vpeconf0());
|
||||
printk(" VPE%d.Status : %08lx\n",
|
||||
i, read_vpe_c0_status());
|
||||
printk(" VPE%d.EPC : %08lx %pS\n",
|
||||
i, read_vpe_c0_epc(),
|
||||
(void *) read_vpe_c0_epc());
|
||||
printk(" VPE%d.Cause : %08lx\n",
|
||||
i, read_vpe_c0_cause());
|
||||
printk(" VPE%d.Config7 : %08lx\n",
|
||||
i, read_vpe_c0_config7());
|
||||
break; /* Next VPE */
|
||||
}
|
||||
}
|
||||
}
|
||||
printk("-- per-TC State --\n");
|
||||
for (tc = 0; tc < ntc; tc++) {
|
||||
settc(tc);
|
||||
if (read_tc_c0_tcbind() == read_c0_tcbind()) {
|
||||
/* Are we dumping ourself? */
|
||||
haltval = 0; /* Then we're not halted, and mustn't be */
|
||||
tcstatval = flags; /* And pre-dump TCStatus is flags */
|
||||
printk(" TC %d (current TC with VPE EPC above)\n", tc);
|
||||
} else {
|
||||
haltval = read_tc_c0_tchalt();
|
||||
write_tc_c0_tchalt(1);
|
||||
tcstatval = read_tc_c0_tcstatus();
|
||||
printk(" TC %d\n", tc);
|
||||
}
|
||||
printk(" TCStatus : %08lx\n", tcstatval);
|
||||
printk(" TCBind : %08lx\n", read_tc_c0_tcbind());
|
||||
printk(" TCRestart : %08lx %pS\n",
|
||||
read_tc_c0_tcrestart(), (void *) read_tc_c0_tcrestart());
|
||||
printk(" TCHalt : %08lx\n", haltval);
|
||||
printk(" TCContext : %08lx\n", read_tc_c0_tccontext());
|
||||
if (!haltval)
|
||||
write_tc_c0_tchalt(0);
|
||||
}
|
||||
printk("===========================\n");
|
||||
evpe(vpflags);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
static int mt_opt_rpsctl = -1;
|
||||
static int mt_opt_nblsu = -1;
|
||||
static int mt_opt_forceconfig7;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/irqchip.h>
|
||||
#include <asm/mips-cps.h>
|
||||
#include <asm/time.h>
|
||||
|
||||
int get_c0_perfcount_int(void)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <linux/of_clk.h>
|
||||
#include <linux/clocksource.h>
|
||||
|
||||
#include <asm/time.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
void __init plat_time_init(void)
|
||||
|
||||
@@ -295,5 +295,6 @@ module_exit(curve25519_mod_exit);
|
||||
|
||||
MODULE_ALIAS_CRYPTO("curve25519");
|
||||
MODULE_ALIAS_CRYPTO("curve25519-ppc64le");
|
||||
MODULE_DESCRIPTION("PPC64le Curve25519 scalar multiplication with 51 bits limbs");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_AUTHOR("Danny Tsen <dtsen@us.ibm.com>");
|
||||
|
||||
+108
-16
@@ -2610,24 +2610,15 @@ config MITIGATION_SLS
|
||||
against straight line speculation. The kernel image might be slightly
|
||||
larger.
|
||||
|
||||
config MITIGATION_GDS_FORCE
|
||||
bool "Force GDS Mitigation"
|
||||
config MITIGATION_GDS
|
||||
bool "Mitigate Gather Data Sampling"
|
||||
depends on CPU_SUP_INTEL
|
||||
default n
|
||||
default y
|
||||
help
|
||||
Gather Data Sampling (GDS) is a hardware vulnerability which allows
|
||||
unprivileged speculative access to data which was previously stored in
|
||||
vector registers.
|
||||
|
||||
This option is equivalent to setting gather_data_sampling=force on the
|
||||
command line. The microcode mitigation is used if present, otherwise
|
||||
AVX is disabled as a mitigation. On affected systems that are missing
|
||||
the microcode any userspace code that unconditionally uses AVX will
|
||||
break with this option set.
|
||||
|
||||
Setting this option on systems not vulnerable to GDS has no effect.
|
||||
|
||||
If in doubt, say N.
|
||||
Enable mitigation for Gather Data Sampling (GDS). GDS is a hardware
|
||||
vulnerability which allows unprivileged speculative access to data
|
||||
which was previously stored in vector registers. The attacker uses gather
|
||||
instructions to infer the stale vector register data.
|
||||
|
||||
config MITIGATION_RFDS
|
||||
bool "RFDS Mitigation"
|
||||
@@ -2650,6 +2641,107 @@ config MITIGATION_SPECTRE_BHI
|
||||
indirect branches.
|
||||
See <file:Documentation/admin-guide/hw-vuln/spectre.rst>
|
||||
|
||||
config MITIGATION_MDS
|
||||
bool "Mitigate Microarchitectural Data Sampling (MDS) hardware bug"
|
||||
depends on CPU_SUP_INTEL
|
||||
default y
|
||||
help
|
||||
Enable mitigation for Microarchitectural Data Sampling (MDS). MDS is
|
||||
a hardware vulnerability which allows unprivileged speculative access
|
||||
to data which is available in various CPU internal buffers.
|
||||
See also <file:Documentation/admin-guide/hw-vuln/mds.rst>
|
||||
|
||||
config MITIGATION_TAA
|
||||
bool "Mitigate TSX Asynchronous Abort (TAA) hardware bug"
|
||||
depends on CPU_SUP_INTEL
|
||||
default y
|
||||
help
|
||||
Enable mitigation for TSX Asynchronous Abort (TAA). TAA is a hardware
|
||||
vulnerability that allows unprivileged speculative access to data
|
||||
which is available in various CPU internal buffers by using
|
||||
asynchronous aborts within an Intel TSX transactional region.
|
||||
See also <file:Documentation/admin-guide/hw-vuln/tsx_async_abort.rst>
|
||||
|
||||
config MITIGATION_MMIO_STALE_DATA
|
||||
bool "Mitigate MMIO Stale Data hardware bug"
|
||||
depends on CPU_SUP_INTEL
|
||||
default y
|
||||
help
|
||||
Enable mitigation for MMIO Stale Data hardware bugs. Processor MMIO
|
||||
Stale Data Vulnerabilities are a class of memory-mapped I/O (MMIO)
|
||||
vulnerabilities that can expose data. The vulnerabilities require the
|
||||
attacker to have access to MMIO.
|
||||
See also
|
||||
<file:Documentation/admin-guide/hw-vuln/processor_mmio_stale_data.rst>
|
||||
|
||||
config MITIGATION_L1TF
|
||||
bool "Mitigate L1 Terminal Fault (L1TF) hardware bug"
|
||||
depends on CPU_SUP_INTEL
|
||||
default y
|
||||
help
|
||||
Mitigate L1 Terminal Fault (L1TF) hardware bug. L1 Terminal Fault is a
|
||||
hardware vulnerability which allows unprivileged speculative access to data
|
||||
available in the Level 1 Data Cache.
|
||||
See <file:Documentation/admin-guide/hw-vuln/l1tf.rst
|
||||
|
||||
config MITIGATION_RETBLEED
|
||||
bool "Mitigate RETBleed hardware bug"
|
||||
depends on (CPU_SUP_INTEL && MITIGATION_SPECTRE_V2) || MITIGATION_UNRET_ENTRY || MITIGATION_IBPB_ENTRY
|
||||
default y
|
||||
help
|
||||
Enable mitigation for RETBleed (Arbitrary Speculative Code Execution
|
||||
with Return Instructions) vulnerability. RETBleed is a speculative
|
||||
execution attack which takes advantage of microarchitectural behavior
|
||||
in many modern microprocessors, similar to Spectre v2. An
|
||||
unprivileged attacker can use these flaws to bypass conventional
|
||||
memory security restrictions to gain read access to privileged memory
|
||||
that would otherwise be inaccessible.
|
||||
|
||||
config MITIGATION_SPECTRE_V1
|
||||
bool "Mitigate SPECTRE V1 hardware bug"
|
||||
default y
|
||||
help
|
||||
Enable mitigation for Spectre V1 (Bounds Check Bypass). Spectre V1 is a
|
||||
class of side channel attacks that takes advantage of speculative
|
||||
execution that bypasses conditional branch instructions used for
|
||||
memory access bounds check.
|
||||
See also <file:Documentation/admin-guide/hw-vuln/spectre.rst>
|
||||
|
||||
config MITIGATION_SPECTRE_V2
|
||||
bool "Mitigate SPECTRE V2 hardware bug"
|
||||
default y
|
||||
help
|
||||
Enable mitigation for Spectre V2 (Branch Target Injection). Spectre
|
||||
V2 is a class of side channel attacks that takes advantage of
|
||||
indirect branch predictors inside the processor. In Spectre variant 2
|
||||
attacks, the attacker can steer speculative indirect branches in the
|
||||
victim to gadget code by poisoning the branch target buffer of a CPU
|
||||
used for predicting indirect branch addresses.
|
||||
See also <file:Documentation/admin-guide/hw-vuln/spectre.rst>
|
||||
|
||||
config MITIGATION_SRBDS
|
||||
bool "Mitigate Special Register Buffer Data Sampling (SRBDS) hardware bug"
|
||||
depends on CPU_SUP_INTEL
|
||||
default y
|
||||
help
|
||||
Enable mitigation for Special Register Buffer Data Sampling (SRBDS).
|
||||
SRBDS is a hardware vulnerability that allows Microarchitectural Data
|
||||
Sampling (MDS) techniques to infer values returned from special
|
||||
register accesses. An unprivileged user can extract values returned
|
||||
from RDRAND and RDSEED executed on another core or sibling thread
|
||||
using MDS techniques.
|
||||
See also
|
||||
<file:Documentation/admin-guide/hw-vuln/special-register-buffer-data-sampling.rst>
|
||||
|
||||
config MITIGATION_SSB
|
||||
bool "Mitigate Speculative Store Bypass (SSB) hardware bug"
|
||||
default y
|
||||
help
|
||||
Enable mitigation for Speculative Store Bypass (SSB). SSB is a
|
||||
hardware security vulnerability and its exploitation takes advantage
|
||||
of speculative execution in a similar way to the Meltdown and Spectre
|
||||
security vulnerabilities.
|
||||
|
||||
endif
|
||||
|
||||
config ARCH_HAS_ADD_PAGES
|
||||
|
||||
@@ -14,7 +14,7 @@ config CRYPTO_CURVE25519_X86
|
||||
- ADX (large integer arithmetic)
|
||||
|
||||
config CRYPTO_AES_NI_INTEL
|
||||
tristate "Ciphers: AES, modes: ECB, CBC, CTS, CTR, XTR, XTS, GCM (AES-NI)"
|
||||
tristate "Ciphers: AES, modes: ECB, CBC, CTS, CTR, XCTR, XTS, GCM (AES-NI/VAES)"
|
||||
depends on X86
|
||||
select CRYPTO_AEAD
|
||||
select CRYPTO_LIB_AES
|
||||
@@ -25,10 +25,14 @@ config CRYPTO_AES_NI_INTEL
|
||||
help
|
||||
Block cipher: AES cipher algorithms
|
||||
AEAD cipher: AES with GCM
|
||||
Length-preserving ciphers: AES with ECB, CBC, CTS, CTR, XTR, XTS
|
||||
Length-preserving ciphers: AES with ECB, CBC, CTS, CTR, XCTR, XTS
|
||||
|
||||
Architecture: x86 (32-bit and 64-bit) using:
|
||||
- AES-NI (AES new instructions)
|
||||
- VAES (Vector AES)
|
||||
|
||||
Some algorithm implementations are supported only in 64-bit builds,
|
||||
and some have additional prerequisites such as AVX2 or AVX512.
|
||||
|
||||
config CRYPTO_BLOWFISH_X86_64
|
||||
tristate "Ciphers: Blowfish, modes: ECB, CBC"
|
||||
|
||||
@@ -1366,6 +1366,8 @@ gcm_crypt(struct aead_request *req, int flags)
|
||||
err = skcipher_walk_aead_encrypt(&walk, req, false);
|
||||
else
|
||||
err = skcipher_walk_aead_decrypt(&walk, req, false);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/*
|
||||
* Since the AES-GCM assembly code requires that at least three assembly
|
||||
@@ -1381,37 +1383,31 @@ gcm_crypt(struct aead_request *req, int flags)
|
||||
gcm_process_assoc(key, ghash_acc, req->src, assoclen, flags);
|
||||
|
||||
/* En/decrypt the data and pass the ciphertext through GHASH. */
|
||||
while ((nbytes = walk.nbytes) != 0) {
|
||||
if (unlikely(nbytes < walk.total)) {
|
||||
/*
|
||||
* Non-last segment. In this case, the assembly
|
||||
* function requires that the length be a multiple of 16
|
||||
* (AES_BLOCK_SIZE) bytes. The needed buffering of up
|
||||
* to 16 bytes is handled by the skcipher_walk. Here we
|
||||
* just need to round down to a multiple of 16.
|
||||
*/
|
||||
nbytes = round_down(nbytes, AES_BLOCK_SIZE);
|
||||
aes_gcm_update(key, le_ctr, ghash_acc,
|
||||
walk.src.virt.addr, walk.dst.virt.addr,
|
||||
nbytes, flags);
|
||||
le_ctr[0] += nbytes / AES_BLOCK_SIZE;
|
||||
kernel_fpu_end();
|
||||
err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
|
||||
kernel_fpu_begin();
|
||||
} else {
|
||||
/* Last segment: process all remaining data. */
|
||||
aes_gcm_update(key, le_ctr, ghash_acc,
|
||||
walk.src.virt.addr, walk.dst.virt.addr,
|
||||
nbytes, flags);
|
||||
err = skcipher_walk_done(&walk, 0);
|
||||
/*
|
||||
* The low word of the counter isn't used by the
|
||||
* finalize, so there's no need to increment it here.
|
||||
*/
|
||||
}
|
||||
while (unlikely((nbytes = walk.nbytes) < walk.total)) {
|
||||
/*
|
||||
* Non-last segment. In this case, the assembly function
|
||||
* requires that the length be a multiple of 16 (AES_BLOCK_SIZE)
|
||||
* bytes. The needed buffering of up to 16 bytes is handled by
|
||||
* the skcipher_walk. Here we just need to round down to a
|
||||
* multiple of 16.
|
||||
*/
|
||||
nbytes = round_down(nbytes, AES_BLOCK_SIZE);
|
||||
aes_gcm_update(key, le_ctr, ghash_acc, walk.src.virt.addr,
|
||||
walk.dst.virt.addr, nbytes, flags);
|
||||
le_ctr[0] += nbytes / AES_BLOCK_SIZE;
|
||||
kernel_fpu_end();
|
||||
err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
|
||||
if (err)
|
||||
return err;
|
||||
kernel_fpu_begin();
|
||||
}
|
||||
if (err)
|
||||
goto out;
|
||||
/* Last segment: process all remaining data. */
|
||||
aes_gcm_update(key, le_ctr, ghash_acc, walk.src.virt.addr,
|
||||
walk.dst.virt.addr, nbytes, flags);
|
||||
/*
|
||||
* The low word of the counter isn't used by the finalize, so there's no
|
||||
* need to increment it here.
|
||||
*/
|
||||
|
||||
/* Finalize */
|
||||
taglen = crypto_aead_authsize(tfm);
|
||||
@@ -1439,8 +1435,9 @@ gcm_crypt(struct aead_request *req, int flags)
|
||||
datalen, tag, taglen, flags))
|
||||
err = -EBADMSG;
|
||||
}
|
||||
out:
|
||||
kernel_fpu_end();
|
||||
if (nbytes)
|
||||
skcipher_walk_done(&walk, 0);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1753,6 +1750,6 @@ static void __exit aesni_exit(void)
|
||||
late_initcall(aesni_init);
|
||||
module_exit(aesni_exit);
|
||||
|
||||
MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, Intel AES-NI instructions optimized");
|
||||
MODULE_DESCRIPTION("AES cipher and modes, optimized with AES-NI or VAES instructions");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS_CRYPTO("aes");
|
||||
|
||||
@@ -592,22 +592,22 @@ SYM_TYPED_FUNC_START(sha256_transform_rorx)
|
||||
leaq K256+0*32(%rip), INP ## reuse INP as scratch reg
|
||||
vpaddd (INP, SRND), X0, XFER
|
||||
vmovdqa XFER, 0*32+_XFER(%rsp, SRND)
|
||||
FOUR_ROUNDS_AND_SCHED _XFER + 0*32
|
||||
FOUR_ROUNDS_AND_SCHED (_XFER + 0*32)
|
||||
|
||||
leaq K256+1*32(%rip), INP
|
||||
vpaddd (INP, SRND), X0, XFER
|
||||
vmovdqa XFER, 1*32+_XFER(%rsp, SRND)
|
||||
FOUR_ROUNDS_AND_SCHED _XFER + 1*32
|
||||
FOUR_ROUNDS_AND_SCHED (_XFER + 1*32)
|
||||
|
||||
leaq K256+2*32(%rip), INP
|
||||
vpaddd (INP, SRND), X0, XFER
|
||||
vmovdqa XFER, 2*32+_XFER(%rsp, SRND)
|
||||
FOUR_ROUNDS_AND_SCHED _XFER + 2*32
|
||||
FOUR_ROUNDS_AND_SCHED (_XFER + 2*32)
|
||||
|
||||
leaq K256+3*32(%rip), INP
|
||||
vpaddd (INP, SRND), X0, XFER
|
||||
vmovdqa XFER, 3*32+_XFER(%rsp, SRND)
|
||||
FOUR_ROUNDS_AND_SCHED _XFER + 3*32
|
||||
FOUR_ROUNDS_AND_SCHED (_XFER + 3*32)
|
||||
|
||||
add $4*32, SRND
|
||||
cmp $3*4*32, SRND
|
||||
@@ -618,12 +618,12 @@ SYM_TYPED_FUNC_START(sha256_transform_rorx)
|
||||
leaq K256+0*32(%rip), INP
|
||||
vpaddd (INP, SRND), X0, XFER
|
||||
vmovdqa XFER, 0*32+_XFER(%rsp, SRND)
|
||||
DO_4ROUNDS _XFER + 0*32
|
||||
DO_4ROUNDS (_XFER + 0*32)
|
||||
|
||||
leaq K256+1*32(%rip), INP
|
||||
vpaddd (INP, SRND), X1, XFER
|
||||
vmovdqa XFER, 1*32+_XFER(%rsp, SRND)
|
||||
DO_4ROUNDS _XFER + 1*32
|
||||
DO_4ROUNDS (_XFER + 1*32)
|
||||
add $2*32, SRND
|
||||
|
||||
vmovdqa X2, X0
|
||||
@@ -651,8 +651,8 @@ SYM_TYPED_FUNC_START(sha256_transform_rorx)
|
||||
xor SRND, SRND
|
||||
.align 16
|
||||
.Lloop3:
|
||||
DO_4ROUNDS _XFER + 0*32 + 16
|
||||
DO_4ROUNDS _XFER + 1*32 + 16
|
||||
DO_4ROUNDS (_XFER + 0*32 + 16)
|
||||
DO_4ROUNDS (_XFER + 1*32 + 16)
|
||||
add $2*32, SRND
|
||||
cmp $4*4*32, SRND
|
||||
jb .Lloop3
|
||||
|
||||
@@ -192,26 +192,6 @@
|
||||
#define X86_MATCH_VENDOR_FAM(vendor, family, data) \
|
||||
X86_MATCH_VENDOR_FAM_MODEL(vendor, family, X86_MODEL_ANY, data)
|
||||
|
||||
/**
|
||||
* X86_MATCH_INTEL_FAM6_MODEL - Match vendor INTEL, family 6 and model
|
||||
* @model: The model name without the INTEL_FAM6_ prefix or ANY
|
||||
* The model name is expanded to INTEL_FAM6_@model internally
|
||||
* @data: Driver specific data or NULL. The internal storage
|
||||
* format is unsigned long. The supplied value, pointer
|
||||
* etc. is casted to unsigned long internally.
|
||||
*
|
||||
* The vendor is set to INTEL, the family to 6 and all other missing
|
||||
* arguments of X86_MATCH_VENDOR_FAM_MODEL_FEATURE() are set to wildcards.
|
||||
*
|
||||
* See X86_MATCH_VENDOR_FAM_MODEL_FEATURE() for further information.
|
||||
*/
|
||||
#define X86_MATCH_INTEL_FAM6_MODEL(model, data) \
|
||||
X86_MATCH_VENDOR_FAM_MODEL(INTEL, 6, INTEL_FAM6_##model, data)
|
||||
|
||||
#define X86_MATCH_INTEL_FAM6_MODEL_STEPPINGS(model, steppings, data) \
|
||||
X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE(INTEL, 6, INTEL_FAM6_##model, \
|
||||
steppings, X86_FEATURE_ANY, data)
|
||||
|
||||
/**
|
||||
* X86_MATCH_VFM - Match encoded vendor/family/model
|
||||
* @vfm: Encoded 8-bits each for vendor, family, model
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* that group keep the CPUID for the variants sorted by model number.
|
||||
*
|
||||
* The defined symbol names have the following form:
|
||||
* INTEL_FAM6{OPTFAMILY}_{MICROARCH}{OPTDIFF}
|
||||
* INTEL_{OPTFAMILY}_{MICROARCH}{OPTDIFF}
|
||||
* where:
|
||||
* OPTFAMILY Describes the family of CPUs that this belongs to. Default
|
||||
* is assumed to be "_CORE" (and should be omitted). Other values
|
||||
@@ -42,215 +42,136 @@
|
||||
|
||||
#define IFM(_fam, _model) VFM_MAKE(X86_VENDOR_INTEL, _fam, _model)
|
||||
|
||||
/* Wildcard match for FAM6 so X86_MATCH_INTEL_FAM6_MODEL(ANY) works */
|
||||
#define INTEL_FAM6_ANY X86_MODEL_ANY
|
||||
/* Wildcard match for FAM6 so X86_MATCH_VFM(ANY) works */
|
||||
/* Wildcard match so X86_MATCH_VFM(ANY) works */
|
||||
#define INTEL_ANY IFM(X86_FAMILY_ANY, X86_MODEL_ANY)
|
||||
|
||||
#define INTEL_FAM6_CORE_YONAH 0x0E
|
||||
#define INTEL_PENTIUM_PRO IFM(6, 0x01)
|
||||
|
||||
#define INTEL_CORE_YONAH IFM(6, 0x0E)
|
||||
|
||||
#define INTEL_FAM6_CORE2_MEROM 0x0F
|
||||
#define INTEL_CORE2_MEROM IFM(6, 0x0F)
|
||||
#define INTEL_FAM6_CORE2_MEROM_L 0x16
|
||||
#define INTEL_CORE2_MEROM_L IFM(6, 0x16)
|
||||
#define INTEL_FAM6_CORE2_PENRYN 0x17
|
||||
#define INTEL_CORE2_PENRYN IFM(6, 0x17)
|
||||
#define INTEL_FAM6_CORE2_DUNNINGTON 0x1D
|
||||
#define INTEL_CORE2_DUNNINGTON IFM(6, 0x1D)
|
||||
|
||||
#define INTEL_FAM6_NEHALEM 0x1E
|
||||
#define INTEL_NEHALEM IFM(6, 0x1E)
|
||||
#define INTEL_FAM6_NEHALEM_G 0x1F /* Auburndale / Havendale */
|
||||
#define INTEL_NEHALEM_G IFM(6, 0x1F) /* Auburndale / Havendale */
|
||||
#define INTEL_FAM6_NEHALEM_EP 0x1A
|
||||
#define INTEL_NEHALEM_EP IFM(6, 0x1A)
|
||||
#define INTEL_FAM6_NEHALEM_EX 0x2E
|
||||
#define INTEL_NEHALEM_EX IFM(6, 0x2E)
|
||||
|
||||
#define INTEL_FAM6_WESTMERE 0x25
|
||||
#define INTEL_WESTMERE IFM(6, 0x25)
|
||||
#define INTEL_FAM6_WESTMERE_EP 0x2C
|
||||
#define INTEL_WESTMERE_EP IFM(6, 0x2C)
|
||||
#define INTEL_FAM6_WESTMERE_EX 0x2F
|
||||
#define INTEL_WESTMERE_EX IFM(6, 0x2F)
|
||||
|
||||
#define INTEL_FAM6_SANDYBRIDGE 0x2A
|
||||
#define INTEL_SANDYBRIDGE IFM(6, 0x2A)
|
||||
#define INTEL_FAM6_SANDYBRIDGE_X 0x2D
|
||||
#define INTEL_SANDYBRIDGE_X IFM(6, 0x2D)
|
||||
#define INTEL_FAM6_IVYBRIDGE 0x3A
|
||||
#define INTEL_IVYBRIDGE IFM(6, 0x3A)
|
||||
#define INTEL_FAM6_IVYBRIDGE_X 0x3E
|
||||
#define INTEL_IVYBRIDGE_X IFM(6, 0x3E)
|
||||
|
||||
#define INTEL_FAM6_HASWELL 0x3C
|
||||
#define INTEL_HASWELL IFM(6, 0x3C)
|
||||
#define INTEL_FAM6_HASWELL_X 0x3F
|
||||
#define INTEL_HASWELL_X IFM(6, 0x3F)
|
||||
#define INTEL_FAM6_HASWELL_L 0x45
|
||||
#define INTEL_HASWELL_L IFM(6, 0x45)
|
||||
#define INTEL_FAM6_HASWELL_G 0x46
|
||||
#define INTEL_HASWELL_G IFM(6, 0x46)
|
||||
|
||||
#define INTEL_FAM6_BROADWELL 0x3D
|
||||
#define INTEL_BROADWELL IFM(6, 0x3D)
|
||||
#define INTEL_FAM6_BROADWELL_G 0x47
|
||||
#define INTEL_BROADWELL_G IFM(6, 0x47)
|
||||
#define INTEL_FAM6_BROADWELL_X 0x4F
|
||||
#define INTEL_BROADWELL_X IFM(6, 0x4F)
|
||||
#define INTEL_FAM6_BROADWELL_D 0x56
|
||||
#define INTEL_BROADWELL_D IFM(6, 0x56)
|
||||
|
||||
#define INTEL_FAM6_SKYLAKE_L 0x4E /* Sky Lake */
|
||||
#define INTEL_SKYLAKE_L IFM(6, 0x4E) /* Sky Lake */
|
||||
#define INTEL_FAM6_SKYLAKE 0x5E /* Sky Lake */
|
||||
#define INTEL_SKYLAKE IFM(6, 0x5E) /* Sky Lake */
|
||||
#define INTEL_FAM6_SKYLAKE_X 0x55 /* Sky Lake */
|
||||
#define INTEL_SKYLAKE_X IFM(6, 0x55) /* Sky Lake */
|
||||
/* CASCADELAKE_X 0x55 Sky Lake -- s: 7 */
|
||||
/* COOPERLAKE_X 0x55 Sky Lake -- s: 11 */
|
||||
|
||||
#define INTEL_FAM6_KABYLAKE_L 0x8E /* Sky Lake */
|
||||
#define INTEL_KABYLAKE_L IFM(6, 0x8E) /* Sky Lake */
|
||||
/* AMBERLAKE_L 0x8E Sky Lake -- s: 9 */
|
||||
/* COFFEELAKE_L 0x8E Sky Lake -- s: 10 */
|
||||
/* WHISKEYLAKE_L 0x8E Sky Lake -- s: 11,12 */
|
||||
|
||||
#define INTEL_FAM6_KABYLAKE 0x9E /* Sky Lake */
|
||||
#define INTEL_KABYLAKE IFM(6, 0x9E) /* Sky Lake */
|
||||
/* COFFEELAKE 0x9E Sky Lake -- s: 10-13 */
|
||||
|
||||
#define INTEL_FAM6_COMETLAKE 0xA5 /* Sky Lake */
|
||||
#define INTEL_COMETLAKE IFM(6, 0xA5) /* Sky Lake */
|
||||
#define INTEL_FAM6_COMETLAKE_L 0xA6 /* Sky Lake */
|
||||
#define INTEL_COMETLAKE_L IFM(6, 0xA6) /* Sky Lake */
|
||||
|
||||
#define INTEL_FAM6_CANNONLAKE_L 0x66 /* Palm Cove */
|
||||
#define INTEL_CANNONLAKE_L IFM(6, 0x66) /* Palm Cove */
|
||||
|
||||
#define INTEL_FAM6_ICELAKE_X 0x6A /* Sunny Cove */
|
||||
#define INTEL_ICELAKE_X IFM(6, 0x6A) /* Sunny Cove */
|
||||
#define INTEL_FAM6_ICELAKE_D 0x6C /* Sunny Cove */
|
||||
#define INTEL_ICELAKE_D IFM(6, 0x6C) /* Sunny Cove */
|
||||
#define INTEL_FAM6_ICELAKE 0x7D /* Sunny Cove */
|
||||
#define INTEL_ICELAKE IFM(6, 0x7D) /* Sunny Cove */
|
||||
#define INTEL_FAM6_ICELAKE_L 0x7E /* Sunny Cove */
|
||||
#define INTEL_ICELAKE_L IFM(6, 0x7E) /* Sunny Cove */
|
||||
#define INTEL_FAM6_ICELAKE_NNPI 0x9D /* Sunny Cove */
|
||||
#define INTEL_ICELAKE_NNPI IFM(6, 0x9D) /* Sunny Cove */
|
||||
|
||||
#define INTEL_FAM6_ROCKETLAKE 0xA7 /* Cypress Cove */
|
||||
#define INTEL_ROCKETLAKE IFM(6, 0xA7) /* Cypress Cove */
|
||||
|
||||
#define INTEL_FAM6_TIGERLAKE_L 0x8C /* Willow Cove */
|
||||
#define INTEL_TIGERLAKE_L IFM(6, 0x8C) /* Willow Cove */
|
||||
#define INTEL_FAM6_TIGERLAKE 0x8D /* Willow Cove */
|
||||
#define INTEL_TIGERLAKE IFM(6, 0x8D) /* Willow Cove */
|
||||
|
||||
#define INTEL_FAM6_SAPPHIRERAPIDS_X 0x8F /* Golden Cove */
|
||||
#define INTEL_SAPPHIRERAPIDS_X IFM(6, 0x8F) /* Golden Cove */
|
||||
|
||||
#define INTEL_FAM6_EMERALDRAPIDS_X 0xCF
|
||||
#define INTEL_EMERALDRAPIDS_X IFM(6, 0xCF)
|
||||
|
||||
#define INTEL_FAM6_GRANITERAPIDS_X 0xAD
|
||||
#define INTEL_GRANITERAPIDS_X IFM(6, 0xAD)
|
||||
#define INTEL_FAM6_GRANITERAPIDS_D 0xAE
|
||||
#define INTEL_GRANITERAPIDS_D IFM(6, 0xAE)
|
||||
|
||||
/* "Hybrid" Processors (P-Core/E-Core) */
|
||||
|
||||
#define INTEL_FAM6_LAKEFIELD 0x8A /* Sunny Cove / Tremont */
|
||||
#define INTEL_LAKEFIELD IFM(6, 0x8A) /* Sunny Cove / Tremont */
|
||||
|
||||
#define INTEL_FAM6_ALDERLAKE 0x97 /* Golden Cove / Gracemont */
|
||||
#define INTEL_ALDERLAKE IFM(6, 0x97) /* Golden Cove / Gracemont */
|
||||
#define INTEL_FAM6_ALDERLAKE_L 0x9A /* Golden Cove / Gracemont */
|
||||
#define INTEL_ALDERLAKE_L IFM(6, 0x9A) /* Golden Cove / Gracemont */
|
||||
|
||||
#define INTEL_FAM6_RAPTORLAKE 0xB7 /* Raptor Cove / Enhanced Gracemont */
|
||||
#define INTEL_RAPTORLAKE IFM(6, 0xB7) /* Raptor Cove / Enhanced Gracemont */
|
||||
#define INTEL_FAM6_RAPTORLAKE_P 0xBA
|
||||
#define INTEL_RAPTORLAKE_P IFM(6, 0xBA)
|
||||
#define INTEL_FAM6_RAPTORLAKE_S 0xBF
|
||||
#define INTEL_RAPTORLAKE_S IFM(6, 0xBF)
|
||||
|
||||
#define INTEL_FAM6_METEORLAKE 0xAC
|
||||
#define INTEL_METEORLAKE IFM(6, 0xAC)
|
||||
#define INTEL_FAM6_METEORLAKE_L 0xAA
|
||||
#define INTEL_METEORLAKE_L IFM(6, 0xAA)
|
||||
|
||||
#define INTEL_FAM6_ARROWLAKE_H 0xC5
|
||||
#define INTEL_ARROWLAKE_H IFM(6, 0xC5)
|
||||
#define INTEL_FAM6_ARROWLAKE 0xC6
|
||||
#define INTEL_ARROWLAKE IFM(6, 0xC6)
|
||||
#define INTEL_FAM6_ARROWLAKE_U 0xB5
|
||||
#define INTEL_ARROWLAKE_U IFM(6, 0xB5)
|
||||
|
||||
#define INTEL_FAM6_LUNARLAKE_M 0xBD
|
||||
#define INTEL_LUNARLAKE_M IFM(6, 0xBD)
|
||||
|
||||
/* "Small Core" Processors (Atom/E-Core) */
|
||||
|
||||
#define INTEL_FAM6_ATOM_BONNELL 0x1C /* Diamondville, Pineview */
|
||||
#define INTEL_ATOM_BONNELL IFM(6, 0x1C) /* Diamondville, Pineview */
|
||||
#define INTEL_FAM6_ATOM_BONNELL_MID 0x26 /* Silverthorne, Lincroft */
|
||||
#define INTEL_ATOM_BONNELL_MID IFM(6, 0x26) /* Silverthorne, Lincroft */
|
||||
|
||||
#define INTEL_FAM6_ATOM_SALTWELL 0x36 /* Cedarview */
|
||||
#define INTEL_ATOM_SALTWELL IFM(6, 0x36) /* Cedarview */
|
||||
#define INTEL_FAM6_ATOM_SALTWELL_MID 0x27 /* Penwell */
|
||||
#define INTEL_ATOM_SALTWELL_MID IFM(6, 0x27) /* Penwell */
|
||||
#define INTEL_FAM6_ATOM_SALTWELL_TABLET 0x35 /* Cloverview */
|
||||
#define INTEL_ATOM_SALTWELL_TABLET IFM(6, 0x35) /* Cloverview */
|
||||
|
||||
#define INTEL_FAM6_ATOM_SILVERMONT 0x37 /* Bay Trail, Valleyview */
|
||||
#define INTEL_ATOM_SILVERMONT IFM(6, 0x37) /* Bay Trail, Valleyview */
|
||||
#define INTEL_FAM6_ATOM_SILVERMONT_D 0x4D /* Avaton, Rangely */
|
||||
#define INTEL_ATOM_SILVERMONT_D IFM(6, 0x4D) /* Avaton, Rangely */
|
||||
#define INTEL_FAM6_ATOM_SILVERMONT_MID 0x4A /* Merriefield */
|
||||
#define INTEL_ATOM_SILVERMONT_MID IFM(6, 0x4A) /* Merriefield */
|
||||
|
||||
#define INTEL_FAM6_ATOM_AIRMONT 0x4C /* Cherry Trail, Braswell */
|
||||
#define INTEL_ATOM_AIRMONT IFM(6, 0x4C) /* Cherry Trail, Braswell */
|
||||
#define INTEL_FAM6_ATOM_AIRMONT_MID 0x5A /* Moorefield */
|
||||
#define INTEL_ATOM_AIRMONT_MID IFM(6, 0x5A) /* Moorefield */
|
||||
#define INTEL_FAM6_ATOM_AIRMONT_NP 0x75 /* Lightning Mountain */
|
||||
#define INTEL_ATOM_AIRMONT_NP IFM(6, 0x75) /* Lightning Mountain */
|
||||
|
||||
#define INTEL_FAM6_ATOM_GOLDMONT 0x5C /* Apollo Lake */
|
||||
#define INTEL_ATOM_GOLDMONT IFM(6, 0x5C) /* Apollo Lake */
|
||||
#define INTEL_FAM6_ATOM_GOLDMONT_D 0x5F /* Denverton */
|
||||
#define INTEL_ATOM_GOLDMONT_D IFM(6, 0x5F) /* Denverton */
|
||||
|
||||
/* Note: the micro-architecture is "Goldmont Plus" */
|
||||
#define INTEL_FAM6_ATOM_GOLDMONT_PLUS 0x7A /* Gemini Lake */
|
||||
#define INTEL_ATOM_GOLDMONT_PLUS IFM(6, 0x7A) /* Gemini Lake */
|
||||
|
||||
#define INTEL_FAM6_ATOM_TREMONT_D 0x86 /* Jacobsville */
|
||||
#define INTEL_ATOM_TREMONT_D IFM(6, 0x86) /* Jacobsville */
|
||||
#define INTEL_FAM6_ATOM_TREMONT 0x96 /* Elkhart Lake */
|
||||
#define INTEL_ATOM_TREMONT IFM(6, 0x96) /* Elkhart Lake */
|
||||
#define INTEL_FAM6_ATOM_TREMONT_L 0x9C /* Jasper Lake */
|
||||
#define INTEL_ATOM_TREMONT_L IFM(6, 0x9C) /* Jasper Lake */
|
||||
|
||||
#define INTEL_FAM6_ATOM_GRACEMONT 0xBE /* Alderlake N */
|
||||
#define INTEL_ATOM_GRACEMONT IFM(6, 0xBE) /* Alderlake N */
|
||||
|
||||
#define INTEL_FAM6_ATOM_CRESTMONT_X 0xAF /* Sierra Forest */
|
||||
#define INTEL_ATOM_CRESTMONT_X IFM(6, 0xAF) /* Sierra Forest */
|
||||
#define INTEL_FAM6_ATOM_CRESTMONT 0xB6 /* Grand Ridge */
|
||||
#define INTEL_ATOM_CRESTMONT IFM(6, 0xB6) /* Grand Ridge */
|
||||
|
||||
#define INTEL_FAM6_ATOM_DARKMONT_X 0xDD /* Clearwater Forest */
|
||||
#define INTEL_ATOM_DARKMONT_X IFM(6, 0xDD) /* Clearwater Forest */
|
||||
|
||||
/* Xeon Phi */
|
||||
|
||||
#define INTEL_FAM6_XEON_PHI_KNL 0x57 /* Knights Landing */
|
||||
#define INTEL_XEON_PHI_KNL IFM(6, 0x57) /* Knights Landing */
|
||||
#define INTEL_FAM6_XEON_PHI_KNM 0x85 /* Knights Mill */
|
||||
#define INTEL_XEON_PHI_KNM IFM(6, 0x85) /* Knights Mill */
|
||||
|
||||
/* Family 5 */
|
||||
|
||||
@@ -221,7 +221,7 @@ static inline int apei_smca_report_x86_error(struct cper_ia_proc_ctx *ctx_info,
|
||||
u64 lapic_id) { return -EINVAL; }
|
||||
#endif
|
||||
|
||||
void mce_setup(struct mce *m);
|
||||
void mce_prep_record(struct mce *m);
|
||||
void mce_log(struct mce *m);
|
||||
DECLARE_PER_CPU(struct device *, mce_device);
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ struct snp_guest_msg_hdr {
|
||||
|
||||
struct snp_guest_msg {
|
||||
struct snp_guest_msg_hdr hdr;
|
||||
u8 payload[4000];
|
||||
u8 payload[PAGE_SIZE - sizeof(struct snp_guest_msg_hdr)];
|
||||
} __packed;
|
||||
|
||||
struct sev_guest_platform_data {
|
||||
|
||||
+31
-29
@@ -233,7 +233,8 @@ static void x86_amd_ssb_disable(void)
|
||||
#define pr_fmt(fmt) "MDS: " fmt
|
||||
|
||||
/* Default mitigation for MDS-affected CPUs */
|
||||
static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_FULL;
|
||||
static enum mds_mitigations mds_mitigation __ro_after_init =
|
||||
IS_ENABLED(CONFIG_MITIGATION_MDS) ? MDS_MITIGATION_FULL : MDS_MITIGATION_OFF;
|
||||
static bool mds_nosmt __ro_after_init = false;
|
||||
|
||||
static const char * const mds_strings[] = {
|
||||
@@ -293,7 +294,8 @@ enum taa_mitigations {
|
||||
};
|
||||
|
||||
/* Default mitigation for TAA-affected CPUs */
|
||||
static enum taa_mitigations taa_mitigation __ro_after_init = TAA_MITIGATION_VERW;
|
||||
static enum taa_mitigations taa_mitigation __ro_after_init =
|
||||
IS_ENABLED(CONFIG_MITIGATION_TAA) ? TAA_MITIGATION_VERW : TAA_MITIGATION_OFF;
|
||||
static bool taa_nosmt __ro_after_init;
|
||||
|
||||
static const char * const taa_strings[] = {
|
||||
@@ -391,7 +393,8 @@ enum mmio_mitigations {
|
||||
};
|
||||
|
||||
/* Default mitigation for Processor MMIO Stale Data vulnerabilities */
|
||||
static enum mmio_mitigations mmio_mitigation __ro_after_init = MMIO_MITIGATION_VERW;
|
||||
static enum mmio_mitigations mmio_mitigation __ro_after_init =
|
||||
IS_ENABLED(CONFIG_MITIGATION_MMIO_STALE_DATA) ? MMIO_MITIGATION_VERW : MMIO_MITIGATION_OFF;
|
||||
static bool mmio_nosmt __ro_after_init = false;
|
||||
|
||||
static const char * const mmio_strings[] = {
|
||||
@@ -605,7 +608,8 @@ enum srbds_mitigations {
|
||||
SRBDS_MITIGATION_HYPERVISOR,
|
||||
};
|
||||
|
||||
static enum srbds_mitigations srbds_mitigation __ro_after_init = SRBDS_MITIGATION_FULL;
|
||||
static enum srbds_mitigations srbds_mitigation __ro_after_init =
|
||||
IS_ENABLED(CONFIG_MITIGATION_SRBDS) ? SRBDS_MITIGATION_FULL : SRBDS_MITIGATION_OFF;
|
||||
|
||||
static const char * const srbds_strings[] = {
|
||||
[SRBDS_MITIGATION_OFF] = "Vulnerable",
|
||||
@@ -731,11 +735,8 @@ enum gds_mitigations {
|
||||
GDS_MITIGATION_HYPERVISOR,
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_MITIGATION_GDS_FORCE)
|
||||
static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FORCE;
|
||||
#else
|
||||
static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FULL;
|
||||
#endif
|
||||
static enum gds_mitigations gds_mitigation __ro_after_init =
|
||||
IS_ENABLED(CONFIG_MITIGATION_GDS) ? GDS_MITIGATION_FULL : GDS_MITIGATION_OFF;
|
||||
|
||||
static const char * const gds_strings[] = {
|
||||
[GDS_MITIGATION_OFF] = "Vulnerable",
|
||||
@@ -871,7 +872,8 @@ enum spectre_v1_mitigation {
|
||||
};
|
||||
|
||||
static enum spectre_v1_mitigation spectre_v1_mitigation __ro_after_init =
|
||||
SPECTRE_V1_MITIGATION_AUTO;
|
||||
IS_ENABLED(CONFIG_MITIGATION_SPECTRE_V1) ?
|
||||
SPECTRE_V1_MITIGATION_AUTO : SPECTRE_V1_MITIGATION_NONE;
|
||||
|
||||
static const char * const spectre_v1_strings[] = {
|
||||
[SPECTRE_V1_MITIGATION_NONE] = "Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers",
|
||||
@@ -986,7 +988,7 @@ static const char * const retbleed_strings[] = {
|
||||
static enum retbleed_mitigation retbleed_mitigation __ro_after_init =
|
||||
RETBLEED_MITIGATION_NONE;
|
||||
static enum retbleed_mitigation_cmd retbleed_cmd __ro_after_init =
|
||||
RETBLEED_CMD_AUTO;
|
||||
IS_ENABLED(CONFIG_MITIGATION_RETBLEED) ? RETBLEED_CMD_AUTO : RETBLEED_CMD_OFF;
|
||||
|
||||
static int __ro_after_init retbleed_nosmt = false;
|
||||
|
||||
@@ -1447,17 +1449,18 @@ static void __init spec_v2_print_cond(const char *reason, bool secure)
|
||||
|
||||
static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
|
||||
{
|
||||
enum spectre_v2_mitigation_cmd cmd = SPECTRE_V2_CMD_AUTO;
|
||||
enum spectre_v2_mitigation_cmd cmd;
|
||||
char arg[20];
|
||||
int ret, i;
|
||||
|
||||
cmd = IS_ENABLED(CONFIG_MITIGATION_SPECTRE_V2) ? SPECTRE_V2_CMD_AUTO : SPECTRE_V2_CMD_NONE;
|
||||
if (cmdline_find_option_bool(boot_command_line, "nospectre_v2") ||
|
||||
cpu_mitigations_off())
|
||||
return SPECTRE_V2_CMD_NONE;
|
||||
|
||||
ret = cmdline_find_option(boot_command_line, "spectre_v2", arg, sizeof(arg));
|
||||
if (ret < 0)
|
||||
return SPECTRE_V2_CMD_AUTO;
|
||||
return cmd;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mitigation_options); i++) {
|
||||
if (!match_option(arg, ret, mitigation_options[i].option))
|
||||
@@ -1467,8 +1470,8 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
|
||||
}
|
||||
|
||||
if (i >= ARRAY_SIZE(mitigation_options)) {
|
||||
pr_err("unknown option (%s). Switching to AUTO select\n", arg);
|
||||
return SPECTRE_V2_CMD_AUTO;
|
||||
pr_err("unknown option (%s). Switching to default mode\n", arg);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
if ((cmd == SPECTRE_V2_CMD_RETPOLINE ||
|
||||
@@ -2021,10 +2024,12 @@ static const struct {
|
||||
|
||||
static enum ssb_mitigation_cmd __init ssb_parse_cmdline(void)
|
||||
{
|
||||
enum ssb_mitigation_cmd cmd = SPEC_STORE_BYPASS_CMD_AUTO;
|
||||
enum ssb_mitigation_cmd cmd;
|
||||
char arg[20];
|
||||
int ret, i;
|
||||
|
||||
cmd = IS_ENABLED(CONFIG_MITIGATION_SSB) ?
|
||||
SPEC_STORE_BYPASS_CMD_AUTO : SPEC_STORE_BYPASS_CMD_NONE;
|
||||
if (cmdline_find_option_bool(boot_command_line, "nospec_store_bypass_disable") ||
|
||||
cpu_mitigations_off()) {
|
||||
return SPEC_STORE_BYPASS_CMD_NONE;
|
||||
@@ -2032,7 +2037,7 @@ static enum ssb_mitigation_cmd __init ssb_parse_cmdline(void)
|
||||
ret = cmdline_find_option(boot_command_line, "spec_store_bypass_disable",
|
||||
arg, sizeof(arg));
|
||||
if (ret < 0)
|
||||
return SPEC_STORE_BYPASS_CMD_AUTO;
|
||||
return cmd;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ssb_mitigation_options); i++) {
|
||||
if (!match_option(arg, ret, ssb_mitigation_options[i].option))
|
||||
@@ -2043,8 +2048,8 @@ static enum ssb_mitigation_cmd __init ssb_parse_cmdline(void)
|
||||
}
|
||||
|
||||
if (i >= ARRAY_SIZE(ssb_mitigation_options)) {
|
||||
pr_err("unknown option (%s). Switching to AUTO select\n", arg);
|
||||
return SPEC_STORE_BYPASS_CMD_AUTO;
|
||||
pr_err("unknown option (%s). Switching to default mode\n", arg);
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2371,7 +2376,8 @@ EXPORT_SYMBOL_GPL(itlb_multihit_kvm_mitigation);
|
||||
#define pr_fmt(fmt) "L1TF: " fmt
|
||||
|
||||
/* Default mitigation for L1TF-affected CPUs */
|
||||
enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
|
||||
enum l1tf_mitigations l1tf_mitigation __ro_after_init =
|
||||
IS_ENABLED(CONFIG_MITIGATION_L1TF) ? L1TF_MITIGATION_FLUSH : L1TF_MITIGATION_OFF;
|
||||
#if IS_ENABLED(CONFIG_KVM_INTEL)
|
||||
EXPORT_SYMBOL_GPL(l1tf_mitigation);
|
||||
#endif
|
||||
@@ -2551,10 +2557,9 @@ static void __init srso_select_mitigation(void)
|
||||
{
|
||||
bool has_microcode = boot_cpu_has(X86_FEATURE_IBPB_BRTYPE);
|
||||
|
||||
if (cpu_mitigations_off())
|
||||
return;
|
||||
|
||||
if (!boot_cpu_has_bug(X86_BUG_SRSO)) {
|
||||
if (!boot_cpu_has_bug(X86_BUG_SRSO) ||
|
||||
cpu_mitigations_off() ||
|
||||
srso_cmd == SRSO_CMD_OFF) {
|
||||
if (boot_cpu_has(X86_FEATURE_SBPB))
|
||||
x86_pred_cmd = PRED_CMD_SBPB;
|
||||
return;
|
||||
@@ -2585,11 +2590,6 @@ static void __init srso_select_mitigation(void)
|
||||
}
|
||||
|
||||
switch (srso_cmd) {
|
||||
case SRSO_CMD_OFF:
|
||||
if (boot_cpu_has(X86_FEATURE_SBPB))
|
||||
x86_pred_cmd = PRED_CMD_SBPB;
|
||||
return;
|
||||
|
||||
case SRSO_CMD_MICROCODE:
|
||||
if (has_microcode) {
|
||||
srso_mitigation = SRSO_MITIGATION_MICROCODE;
|
||||
@@ -2643,6 +2643,8 @@ static void __init srso_select_mitigation(void)
|
||||
pr_err("WARNING: kernel not compiled with MITIGATION_SRSO.\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
@@ -1165,8 +1165,8 @@ static const __initconst struct x86_cpu_id cpu_vuln_whitelist[] = {
|
||||
|
||||
VULNWL_INTEL(INTEL_CORE_YONAH, NO_SSB),
|
||||
|
||||
VULNWL_INTEL(INTEL_ATOM_AIRMONT_MID, NO_L1TF | MSBDS_ONLY | NO_SWAPGS | NO_ITLB_MULTIHIT),
|
||||
VULNWL_INTEL(INTEL_ATOM_AIRMONT_NP, NO_L1TF | NO_SWAPGS | NO_ITLB_MULTIHIT),
|
||||
VULNWL_INTEL(INTEL_ATOM_AIRMONT_MID, NO_SSB | NO_L1TF | NO_SWAPGS | NO_ITLB_MULTIHIT | MSBDS_ONLY),
|
||||
VULNWL_INTEL(INTEL_ATOM_AIRMONT_NP, NO_SSB | NO_L1TF | NO_SWAPGS | NO_ITLB_MULTIHIT),
|
||||
|
||||
VULNWL_INTEL(INTEL_ATOM_GOLDMONT, NO_MDS | NO_L1TF | NO_SWAPGS | NO_ITLB_MULTIHIT | NO_MMIO),
|
||||
VULNWL_INTEL(INTEL_ATOM_GOLDMONT_D, NO_MDS | NO_L1TF | NO_SWAPGS | NO_ITLB_MULTIHIT | NO_MMIO),
|
||||
|
||||
@@ -311,16 +311,18 @@ static void early_init_intel(struct cpuinfo_x86 *c)
|
||||
}
|
||||
|
||||
/*
|
||||
* There is a known erratum on Pentium III and Core Solo
|
||||
* and Core Duo CPUs.
|
||||
* " Page with PAT set to WC while associated MTRR is UC
|
||||
* may consolidate to UC "
|
||||
* Because of this erratum, it is better to stick with
|
||||
* setting WC in MTRR rather than using PAT on these CPUs.
|
||||
* PAT is broken on early family 6 CPUs, the last of which
|
||||
* is "Yonah" where the erratum is named "AN7":
|
||||
*
|
||||
* Enable PAT WC only on P4, Core 2 or later CPUs.
|
||||
* Page with PAT (Page Attribute Table) Set to USWC
|
||||
* (Uncacheable Speculative Write Combine) While
|
||||
* Associated MTRR (Memory Type Range Register) Is UC
|
||||
* (Uncacheable) May Consolidate to UC
|
||||
*
|
||||
* Disable PAT and fall back to MTRR on these CPUs.
|
||||
*/
|
||||
if (c->x86 == 6 && c->x86_model < 15)
|
||||
if (c->x86_vfm >= INTEL_PENTIUM_PRO &&
|
||||
c->x86_vfm <= INTEL_CORE_YONAH)
|
||||
clear_cpu_cap(c, X86_FEATURE_PAT);
|
||||
|
||||
/*
|
||||
|
||||
@@ -780,7 +780,7 @@ static void __log_error(unsigned int bank, u64 status, u64 addr, u64 misc)
|
||||
{
|
||||
struct mce m;
|
||||
|
||||
mce_setup(&m);
|
||||
mce_prep_record(&m);
|
||||
|
||||
m.status = status;
|
||||
m.misc = misc;
|
||||
|
||||
@@ -44,7 +44,7 @@ void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err)
|
||||
else
|
||||
lsb = PAGE_SHIFT;
|
||||
|
||||
mce_setup(&m);
|
||||
mce_prep_record(&m);
|
||||
m.bank = -1;
|
||||
/* Fake a memory read error with unknown channel */
|
||||
m.status = MCI_STATUS_VAL | MCI_STATUS_EN | MCI_STATUS_ADDRV | MCI_STATUS_MISCV | 0x9f;
|
||||
@@ -66,6 +66,7 @@ EXPORT_SYMBOL_GPL(apei_mce_report_mem_error);
|
||||
int apei_smca_report_x86_error(struct cper_ia_proc_ctx *ctx_info, u64 lapic_id)
|
||||
{
|
||||
const u64 *i_mce = ((const u64 *) (ctx_info + 1));
|
||||
bool apicid_found = false;
|
||||
unsigned int cpu;
|
||||
struct mce m;
|
||||
|
||||
@@ -97,20 +98,19 @@ int apei_smca_report_x86_error(struct cper_ia_proc_ctx *ctx_info, u64 lapic_id)
|
||||
if (ctx_info->reg_arr_size < 48)
|
||||
return -EINVAL;
|
||||
|
||||
mce_setup(&m);
|
||||
|
||||
m.extcpu = -1;
|
||||
m.socketid = -1;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
if (cpu_data(cpu).topo.initial_apicid == lapic_id) {
|
||||
m.extcpu = cpu;
|
||||
m.socketid = cpu_data(m.extcpu).topo.pkg_id;
|
||||
apicid_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m.apicid = lapic_id;
|
||||
if (!apicid_found)
|
||||
return -EINVAL;
|
||||
|
||||
mce_prep_record_common(&m);
|
||||
mce_prep_record_per_cpu(cpu, &m);
|
||||
|
||||
m.bank = (ctx_info->msr_addr >> 4) & 0xFF;
|
||||
m.status = *i_mce;
|
||||
m.addr = *(i_mce + 1);
|
||||
|
||||
@@ -117,20 +117,32 @@ static struct irq_work mce_irq_work;
|
||||
*/
|
||||
BLOCKING_NOTIFIER_HEAD(x86_mce_decoder_chain);
|
||||
|
||||
/* Do initial initialization of a struct mce */
|
||||
void mce_setup(struct mce *m)
|
||||
void mce_prep_record_common(struct mce *m)
|
||||
{
|
||||
memset(m, 0, sizeof(struct mce));
|
||||
m->cpu = m->extcpu = smp_processor_id();
|
||||
|
||||
m->cpuid = cpuid_eax(1);
|
||||
m->cpuvendor = boot_cpu_data.x86_vendor;
|
||||
m->mcgcap = __rdmsr(MSR_IA32_MCG_CAP);
|
||||
/* need the internal __ version to avoid deadlocks */
|
||||
m->time = __ktime_get_real_seconds();
|
||||
m->cpuvendor = boot_cpu_data.x86_vendor;
|
||||
m->cpuid = cpuid_eax(1);
|
||||
m->socketid = cpu_data(m->extcpu).topo.pkg_id;
|
||||
m->apicid = cpu_data(m->extcpu).topo.initial_apicid;
|
||||
m->mcgcap = __rdmsr(MSR_IA32_MCG_CAP);
|
||||
m->ppin = cpu_data(m->extcpu).ppin;
|
||||
m->microcode = boot_cpu_data.microcode;
|
||||
m->time = __ktime_get_real_seconds();
|
||||
}
|
||||
|
||||
void mce_prep_record_per_cpu(unsigned int cpu, struct mce *m)
|
||||
{
|
||||
m->cpu = cpu;
|
||||
m->extcpu = cpu;
|
||||
m->apicid = cpu_data(cpu).topo.initial_apicid;
|
||||
m->microcode = cpu_data(cpu).microcode;
|
||||
m->ppin = topology_ppin(cpu);
|
||||
m->socketid = topology_physical_package_id(cpu);
|
||||
}
|
||||
|
||||
/* Do initial initialization of a struct mce */
|
||||
void mce_prep_record(struct mce *m)
|
||||
{
|
||||
mce_prep_record_common(m);
|
||||
mce_prep_record_per_cpu(smp_processor_id(), m);
|
||||
}
|
||||
|
||||
DEFINE_PER_CPU(struct mce, injectm);
|
||||
@@ -436,11 +448,11 @@ static noinstr void mce_wrmsrl(u32 msr, u64 v)
|
||||
static noinstr void mce_gather_info(struct mce *m, struct pt_regs *regs)
|
||||
{
|
||||
/*
|
||||
* Enable instrumentation around mce_setup() which calls external
|
||||
* Enable instrumentation around mce_prep_record() which calls external
|
||||
* facilities.
|
||||
*/
|
||||
instrumentation_begin();
|
||||
mce_setup(m);
|
||||
mce_prep_record(m);
|
||||
instrumentation_end();
|
||||
|
||||
m->mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS);
|
||||
|
||||
@@ -261,6 +261,8 @@ enum mca_msr {
|
||||
|
||||
/* Decide whether to add MCE record to MCE event pool or filter it out. */
|
||||
extern bool filter_mce(struct mce *m);
|
||||
void mce_prep_record_common(struct mce *m);
|
||||
void mce_prep_record_per_cpu(unsigned int cpu, struct mce *m);
|
||||
|
||||
#ifdef CONFIG_X86_MCE_AMD
|
||||
extern bool amd_filter_mce(struct mce *m);
|
||||
|
||||
@@ -89,6 +89,31 @@ static struct equiv_cpu_table {
|
||||
struct equiv_cpu_entry *entry;
|
||||
} equiv_table;
|
||||
|
||||
union zen_patch_rev {
|
||||
struct {
|
||||
__u32 rev : 8,
|
||||
stepping : 4,
|
||||
model : 4,
|
||||
__reserved : 4,
|
||||
ext_model : 4,
|
||||
ext_fam : 8;
|
||||
};
|
||||
__u32 ucode_rev;
|
||||
};
|
||||
|
||||
union cpuid_1_eax {
|
||||
struct {
|
||||
__u32 stepping : 4,
|
||||
model : 4,
|
||||
family : 4,
|
||||
__reserved0 : 4,
|
||||
ext_model : 4,
|
||||
ext_fam : 8,
|
||||
__reserved1 : 4;
|
||||
};
|
||||
__u32 full;
|
||||
};
|
||||
|
||||
/*
|
||||
* This points to the current valid container of microcode patches which we will
|
||||
* save from the initrd/builtin before jettisoning its contents. @mc is the
|
||||
@@ -96,7 +121,6 @@ static struct equiv_cpu_table {
|
||||
*/
|
||||
struct cont_desc {
|
||||
struct microcode_amd *mc;
|
||||
u32 cpuid_1_eax;
|
||||
u32 psize;
|
||||
u8 *data;
|
||||
size_t size;
|
||||
@@ -109,10 +133,42 @@ struct cont_desc {
|
||||
static const char
|
||||
ucode_path[] __maybe_unused = "kernel/x86/microcode/AuthenticAMD.bin";
|
||||
|
||||
/*
|
||||
* This is CPUID(1).EAX on the BSP. It is used in two ways:
|
||||
*
|
||||
* 1. To ignore the equivalence table on Zen1 and newer.
|
||||
*
|
||||
* 2. To match which patches to load because the patch revision ID
|
||||
* already contains the f/m/s for which the microcode is destined
|
||||
* for.
|
||||
*/
|
||||
static u32 bsp_cpuid_1_eax __ro_after_init;
|
||||
|
||||
static union cpuid_1_eax ucode_rev_to_cpuid(unsigned int val)
|
||||
{
|
||||
union zen_patch_rev p;
|
||||
union cpuid_1_eax c;
|
||||
|
||||
p.ucode_rev = val;
|
||||
c.full = 0;
|
||||
|
||||
c.stepping = p.stepping;
|
||||
c.model = p.model;
|
||||
c.ext_model = p.ext_model;
|
||||
c.family = 0xf;
|
||||
c.ext_fam = p.ext_fam;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
static u16 find_equiv_id(struct equiv_cpu_table *et, u32 sig)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* Zen and newer do not need an equivalence table. */
|
||||
if (x86_family(bsp_cpuid_1_eax) >= 0x17)
|
||||
return 0;
|
||||
|
||||
if (!et || !et->num_entries)
|
||||
return 0;
|
||||
|
||||
@@ -159,6 +215,10 @@ static bool verify_equivalence_table(const u8 *buf, size_t buf_size)
|
||||
if (!verify_container(buf, buf_size))
|
||||
return false;
|
||||
|
||||
/* Zen and newer do not need an equivalence table. */
|
||||
if (x86_family(bsp_cpuid_1_eax) >= 0x17)
|
||||
return true;
|
||||
|
||||
cont_type = hdr[1];
|
||||
if (cont_type != UCODE_EQUIV_CPU_TABLE_TYPE) {
|
||||
pr_debug("Wrong microcode container equivalence table type: %u.\n",
|
||||
@@ -222,8 +282,9 @@ __verify_patch_section(const u8 *buf, size_t buf_size, u32 *sh_psize)
|
||||
* exceed the per-family maximum). @sh_psize is the size read from the section
|
||||
* header.
|
||||
*/
|
||||
static unsigned int __verify_patch_size(u8 family, u32 sh_psize, size_t buf_size)
|
||||
static unsigned int __verify_patch_size(u32 sh_psize, size_t buf_size)
|
||||
{
|
||||
u8 family = x86_family(bsp_cpuid_1_eax);
|
||||
u32 max_size;
|
||||
|
||||
if (family >= 0x15)
|
||||
@@ -258,9 +319,9 @@ static unsigned int __verify_patch_size(u8 family, u32 sh_psize, size_t buf_size
|
||||
* positive: patch is not for this family, skip it
|
||||
* 0: success
|
||||
*/
|
||||
static int
|
||||
verify_patch(u8 family, const u8 *buf, size_t buf_size, u32 *patch_size)
|
||||
static int verify_patch(const u8 *buf, size_t buf_size, u32 *patch_size)
|
||||
{
|
||||
u8 family = x86_family(bsp_cpuid_1_eax);
|
||||
struct microcode_header_amd *mc_hdr;
|
||||
unsigned int ret;
|
||||
u32 sh_psize;
|
||||
@@ -286,7 +347,7 @@ verify_patch(u8 family, const u8 *buf, size_t buf_size, u32 *patch_size)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = __verify_patch_size(family, sh_psize, buf_size);
|
||||
ret = __verify_patch_size(sh_psize, buf_size);
|
||||
if (!ret) {
|
||||
pr_debug("Per-family patch size mismatch.\n");
|
||||
return -1;
|
||||
@@ -308,6 +369,15 @@ verify_patch(u8 family, const u8 *buf, size_t buf_size, u32 *patch_size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool mc_patch_matches(struct microcode_amd *mc, u16 eq_id)
|
||||
{
|
||||
/* Zen and newer do not need an equivalence table. */
|
||||
if (x86_family(bsp_cpuid_1_eax) >= 0x17)
|
||||
return ucode_rev_to_cpuid(mc->hdr.patch_id).full == bsp_cpuid_1_eax;
|
||||
else
|
||||
return eq_id == mc->hdr.processor_rev_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* This scans the ucode blob for the proper container as we can have multiple
|
||||
* containers glued together. Returns the equivalence ID from the equivalence
|
||||
@@ -336,7 +406,7 @@ static size_t parse_container(u8 *ucode, size_t size, struct cont_desc *desc)
|
||||
* doesn't contain a patch for the CPU, scan through the whole container
|
||||
* so that it can be skipped in case there are other containers appended.
|
||||
*/
|
||||
eq_id = find_equiv_id(&table, desc->cpuid_1_eax);
|
||||
eq_id = find_equiv_id(&table, bsp_cpuid_1_eax);
|
||||
|
||||
buf += hdr[2] + CONTAINER_HDR_SZ;
|
||||
size -= hdr[2] + CONTAINER_HDR_SZ;
|
||||
@@ -350,7 +420,7 @@ static size_t parse_container(u8 *ucode, size_t size, struct cont_desc *desc)
|
||||
u32 patch_size;
|
||||
int ret;
|
||||
|
||||
ret = verify_patch(x86_family(desc->cpuid_1_eax), buf, size, &patch_size);
|
||||
ret = verify_patch(buf, size, &patch_size);
|
||||
if (ret < 0) {
|
||||
/*
|
||||
* Patch verification failed, skip to the next container, if
|
||||
@@ -363,7 +433,7 @@ static size_t parse_container(u8 *ucode, size_t size, struct cont_desc *desc)
|
||||
}
|
||||
|
||||
mc = (struct microcode_amd *)(buf + SECTION_HDR_SIZE);
|
||||
if (eq_id == mc->hdr.processor_rev_id) {
|
||||
if (mc_patch_matches(mc, eq_id)) {
|
||||
desc->psize = patch_size;
|
||||
desc->mc = mc;
|
||||
}
|
||||
@@ -421,6 +491,7 @@ static int __apply_microcode_amd(struct microcode_amd *mc)
|
||||
|
||||
/* verify patch application was successful */
|
||||
native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
|
||||
|
||||
if (rev != mc->hdr.patch_id)
|
||||
return -1;
|
||||
|
||||
@@ -438,14 +509,12 @@ static int __apply_microcode_amd(struct microcode_amd *mc)
|
||||
*
|
||||
* Returns true if container found (sets @desc), false otherwise.
|
||||
*/
|
||||
static bool early_apply_microcode(u32 cpuid_1_eax, u32 old_rev, void *ucode, size_t size)
|
||||
static bool early_apply_microcode(u32 old_rev, void *ucode, size_t size)
|
||||
{
|
||||
struct cont_desc desc = { 0 };
|
||||
struct microcode_amd *mc;
|
||||
bool ret = false;
|
||||
|
||||
desc.cpuid_1_eax = cpuid_1_eax;
|
||||
|
||||
scan_containers(ucode, size, &desc);
|
||||
|
||||
mc = desc.mc;
|
||||
@@ -463,9 +532,10 @@ static bool early_apply_microcode(u32 cpuid_1_eax, u32 old_rev, void *ucode, siz
|
||||
return !__apply_microcode_amd(mc);
|
||||
}
|
||||
|
||||
static bool get_builtin_microcode(struct cpio_data *cp, u8 family)
|
||||
static bool get_builtin_microcode(struct cpio_data *cp)
|
||||
{
|
||||
char fw_name[36] = "amd-ucode/microcode_amd.bin";
|
||||
u8 family = x86_family(bsp_cpuid_1_eax);
|
||||
struct firmware fw;
|
||||
|
||||
if (IS_ENABLED(CONFIG_X86_32))
|
||||
@@ -484,11 +554,11 @@ static bool get_builtin_microcode(struct cpio_data *cp, u8 family)
|
||||
return false;
|
||||
}
|
||||
|
||||
static void __init find_blobs_in_containers(unsigned int cpuid_1_eax, struct cpio_data *ret)
|
||||
static void __init find_blobs_in_containers(struct cpio_data *ret)
|
||||
{
|
||||
struct cpio_data cp;
|
||||
|
||||
if (!get_builtin_microcode(&cp, x86_family(cpuid_1_eax)))
|
||||
if (!get_builtin_microcode(&cp))
|
||||
cp = find_microcode_in_initrd(ucode_path);
|
||||
|
||||
*ret = cp;
|
||||
@@ -499,16 +569,18 @@ void __init load_ucode_amd_bsp(struct early_load_data *ed, unsigned int cpuid_1_
|
||||
struct cpio_data cp = { };
|
||||
u32 dummy;
|
||||
|
||||
bsp_cpuid_1_eax = cpuid_1_eax;
|
||||
|
||||
native_rdmsr(MSR_AMD64_PATCH_LEVEL, ed->old_rev, dummy);
|
||||
|
||||
/* Needed in load_microcode_amd() */
|
||||
ucode_cpu_info[0].cpu_sig.sig = cpuid_1_eax;
|
||||
|
||||
find_blobs_in_containers(cpuid_1_eax, &cp);
|
||||
find_blobs_in_containers(&cp);
|
||||
if (!(cp.data && cp.size))
|
||||
return;
|
||||
|
||||
if (early_apply_microcode(cpuid_1_eax, ed->old_rev, cp.data, cp.size))
|
||||
if (early_apply_microcode(ed->old_rev, cp.data, cp.size))
|
||||
native_rdmsr(MSR_AMD64_PATCH_LEVEL, ed->new_rev, dummy);
|
||||
}
|
||||
|
||||
@@ -525,12 +597,10 @@ static int __init save_microcode_in_initrd(void)
|
||||
if (dis_ucode_ldr || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)
|
||||
return 0;
|
||||
|
||||
find_blobs_in_containers(cpuid_1_eax, &cp);
|
||||
find_blobs_in_containers(&cp);
|
||||
if (!(cp.data && cp.size))
|
||||
return -EINVAL;
|
||||
|
||||
desc.cpuid_1_eax = cpuid_1_eax;
|
||||
|
||||
scan_containers(cp.data, cp.size, &desc);
|
||||
if (!desc.mc)
|
||||
return -EINVAL;
|
||||
@@ -543,26 +613,65 @@ static int __init save_microcode_in_initrd(void)
|
||||
}
|
||||
early_initcall(save_microcode_in_initrd);
|
||||
|
||||
static inline bool patch_cpus_equivalent(struct ucode_patch *p, struct ucode_patch *n)
|
||||
{
|
||||
/* Zen and newer hardcode the f/m/s in the patch ID */
|
||||
if (x86_family(bsp_cpuid_1_eax) >= 0x17) {
|
||||
union cpuid_1_eax p_cid = ucode_rev_to_cpuid(p->patch_id);
|
||||
union cpuid_1_eax n_cid = ucode_rev_to_cpuid(n->patch_id);
|
||||
|
||||
/* Zap stepping */
|
||||
p_cid.stepping = 0;
|
||||
n_cid.stepping = 0;
|
||||
|
||||
return p_cid.full == n_cid.full;
|
||||
} else {
|
||||
return p->equiv_cpu == n->equiv_cpu;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* a small, trivial cache of per-family ucode patches
|
||||
*/
|
||||
static struct ucode_patch *cache_find_patch(u16 equiv_cpu)
|
||||
static struct ucode_patch *cache_find_patch(struct ucode_cpu_info *uci, u16 equiv_cpu)
|
||||
{
|
||||
struct ucode_patch *p;
|
||||
struct ucode_patch n;
|
||||
|
||||
n.equiv_cpu = equiv_cpu;
|
||||
n.patch_id = uci->cpu_sig.rev;
|
||||
|
||||
WARN_ON_ONCE(!n.patch_id);
|
||||
|
||||
list_for_each_entry(p, µcode_cache, plist)
|
||||
if (p->equiv_cpu == equiv_cpu)
|
||||
if (patch_cpus_equivalent(p, &n))
|
||||
return p;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline bool patch_newer(struct ucode_patch *p, struct ucode_patch *n)
|
||||
{
|
||||
/* Zen and newer hardcode the f/m/s in the patch ID */
|
||||
if (x86_family(bsp_cpuid_1_eax) >= 0x17) {
|
||||
union zen_patch_rev zp, zn;
|
||||
|
||||
zp.ucode_rev = p->patch_id;
|
||||
zn.ucode_rev = n->patch_id;
|
||||
|
||||
return zn.rev > zp.rev;
|
||||
} else {
|
||||
return n->patch_id > p->patch_id;
|
||||
}
|
||||
}
|
||||
|
||||
static void update_cache(struct ucode_patch *new_patch)
|
||||
{
|
||||
struct ucode_patch *p;
|
||||
|
||||
list_for_each_entry(p, µcode_cache, plist) {
|
||||
if (p->equiv_cpu == new_patch->equiv_cpu) {
|
||||
if (p->patch_id >= new_patch->patch_id) {
|
||||
if (patch_cpus_equivalent(p, new_patch)) {
|
||||
if (!patch_newer(p, new_patch)) {
|
||||
/* we already have the latest patch */
|
||||
kfree(new_patch->data);
|
||||
kfree(new_patch);
|
||||
@@ -593,13 +702,22 @@ static void free_cache(void)
|
||||
static struct ucode_patch *find_patch(unsigned int cpu)
|
||||
{
|
||||
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
|
||||
u16 equiv_id;
|
||||
u32 rev, dummy __always_unused;
|
||||
u16 equiv_id = 0;
|
||||
|
||||
equiv_id = find_equiv_id(&equiv_table, uci->cpu_sig.sig);
|
||||
if (!equiv_id)
|
||||
return NULL;
|
||||
/* fetch rev if not populated yet: */
|
||||
if (!uci->cpu_sig.rev) {
|
||||
rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
|
||||
uci->cpu_sig.rev = rev;
|
||||
}
|
||||
|
||||
return cache_find_patch(equiv_id);
|
||||
if (x86_family(bsp_cpuid_1_eax) < 0x17) {
|
||||
equiv_id = find_equiv_id(&equiv_table, uci->cpu_sig.sig);
|
||||
if (!equiv_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return cache_find_patch(uci, equiv_id);
|
||||
}
|
||||
|
||||
void reload_ucode_amd(unsigned int cpu)
|
||||
@@ -649,7 +767,7 @@ static enum ucode_state apply_microcode_amd(int cpu)
|
||||
struct ucode_cpu_info *uci;
|
||||
struct ucode_patch *p;
|
||||
enum ucode_state ret;
|
||||
u32 rev, dummy __always_unused;
|
||||
u32 rev;
|
||||
|
||||
BUG_ON(raw_smp_processor_id() != cpu);
|
||||
|
||||
@@ -659,11 +777,11 @@ static enum ucode_state apply_microcode_amd(int cpu)
|
||||
if (!p)
|
||||
return UCODE_NFOUND;
|
||||
|
||||
rev = uci->cpu_sig.rev;
|
||||
|
||||
mc_amd = p->data;
|
||||
uci->mc = p->data;
|
||||
|
||||
rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
|
||||
|
||||
/* need to apply patch? */
|
||||
if (rev > mc_amd->hdr.patch_id) {
|
||||
ret = UCODE_OK;
|
||||
@@ -709,6 +827,10 @@ static size_t install_equiv_cpu_table(const u8 *buf, size_t buf_size)
|
||||
hdr = (const u32 *)buf;
|
||||
equiv_tbl_len = hdr[2];
|
||||
|
||||
/* Zen and newer do not need an equivalence table. */
|
||||
if (x86_family(bsp_cpuid_1_eax) >= 0x17)
|
||||
goto out;
|
||||
|
||||
equiv_table.entry = vmalloc(equiv_tbl_len);
|
||||
if (!equiv_table.entry) {
|
||||
pr_err("failed to allocate equivalent CPU table\n");
|
||||
@@ -718,12 +840,16 @@ static size_t install_equiv_cpu_table(const u8 *buf, size_t buf_size)
|
||||
memcpy(equiv_table.entry, buf + CONTAINER_HDR_SZ, equiv_tbl_len);
|
||||
equiv_table.num_entries = equiv_tbl_len / sizeof(struct equiv_cpu_entry);
|
||||
|
||||
out:
|
||||
/* add header length */
|
||||
return equiv_tbl_len + CONTAINER_HDR_SZ;
|
||||
}
|
||||
|
||||
static void free_equiv_cpu_table(void)
|
||||
{
|
||||
if (x86_family(bsp_cpuid_1_eax) >= 0x17)
|
||||
return;
|
||||
|
||||
vfree(equiv_table.entry);
|
||||
memset(&equiv_table, 0, sizeof(equiv_table));
|
||||
}
|
||||
@@ -749,7 +875,7 @@ static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover,
|
||||
u16 proc_id;
|
||||
int ret;
|
||||
|
||||
ret = verify_patch(family, fw, leftover, patch_size);
|
||||
ret = verify_patch(fw, leftover, patch_size);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -774,7 +900,7 @@ static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover,
|
||||
patch->patch_id = mc_hdr->patch_id;
|
||||
patch->equiv_cpu = proc_id;
|
||||
|
||||
pr_debug("%s: Added patch_id: 0x%08x, proc_id: 0x%04x\n",
|
||||
pr_debug("%s: Adding patch_id: 0x%08x, proc_id: 0x%04x\n",
|
||||
__func__, patch->patch_id, proc_id);
|
||||
|
||||
/* ... and add to cache. */
|
||||
|
||||
@@ -475,24 +475,25 @@ struct sgx_epc_page *__sgx_alloc_epc_page(void)
|
||||
{
|
||||
struct sgx_epc_page *page;
|
||||
int nid_of_current = numa_node_id();
|
||||
int nid = nid_of_current;
|
||||
int nid_start, nid;
|
||||
|
||||
if (node_isset(nid_of_current, sgx_numa_mask)) {
|
||||
page = __sgx_alloc_epc_page_from_node(nid_of_current);
|
||||
if (page)
|
||||
return page;
|
||||
}
|
||||
|
||||
/* Fall back to the non-local NUMA nodes: */
|
||||
while (true) {
|
||||
nid = next_node_in(nid, sgx_numa_mask);
|
||||
if (nid == nid_of_current)
|
||||
break;
|
||||
/*
|
||||
* Try local node first. If it doesn't have an EPC section,
|
||||
* fall back to the non-local NUMA nodes.
|
||||
*/
|
||||
if (node_isset(nid_of_current, sgx_numa_mask))
|
||||
nid_start = nid_of_current;
|
||||
else
|
||||
nid_start = next_node_in(nid_of_current, sgx_numa_mask);
|
||||
|
||||
nid = nid_start;
|
||||
do {
|
||||
page = __sgx_alloc_epc_page_from_node(nid);
|
||||
if (page)
|
||||
return page;
|
||||
}
|
||||
|
||||
nid = next_node_in(nid, sgx_numa_mask);
|
||||
} while (nid != nid_start);
|
||||
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
@@ -847,6 +848,13 @@ static bool __init sgx_page_cache_init(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
for_each_online_node(nid) {
|
||||
if (!node_isset(nid, sgx_numa_mask) &&
|
||||
node_state(nid, N_MEMORY) && node_state(nid, N_CPU))
|
||||
pr_info("node%d has both CPUs and memory but doesn't have an EPC section\n",
|
||||
nid);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1305,7 +1305,7 @@ config CRYPTO_JITTERENTROPY_MEMORY_BLOCKSIZE
|
||||
config CRYPTO_JITTERENTROPY_OSR
|
||||
int "CPU Jitter RNG Oversampling Rate"
|
||||
range 1 15
|
||||
default 1
|
||||
default 3
|
||||
help
|
||||
The Jitter RNG allows the specification of an oversampling rate (OSR).
|
||||
The Jitter RNG operation requires a fixed amount of timing
|
||||
|
||||
@@ -323,8 +323,9 @@ static __always_inline
|
||||
int crypto_aegis128_process_crypt(struct aegis_state *state,
|
||||
struct skcipher_walk *walk,
|
||||
void (*crypt)(struct aegis_state *state,
|
||||
u8 *dst, const u8 *src,
|
||||
unsigned int size))
|
||||
u8 *dst,
|
||||
const u8 *src,
|
||||
unsigned int size))
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
|
||||
+15
-56
@@ -235,7 +235,6 @@ void crypto_remove_spawns(struct crypto_alg *alg, struct list_head *list,
|
||||
EXPORT_SYMBOL_GPL(crypto_remove_spawns);
|
||||
|
||||
static void crypto_alg_finish_registration(struct crypto_alg *alg,
|
||||
bool fulfill_requests,
|
||||
struct list_head *algs_to_put)
|
||||
{
|
||||
struct crypto_alg *q;
|
||||
@@ -247,30 +246,8 @@ static void crypto_alg_finish_registration(struct crypto_alg *alg,
|
||||
if (crypto_is_moribund(q))
|
||||
continue;
|
||||
|
||||
if (crypto_is_larval(q)) {
|
||||
struct crypto_larval *larval = (void *)q;
|
||||
|
||||
/*
|
||||
* Check to see if either our generic name or
|
||||
* specific name can satisfy the name requested
|
||||
* by the larval entry q.
|
||||
*/
|
||||
if (strcmp(alg->cra_name, q->cra_name) &&
|
||||
strcmp(alg->cra_driver_name, q->cra_name))
|
||||
continue;
|
||||
|
||||
if (larval->adult)
|
||||
continue;
|
||||
if ((q->cra_flags ^ alg->cra_flags) & larval->mask)
|
||||
continue;
|
||||
|
||||
if (fulfill_requests && crypto_mod_get(alg))
|
||||
larval->adult = alg;
|
||||
else
|
||||
larval->adult = ERR_PTR(-EAGAIN);
|
||||
|
||||
if (crypto_is_larval(q))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(alg->cra_name, q->cra_name))
|
||||
continue;
|
||||
@@ -359,7 +336,7 @@ __crypto_register_alg(struct crypto_alg *alg, struct list_head *algs_to_put)
|
||||
list_add(&larval->alg.cra_list, &crypto_alg_list);
|
||||
} else {
|
||||
alg->cra_flags |= CRYPTO_ALG_TESTED;
|
||||
crypto_alg_finish_registration(alg, true, algs_to_put);
|
||||
crypto_alg_finish_registration(alg, algs_to_put);
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -376,7 +353,6 @@ void crypto_alg_tested(const char *name, int err)
|
||||
struct crypto_alg *alg;
|
||||
struct crypto_alg *q;
|
||||
LIST_HEAD(list);
|
||||
bool best;
|
||||
|
||||
down_write(&crypto_alg_sem);
|
||||
list_for_each_entry(q, &crypto_alg_list, cra_list) {
|
||||
@@ -390,7 +366,8 @@ void crypto_alg_tested(const char *name, int err)
|
||||
}
|
||||
|
||||
pr_err("alg: Unexpected test result for %s: %d\n", name, err);
|
||||
goto unlock;
|
||||
up_write(&crypto_alg_sem);
|
||||
return;
|
||||
|
||||
found:
|
||||
q->cra_flags |= CRYPTO_ALG_DEAD;
|
||||
@@ -408,32 +385,15 @@ found:
|
||||
|
||||
alg->cra_flags |= CRYPTO_ALG_TESTED;
|
||||
|
||||
/*
|
||||
* If a higher-priority implementation of the same algorithm is
|
||||
* currently being tested, then don't fulfill request larvals.
|
||||
*/
|
||||
best = true;
|
||||
list_for_each_entry(q, &crypto_alg_list, cra_list) {
|
||||
if (crypto_is_moribund(q) || !crypto_is_larval(q))
|
||||
continue;
|
||||
|
||||
if (strcmp(alg->cra_name, q->cra_name))
|
||||
continue;
|
||||
|
||||
if (q->cra_priority > alg->cra_priority) {
|
||||
best = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
crypto_alg_finish_registration(alg, best, &list);
|
||||
crypto_alg_finish_registration(alg, &list);
|
||||
|
||||
complete:
|
||||
list_del_init(&test->alg.cra_list);
|
||||
complete_all(&test->completion);
|
||||
|
||||
unlock:
|
||||
up_write(&crypto_alg_sem);
|
||||
|
||||
crypto_alg_put(&test->alg);
|
||||
crypto_remove_final(&list);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_alg_tested);
|
||||
@@ -454,7 +414,6 @@ int crypto_register_alg(struct crypto_alg *alg)
|
||||
{
|
||||
struct crypto_larval *larval;
|
||||
LIST_HEAD(algs_to_put);
|
||||
bool test_started = false;
|
||||
int err;
|
||||
|
||||
alg->cra_flags &= ~CRYPTO_ALG_DEAD;
|
||||
@@ -465,15 +424,16 @@ int crypto_register_alg(struct crypto_alg *alg)
|
||||
down_write(&crypto_alg_sem);
|
||||
larval = __crypto_register_alg(alg, &algs_to_put);
|
||||
if (!IS_ERR_OR_NULL(larval)) {
|
||||
test_started = crypto_boot_test_finished();
|
||||
bool test_started = crypto_boot_test_finished();
|
||||
|
||||
larval->test_started = test_started;
|
||||
if (test_started)
|
||||
crypto_schedule_test(larval);
|
||||
}
|
||||
up_write(&crypto_alg_sem);
|
||||
|
||||
if (IS_ERR(larval))
|
||||
return PTR_ERR(larval);
|
||||
if (test_started)
|
||||
crypto_wait_for_test(larval);
|
||||
crypto_remove_final(&algs_to_put);
|
||||
return 0;
|
||||
}
|
||||
@@ -688,8 +648,10 @@ int crypto_register_instance(struct crypto_template *tmpl,
|
||||
larval = __crypto_register_alg(&inst->alg, &algs_to_put);
|
||||
if (IS_ERR(larval))
|
||||
goto unlock;
|
||||
else if (larval)
|
||||
else if (larval) {
|
||||
larval->test_started = true;
|
||||
crypto_schedule_test(larval);
|
||||
}
|
||||
|
||||
hlist_add_head(&inst->list, &tmpl->instances);
|
||||
inst->tmpl = tmpl;
|
||||
@@ -699,8 +661,6 @@ unlock:
|
||||
|
||||
if (IS_ERR(larval))
|
||||
return PTR_ERR(larval);
|
||||
if (larval)
|
||||
crypto_wait_for_test(larval);
|
||||
crypto_remove_final(&algs_to_put);
|
||||
return 0;
|
||||
}
|
||||
@@ -1084,6 +1044,7 @@ static void __init crypto_start_tests(void)
|
||||
|
||||
l->test_started = true;
|
||||
larval = l;
|
||||
crypto_schedule_test(larval);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1091,8 +1052,6 @@ static void __init crypto_start_tests(void)
|
||||
|
||||
if (!larval)
|
||||
break;
|
||||
|
||||
crypto_wait_for_test(larval);
|
||||
}
|
||||
|
||||
set_crypto_boot_test_finished();
|
||||
|
||||
+3
-1
@@ -51,7 +51,7 @@ static int cryptomgr_probe(void *data)
|
||||
{
|
||||
struct cryptomgr_param *param = data;
|
||||
struct crypto_template *tmpl;
|
||||
int err;
|
||||
int err = -ENOENT;
|
||||
|
||||
tmpl = crypto_lookup_template(param->template);
|
||||
if (!tmpl)
|
||||
@@ -64,6 +64,8 @@ static int cryptomgr_probe(void *data)
|
||||
crypto_tmpl_put(tmpl);
|
||||
|
||||
out:
|
||||
param->larval->adult = ERR_PTR(err);
|
||||
param->larval->alg.cra_flags |= CRYPTO_ALG_DEAD;
|
||||
complete_all(¶m->larval->completion);
|
||||
crypto_alg_put(¶m->larval->alg);
|
||||
kfree(param);
|
||||
|
||||
+46
-29
@@ -37,6 +37,8 @@ DEFINE_STATIC_KEY_FALSE(__crypto_boot_test_finished);
|
||||
#endif
|
||||
|
||||
static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg);
|
||||
static struct crypto_alg *crypto_alg_lookup(const char *name, u32 type,
|
||||
u32 mask);
|
||||
|
||||
struct crypto_alg *crypto_mod_get(struct crypto_alg *alg)
|
||||
{
|
||||
@@ -68,11 +70,6 @@ static struct crypto_alg *__crypto_alg_lookup(const char *name, u32 type,
|
||||
if ((q->cra_flags ^ type) & mask)
|
||||
continue;
|
||||
|
||||
if (crypto_is_larval(q) &&
|
||||
!crypto_is_test_larval((struct crypto_larval *)q) &&
|
||||
((struct crypto_larval *)q)->mask != mask)
|
||||
continue;
|
||||
|
||||
exact = !strcmp(q->cra_driver_name, name);
|
||||
fuzzy = !strcmp(q->cra_name, name);
|
||||
if (!exact && !(fuzzy && q->cra_priority > best))
|
||||
@@ -111,6 +108,8 @@ struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask)
|
||||
if (!larval)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
type &= ~CRYPTO_ALG_TYPE_MASK | (mask ?: CRYPTO_ALG_TYPE_MASK);
|
||||
|
||||
larval->mask = mask;
|
||||
larval->alg.cra_flags = CRYPTO_ALG_LARVAL | type;
|
||||
larval->alg.cra_priority = -1;
|
||||
@@ -152,32 +151,31 @@ static struct crypto_alg *crypto_larval_add(const char *name, u32 type,
|
||||
return alg;
|
||||
}
|
||||
|
||||
void crypto_larval_kill(struct crypto_alg *alg)
|
||||
static void crypto_larval_kill(struct crypto_larval *larval)
|
||||
{
|
||||
struct crypto_larval *larval = (void *)alg;
|
||||
bool unlinked;
|
||||
|
||||
down_write(&crypto_alg_sem);
|
||||
list_del(&alg->cra_list);
|
||||
unlinked = list_empty(&larval->alg.cra_list);
|
||||
if (!unlinked)
|
||||
list_del_init(&larval->alg.cra_list);
|
||||
up_write(&crypto_alg_sem);
|
||||
complete_all(&larval->completion);
|
||||
crypto_alg_put(alg);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_larval_kill);
|
||||
|
||||
void crypto_wait_for_test(struct crypto_larval *larval)
|
||||
if (unlinked)
|
||||
return;
|
||||
|
||||
complete_all(&larval->completion);
|
||||
crypto_alg_put(&larval->alg);
|
||||
}
|
||||
|
||||
void crypto_schedule_test(struct crypto_larval *larval)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = crypto_probing_notify(CRYPTO_MSG_ALG_REGISTER, larval->adult);
|
||||
if (WARN_ON_ONCE(err != NOTIFY_STOP))
|
||||
goto out;
|
||||
|
||||
err = wait_for_completion_killable(&larval->completion);
|
||||
WARN_ON(err);
|
||||
out:
|
||||
crypto_larval_kill(&larval->alg);
|
||||
WARN_ON_ONCE(err != NOTIFY_STOP);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_wait_for_test);
|
||||
EXPORT_SYMBOL_GPL(crypto_schedule_test);
|
||||
|
||||
static void crypto_start_test(struct crypto_larval *larval)
|
||||
{
|
||||
@@ -196,14 +194,17 @@ static void crypto_start_test(struct crypto_larval *larval)
|
||||
larval->test_started = true;
|
||||
up_write(&crypto_alg_sem);
|
||||
|
||||
crypto_wait_for_test(larval);
|
||||
crypto_schedule_test(larval);
|
||||
}
|
||||
|
||||
static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
|
||||
{
|
||||
struct crypto_larval *larval = (void *)alg;
|
||||
struct crypto_larval *larval;
|
||||
long time_left;
|
||||
|
||||
again:
|
||||
larval = container_of(alg, struct crypto_larval, alg);
|
||||
|
||||
if (!crypto_boot_test_finished())
|
||||
crypto_start_test(larval);
|
||||
|
||||
@@ -213,11 +214,20 @@ static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
|
||||
alg = larval->adult;
|
||||
if (time_left < 0)
|
||||
alg = ERR_PTR(-EINTR);
|
||||
else if (!time_left)
|
||||
else if (!time_left) {
|
||||
if (crypto_is_test_larval(larval))
|
||||
crypto_larval_kill(larval);
|
||||
alg = ERR_PTR(-ETIMEDOUT);
|
||||
else if (!alg)
|
||||
alg = ERR_PTR(-ENOENT);
|
||||
else if (IS_ERR(alg))
|
||||
} else if (!alg) {
|
||||
u32 type;
|
||||
u32 mask;
|
||||
|
||||
alg = &larval->alg;
|
||||
type = alg->cra_flags & ~(CRYPTO_ALG_LARVAL | CRYPTO_ALG_DEAD);
|
||||
mask = larval->mask;
|
||||
alg = crypto_alg_lookup(alg->cra_name, type, mask) ?:
|
||||
ERR_PTR(-EAGAIN);
|
||||
} else if (IS_ERR(alg))
|
||||
;
|
||||
else if (crypto_is_test_larval(larval) &&
|
||||
!(alg->cra_flags & CRYPTO_ALG_TESTED))
|
||||
@@ -228,6 +238,9 @@ static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
|
||||
alg = ERR_PTR(-EAGAIN);
|
||||
crypto_mod_put(&larval->alg);
|
||||
|
||||
if (!IS_ERR(alg) && crypto_is_larval(alg))
|
||||
goto again;
|
||||
|
||||
return alg;
|
||||
}
|
||||
|
||||
@@ -292,8 +305,12 @@ static struct crypto_alg *crypto_larval_lookup(const char *name, u32 type,
|
||||
|
||||
if (!IS_ERR_OR_NULL(alg) && crypto_is_larval(alg))
|
||||
alg = crypto_larval_wait(alg);
|
||||
else if (!alg)
|
||||
else if (alg)
|
||||
;
|
||||
else if (!(mask & CRYPTO_ALG_TESTED))
|
||||
alg = crypto_larval_add(name, type, mask);
|
||||
else
|
||||
alg = ERR_PTR(-ENOENT);
|
||||
|
||||
return alg;
|
||||
}
|
||||
@@ -340,7 +357,7 @@ struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask)
|
||||
crypto_mod_put(larval);
|
||||
alg = ERR_PTR(-ENOENT);
|
||||
}
|
||||
crypto_larval_kill(larval);
|
||||
crypto_larval_kill(container_of(larval, struct crypto_larval, alg));
|
||||
return alg;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_alg_mod_lookup);
|
||||
|
||||
@@ -27,7 +27,7 @@ struct chachapoly_ctx {
|
||||
struct crypto_ahash *poly;
|
||||
/* key bytes we use for the ChaCha20 IV */
|
||||
unsigned int saltlen;
|
||||
u8 salt[];
|
||||
u8 salt[] __counted_by(saltlen);
|
||||
};
|
||||
|
||||
struct poly_req {
|
||||
|
||||
+2
-2
@@ -145,9 +145,9 @@ static int dh_is_pubkey_valid(struct dh_ctx *ctx, MPI y)
|
||||
* ->p is odd, so no need to explicitly subtract one
|
||||
* from it before shifting to the right.
|
||||
*/
|
||||
mpi_rshift(q, ctx->p, 1);
|
||||
ret = mpi_rshift(q, ctx->p, 1) ?:
|
||||
mpi_powm(val, y, q, ctx->p);
|
||||
|
||||
ret = mpi_powm(val, y, q, ctx->p);
|
||||
mpi_free(q);
|
||||
if (ret) {
|
||||
mpi_free(val);
|
||||
|
||||
+1
-2
@@ -113,8 +113,7 @@ struct crypto_alg *crypto_mod_get(struct crypto_alg *alg);
|
||||
struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask);
|
||||
|
||||
struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask);
|
||||
void crypto_larval_kill(struct crypto_alg *alg);
|
||||
void crypto_wait_for_test(struct crypto_larval *larval);
|
||||
void crypto_schedule_test(struct crypto_larval *larval);
|
||||
void crypto_alg_tested(const char *name, int err);
|
||||
|
||||
void crypto_remove_spawns(struct crypto_alg *alg, struct list_head *list,
|
||||
|
||||
@@ -146,6 +146,7 @@ struct rand_data {
|
||||
#define JENT_ENTROPY_SAFETY_FACTOR 64
|
||||
|
||||
#include <linux/fips.h>
|
||||
#include <linux/minmax.h>
|
||||
#include "jitterentropy.h"
|
||||
|
||||
/***************************************************************************
|
||||
@@ -638,10 +639,7 @@ int jent_read_entropy(struct rand_data *ec, unsigned char *data,
|
||||
return -2;
|
||||
}
|
||||
|
||||
if ((DATA_SIZE_BITS / 8) < len)
|
||||
tocopy = (DATA_SIZE_BITS / 8);
|
||||
else
|
||||
tocopy = len;
|
||||
tocopy = min(DATA_SIZE_BITS / 8, len);
|
||||
if (jent_read_random_block(ec->hash_state, p, tocopy))
|
||||
return -1;
|
||||
|
||||
|
||||
+12
-7
@@ -98,14 +98,13 @@ static int _rsa_dec_crt(const struct rsa_mpi_key *key, MPI m_or_m1_or_h, MPI c)
|
||||
goto err_free_mpi;
|
||||
|
||||
/* (2iii) h = (m_1 - m_2) * qInv mod p */
|
||||
mpi_sub(m12_or_qh, m_or_m1_or_h, m2);
|
||||
mpi_mulm(m_or_m1_or_h, m12_or_qh, key->qinv, key->p);
|
||||
ret = mpi_sub(m12_or_qh, m_or_m1_or_h, m2) ?:
|
||||
mpi_mulm(m_or_m1_or_h, m12_or_qh, key->qinv, key->p);
|
||||
|
||||
/* (2iv) m = m_2 + q * h */
|
||||
mpi_mul(m12_or_qh, key->q, m_or_m1_or_h);
|
||||
mpi_addm(m_or_m1_or_h, m2, m12_or_qh, key->n);
|
||||
|
||||
ret = 0;
|
||||
ret = ret ?:
|
||||
mpi_mul(m12_or_qh, key->q, m_or_m1_or_h) ?:
|
||||
mpi_addm(m_or_m1_or_h, m2, m12_or_qh, key->n);
|
||||
|
||||
err_free_mpi:
|
||||
mpi_free(m12_or_qh);
|
||||
@@ -236,6 +235,7 @@ static int rsa_check_key_length(unsigned int len)
|
||||
static int rsa_check_exponent_fips(MPI e)
|
||||
{
|
||||
MPI e_max = NULL;
|
||||
int err;
|
||||
|
||||
/* check if odd */
|
||||
if (!mpi_test_bit(e, 0)) {
|
||||
@@ -250,7 +250,12 @@ static int rsa_check_exponent_fips(MPI e)
|
||||
e_max = mpi_alloc(0);
|
||||
if (!e_max)
|
||||
return -ENOMEM;
|
||||
mpi_set_bit(e_max, 256);
|
||||
|
||||
err = mpi_set_bit(e_max, 256);
|
||||
if (err) {
|
||||
mpi_free(e_max);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (mpi_cmp(e, e_max) >= 0) {
|
||||
mpi_free(e_max);
|
||||
|
||||
+15
-61
@@ -136,27 +136,19 @@ static int simd_skcipher_init(struct crypto_skcipher *tfm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct simd_skcipher_alg *simd_skcipher_create_compat(const char *algname,
|
||||
struct simd_skcipher_alg *simd_skcipher_create_compat(struct skcipher_alg *ialg,
|
||||
const char *algname,
|
||||
const char *drvname,
|
||||
const char *basename)
|
||||
{
|
||||
struct simd_skcipher_alg *salg;
|
||||
struct crypto_skcipher *tfm;
|
||||
struct skcipher_alg *ialg;
|
||||
struct skcipher_alg *alg;
|
||||
int err;
|
||||
|
||||
tfm = crypto_alloc_skcipher(basename, CRYPTO_ALG_INTERNAL,
|
||||
CRYPTO_ALG_INTERNAL | CRYPTO_ALG_ASYNC);
|
||||
if (IS_ERR(tfm))
|
||||
return ERR_CAST(tfm);
|
||||
|
||||
ialg = crypto_skcipher_alg(tfm);
|
||||
|
||||
salg = kzalloc(sizeof(*salg), GFP_KERNEL);
|
||||
if (!salg) {
|
||||
salg = ERR_PTR(-ENOMEM);
|
||||
goto out_put_tfm;
|
||||
goto out;
|
||||
}
|
||||
|
||||
salg->ialg_name = basename;
|
||||
@@ -195,30 +187,16 @@ struct simd_skcipher_alg *simd_skcipher_create_compat(const char *algname,
|
||||
if (err)
|
||||
goto out_free_salg;
|
||||
|
||||
out_put_tfm:
|
||||
crypto_free_skcipher(tfm);
|
||||
out:
|
||||
return salg;
|
||||
|
||||
out_free_salg:
|
||||
kfree(salg);
|
||||
salg = ERR_PTR(err);
|
||||
goto out_put_tfm;
|
||||
goto out;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(simd_skcipher_create_compat);
|
||||
|
||||
struct simd_skcipher_alg *simd_skcipher_create(const char *algname,
|
||||
const char *basename)
|
||||
{
|
||||
char drvname[CRYPTO_MAX_ALG_NAME];
|
||||
|
||||
if (snprintf(drvname, CRYPTO_MAX_ALG_NAME, "simd-%s", basename) >=
|
||||
CRYPTO_MAX_ALG_NAME)
|
||||
return ERR_PTR(-ENAMETOOLONG);
|
||||
|
||||
return simd_skcipher_create_compat(algname, drvname, basename);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(simd_skcipher_create);
|
||||
|
||||
void simd_skcipher_free(struct simd_skcipher_alg *salg)
|
||||
{
|
||||
crypto_unregister_skcipher(&salg->alg);
|
||||
@@ -246,7 +224,7 @@ int simd_register_skciphers_compat(struct skcipher_alg *algs, int count,
|
||||
algname = algs[i].base.cra_name + 2;
|
||||
drvname = algs[i].base.cra_driver_name + 2;
|
||||
basename = algs[i].base.cra_driver_name;
|
||||
simd = simd_skcipher_create_compat(algname, drvname, basename);
|
||||
simd = simd_skcipher_create_compat(algs + i, algname, drvname, basename);
|
||||
err = PTR_ERR(simd);
|
||||
if (IS_ERR(simd))
|
||||
goto err_unregister;
|
||||
@@ -383,27 +361,19 @@ static int simd_aead_init(struct crypto_aead *tfm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct simd_aead_alg *simd_aead_create_compat(const char *algname,
|
||||
const char *drvname,
|
||||
const char *basename)
|
||||
static struct simd_aead_alg *simd_aead_create_compat(struct aead_alg *ialg,
|
||||
const char *algname,
|
||||
const char *drvname,
|
||||
const char *basename)
|
||||
{
|
||||
struct simd_aead_alg *salg;
|
||||
struct crypto_aead *tfm;
|
||||
struct aead_alg *ialg;
|
||||
struct aead_alg *alg;
|
||||
int err;
|
||||
|
||||
tfm = crypto_alloc_aead(basename, CRYPTO_ALG_INTERNAL,
|
||||
CRYPTO_ALG_INTERNAL | CRYPTO_ALG_ASYNC);
|
||||
if (IS_ERR(tfm))
|
||||
return ERR_CAST(tfm);
|
||||
|
||||
ialg = crypto_aead_alg(tfm);
|
||||
|
||||
salg = kzalloc(sizeof(*salg), GFP_KERNEL);
|
||||
if (!salg) {
|
||||
salg = ERR_PTR(-ENOMEM);
|
||||
goto out_put_tfm;
|
||||
goto out;
|
||||
}
|
||||
|
||||
salg->ialg_name = basename;
|
||||
@@ -442,36 +412,20 @@ struct simd_aead_alg *simd_aead_create_compat(const char *algname,
|
||||
if (err)
|
||||
goto out_free_salg;
|
||||
|
||||
out_put_tfm:
|
||||
crypto_free_aead(tfm);
|
||||
out:
|
||||
return salg;
|
||||
|
||||
out_free_salg:
|
||||
kfree(salg);
|
||||
salg = ERR_PTR(err);
|
||||
goto out_put_tfm;
|
||||
goto out;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(simd_aead_create_compat);
|
||||
|
||||
struct simd_aead_alg *simd_aead_create(const char *algname,
|
||||
const char *basename)
|
||||
{
|
||||
char drvname[CRYPTO_MAX_ALG_NAME];
|
||||
|
||||
if (snprintf(drvname, CRYPTO_MAX_ALG_NAME, "simd-%s", basename) >=
|
||||
CRYPTO_MAX_ALG_NAME)
|
||||
return ERR_PTR(-ENAMETOOLONG);
|
||||
|
||||
return simd_aead_create_compat(algname, drvname, basename);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(simd_aead_create);
|
||||
|
||||
void simd_aead_free(struct simd_aead_alg *salg)
|
||||
static void simd_aead_free(struct simd_aead_alg *salg)
|
||||
{
|
||||
crypto_unregister_aead(&salg->alg);
|
||||
kfree(salg);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(simd_aead_free);
|
||||
|
||||
int simd_register_aeads_compat(struct aead_alg *algs, int count,
|
||||
struct simd_aead_alg **simd_algs)
|
||||
@@ -493,7 +447,7 @@ int simd_register_aeads_compat(struct aead_alg *algs, int count,
|
||||
algname = algs[i].base.cra_name + 2;
|
||||
drvname = algs[i].base.cra_driver_name + 2;
|
||||
basename = algs[i].base.cra_driver_name;
|
||||
simd = simd_aead_create_compat(algname, drvname, basename);
|
||||
simd = simd_aead_create_compat(algs + i, algname, drvname, basename);
|
||||
err = PTR_ERR(simd);
|
||||
if (IS_ERR(simd))
|
||||
goto err_unregister;
|
||||
|
||||
+22
-1
@@ -1939,6 +1939,8 @@ static int __alg_test_hash(const struct hash_testvec *vecs,
|
||||
|
||||
atfm = crypto_alloc_ahash(driver, type, mask);
|
||||
if (IS_ERR(atfm)) {
|
||||
if (PTR_ERR(atfm) == -ENOENT)
|
||||
return -ENOENT;
|
||||
pr_err("alg: hash: failed to allocate transform for %s: %ld\n",
|
||||
driver, PTR_ERR(atfm));
|
||||
return PTR_ERR(atfm);
|
||||
@@ -2703,6 +2705,8 @@ static int alg_test_aead(const struct alg_test_desc *desc, const char *driver,
|
||||
|
||||
tfm = crypto_alloc_aead(driver, type, mask);
|
||||
if (IS_ERR(tfm)) {
|
||||
if (PTR_ERR(tfm) == -ENOENT)
|
||||
return -ENOENT;
|
||||
pr_err("alg: aead: failed to allocate transform for %s: %ld\n",
|
||||
driver, PTR_ERR(tfm));
|
||||
return PTR_ERR(tfm);
|
||||
@@ -3280,6 +3284,8 @@ static int alg_test_skcipher(const struct alg_test_desc *desc,
|
||||
|
||||
tfm = crypto_alloc_skcipher(driver, type, mask);
|
||||
if (IS_ERR(tfm)) {
|
||||
if (PTR_ERR(tfm) == -ENOENT)
|
||||
return -ENOENT;
|
||||
pr_err("alg: skcipher: failed to allocate transform for %s: %ld\n",
|
||||
driver, PTR_ERR(tfm));
|
||||
return PTR_ERR(tfm);
|
||||
@@ -3693,6 +3699,8 @@ static int alg_test_cipher(const struct alg_test_desc *desc,
|
||||
|
||||
tfm = crypto_alloc_cipher(driver, type, mask);
|
||||
if (IS_ERR(tfm)) {
|
||||
if (PTR_ERR(tfm) == -ENOENT)
|
||||
return -ENOENT;
|
||||
printk(KERN_ERR "alg: cipher: Failed to load transform for "
|
||||
"%s: %ld\n", driver, PTR_ERR(tfm));
|
||||
return PTR_ERR(tfm);
|
||||
@@ -3717,6 +3725,8 @@ static int alg_test_comp(const struct alg_test_desc *desc, const char *driver,
|
||||
if (algo_type == CRYPTO_ALG_TYPE_ACOMPRESS) {
|
||||
acomp = crypto_alloc_acomp(driver, type, mask);
|
||||
if (IS_ERR(acomp)) {
|
||||
if (PTR_ERR(acomp) == -ENOENT)
|
||||
return -ENOENT;
|
||||
pr_err("alg: acomp: Failed to load transform for %s: %ld\n",
|
||||
driver, PTR_ERR(acomp));
|
||||
return PTR_ERR(acomp);
|
||||
@@ -3729,6 +3739,8 @@ static int alg_test_comp(const struct alg_test_desc *desc, const char *driver,
|
||||
} else {
|
||||
comp = crypto_alloc_comp(driver, type, mask);
|
||||
if (IS_ERR(comp)) {
|
||||
if (PTR_ERR(comp) == -ENOENT)
|
||||
return -ENOENT;
|
||||
pr_err("alg: comp: Failed to load transform for %s: %ld\n",
|
||||
driver, PTR_ERR(comp));
|
||||
return PTR_ERR(comp);
|
||||
@@ -3805,6 +3817,8 @@ static int alg_test_cprng(const struct alg_test_desc *desc, const char *driver,
|
||||
|
||||
rng = crypto_alloc_rng(driver, type, mask);
|
||||
if (IS_ERR(rng)) {
|
||||
if (PTR_ERR(rng) == -ENOENT)
|
||||
return -ENOENT;
|
||||
printk(KERN_ERR "alg: cprng: Failed to load transform for %s: "
|
||||
"%ld\n", driver, PTR_ERR(rng));
|
||||
return PTR_ERR(rng);
|
||||
@@ -3832,10 +3846,13 @@ static int drbg_cavs_test(const struct drbg_testvec *test, int pr,
|
||||
|
||||
drng = crypto_alloc_rng(driver, type, mask);
|
||||
if (IS_ERR(drng)) {
|
||||
if (PTR_ERR(drng) == -ENOENT)
|
||||
goto out_no_rng;
|
||||
printk(KERN_ERR "alg: drbg: could not allocate DRNG handle for "
|
||||
"%s\n", driver);
|
||||
out_no_rng:
|
||||
kfree_sensitive(buf);
|
||||
return -ENOMEM;
|
||||
return PTR_ERR(drng);
|
||||
}
|
||||
|
||||
test_data.testentropy = &testentropy;
|
||||
@@ -4077,6 +4094,8 @@ static int alg_test_kpp(const struct alg_test_desc *desc, const char *driver,
|
||||
|
||||
tfm = crypto_alloc_kpp(driver, type, mask);
|
||||
if (IS_ERR(tfm)) {
|
||||
if (PTR_ERR(tfm) == -ENOENT)
|
||||
return -ENOENT;
|
||||
pr_err("alg: kpp: Failed to load tfm for %s: %ld\n",
|
||||
driver, PTR_ERR(tfm));
|
||||
return PTR_ERR(tfm);
|
||||
@@ -4305,6 +4324,8 @@ static int alg_test_akcipher(const struct alg_test_desc *desc,
|
||||
|
||||
tfm = crypto_alloc_akcipher(driver, type, mask);
|
||||
if (IS_ERR(tfm)) {
|
||||
if (PTR_ERR(tfm) == -ENOENT)
|
||||
return -ENOENT;
|
||||
pr_err("alg: akcipher: Failed to load tfm for %s: %ld\n",
|
||||
driver, PTR_ERR(tfm));
|
||||
return PTR_ERR(tfm);
|
||||
|
||||
+14
-17
@@ -83,33 +83,30 @@ static void __init
|
||||
do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
|
||||
{
|
||||
int speed;
|
||||
int i, j;
|
||||
ktime_t min, start, diff;
|
||||
unsigned long reps;
|
||||
ktime_t min, start, t0;
|
||||
|
||||
tmpl->next = template_list;
|
||||
template_list = tmpl;
|
||||
|
||||
preempt_disable();
|
||||
|
||||
min = (ktime_t)S64_MAX;
|
||||
for (i = 0; i < 3; i++) {
|
||||
start = ktime_get();
|
||||
for (j = 0; j < REPS; j++) {
|
||||
mb(); /* prevent loop optimization */
|
||||
tmpl->do_2(BENCH_SIZE, b1, b2);
|
||||
mb();
|
||||
}
|
||||
diff = ktime_sub(ktime_get(), start);
|
||||
if (diff < min)
|
||||
min = diff;
|
||||
}
|
||||
reps = 0;
|
||||
t0 = ktime_get();
|
||||
/* delay start until time has advanced */
|
||||
while ((start = ktime_get()) == t0)
|
||||
cpu_relax();
|
||||
do {
|
||||
mb(); /* prevent loop optimization */
|
||||
tmpl->do_2(BENCH_SIZE, b1, b2);
|
||||
mb();
|
||||
} while (reps++ < REPS || (t0 = ktime_get()) == start);
|
||||
min = ktime_sub(t0, start);
|
||||
|
||||
preempt_enable();
|
||||
|
||||
// bytes/ns == GB/s, multiply by 1000 to get MB/s [not MiB/s]
|
||||
if (!min)
|
||||
min = 1;
|
||||
speed = (1000 * REPS * BENCH_SIZE) / (unsigned int)ktime_to_ns(min);
|
||||
speed = (1000 * reps * BENCH_SIZE) / (unsigned int)ktime_to_ns(min);
|
||||
tmpl->speed = speed;
|
||||
|
||||
pr_info(" %-16s: %5d MB/sec\n", tmpl->name, speed);
|
||||
|
||||
@@ -214,6 +214,30 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)
|
||||
#define UPDATE_LOCK_ALREADY_HELD 4
|
||||
#define UPDATE_UNLOCK_WITHOUT_LOCK 5
|
||||
|
||||
int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer)
|
||||
{
|
||||
struct prm_handler_info *handler = find_prm_handler(&handler_guid);
|
||||
struct prm_module_info *module = find_prm_module(&handler_guid);
|
||||
struct prm_context_buffer context;
|
||||
efi_status_t status;
|
||||
|
||||
if (!module || !handler)
|
||||
return -ENODEV;
|
||||
|
||||
memset(&context, 0, sizeof(context));
|
||||
ACPI_COPY_NAMESEG(context.signature, "PRMC");
|
||||
context.identifier = handler->guid;
|
||||
context.static_data_buffer = handler->static_data_buffer_addr;
|
||||
context.mmio_ranges = module->mmio_info;
|
||||
|
||||
status = efi_call_acpi_prm_handler(handler->handler_addr,
|
||||
(u64)param_buffer,
|
||||
&context);
|
||||
|
||||
return efi_status_to_err(status);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_call_prm_handler);
|
||||
|
||||
/*
|
||||
* This is the PlatformRtMechanism opregion space handler.
|
||||
* @function: indicates the read/write. In fact as the PlatformRtMechanism
|
||||
|
||||
+1
-1
@@ -435,7 +435,7 @@ static const struct dev_pm_ops amba_pm = {
|
||||
* DMA configuration for platform and AMBA bus is same. So here we reuse
|
||||
* platform's DMA config routine.
|
||||
*/
|
||||
struct bus_type amba_bustype = {
|
||||
const struct bus_type amba_bustype = {
|
||||
.name = "amba",
|
||||
.dev_groups = amba_dev_groups,
|
||||
.match = amba_match,
|
||||
|
||||
+1
-22
@@ -185,34 +185,13 @@ static int bt1_apb_request_rst(struct bt1_apb *apb)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void bt1_apb_disable_clk(void *data)
|
||||
{
|
||||
struct bt1_apb *apb = data;
|
||||
|
||||
clk_disable_unprepare(apb->pclk);
|
||||
}
|
||||
|
||||
static int bt1_apb_request_clk(struct bt1_apb *apb)
|
||||
{
|
||||
int ret;
|
||||
|
||||
apb->pclk = devm_clk_get(apb->dev, "pclk");
|
||||
apb->pclk = devm_clk_get_enabled(apb->dev, "pclk");
|
||||
if (IS_ERR(apb->pclk))
|
||||
return dev_err_probe(apb->dev, PTR_ERR(apb->pclk),
|
||||
"Couldn't get APB clock descriptor\n");
|
||||
|
||||
ret = clk_prepare_enable(apb->pclk);
|
||||
if (ret) {
|
||||
dev_err(apb->dev, "Couldn't enable the APB clock\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = devm_add_action_or_reset(apb->dev, bt1_apb_disable_clk, apb);
|
||||
if (ret) {
|
||||
dev_err(apb->dev, "Can't add APB EHB clocks disable action\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
apb->rate = clk_get_rate(apb->pclk);
|
||||
if (!apb->rate) {
|
||||
dev_err(apb->dev, "Invalid clock rate\n");
|
||||
|
||||
+2
-21
@@ -146,33 +146,14 @@ static int bt1_axi_request_rst(struct bt1_axi *axi)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void bt1_axi_disable_clk(void *data)
|
||||
{
|
||||
struct bt1_axi *axi = data;
|
||||
|
||||
clk_disable_unprepare(axi->aclk);
|
||||
}
|
||||
|
||||
static int bt1_axi_request_clk(struct bt1_axi *axi)
|
||||
{
|
||||
int ret;
|
||||
|
||||
axi->aclk = devm_clk_get(axi->dev, "aclk");
|
||||
axi->aclk = devm_clk_get_enabled(axi->dev, "aclk");
|
||||
if (IS_ERR(axi->aclk))
|
||||
return dev_err_probe(axi->dev, PTR_ERR(axi->aclk),
|
||||
"Couldn't get AXI Interconnect clock\n");
|
||||
|
||||
ret = clk_prepare_enable(axi->aclk);
|
||||
if (ret) {
|
||||
dev_err(axi->dev, "Couldn't enable the AXI clock\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi);
|
||||
if (ret)
|
||||
dev_err(axi->dev, "Can't add AXI clock disable action\n");
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bt1_axi_request_irq(struct bt1_axi *axi)
|
||||
|
||||
@@ -555,6 +555,7 @@ config HW_RANDOM_ARM_SMCCC_TRNG
|
||||
config HW_RANDOM_CN10K
|
||||
tristate "Marvell CN10K Random Number Generator support"
|
||||
depends on HW_RANDOM && PCI && (ARM64 || (64BIT && COMPILE_TEST))
|
||||
default HW_RANDOM if ARCH_THUNDER
|
||||
help
|
||||
This driver provides support for the True Random Number
|
||||
generator available in Marvell CN10K SoCs.
|
||||
@@ -572,6 +573,20 @@ config HW_RANDOM_JH7110
|
||||
To compile this driver as a module, choose M here.
|
||||
The module will be called jh7110-trng.
|
||||
|
||||
config HW_RANDOM_ROCKCHIP
|
||||
tristate "Rockchip True Random Number Generator"
|
||||
depends on HW_RANDOM && (ARCH_ROCKCHIP || COMPILE_TEST)
|
||||
depends on HAS_IOMEM
|
||||
default HW_RANDOM
|
||||
help
|
||||
This driver provides kernel-side support for the True Random Number
|
||||
Generator hardware found on some Rockchip SoC like RK3566 or RK3568.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called rockchip-rng.
|
||||
|
||||
If unsure, say Y.
|
||||
|
||||
endif # HW_RANDOM
|
||||
|
||||
config UML_RANDOM
|
||||
|
||||
@@ -48,4 +48,5 @@ obj-$(CONFIG_HW_RANDOM_XIPHERA) += xiphera-trng.o
|
||||
obj-$(CONFIG_HW_RANDOM_ARM_SMCCC_TRNG) += arm_smccc_trng.o
|
||||
obj-$(CONFIG_HW_RANDOM_CN10K) += cn10k-rng.o
|
||||
obj-$(CONFIG_HW_RANDOM_POLARFIRE_SOC) += mpfs-rng.o
|
||||
obj-$(CONFIG_HW_RANDOM_ROCKCHIP) += rockchip-rng.o
|
||||
obj-$(CONFIG_HW_RANDOM_JH7110) += jh7110-trng.o
|
||||
|
||||
@@ -94,8 +94,10 @@ static int bcm2835_rng_init(struct hwrng *rng)
|
||||
return ret;
|
||||
|
||||
ret = reset_control_reset(priv->reset);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
clk_disable_unprepare(priv->clk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (priv->mask_interrupts) {
|
||||
/* mask the interrupt */
|
||||
|
||||
@@ -622,6 +622,7 @@ static int __maybe_unused cctrng_resume(struct device *dev)
|
||||
/* wait for Cryptocell reset completion */
|
||||
if (!cctrng_wait_for_reset_completion(drvdata)) {
|
||||
dev_err(dev, "Cryptocell reset not completed");
|
||||
clk_disable_unprepare(drvdata->clk);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ static int mtk_rng_probe(struct platform_device *pdev)
|
||||
dev_set_drvdata(&pdev->dev, priv);
|
||||
pm_runtime_set_autosuspend_delay(&pdev->dev, RNG_AUTOSUSPEND_TIMEOUT);
|
||||
pm_runtime_use_autosuspend(&pdev->dev);
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
devm_pm_runtime_enable(&pdev->dev);
|
||||
|
||||
dev_info(&pdev->dev, "registered RNG driver\n");
|
||||
|
||||
|
||||
@@ -147,33 +147,25 @@ static int mxc_rnga_probe(struct platform_device *pdev)
|
||||
mxc_rng->rng.data_present = mxc_rnga_data_present;
|
||||
mxc_rng->rng.data_read = mxc_rnga_data_read;
|
||||
|
||||
mxc_rng->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
mxc_rng->clk = devm_clk_get_enabled(&pdev->dev, NULL);
|
||||
if (IS_ERR(mxc_rng->clk)) {
|
||||
dev_err(&pdev->dev, "Could not get rng_clk!\n");
|
||||
return PTR_ERR(mxc_rng->clk);
|
||||
}
|
||||
|
||||
err = clk_prepare_enable(mxc_rng->clk);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
mxc_rng->mem = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(mxc_rng->mem)) {
|
||||
err = PTR_ERR(mxc_rng->mem);
|
||||
goto err_ioremap;
|
||||
return err;
|
||||
}
|
||||
|
||||
err = hwrng_register(&mxc_rng->rng);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "MXC RNGA registering failed (%d)\n", err);
|
||||
goto err_ioremap;
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_ioremap:
|
||||
clk_disable_unprepare(mxc_rng->clk);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void mxc_rnga_remove(struct platform_device *pdev)
|
||||
@@ -181,8 +173,6 @@ static void mxc_rnga_remove(struct platform_device *pdev)
|
||||
struct mxc_rng *mxc_rng = platform_get_drvdata(pdev);
|
||||
|
||||
hwrng_unregister(&mxc_rng->rng);
|
||||
|
||||
clk_disable_unprepare(mxc_rng->clk);
|
||||
}
|
||||
|
||||
static const struct of_device_id mxc_rnga_of_match[] = {
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* rockchip-rng.c True Random Number Generator driver for Rockchip RK3568 SoC
|
||||
*
|
||||
* Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd.
|
||||
* Copyright (c) 2022, Aurelien Jarno
|
||||
* Authors:
|
||||
* Lin Jinhan <troy.lin@rock-chips.com>
|
||||
* Aurelien Jarno <aurelien@aurel32.net>
|
||||
*/
|
||||
#include <linux/clk.h>
|
||||
#include <linux/hw_random.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#define RK_RNG_AUTOSUSPEND_DELAY 100
|
||||
#define RK_RNG_MAX_BYTE 32
|
||||
#define RK_RNG_POLL_PERIOD_US 100
|
||||
#define RK_RNG_POLL_TIMEOUT_US 10000
|
||||
|
||||
/*
|
||||
* TRNG collects osc ring output bit every RK_RNG_SAMPLE_CNT time. The value is
|
||||
* a tradeoff between speed and quality and has been adjusted to get a quality
|
||||
* of ~900 (~87.5% of FIPS 140-2 successes).
|
||||
*/
|
||||
#define RK_RNG_SAMPLE_CNT 1000
|
||||
|
||||
/* TRNG registers from RK3568 TRM-Part2, section 5.4.1 */
|
||||
#define TRNG_RST_CTL 0x0004
|
||||
#define TRNG_RNG_CTL 0x0400
|
||||
#define TRNG_RNG_CTL_LEN_64_BIT (0x00 << 4)
|
||||
#define TRNG_RNG_CTL_LEN_128_BIT (0x01 << 4)
|
||||
#define TRNG_RNG_CTL_LEN_192_BIT (0x02 << 4)
|
||||
#define TRNG_RNG_CTL_LEN_256_BIT (0x03 << 4)
|
||||
#define TRNG_RNG_CTL_OSC_RING_SPEED_0 (0x00 << 2)
|
||||
#define TRNG_RNG_CTL_OSC_RING_SPEED_1 (0x01 << 2)
|
||||
#define TRNG_RNG_CTL_OSC_RING_SPEED_2 (0x02 << 2)
|
||||
#define TRNG_RNG_CTL_OSC_RING_SPEED_3 (0x03 << 2)
|
||||
#define TRNG_RNG_CTL_MASK GENMASK(15, 0)
|
||||
#define TRNG_RNG_CTL_ENABLE BIT(1)
|
||||
#define TRNG_RNG_CTL_START BIT(0)
|
||||
#define TRNG_RNG_SAMPLE_CNT 0x0404
|
||||
#define TRNG_RNG_DOUT 0x0410
|
||||
|
||||
struct rk_rng {
|
||||
struct hwrng rng;
|
||||
void __iomem *base;
|
||||
int clk_num;
|
||||
struct clk_bulk_data *clk_bulks;
|
||||
};
|
||||
|
||||
/* The mask in the upper 16 bits determines the bits that are updated */
|
||||
static void rk_rng_write_ctl(struct rk_rng *rng, u32 val, u32 mask)
|
||||
{
|
||||
writel((mask << 16) | val, rng->base + TRNG_RNG_CTL);
|
||||
}
|
||||
|
||||
static int rk_rng_init(struct hwrng *rng)
|
||||
{
|
||||
struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng);
|
||||
int ret;
|
||||
|
||||
/* start clocks */
|
||||
ret = clk_bulk_prepare_enable(rk_rng->clk_num, rk_rng->clk_bulks);
|
||||
if (ret < 0) {
|
||||
dev_err((struct device *) rk_rng->rng.priv,
|
||||
"Failed to enable clks %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set the sample period */
|
||||
writel(RK_RNG_SAMPLE_CNT, rk_rng->base + TRNG_RNG_SAMPLE_CNT);
|
||||
|
||||
/* set osc ring speed and enable it */
|
||||
rk_rng_write_ctl(rk_rng, TRNG_RNG_CTL_LEN_256_BIT |
|
||||
TRNG_RNG_CTL_OSC_RING_SPEED_0 |
|
||||
TRNG_RNG_CTL_ENABLE,
|
||||
TRNG_RNG_CTL_MASK);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rk_rng_cleanup(struct hwrng *rng)
|
||||
{
|
||||
struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng);
|
||||
|
||||
/* stop TRNG */
|
||||
rk_rng_write_ctl(rk_rng, 0, TRNG_RNG_CTL_MASK);
|
||||
|
||||
/* stop clocks */
|
||||
clk_bulk_disable_unprepare(rk_rng->clk_num, rk_rng->clk_bulks);
|
||||
}
|
||||
|
||||
static int rk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
|
||||
{
|
||||
struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng);
|
||||
size_t to_read = min_t(size_t, max, RK_RNG_MAX_BYTE);
|
||||
u32 reg;
|
||||
int ret = 0;
|
||||
|
||||
ret = pm_runtime_resume_and_get((struct device *) rk_rng->rng.priv);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Start collecting random data */
|
||||
rk_rng_write_ctl(rk_rng, TRNG_RNG_CTL_START, TRNG_RNG_CTL_START);
|
||||
|
||||
ret = readl_poll_timeout(rk_rng->base + TRNG_RNG_CTL, reg,
|
||||
!(reg & TRNG_RNG_CTL_START),
|
||||
RK_RNG_POLL_PERIOD_US,
|
||||
RK_RNG_POLL_TIMEOUT_US);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
/* Read random data stored in the registers */
|
||||
memcpy_fromio(buf, rk_rng->base + TRNG_RNG_DOUT, to_read);
|
||||
out:
|
||||
pm_runtime_mark_last_busy((struct device *) rk_rng->rng.priv);
|
||||
pm_runtime_put_sync_autosuspend((struct device *) rk_rng->rng.priv);
|
||||
|
||||
return (ret < 0) ? ret : to_read;
|
||||
}
|
||||
|
||||
static int rk_rng_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct reset_control *rst;
|
||||
struct rk_rng *rk_rng;
|
||||
int ret;
|
||||
|
||||
rk_rng = devm_kzalloc(dev, sizeof(*rk_rng), GFP_KERNEL);
|
||||
if (!rk_rng)
|
||||
return -ENOMEM;
|
||||
|
||||
rk_rng->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(rk_rng->base))
|
||||
return PTR_ERR(rk_rng->base);
|
||||
|
||||
rk_rng->clk_num = devm_clk_bulk_get_all(dev, &rk_rng->clk_bulks);
|
||||
if (rk_rng->clk_num < 0)
|
||||
return dev_err_probe(dev, rk_rng->clk_num,
|
||||
"Failed to get clks property\n");
|
||||
|
||||
rst = devm_reset_control_array_get_exclusive(&pdev->dev);
|
||||
if (IS_ERR(rst))
|
||||
return dev_err_probe(dev, PTR_ERR(rst), "Failed to get reset property\n");
|
||||
|
||||
reset_control_assert(rst);
|
||||
udelay(2);
|
||||
reset_control_deassert(rst);
|
||||
|
||||
platform_set_drvdata(pdev, rk_rng);
|
||||
|
||||
rk_rng->rng.name = dev_driver_string(dev);
|
||||
if (!IS_ENABLED(CONFIG_PM)) {
|
||||
rk_rng->rng.init = rk_rng_init;
|
||||
rk_rng->rng.cleanup = rk_rng_cleanup;
|
||||
}
|
||||
rk_rng->rng.read = rk_rng_read;
|
||||
rk_rng->rng.priv = (unsigned long) dev;
|
||||
rk_rng->rng.quality = 900;
|
||||
|
||||
pm_runtime_set_autosuspend_delay(dev, RK_RNG_AUTOSUSPEND_DELAY);
|
||||
pm_runtime_use_autosuspend(dev);
|
||||
ret = devm_pm_runtime_enable(dev);
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret, "Runtime pm activation failed.\n");
|
||||
|
||||
ret = devm_hwrng_register(dev, &rk_rng->rng);
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret, "Failed to register Rockchip hwrng\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused rk_rng_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct rk_rng *rk_rng = dev_get_drvdata(dev);
|
||||
|
||||
rk_rng_cleanup(&rk_rng->rng);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused rk_rng_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct rk_rng *rk_rng = dev_get_drvdata(dev);
|
||||
|
||||
return rk_rng_init(&rk_rng->rng);
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops rk_rng_pm_ops = {
|
||||
SET_RUNTIME_PM_OPS(rk_rng_runtime_suspend,
|
||||
rk_rng_runtime_resume, NULL)
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
|
||||
pm_runtime_force_resume)
|
||||
};
|
||||
|
||||
static const struct of_device_id rk_rng_dt_match[] = {
|
||||
{ .compatible = "rockchip,rk3568-rng", },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, rk_rng_dt_match);
|
||||
|
||||
static struct platform_driver rk_rng_driver = {
|
||||
.driver = {
|
||||
.name = "rockchip-rng",
|
||||
.pm = &rk_rng_pm_ops,
|
||||
.of_match_table = rk_rng_dt_match,
|
||||
},
|
||||
.probe = rk_rng_probe,
|
||||
};
|
||||
|
||||
module_platform_driver(rk_rng_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Rockchip RK3568 True Random Number Generator driver");
|
||||
MODULE_AUTHOR("Lin Jinhan <troy.lin@rock-chips.com>");
|
||||
MODULE_AUTHOR("Aurelien Jarno <aurelien@aurel32.net>");
|
||||
MODULE_AUTHOR("Daniel Golle <daniel@makrotopia.org>");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -149,7 +149,6 @@ struct crypto4xx_alg {
|
||||
|
||||
int crypto4xx_alloc_sa(struct crypto4xx_ctx *ctx, u32 size);
|
||||
void crypto4xx_free_sa(struct crypto4xx_ctx *ctx);
|
||||
void crypto4xx_free_ctx(struct crypto4xx_ctx *ctx);
|
||||
int crypto4xx_build_pd(struct crypto_async_request *req,
|
||||
struct crypto4xx_ctx *ctx,
|
||||
struct scatterlist *src,
|
||||
|
||||
@@ -150,8 +150,6 @@ struct meson_alg_template {
|
||||
#endif
|
||||
};
|
||||
|
||||
int meson_enqueue(struct crypto_async_request *areq, u32 type);
|
||||
|
||||
int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,
|
||||
unsigned int keylen);
|
||||
int meson_cipher_init(struct crypto_tfm *tfm);
|
||||
|
||||
@@ -2376,33 +2376,29 @@ static int atmel_aes_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
/* Initializing the clock */
|
||||
aes_dd->iclk = devm_clk_get(&pdev->dev, "aes_clk");
|
||||
aes_dd->iclk = devm_clk_get_prepared(&pdev->dev, "aes_clk");
|
||||
if (IS_ERR(aes_dd->iclk)) {
|
||||
dev_err(dev, "clock initialization failed.\n");
|
||||
err = PTR_ERR(aes_dd->iclk);
|
||||
goto err_tasklet_kill;
|
||||
}
|
||||
|
||||
err = clk_prepare(aes_dd->iclk);
|
||||
if (err)
|
||||
goto err_tasklet_kill;
|
||||
|
||||
err = atmel_aes_hw_version_init(aes_dd);
|
||||
if (err)
|
||||
goto err_iclk_unprepare;
|
||||
goto err_tasklet_kill;
|
||||
|
||||
atmel_aes_get_cap(aes_dd);
|
||||
|
||||
#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
|
||||
if (aes_dd->caps.has_authenc && !atmel_sha_authenc_is_ready()) {
|
||||
err = -EPROBE_DEFER;
|
||||
goto err_iclk_unprepare;
|
||||
goto err_tasklet_kill;
|
||||
}
|
||||
#endif
|
||||
|
||||
err = atmel_aes_buff_init(aes_dd);
|
||||
if (err)
|
||||
goto err_iclk_unprepare;
|
||||
goto err_tasklet_kill;
|
||||
|
||||
err = atmel_aes_dma_init(aes_dd);
|
||||
if (err)
|
||||
@@ -2429,8 +2425,6 @@ err_algs:
|
||||
atmel_aes_dma_cleanup(aes_dd);
|
||||
err_buff_cleanup:
|
||||
atmel_aes_buff_cleanup(aes_dd);
|
||||
err_iclk_unprepare:
|
||||
clk_unprepare(aes_dd->iclk);
|
||||
err_tasklet_kill:
|
||||
tasklet_kill(&aes_dd->done_task);
|
||||
tasklet_kill(&aes_dd->queue_task);
|
||||
@@ -2455,8 +2449,6 @@ static void atmel_aes_remove(struct platform_device *pdev)
|
||||
|
||||
atmel_aes_dma_cleanup(aes_dd);
|
||||
atmel_aes_buff_cleanup(aes_dd);
|
||||
|
||||
clk_unprepare(aes_dd->iclk);
|
||||
}
|
||||
|
||||
static struct platform_driver atmel_aes_driver = {
|
||||
|
||||
@@ -2623,27 +2623,23 @@ static int atmel_sha_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
/* Initializing the clock */
|
||||
sha_dd->iclk = devm_clk_get(&pdev->dev, "sha_clk");
|
||||
sha_dd->iclk = devm_clk_get_prepared(&pdev->dev, "sha_clk");
|
||||
if (IS_ERR(sha_dd->iclk)) {
|
||||
dev_err(dev, "clock initialization failed.\n");
|
||||
err = PTR_ERR(sha_dd->iclk);
|
||||
goto err_tasklet_kill;
|
||||
}
|
||||
|
||||
err = clk_prepare(sha_dd->iclk);
|
||||
if (err)
|
||||
goto err_tasklet_kill;
|
||||
|
||||
err = atmel_sha_hw_version_init(sha_dd);
|
||||
if (err)
|
||||
goto err_iclk_unprepare;
|
||||
goto err_tasklet_kill;
|
||||
|
||||
atmel_sha_get_cap(sha_dd);
|
||||
|
||||
if (sha_dd->caps.has_dma) {
|
||||
err = atmel_sha_dma_init(sha_dd);
|
||||
if (err)
|
||||
goto err_iclk_unprepare;
|
||||
goto err_tasklet_kill;
|
||||
|
||||
dev_info(dev, "using %s for DMA transfers\n",
|
||||
dma_chan_name(sha_dd->dma_lch_in.chan));
|
||||
@@ -2669,8 +2665,6 @@ err_algs:
|
||||
spin_unlock(&atmel_sha.lock);
|
||||
if (sha_dd->caps.has_dma)
|
||||
atmel_sha_dma_cleanup(sha_dd);
|
||||
err_iclk_unprepare:
|
||||
clk_unprepare(sha_dd->iclk);
|
||||
err_tasklet_kill:
|
||||
tasklet_kill(&sha_dd->queue_task);
|
||||
tasklet_kill(&sha_dd->done_task);
|
||||
@@ -2693,8 +2687,6 @@ static void atmel_sha_remove(struct platform_device *pdev)
|
||||
|
||||
if (sha_dd->caps.has_dma)
|
||||
atmel_sha_dma_cleanup(sha_dd);
|
||||
|
||||
clk_unprepare(sha_dd->iclk);
|
||||
}
|
||||
|
||||
static struct platform_driver atmel_sha_driver = {
|
||||
|
||||
@@ -961,7 +961,7 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req,
|
||||
|
||||
drv_ctx = get_drv_ctx(ctx, encrypt ? ENCRYPT : DECRYPT);
|
||||
if (IS_ERR(drv_ctx))
|
||||
return (struct aead_edesc *)drv_ctx;
|
||||
return ERR_CAST(drv_ctx);
|
||||
|
||||
/* allocate space for base edesc and hw desc commands, link tables */
|
||||
edesc = qi_cache_alloc(flags);
|
||||
@@ -1271,7 +1271,7 @@ static struct skcipher_edesc *skcipher_edesc_alloc(struct skcipher_request *req,
|
||||
|
||||
drv_ctx = get_drv_ctx(ctx, encrypt ? ENCRYPT : DECRYPT);
|
||||
if (IS_ERR(drv_ctx))
|
||||
return (struct skcipher_edesc *)drv_ctx;
|
||||
return ERR_CAST(drv_ctx);
|
||||
|
||||
src_nents = sg_nents_for_len(req->src, req->cryptlen);
|
||||
if (unlikely(src_nents < 0)) {
|
||||
|
||||
@@ -5006,10 +5006,14 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev)
|
||||
struct device *dev = &ls_dev->dev;
|
||||
struct dpaa2_caam_priv *priv;
|
||||
struct dpaa2_caam_priv_per_cpu *ppriv;
|
||||
cpumask_t clean_mask;
|
||||
cpumask_var_t clean_mask;
|
||||
int err, cpu;
|
||||
u8 i;
|
||||
|
||||
err = -ENOMEM;
|
||||
if (!zalloc_cpumask_var(&clean_mask, GFP_KERNEL))
|
||||
goto err_cpumask;
|
||||
|
||||
priv = dev_get_drvdata(dev);
|
||||
|
||||
priv->dev = dev;
|
||||
@@ -5085,7 +5089,6 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev)
|
||||
}
|
||||
}
|
||||
|
||||
cpumask_clear(&clean_mask);
|
||||
i = 0;
|
||||
for_each_online_cpu(cpu) {
|
||||
u8 j;
|
||||
@@ -5114,7 +5117,7 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev)
|
||||
err = -ENOMEM;
|
||||
goto err_alloc_netdev;
|
||||
}
|
||||
cpumask_set_cpu(cpu, &clean_mask);
|
||||
cpumask_set_cpu(cpu, clean_mask);
|
||||
ppriv->net_dev->dev = *dev;
|
||||
|
||||
netif_napi_add_tx_weight(ppriv->net_dev, &ppriv->napi,
|
||||
@@ -5122,15 +5125,19 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev)
|
||||
DPAA2_CAAM_NAPI_WEIGHT);
|
||||
}
|
||||
|
||||
return 0;
|
||||
err = 0;
|
||||
goto free_cpumask;
|
||||
|
||||
err_alloc_netdev:
|
||||
free_dpaa2_pcpu_netdev(priv, &clean_mask);
|
||||
free_dpaa2_pcpu_netdev(priv, clean_mask);
|
||||
err_get_rx_queue:
|
||||
dpaa2_dpseci_congestion_free(priv);
|
||||
err_get_vers:
|
||||
dpseci_close(priv->mc_io, 0, ls_dev->mc_handle);
|
||||
err_open:
|
||||
free_cpumask:
|
||||
free_cpumask_var(clean_mask);
|
||||
err_cpumask:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
+20
-11
@@ -736,7 +736,11 @@ int caam_qi_init(struct platform_device *caam_pdev)
|
||||
struct device *ctrldev = &caam_pdev->dev, *qidev;
|
||||
struct caam_drv_private *ctrlpriv;
|
||||
const cpumask_t *cpus = qman_affine_cpus();
|
||||
cpumask_t clean_mask;
|
||||
cpumask_var_t clean_mask;
|
||||
|
||||
err = -ENOMEM;
|
||||
if (!zalloc_cpumask_var(&clean_mask, GFP_KERNEL))
|
||||
goto fail_cpumask;
|
||||
|
||||
ctrlpriv = dev_get_drvdata(ctrldev);
|
||||
qidev = ctrldev;
|
||||
@@ -745,19 +749,16 @@ int caam_qi_init(struct platform_device *caam_pdev)
|
||||
err = init_cgr(qidev);
|
||||
if (err) {
|
||||
dev_err(qidev, "CGR initialization failed: %d\n", err);
|
||||
return err;
|
||||
goto fail_cgr;
|
||||
}
|
||||
|
||||
/* Initialise response FQs */
|
||||
err = alloc_rsp_fqs(qidev);
|
||||
if (err) {
|
||||
dev_err(qidev, "Can't allocate CAAM response FQs: %d\n", err);
|
||||
free_rsp_fqs();
|
||||
return err;
|
||||
goto fail_fqs;
|
||||
}
|
||||
|
||||
cpumask_clear(&clean_mask);
|
||||
|
||||
/*
|
||||
* Enable the NAPI contexts on each of the core which has an affine
|
||||
* portal.
|
||||
@@ -773,7 +774,7 @@ int caam_qi_init(struct platform_device *caam_pdev)
|
||||
err = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
cpumask_set_cpu(i, &clean_mask);
|
||||
cpumask_set_cpu(i, clean_mask);
|
||||
priv->net_dev = net_dev;
|
||||
net_dev->dev = *qidev;
|
||||
|
||||
@@ -788,7 +789,7 @@ int caam_qi_init(struct platform_device *caam_pdev)
|
||||
if (!qi_cache) {
|
||||
dev_err(qidev, "Can't allocate CAAM cache\n");
|
||||
err = -ENOMEM;
|
||||
goto fail2;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
caam_debugfs_qi_init(ctrlpriv);
|
||||
@@ -798,11 +799,19 @@ int caam_qi_init(struct platform_device *caam_pdev)
|
||||
goto fail2;
|
||||
|
||||
dev_info(qidev, "Linux CAAM Queue I/F driver initialised\n");
|
||||
return 0;
|
||||
goto free_cpumask;
|
||||
|
||||
fail2:
|
||||
free_rsp_fqs();
|
||||
kmem_cache_destroy(qi_cache);
|
||||
fail:
|
||||
free_caam_qi_pcpu_netdev(&clean_mask);
|
||||
free_caam_qi_pcpu_netdev(clean_mask);
|
||||
fail_fqs:
|
||||
free_rsp_fqs();
|
||||
qman_delete_cgr_safe(&qipriv.cgr);
|
||||
qman_release_cgrid(qipriv.cgr.cgrid);
|
||||
fail_cgr:
|
||||
free_cpumask:
|
||||
free_cpumask_var(clean_mask);
|
||||
fail_cpumask:
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -910,7 +910,18 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret)
|
||||
|
||||
sev->int_rcvd = 0;
|
||||
|
||||
reg = FIELD_PREP(SEV_CMDRESP_CMD, cmd) | SEV_CMDRESP_IOC;
|
||||
reg = FIELD_PREP(SEV_CMDRESP_CMD, cmd);
|
||||
|
||||
/*
|
||||
* If invoked during panic handling, local interrupts are disabled so
|
||||
* the PSP command completion interrupt can't be used.
|
||||
* sev_wait_cmd_ioc() already checks for interrupts disabled and
|
||||
* polls for PSP command completion. Ensure we do not request an
|
||||
* interrupt from the PSP if irqs disabled.
|
||||
*/
|
||||
if (!irqs_disabled())
|
||||
reg |= SEV_CMDRESP_IOC;
|
||||
|
||||
iowrite32(reg, sev->io_regs + sev->vdata->cmdresp_reg);
|
||||
|
||||
/* wait for command completion */
|
||||
@@ -1629,8 +1640,6 @@ static int sev_update_firmware(struct device *dev)
|
||||
|
||||
if (ret)
|
||||
dev_dbg(dev, "Failed to update SEV firmware: %#x\n", error);
|
||||
else
|
||||
dev_info(dev, "SEV firmware update successful\n");
|
||||
|
||||
__free_pages(p, order);
|
||||
|
||||
@@ -2382,6 +2391,7 @@ void sev_pci_init(void)
|
||||
{
|
||||
struct sev_device *sev = psp_master->sev_data;
|
||||
struct sev_platform_init_args args = {0};
|
||||
u8 api_major, api_minor, build;
|
||||
int rc;
|
||||
|
||||
if (!sev)
|
||||
@@ -2392,9 +2402,19 @@ void sev_pci_init(void)
|
||||
if (sev_get_api_version())
|
||||
goto err;
|
||||
|
||||
api_major = sev->api_major;
|
||||
api_minor = sev->api_minor;
|
||||
build = sev->build;
|
||||
|
||||
if (sev_update_firmware(sev->dev) == 0)
|
||||
sev_get_api_version();
|
||||
|
||||
if (api_major != sev->api_major || api_minor != sev->api_minor ||
|
||||
build != sev->build)
|
||||
dev_info(sev->dev, "SEV firmware updated from %d.%d.%d to %d.%d.%d\n",
|
||||
api_major, api_minor, build,
|
||||
sev->api_major, sev->api_minor, sev->build);
|
||||
|
||||
/* Initialize the platform */
|
||||
args.probe = true;
|
||||
rc = sev_platform_init(&args);
|
||||
@@ -2410,6 +2430,8 @@ void sev_pci_init(void)
|
||||
return;
|
||||
|
||||
err:
|
||||
sev_dev_destroy(psp_master);
|
||||
|
||||
psp_master->sev_data = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,6 @@ struct sp_device *sp_alloc_struct(struct device *dev);
|
||||
|
||||
int sp_init(struct sp_device *sp);
|
||||
void sp_destroy(struct sp_device *sp);
|
||||
struct sp_device *sp_get_master(void);
|
||||
|
||||
int sp_suspend(struct sp_device *sp);
|
||||
int sp_resume(struct sp_device *sp);
|
||||
|
||||
@@ -326,8 +326,6 @@ struct sl3516_ce_alg_template {
|
||||
unsigned long stat_bytes;
|
||||
};
|
||||
|
||||
int sl3516_ce_enqueue(struct crypto_async_request *areq, u32 type);
|
||||
|
||||
int sl3516_ce_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,
|
||||
unsigned int keylen);
|
||||
int sl3516_ce_cipher_init(struct crypto_tfm *tfm);
|
||||
|
||||
@@ -575,7 +575,9 @@ static int hpre_send(struct hpre_ctx *ctx, struct hpre_sqe *msg)
|
||||
|
||||
do {
|
||||
atomic64_inc(&dfx[HPRE_SEND_CNT].value);
|
||||
spin_lock_bh(&ctx->req_lock);
|
||||
ret = hisi_qp_send(ctx->qp, msg);
|
||||
spin_unlock_bh(&ctx->req_lock);
|
||||
if (ret != -EBUSY)
|
||||
break;
|
||||
atomic64_inc(&dfx[HPRE_SEND_BUSY_CNT].value);
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
#include <linux/uacce.h>
|
||||
#include "hpre.h"
|
||||
|
||||
#define HPRE_QM_ABNML_INT_MASK 0x100004
|
||||
#define HPRE_CTRL_CNT_CLR_CE_BIT BIT(0)
|
||||
#define HPRE_COMM_CNT_CLR_CE 0x0
|
||||
#define HPRE_CTRL_CNT_CLR_CE 0x301000
|
||||
#define HPRE_FSM_MAX_CNT 0x301008
|
||||
#define HPRE_VFG_AXQOS 0x30100c
|
||||
@@ -42,7 +40,6 @@
|
||||
#define HPRE_HAC_INT_SET 0x301500
|
||||
#define HPRE_RNG_TIMEOUT_NUM 0x301A34
|
||||
#define HPRE_CORE_INT_ENABLE 0
|
||||
#define HPRE_CORE_INT_DISABLE GENMASK(21, 0)
|
||||
#define HPRE_RDCHN_INI_ST 0x301a00
|
||||
#define HPRE_CLSTR_BASE 0x302000
|
||||
#define HPRE_CORE_EN_OFFSET 0x04
|
||||
@@ -66,7 +63,6 @@
|
||||
#define HPRE_CLSTR_ADDR_INTRVL 0x1000
|
||||
#define HPRE_CLUSTER_INQURY 0x100
|
||||
#define HPRE_CLSTR_ADDR_INQRY_RSLT 0x104
|
||||
#define HPRE_TIMEOUT_ABNML_BIT 6
|
||||
#define HPRE_PASID_EN_BIT 9
|
||||
#define HPRE_REG_RD_INTVRL_US 10
|
||||
#define HPRE_REG_RD_TMOUT_US 1000
|
||||
@@ -203,9 +199,9 @@ static const struct hisi_qm_cap_info hpre_basic_info[] = {
|
||||
{HPRE_QM_RESET_MASK_CAP, 0x3128, 0, GENMASK(31, 0), 0x0, 0xC37, 0x6C37},
|
||||
{HPRE_QM_OOO_SHUTDOWN_MASK_CAP, 0x3128, 0, GENMASK(31, 0), 0x0, 0x4, 0x6C37},
|
||||
{HPRE_QM_CE_MASK_CAP, 0x312C, 0, GENMASK(31, 0), 0x0, 0x8, 0x8},
|
||||
{HPRE_NFE_MASK_CAP, 0x3130, 0, GENMASK(31, 0), 0x0, 0x3FFFFE, 0x1FFFFFE},
|
||||
{HPRE_RESET_MASK_CAP, 0x3134, 0, GENMASK(31, 0), 0x0, 0x3FFFFE, 0xBFFFFE},
|
||||
{HPRE_OOO_SHUTDOWN_MASK_CAP, 0x3134, 0, GENMASK(31, 0), 0x0, 0x22, 0xBFFFFE},
|
||||
{HPRE_NFE_MASK_CAP, 0x3130, 0, GENMASK(31, 0), 0x0, 0x3FFFFE, 0x1FFFC3E},
|
||||
{HPRE_RESET_MASK_CAP, 0x3134, 0, GENMASK(31, 0), 0x0, 0x3FFFFE, 0xBFFC3E},
|
||||
{HPRE_OOO_SHUTDOWN_MASK_CAP, 0x3134, 0, GENMASK(31, 0), 0x0, 0x22, 0xBFFC3E},
|
||||
{HPRE_CE_MASK_CAP, 0x3138, 0, GENMASK(31, 0), 0x0, 0x1, 0x1},
|
||||
{HPRE_CLUSTER_NUM_CAP, 0x313c, 20, GENMASK(3, 0), 0x0, 0x4, 0x1},
|
||||
{HPRE_CORE_TYPE_NUM_CAP, 0x313c, 16, GENMASK(3, 0), 0x0, 0x2, 0x2},
|
||||
@@ -358,6 +354,8 @@ static struct dfx_diff_registers hpre_diff_regs[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct hisi_qm_err_ini hpre_err_ini;
|
||||
|
||||
bool hpre_check_alg_support(struct hisi_qm *qm, u32 alg)
|
||||
{
|
||||
u32 cap_val;
|
||||
@@ -654,11 +652,6 @@ static int hpre_set_user_domain_and_cache(struct hisi_qm *qm)
|
||||
writel(HPRE_QM_USR_CFG_MASK, qm->io_base + QM_AWUSER_M_CFG_ENABLE);
|
||||
writel_relaxed(HPRE_QM_AXI_CFG_MASK, qm->io_base + QM_AXI_M_CFG);
|
||||
|
||||
/* HPRE need more time, we close this interrupt */
|
||||
val = readl_relaxed(qm->io_base + HPRE_QM_ABNML_INT_MASK);
|
||||
val |= BIT(HPRE_TIMEOUT_ABNML_BIT);
|
||||
writel_relaxed(val, qm->io_base + HPRE_QM_ABNML_INT_MASK);
|
||||
|
||||
if (qm->ver >= QM_HW_V3)
|
||||
writel(HPRE_RSA_ENB | HPRE_ECC_ENB,
|
||||
qm->io_base + HPRE_TYPES_ENB);
|
||||
@@ -667,9 +660,7 @@ static int hpre_set_user_domain_and_cache(struct hisi_qm *qm)
|
||||
|
||||
writel(HPRE_QM_VFG_AX_MASK, qm->io_base + HPRE_VFG_AXCACHE);
|
||||
writel(0x0, qm->io_base + HPRE_BD_ENDIAN);
|
||||
writel(0x0, qm->io_base + HPRE_INT_MASK);
|
||||
writel(0x0, qm->io_base + HPRE_POISON_BYPASS);
|
||||
writel(0x0, qm->io_base + HPRE_COMM_CNT_CLR_CE);
|
||||
writel(0x0, qm->io_base + HPRE_ECC_BYPASS);
|
||||
|
||||
writel(HPRE_BD_USR_MASK, qm->io_base + HPRE_BD_ARUSR_CFG);
|
||||
@@ -759,7 +750,7 @@ static void hpre_hw_error_disable(struct hisi_qm *qm)
|
||||
|
||||
static void hpre_hw_error_enable(struct hisi_qm *qm)
|
||||
{
|
||||
u32 ce, nfe;
|
||||
u32 ce, nfe, err_en;
|
||||
|
||||
ce = hisi_qm_get_hw_info(qm, hpre_basic_info, HPRE_CE_MASK_CAP, qm->cap_ver);
|
||||
nfe = hisi_qm_get_hw_info(qm, hpre_basic_info, HPRE_NFE_MASK_CAP, qm->cap_ver);
|
||||
@@ -776,7 +767,8 @@ static void hpre_hw_error_enable(struct hisi_qm *qm)
|
||||
hpre_master_ooo_ctrl(qm, true);
|
||||
|
||||
/* enable hpre hw error interrupts */
|
||||
writel(HPRE_CORE_INT_ENABLE, qm->io_base + HPRE_INT_MASK);
|
||||
err_en = ce | nfe | HPRE_HAC_RAS_FE_ENABLE;
|
||||
writel(~err_en, qm->io_base + HPRE_INT_MASK);
|
||||
}
|
||||
|
||||
static inline struct hisi_qm *hpre_file_to_qm(struct hpre_debugfs_file *file)
|
||||
@@ -1161,6 +1153,7 @@ static int hpre_qm_init(struct hisi_qm *qm, struct pci_dev *pdev)
|
||||
qm->qp_num = pf_q_num;
|
||||
qm->debug.curr_qm_qp_num = pf_q_num;
|
||||
qm->qm_list = &hpre_devices;
|
||||
qm->err_ini = &hpre_err_ini;
|
||||
if (pf_q_num_flag)
|
||||
set_bit(QM_MODULE_PARAM, &qm->misc_ctl);
|
||||
}
|
||||
@@ -1350,8 +1343,6 @@ static int hpre_pf_probe_init(struct hpre *hpre)
|
||||
|
||||
hpre_open_sva_prefetch(qm);
|
||||
|
||||
qm->err_ini = &hpre_err_ini;
|
||||
qm->err_ini->err_info_init(qm);
|
||||
hisi_qm_dev_err_init(qm);
|
||||
ret = hpre_show_last_regs_init(qm);
|
||||
if (ret)
|
||||
@@ -1380,6 +1371,18 @@ static int hpre_probe_init(struct hpre *hpre)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hpre_probe_uninit(struct hisi_qm *qm)
|
||||
{
|
||||
if (qm->fun_type == QM_HW_VF)
|
||||
return;
|
||||
|
||||
hpre_cnt_regs_clear(qm);
|
||||
qm->debug.curr_qm_qp_num = 0;
|
||||
hpre_show_last_regs_uninit(qm);
|
||||
hpre_close_sva_prefetch(qm);
|
||||
hisi_qm_dev_err_uninit(qm);
|
||||
}
|
||||
|
||||
static int hpre_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
{
|
||||
struct hisi_qm *qm;
|
||||
@@ -1405,7 +1408,7 @@ static int hpre_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
|
||||
ret = hisi_qm_start(qm);
|
||||
if (ret)
|
||||
goto err_with_err_init;
|
||||
goto err_with_probe_init;
|
||||
|
||||
ret = hpre_debugfs_init(qm);
|
||||
if (ret)
|
||||
@@ -1444,9 +1447,8 @@ err_qm_del_list:
|
||||
hpre_debugfs_exit(qm);
|
||||
hisi_qm_stop(qm, QM_NORMAL);
|
||||
|
||||
err_with_err_init:
|
||||
hpre_show_last_regs_uninit(qm);
|
||||
hisi_qm_dev_err_uninit(qm);
|
||||
err_with_probe_init:
|
||||
hpre_probe_uninit(qm);
|
||||
|
||||
err_with_qm_init:
|
||||
hisi_qm_uninit(qm);
|
||||
@@ -1468,13 +1470,7 @@ static void hpre_remove(struct pci_dev *pdev)
|
||||
hpre_debugfs_exit(qm);
|
||||
hisi_qm_stop(qm, QM_NORMAL);
|
||||
|
||||
if (qm->fun_type == QM_HW_PF) {
|
||||
hpre_cnt_regs_clear(qm);
|
||||
qm->debug.curr_qm_qp_num = 0;
|
||||
hpre_show_last_regs_uninit(qm);
|
||||
hisi_qm_dev_err_uninit(qm);
|
||||
}
|
||||
|
||||
hpre_probe_uninit(qm);
|
||||
hisi_qm_uninit(qm);
|
||||
}
|
||||
|
||||
|
||||
@@ -450,6 +450,7 @@ static struct qm_typical_qos_table shaper_cbs_s[] = {
|
||||
};
|
||||
|
||||
static void qm_irqs_unregister(struct hisi_qm *qm);
|
||||
static int qm_reset_device(struct hisi_qm *qm);
|
||||
|
||||
static u32 qm_get_hw_error_status(struct hisi_qm *qm)
|
||||
{
|
||||
@@ -4014,6 +4015,28 @@ static int qm_set_vf_mse(struct hisi_qm *qm, bool set)
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
static void qm_dev_ecc_mbit_handle(struct hisi_qm *qm)
|
||||
{
|
||||
u32 nfe_enb = 0;
|
||||
|
||||
/* Kunpeng930 hardware automatically close master ooo when NFE occurs */
|
||||
if (qm->ver >= QM_HW_V3)
|
||||
return;
|
||||
|
||||
if (!qm->err_status.is_dev_ecc_mbit &&
|
||||
qm->err_status.is_qm_ecc_mbit &&
|
||||
qm->err_ini->close_axi_master_ooo) {
|
||||
qm->err_ini->close_axi_master_ooo(qm);
|
||||
} else if (qm->err_status.is_dev_ecc_mbit &&
|
||||
!qm->err_status.is_qm_ecc_mbit &&
|
||||
!qm->err_ini->close_axi_master_ooo) {
|
||||
nfe_enb = readl(qm->io_base + QM_RAS_NFE_ENABLE);
|
||||
writel(nfe_enb & QM_RAS_NFE_MBIT_DISABLE,
|
||||
qm->io_base + QM_RAS_NFE_ENABLE);
|
||||
writel(QM_ECC_MBIT, qm->io_base + QM_ABNORMAL_INT_SET);
|
||||
}
|
||||
}
|
||||
|
||||
static int qm_vf_reset_prepare(struct hisi_qm *qm,
|
||||
enum qm_stop_reason stop_reason)
|
||||
{
|
||||
@@ -4078,6 +4101,8 @@ static int qm_controller_reset_prepare(struct hisi_qm *qm)
|
||||
return ret;
|
||||
}
|
||||
|
||||
qm_dev_ecc_mbit_handle(qm);
|
||||
|
||||
/* PF obtains the information of VF by querying the register. */
|
||||
qm_cmd_uninit(qm);
|
||||
|
||||
@@ -4108,33 +4133,26 @@ static int qm_controller_reset_prepare(struct hisi_qm *qm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void qm_dev_ecc_mbit_handle(struct hisi_qm *qm)
|
||||
static int qm_master_ooo_check(struct hisi_qm *qm)
|
||||
{
|
||||
u32 nfe_enb = 0;
|
||||
u32 val;
|
||||
int ret;
|
||||
|
||||
/* Kunpeng930 hardware automatically close master ooo when NFE occurs */
|
||||
if (qm->ver >= QM_HW_V3)
|
||||
return;
|
||||
/* Check the ooo register of the device before resetting the device. */
|
||||
writel(ACC_MASTER_GLOBAL_CTRL_SHUTDOWN, qm->io_base + ACC_MASTER_GLOBAL_CTRL);
|
||||
ret = readl_relaxed_poll_timeout(qm->io_base + ACC_MASTER_TRANS_RETURN,
|
||||
val, (val == ACC_MASTER_TRANS_RETURN_RW),
|
||||
POLL_PERIOD, POLL_TIMEOUT);
|
||||
if (ret)
|
||||
pci_warn(qm->pdev, "Bus lock! Please reset system.\n");
|
||||
|
||||
if (!qm->err_status.is_dev_ecc_mbit &&
|
||||
qm->err_status.is_qm_ecc_mbit &&
|
||||
qm->err_ini->close_axi_master_ooo) {
|
||||
qm->err_ini->close_axi_master_ooo(qm);
|
||||
} else if (qm->err_status.is_dev_ecc_mbit &&
|
||||
!qm->err_status.is_qm_ecc_mbit &&
|
||||
!qm->err_ini->close_axi_master_ooo) {
|
||||
nfe_enb = readl(qm->io_base + QM_RAS_NFE_ENABLE);
|
||||
writel(nfe_enb & QM_RAS_NFE_MBIT_DISABLE,
|
||||
qm->io_base + QM_RAS_NFE_ENABLE);
|
||||
writel(QM_ECC_MBIT, qm->io_base + QM_ABNORMAL_INT_SET);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int qm_soft_reset(struct hisi_qm *qm)
|
||||
static int qm_soft_reset_prepare(struct hisi_qm *qm)
|
||||
{
|
||||
struct pci_dev *pdev = qm->pdev;
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
/* Ensure all doorbells and mailboxes received by QM */
|
||||
ret = qm_check_req_recv(qm);
|
||||
@@ -4155,30 +4173,23 @@ static int qm_soft_reset(struct hisi_qm *qm)
|
||||
return ret;
|
||||
}
|
||||
|
||||
qm_dev_ecc_mbit_handle(qm);
|
||||
|
||||
/* OOO register set and check */
|
||||
writel(ACC_MASTER_GLOBAL_CTRL_SHUTDOWN,
|
||||
qm->io_base + ACC_MASTER_GLOBAL_CTRL);
|
||||
|
||||
/* If bus lock, reset chip */
|
||||
ret = readl_relaxed_poll_timeout(qm->io_base + ACC_MASTER_TRANS_RETURN,
|
||||
val,
|
||||
(val == ACC_MASTER_TRANS_RETURN_RW),
|
||||
POLL_PERIOD, POLL_TIMEOUT);
|
||||
if (ret) {
|
||||
pci_emerg(pdev, "Bus lock! Please reset system.\n");
|
||||
ret = qm_master_ooo_check(qm);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (qm->err_ini->close_sva_prefetch)
|
||||
qm->err_ini->close_sva_prefetch(qm);
|
||||
|
||||
ret = qm_set_pf_mse(qm, false);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
pci_err(pdev, "Fails to disable pf MSE bit.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int qm_reset_device(struct hisi_qm *qm)
|
||||
{
|
||||
struct pci_dev *pdev = qm->pdev;
|
||||
|
||||
/* The reset related sub-control registers are not in PCI BAR */
|
||||
if (ACPI_HANDLE(&pdev->dev)) {
|
||||
@@ -4197,12 +4208,23 @@ static int qm_soft_reset(struct hisi_qm *qm)
|
||||
pci_err(pdev, "Reset step %llu failed!\n", value);
|
||||
return -EIO;
|
||||
}
|
||||
} else {
|
||||
pci_err(pdev, "No reset method!\n");
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
pci_err(pdev, "No reset method!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int qm_soft_reset(struct hisi_qm *qm)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = qm_soft_reset_prepare(qm);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return qm_reset_device(qm);
|
||||
}
|
||||
|
||||
static int qm_vf_reset_done(struct hisi_qm *qm)
|
||||
@@ -5155,6 +5177,35 @@ err_request_mem_regions:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int qm_clear_device(struct hisi_qm *qm)
|
||||
{
|
||||
acpi_handle handle = ACPI_HANDLE(&qm->pdev->dev);
|
||||
int ret;
|
||||
|
||||
if (qm->fun_type == QM_HW_VF)
|
||||
return 0;
|
||||
|
||||
/* Device does not support reset, return */
|
||||
if (!qm->err_ini->err_info_init)
|
||||
return 0;
|
||||
qm->err_ini->err_info_init(qm);
|
||||
|
||||
if (!handle)
|
||||
return 0;
|
||||
|
||||
/* No reset method, return */
|
||||
if (!acpi_has_method(handle, qm->err_info.acpi_rst))
|
||||
return 0;
|
||||
|
||||
ret = qm_master_ooo_check(qm);
|
||||
if (ret) {
|
||||
writel(0x0, qm->io_base + ACC_MASTER_GLOBAL_CTRL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return qm_reset_device(qm);
|
||||
}
|
||||
|
||||
static int hisi_qm_pci_init(struct hisi_qm *qm)
|
||||
{
|
||||
struct pci_dev *pdev = qm->pdev;
|
||||
@@ -5184,8 +5235,14 @@ static int hisi_qm_pci_init(struct hisi_qm *qm)
|
||||
goto err_get_pci_res;
|
||||
}
|
||||
|
||||
ret = qm_clear_device(qm);
|
||||
if (ret)
|
||||
goto err_free_vectors;
|
||||
|
||||
return 0;
|
||||
|
||||
err_free_vectors:
|
||||
pci_free_irq_vectors(pdev);
|
||||
err_get_pci_res:
|
||||
qm_put_pci_res(qm);
|
||||
err_disable_pcidev:
|
||||
@@ -5486,7 +5543,6 @@ static int qm_prepare_for_suspend(struct hisi_qm *qm)
|
||||
{
|
||||
struct pci_dev *pdev = qm->pdev;
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
ret = qm->ops->set_msi(qm, false);
|
||||
if (ret) {
|
||||
@@ -5494,18 +5550,9 @@ static int qm_prepare_for_suspend(struct hisi_qm *qm)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* shutdown OOO register */
|
||||
writel(ACC_MASTER_GLOBAL_CTRL_SHUTDOWN,
|
||||
qm->io_base + ACC_MASTER_GLOBAL_CTRL);
|
||||
|
||||
ret = readl_relaxed_poll_timeout(qm->io_base + ACC_MASTER_TRANS_RETURN,
|
||||
val,
|
||||
(val == ACC_MASTER_TRANS_RETURN_RW),
|
||||
POLL_PERIOD, POLL_TIMEOUT);
|
||||
if (ret) {
|
||||
pci_emerg(pdev, "Bus lock! Please reset system.\n");
|
||||
ret = qm_master_ooo_check(qm);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = qm_set_pf_mse(qm, false);
|
||||
if (ret)
|
||||
|
||||
@@ -458,7 +458,7 @@ static void sec_ipv6_hashmask(struct sec_dev_info *info, u32 hash_mask[])
|
||||
static int sec_ipv4_hashmask(struct sec_dev_info *info, u32 hash_mask)
|
||||
{
|
||||
if (hash_mask & SEC_HASH_IPV4_MASK) {
|
||||
dev_err(info->dev, "Sec Ipv4 Hash Mask Input Error!\n ");
|
||||
dev_err(info->dev, "Sec Ipv4 Hash Mask Input Error!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1065,9 +1065,6 @@ static int sec_pf_probe_init(struct sec_dev *sec)
|
||||
struct hisi_qm *qm = &sec->qm;
|
||||
int ret;
|
||||
|
||||
qm->err_ini = &sec_err_ini;
|
||||
qm->err_ini->err_info_init(qm);
|
||||
|
||||
ret = sec_set_user_domain_and_cache(qm);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -1122,6 +1119,7 @@ static int sec_qm_init(struct hisi_qm *qm, struct pci_dev *pdev)
|
||||
qm->qp_num = pf_q_num;
|
||||
qm->debug.curr_qm_qp_num = pf_q_num;
|
||||
qm->qm_list = &sec_devices;
|
||||
qm->err_ini = &sec_err_ini;
|
||||
if (pf_q_num_flag)
|
||||
set_bit(QM_MODULE_PARAM, &qm->misc_ctl);
|
||||
} else if (qm->fun_type == QM_HW_VF && qm->ver == QM_HW_V1) {
|
||||
@@ -1186,6 +1184,12 @@ static int sec_probe_init(struct sec_dev *sec)
|
||||
|
||||
static void sec_probe_uninit(struct hisi_qm *qm)
|
||||
{
|
||||
if (qm->fun_type == QM_HW_VF)
|
||||
return;
|
||||
|
||||
sec_debug_regs_clear(qm);
|
||||
sec_show_last_regs_uninit(qm);
|
||||
sec_close_sva_prefetch(qm);
|
||||
hisi_qm_dev_err_uninit(qm);
|
||||
}
|
||||
|
||||
@@ -1274,7 +1278,6 @@ err_qm_del_list:
|
||||
sec_debugfs_exit(qm);
|
||||
hisi_qm_stop(qm, QM_NORMAL);
|
||||
err_probe_uninit:
|
||||
sec_show_last_regs_uninit(qm);
|
||||
sec_probe_uninit(qm);
|
||||
err_qm_uninit:
|
||||
sec_qm_uninit(qm);
|
||||
@@ -1296,11 +1299,6 @@ static void sec_remove(struct pci_dev *pdev)
|
||||
sec_debugfs_exit(qm);
|
||||
|
||||
(void)hisi_qm_stop(qm, QM_NORMAL);
|
||||
|
||||
if (qm->fun_type == QM_HW_PF)
|
||||
sec_debug_regs_clear(qm);
|
||||
sec_show_last_regs_uninit(qm);
|
||||
|
||||
sec_probe_uninit(qm);
|
||||
|
||||
sec_qm_uninit(qm);
|
||||
|
||||
@@ -225,7 +225,7 @@ hisi_acc_sg_buf_map_to_hw_sgl(struct device *dev,
|
||||
dma_addr_t curr_sgl_dma = 0;
|
||||
struct acc_hw_sge *curr_hw_sge;
|
||||
struct scatterlist *sg;
|
||||
int sg_n;
|
||||
int sg_n, ret;
|
||||
|
||||
if (!dev || !sgl || !pool || !hw_sgl_dma || index >= pool->count)
|
||||
return ERR_PTR(-EINVAL);
|
||||
@@ -240,14 +240,15 @@ hisi_acc_sg_buf_map_to_hw_sgl(struct device *dev,
|
||||
|
||||
if (sg_n_mapped > pool->sge_nr) {
|
||||
dev_err(dev, "the number of entries in input scatterlist is bigger than SGL pool setting.\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
ret = -EINVAL;
|
||||
goto err_unmap;
|
||||
}
|
||||
|
||||
curr_hw_sgl = acc_get_sgl(pool, index, &curr_sgl_dma);
|
||||
if (IS_ERR(curr_hw_sgl)) {
|
||||
dev_err(dev, "Get SGL error!\n");
|
||||
dma_unmap_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
ret = -ENOMEM;
|
||||
goto err_unmap;
|
||||
}
|
||||
curr_hw_sgl->entry_length_in_sgl = cpu_to_le16(pool->sge_nr);
|
||||
curr_hw_sge = curr_hw_sgl->sge_entries;
|
||||
@@ -262,6 +263,11 @@ hisi_acc_sg_buf_map_to_hw_sgl(struct device *dev,
|
||||
*hw_sgl_dma = curr_sgl_dma;
|
||||
|
||||
return curr_hw_sgl;
|
||||
|
||||
err_unmap:
|
||||
dma_unmap_sg(dev, sgl, sg_n, DMA_BIDIRECTIONAL);
|
||||
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(hisi_acc_sg_buf_map_to_hw_sgl);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright (c) 2019 HiSilicon Limited. */
|
||||
|
||||
#include <crypto/internal/rng.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/err.h>
|
||||
@@ -13,7 +14,6 @@
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/random.h>
|
||||
#include <crypto/internal/rng.h>
|
||||
|
||||
#define HISI_TRNG_REG 0x00F0
|
||||
#define HISI_TRNG_BYTES 4
|
||||
@@ -121,7 +121,7 @@ static int hisi_trng_generate(struct crypto_rng *tfm, const u8 *src,
|
||||
u32 i;
|
||||
|
||||
if (dlen > SW_DRBG_BLOCKS_NUM * SW_DRBG_BYTES || dlen == 0) {
|
||||
pr_err("dlen(%d) exceeds limit(%d)!\n", dlen,
|
||||
pr_err("dlen(%u) exceeds limit(%d)!\n", dlen,
|
||||
SW_DRBG_BLOCKS_NUM * SW_DRBG_BYTES);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ struct hisi_zip_req {
|
||||
struct hisi_zip_req_q {
|
||||
struct hisi_zip_req *q;
|
||||
unsigned long *req_bitmap;
|
||||
rwlock_t req_lock;
|
||||
spinlock_t req_lock;
|
||||
u16 size;
|
||||
};
|
||||
|
||||
@@ -116,17 +116,17 @@ static struct hisi_zip_req *hisi_zip_create_req(struct hisi_zip_qp_ctx *qp_ctx,
|
||||
struct hisi_zip_req *req_cache;
|
||||
int req_id;
|
||||
|
||||
write_lock(&req_q->req_lock);
|
||||
spin_lock(&req_q->req_lock);
|
||||
|
||||
req_id = find_first_zero_bit(req_q->req_bitmap, req_q->size);
|
||||
if (req_id >= req_q->size) {
|
||||
write_unlock(&req_q->req_lock);
|
||||
spin_unlock(&req_q->req_lock);
|
||||
dev_dbg(&qp_ctx->qp->qm->pdev->dev, "req cache is full!\n");
|
||||
return ERR_PTR(-EAGAIN);
|
||||
}
|
||||
set_bit(req_id, req_q->req_bitmap);
|
||||
|
||||
write_unlock(&req_q->req_lock);
|
||||
spin_unlock(&req_q->req_lock);
|
||||
|
||||
req_cache = q + req_id;
|
||||
req_cache->req_id = req_id;
|
||||
@@ -140,9 +140,9 @@ static void hisi_zip_remove_req(struct hisi_zip_qp_ctx *qp_ctx,
|
||||
{
|
||||
struct hisi_zip_req_q *req_q = &qp_ctx->req_q;
|
||||
|
||||
write_lock(&req_q->req_lock);
|
||||
spin_lock(&req_q->req_lock);
|
||||
clear_bit(req->req_id, req_q->req_bitmap);
|
||||
write_unlock(&req_q->req_lock);
|
||||
spin_unlock(&req_q->req_lock);
|
||||
}
|
||||
|
||||
static void hisi_zip_fill_addr(struct hisi_zip_sqe *sqe, struct hisi_zip_req *req)
|
||||
@@ -213,6 +213,7 @@ static int hisi_zip_do_work(struct hisi_zip_qp_ctx *qp_ctx,
|
||||
{
|
||||
struct hisi_acc_sgl_pool *pool = qp_ctx->sgl_pool;
|
||||
struct hisi_zip_dfx *dfx = &qp_ctx->zip_dev->dfx;
|
||||
struct hisi_zip_req_q *req_q = &qp_ctx->req_q;
|
||||
struct acomp_req *a_req = req->req;
|
||||
struct hisi_qp *qp = qp_ctx->qp;
|
||||
struct device *dev = &qp->qm->pdev->dev;
|
||||
@@ -244,7 +245,9 @@ static int hisi_zip_do_work(struct hisi_zip_qp_ctx *qp_ctx,
|
||||
|
||||
/* send command to start a task */
|
||||
atomic64_inc(&dfx->send_cnt);
|
||||
spin_lock_bh(&req_q->req_lock);
|
||||
ret = hisi_qp_send(qp, &zip_sqe);
|
||||
spin_unlock_bh(&req_q->req_lock);
|
||||
if (unlikely(ret < 0)) {
|
||||
atomic64_inc(&dfx->send_busy_cnt);
|
||||
ret = -EAGAIN;
|
||||
@@ -456,7 +459,7 @@ static int hisi_zip_create_req_q(struct hisi_zip_ctx *ctx)
|
||||
|
||||
goto err_free_comp_q;
|
||||
}
|
||||
rwlock_init(&req_q->req_lock);
|
||||
spin_lock_init(&req_q->req_lock);
|
||||
|
||||
req_q->q = kcalloc(req_q->size, sizeof(struct hisi_zip_req),
|
||||
GFP_KERNEL);
|
||||
|
||||
@@ -1141,8 +1141,6 @@ static int hisi_zip_pf_probe_init(struct hisi_zip *hisi_zip)
|
||||
|
||||
hisi_zip->ctrl = ctrl;
|
||||
ctrl->hisi_zip = hisi_zip;
|
||||
qm->err_ini = &hisi_zip_err_ini;
|
||||
qm->err_ini->err_info_init(qm);
|
||||
|
||||
ret = hisi_zip_set_user_domain_and_cache(qm);
|
||||
if (ret)
|
||||
@@ -1203,6 +1201,7 @@ static int hisi_zip_qm_init(struct hisi_qm *qm, struct pci_dev *pdev)
|
||||
qm->qp_num = pf_q_num;
|
||||
qm->debug.curr_qm_qp_num = pf_q_num;
|
||||
qm->qm_list = &zip_devices;
|
||||
qm->err_ini = &hisi_zip_err_ini;
|
||||
if (pf_q_num_flag)
|
||||
set_bit(QM_MODULE_PARAM, &qm->misc_ctl);
|
||||
} else if (qm->fun_type == QM_HW_VF && qm->ver == QM_HW_V1) {
|
||||
@@ -1269,6 +1268,16 @@ static int hisi_zip_probe_init(struct hisi_zip *hisi_zip)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hisi_zip_probe_uninit(struct hisi_qm *qm)
|
||||
{
|
||||
if (qm->fun_type == QM_HW_VF)
|
||||
return;
|
||||
|
||||
hisi_zip_show_last_regs_uninit(qm);
|
||||
hisi_zip_close_sva_prefetch(qm);
|
||||
hisi_qm_dev_err_uninit(qm);
|
||||
}
|
||||
|
||||
static int hisi_zip_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
{
|
||||
struct hisi_zip *hisi_zip;
|
||||
@@ -1295,7 +1304,7 @@ static int hisi_zip_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
|
||||
ret = hisi_qm_start(qm);
|
||||
if (ret)
|
||||
goto err_dev_err_uninit;
|
||||
goto err_probe_uninit;
|
||||
|
||||
ret = hisi_zip_debugfs_init(qm);
|
||||
if (ret)
|
||||
@@ -1334,9 +1343,8 @@ err_qm_del_list:
|
||||
hisi_zip_debugfs_exit(qm);
|
||||
hisi_qm_stop(qm, QM_NORMAL);
|
||||
|
||||
err_dev_err_uninit:
|
||||
hisi_zip_show_last_regs_uninit(qm);
|
||||
hisi_qm_dev_err_uninit(qm);
|
||||
err_probe_uninit:
|
||||
hisi_zip_probe_uninit(qm);
|
||||
|
||||
err_qm_uninit:
|
||||
hisi_zip_qm_uninit(qm);
|
||||
@@ -1358,8 +1366,7 @@ static void hisi_zip_remove(struct pci_dev *pdev)
|
||||
|
||||
hisi_zip_debugfs_exit(qm);
|
||||
hisi_qm_stop(qm, QM_NORMAL);
|
||||
hisi_zip_show_last_regs_uninit(qm);
|
||||
hisi_qm_dev_err_uninit(qm);
|
||||
hisi_zip_probe_uninit(qm);
|
||||
hisi_zip_qm_uninit(qm);
|
||||
}
|
||||
|
||||
|
||||
@@ -987,31 +987,23 @@ static int img_hash_probe(struct platform_device *pdev)
|
||||
}
|
||||
dev_dbg(dev, "using IRQ channel %d\n", irq);
|
||||
|
||||
hdev->hash_clk = devm_clk_get(&pdev->dev, "hash");
|
||||
hdev->hash_clk = devm_clk_get_enabled(&pdev->dev, "hash");
|
||||
if (IS_ERR(hdev->hash_clk)) {
|
||||
dev_err(dev, "clock initialization failed.\n");
|
||||
err = PTR_ERR(hdev->hash_clk);
|
||||
goto res_err;
|
||||
}
|
||||
|
||||
hdev->sys_clk = devm_clk_get(&pdev->dev, "sys");
|
||||
hdev->sys_clk = devm_clk_get_enabled(&pdev->dev, "sys");
|
||||
if (IS_ERR(hdev->sys_clk)) {
|
||||
dev_err(dev, "clock initialization failed.\n");
|
||||
err = PTR_ERR(hdev->sys_clk);
|
||||
goto res_err;
|
||||
}
|
||||
|
||||
err = clk_prepare_enable(hdev->hash_clk);
|
||||
if (err)
|
||||
goto res_err;
|
||||
|
||||
err = clk_prepare_enable(hdev->sys_clk);
|
||||
if (err)
|
||||
goto clk_err;
|
||||
|
||||
err = img_hash_dma_init(hdev);
|
||||
if (err)
|
||||
goto dma_err;
|
||||
goto res_err;
|
||||
|
||||
dev_dbg(dev, "using %s for DMA transfers\n",
|
||||
dma_chan_name(hdev->dma_lch));
|
||||
@@ -1032,10 +1024,6 @@ err_algs:
|
||||
list_del(&hdev->list);
|
||||
spin_unlock(&img_hash.lock);
|
||||
dma_release_channel(hdev->dma_lch);
|
||||
dma_err:
|
||||
clk_disable_unprepare(hdev->sys_clk);
|
||||
clk_err:
|
||||
clk_disable_unprepare(hdev->hash_clk);
|
||||
res_err:
|
||||
tasklet_kill(&hdev->done_task);
|
||||
tasklet_kill(&hdev->dma_task);
|
||||
@@ -1058,9 +1046,6 @@ static void img_hash_remove(struct platform_device *pdev)
|
||||
tasklet_kill(&hdev->dma_task);
|
||||
|
||||
dma_release_channel(hdev->dma_lch);
|
||||
|
||||
clk_disable_unprepare(hdev->hash_clk);
|
||||
clk_disable_unprepare(hdev->sys_clk);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
||||
@@ -897,7 +897,6 @@ int safexcel_init_ring_descriptors(struct safexcel_crypto_priv *priv,
|
||||
int safexcel_select_ring(struct safexcel_crypto_priv *priv);
|
||||
void *safexcel_ring_next_rptr(struct safexcel_crypto_priv *priv,
|
||||
struct safexcel_desc_ring *ring);
|
||||
void *safexcel_ring_first_rptr(struct safexcel_crypto_priv *priv, int ring);
|
||||
void safexcel_ring_rollback_wptr(struct safexcel_crypto_priv *priv,
|
||||
struct safexcel_desc_ring *ring);
|
||||
struct safexcel_command_desc *safexcel_add_cdesc(struct safexcel_crypto_priv *priv,
|
||||
|
||||
@@ -495,10 +495,10 @@ static void remove_device_compression_modes(struct iaa_device *iaa_device)
|
||||
if (!device_mode)
|
||||
continue;
|
||||
|
||||
free_device_compression_mode(iaa_device, device_mode);
|
||||
iaa_device->compression_modes[i] = NULL;
|
||||
if (iaa_compression_modes[i]->free)
|
||||
iaa_compression_modes[i]->free(device_mode);
|
||||
free_device_compression_mode(iaa_device, device_mode);
|
||||
iaa_device->compression_modes[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1150,6 +1150,7 @@ static const struct of_device_id kmb_ocs_hcu_of_match[] = {
|
||||
},
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, kmb_ocs_hcu_of_match);
|
||||
|
||||
static void kmb_ocs_hcu_remove(struct platform_device *pdev)
|
||||
{
|
||||
|
||||
@@ -163,7 +163,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
return ret;
|
||||
|
||||
out_err_dev_stop:
|
||||
adf_dev_down(accel_dev, false);
|
||||
adf_dev_down(accel_dev);
|
||||
out_err:
|
||||
adf_cleanup_accel(accel_dev);
|
||||
return ret;
|
||||
@@ -177,7 +177,7 @@ static void adf_remove(struct pci_dev *pdev)
|
||||
pr_err("QAT: Driver removal failed\n");
|
||||
return;
|
||||
}
|
||||
adf_dev_down(accel_dev, false);
|
||||
adf_dev_down(accel_dev);
|
||||
adf_cleanup_accel(accel_dev);
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
return ret;
|
||||
|
||||
out_err_dev_stop:
|
||||
adf_dev_down(accel_dev, false);
|
||||
adf_dev_down(accel_dev);
|
||||
out_err:
|
||||
adf_cleanup_accel(accel_dev);
|
||||
return ret;
|
||||
@@ -179,7 +179,7 @@ static void adf_remove(struct pci_dev *pdev)
|
||||
pr_err("QAT: Driver removal failed\n");
|
||||
return;
|
||||
}
|
||||
adf_dev_down(accel_dev, false);
|
||||
adf_dev_down(accel_dev);
|
||||
adf_cleanup_accel(accel_dev);
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
return ret;
|
||||
|
||||
out_err_dev_stop:
|
||||
adf_dev_down(accel_dev, false);
|
||||
adf_dev_down(accel_dev);
|
||||
out_err_free_reg:
|
||||
pci_release_regions(accel_pci_dev->pci_dev);
|
||||
out_err_disable:
|
||||
@@ -221,7 +221,7 @@ static void adf_remove(struct pci_dev *pdev)
|
||||
pr_err("QAT: Driver removal failed\n");
|
||||
return;
|
||||
}
|
||||
adf_dev_down(accel_dev, false);
|
||||
adf_dev_down(accel_dev);
|
||||
adf_cleanup_accel(accel_dev);
|
||||
adf_cleanup_pci_dev(accel_dev);
|
||||
kfree(accel_dev);
|
||||
|
||||
@@ -176,7 +176,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
return ret;
|
||||
|
||||
out_err_dev_stop:
|
||||
adf_dev_down(accel_dev, false);
|
||||
adf_dev_down(accel_dev);
|
||||
out_err_free_reg:
|
||||
pci_release_regions(accel_pci_dev->pci_dev);
|
||||
out_err_disable:
|
||||
@@ -196,7 +196,7 @@ static void adf_remove(struct pci_dev *pdev)
|
||||
return;
|
||||
}
|
||||
adf_flush_vf_wq(accel_dev);
|
||||
adf_dev_down(accel_dev, false);
|
||||
adf_dev_down(accel_dev);
|
||||
adf_cleanup_accel(accel_dev);
|
||||
adf_cleanup_pci_dev(accel_dev);
|
||||
kfree(accel_dev);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user