mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
Merge e397ad3f16 ("ASoC: Intel: avs: Fix theoretical infinite loop") into android14-6.1-lts
Steps on the way to 6.1.129 Change-Id: I1dccc0094c873f1be70ee97b941f74b5ace58e1e Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -291,7 +291,7 @@ int wrpll_configure_for_rate(struct wrpll_cfg *c, u32 target_rate,
|
|||||||
vco = vco_pre * f;
|
vco = vco_pre * f;
|
||||||
}
|
}
|
||||||
|
|
||||||
delta = abs(target_rate - vco);
|
delta = abs(target_vco_rate - vco);
|
||||||
if (delta < best_delta) {
|
if (delta < best_delta) {
|
||||||
best_delta = delta;
|
best_delta = delta;
|
||||||
best_r = r;
|
best_r = r;
|
||||||
|
|||||||
@@ -635,7 +635,14 @@ static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI_CPPC_LIB
|
#ifdef CONFIG_ACPI_CPPC_LIB
|
||||||
static u64 get_max_boost_ratio(unsigned int cpu)
|
/*
|
||||||
|
* get_max_boost_ratio: Computes the max_boost_ratio as the ratio
|
||||||
|
* between the highest_perf and the nominal_perf.
|
||||||
|
*
|
||||||
|
* Returns the max_boost_ratio for @cpu. Returns the CPPC nominal
|
||||||
|
* frequency via @nominal_freq if it is non-NULL pointer.
|
||||||
|
*/
|
||||||
|
static u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq)
|
||||||
{
|
{
|
||||||
struct cppc_perf_caps perf_caps;
|
struct cppc_perf_caps perf_caps;
|
||||||
u64 highest_perf, nominal_perf;
|
u64 highest_perf, nominal_perf;
|
||||||
@@ -658,6 +665,9 @@ static u64 get_max_boost_ratio(unsigned int cpu)
|
|||||||
|
|
||||||
nominal_perf = perf_caps.nominal_perf;
|
nominal_perf = perf_caps.nominal_perf;
|
||||||
|
|
||||||
|
if (nominal_freq)
|
||||||
|
*nominal_freq = perf_caps.nominal_freq;
|
||||||
|
|
||||||
if (!highest_perf || !nominal_perf) {
|
if (!highest_perf || !nominal_perf) {
|
||||||
pr_debug("CPU%d: highest or nominal performance missing\n", cpu);
|
pr_debug("CPU%d: highest or nominal performance missing\n", cpu);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -670,8 +680,12 @@ static u64 get_max_boost_ratio(unsigned int cpu)
|
|||||||
|
|
||||||
return div_u64(highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf);
|
return div_u64(highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static inline u64 get_max_boost_ratio(unsigned int cpu) { return 0; }
|
static inline u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||||
@@ -681,9 +695,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
|||||||
struct acpi_cpufreq_data *data;
|
struct acpi_cpufreq_data *data;
|
||||||
unsigned int cpu = policy->cpu;
|
unsigned int cpu = policy->cpu;
|
||||||
struct cpuinfo_x86 *c = &cpu_data(cpu);
|
struct cpuinfo_x86 *c = &cpu_data(cpu);
|
||||||
|
u64 max_boost_ratio, nominal_freq = 0;
|
||||||
unsigned int valid_states = 0;
|
unsigned int valid_states = 0;
|
||||||
unsigned int result = 0;
|
unsigned int result = 0;
|
||||||
u64 max_boost_ratio;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
static int blacklisted;
|
static int blacklisted;
|
||||||
@@ -833,16 +847,20 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
|||||||
}
|
}
|
||||||
freq_table[valid_states].frequency = CPUFREQ_TABLE_END;
|
freq_table[valid_states].frequency = CPUFREQ_TABLE_END;
|
||||||
|
|
||||||
max_boost_ratio = get_max_boost_ratio(cpu);
|
max_boost_ratio = get_max_boost_ratio(cpu, &nominal_freq);
|
||||||
if (max_boost_ratio) {
|
if (max_boost_ratio) {
|
||||||
unsigned int freq = freq_table[0].frequency;
|
unsigned int freq = nominal_freq;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Because the loop above sorts the freq_table entries in the
|
* The loop above sorts the freq_table entries in the
|
||||||
* descending order, freq is the maximum frequency in the table.
|
* descending order. If ACPI CPPC has not advertised
|
||||||
* Assume that it corresponds to the CPPC nominal frequency and
|
* the nominal frequency (this is possible in CPPC
|
||||||
* use it to set cpuinfo.max_freq.
|
* revisions prior to 3), then use the first entry in
|
||||||
|
* the pstate table as a proxy for nominal frequency.
|
||||||
*/
|
*/
|
||||||
|
if (!freq)
|
||||||
|
freq = freq_table[0].frequency;
|
||||||
|
|
||||||
policy->cpuinfo.max_freq = freq * max_boost_ratio >> SCHED_CAPACITY_SHIFT;
|
policy->cpuinfo.max_freq = freq * max_boost_ratio >> SCHED_CAPACITY_SHIFT;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ struct sec_aead_req {
|
|||||||
u8 *a_ivin;
|
u8 *a_ivin;
|
||||||
dma_addr_t a_ivin_dma;
|
dma_addr_t a_ivin_dma;
|
||||||
struct aead_request *aead_req;
|
struct aead_request *aead_req;
|
||||||
|
bool fallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* SEC request of Crypto */
|
/* SEC request of Crypto */
|
||||||
@@ -90,9 +91,7 @@ struct sec_auth_ctx {
|
|||||||
dma_addr_t a_key_dma;
|
dma_addr_t a_key_dma;
|
||||||
u8 *a_key;
|
u8 *a_key;
|
||||||
u8 a_key_len;
|
u8 a_key_len;
|
||||||
u8 mac_len;
|
|
||||||
u8 a_alg;
|
u8 a_alg;
|
||||||
bool fallback;
|
|
||||||
struct crypto_shash *hash_tfm;
|
struct crypto_shash *hash_tfm;
|
||||||
struct crypto_aead *fallback_aead_tfm;
|
struct crypto_aead *fallback_aead_tfm;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -850,6 +850,7 @@ static int sec_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
|
|||||||
ret = sec_skcipher_aes_sm4_setkey(c_ctx, keylen, c_mode);
|
ret = sec_skcipher_aes_sm4_setkey(c_ctx, keylen, c_mode);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
dev_err(dev, "sec c_alg err!\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -953,15 +954,14 @@ static int sec_aead_mac_init(struct sec_aead_req *req)
|
|||||||
struct aead_request *aead_req = req->aead_req;
|
struct aead_request *aead_req = req->aead_req;
|
||||||
struct crypto_aead *tfm = crypto_aead_reqtfm(aead_req);
|
struct crypto_aead *tfm = crypto_aead_reqtfm(aead_req);
|
||||||
size_t authsize = crypto_aead_authsize(tfm);
|
size_t authsize = crypto_aead_authsize(tfm);
|
||||||
u8 *mac_out = req->out_mac;
|
|
||||||
struct scatterlist *sgl = aead_req->src;
|
struct scatterlist *sgl = aead_req->src;
|
||||||
|
u8 *mac_out = req->out_mac;
|
||||||
size_t copy_size;
|
size_t copy_size;
|
||||||
off_t skip_size;
|
off_t skip_size;
|
||||||
|
|
||||||
/* Copy input mac */
|
/* Copy input mac */
|
||||||
skip_size = aead_req->assoclen + aead_req->cryptlen - authsize;
|
skip_size = aead_req->assoclen + aead_req->cryptlen - authsize;
|
||||||
copy_size = sg_pcopy_to_buffer(sgl, sg_nents(sgl), mac_out,
|
copy_size = sg_pcopy_to_buffer(sgl, sg_nents(sgl), mac_out, authsize, skip_size);
|
||||||
authsize, skip_size);
|
|
||||||
if (unlikely(copy_size != authsize))
|
if (unlikely(copy_size != authsize))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -1124,10 +1124,7 @@ static int sec_aead_setauthsize(struct crypto_aead *aead, unsigned int authsize)
|
|||||||
struct sec_ctx *ctx = crypto_tfm_ctx(tfm);
|
struct sec_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||||
struct sec_auth_ctx *a_ctx = &ctx->a_ctx;
|
struct sec_auth_ctx *a_ctx = &ctx->a_ctx;
|
||||||
|
|
||||||
if (unlikely(a_ctx->fallback_aead_tfm))
|
return crypto_aead_setauthsize(a_ctx->fallback_aead_tfm, authsize);
|
||||||
return crypto_aead_setauthsize(a_ctx->fallback_aead_tfm, authsize);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sec_aead_fallback_setkey(struct sec_auth_ctx *a_ctx,
|
static int sec_aead_fallback_setkey(struct sec_auth_ctx *a_ctx,
|
||||||
@@ -1143,7 +1140,6 @@ static int sec_aead_fallback_setkey(struct sec_auth_ctx *a_ctx,
|
|||||||
static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key,
|
static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key,
|
||||||
const u32 keylen, const enum sec_hash_alg a_alg,
|
const u32 keylen, const enum sec_hash_alg a_alg,
|
||||||
const enum sec_calg c_alg,
|
const enum sec_calg c_alg,
|
||||||
const enum sec_mac_len mac_len,
|
|
||||||
const enum sec_cmode c_mode)
|
const enum sec_cmode c_mode)
|
||||||
{
|
{
|
||||||
struct sec_ctx *ctx = crypto_aead_ctx(tfm);
|
struct sec_ctx *ctx = crypto_aead_ctx(tfm);
|
||||||
@@ -1155,7 +1151,6 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key,
|
|||||||
|
|
||||||
ctx->a_ctx.a_alg = a_alg;
|
ctx->a_ctx.a_alg = a_alg;
|
||||||
ctx->c_ctx.c_alg = c_alg;
|
ctx->c_ctx.c_alg = c_alg;
|
||||||
ctx->a_ctx.mac_len = mac_len;
|
|
||||||
c_ctx->c_mode = c_mode;
|
c_ctx->c_mode = c_mode;
|
||||||
|
|
||||||
if (c_mode == SEC_CMODE_CCM || c_mode == SEC_CMODE_GCM) {
|
if (c_mode == SEC_CMODE_CCM || c_mode == SEC_CMODE_GCM) {
|
||||||
@@ -1166,16 +1161,11 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key,
|
|||||||
}
|
}
|
||||||
memcpy(c_ctx->c_key, key, keylen);
|
memcpy(c_ctx->c_key, key, keylen);
|
||||||
|
|
||||||
if (unlikely(a_ctx->fallback_aead_tfm)) {
|
return sec_aead_fallback_setkey(a_ctx, tfm, key, keylen);
|
||||||
ret = sec_aead_fallback_setkey(a_ctx, tfm, key, keylen);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crypto_authenc_extractkeys(&keys, key, keylen))
|
ret = crypto_authenc_extractkeys(&keys, key, keylen);
|
||||||
|
if (ret)
|
||||||
goto bad_key;
|
goto bad_key;
|
||||||
|
|
||||||
ret = sec_aead_aes_set_key(c_ctx, &keys);
|
ret = sec_aead_aes_set_key(c_ctx, &keys);
|
||||||
@@ -1190,9 +1180,15 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key,
|
|||||||
goto bad_key;
|
goto bad_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ctx->a_ctx.mac_len & SEC_SQE_LEN_RATE_MASK) ||
|
if (ctx->a_ctx.a_key_len & SEC_SQE_LEN_RATE_MASK) {
|
||||||
(ctx->a_ctx.a_key_len & SEC_SQE_LEN_RATE_MASK)) {
|
ret = -EINVAL;
|
||||||
dev_err(dev, "MAC or AUTH key length error!\n");
|
dev_err(dev, "AUTH key length error!\n");
|
||||||
|
goto bad_key;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = sec_aead_fallback_setkey(a_ctx, tfm, key, keylen);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "set sec fallback key err!\n");
|
||||||
goto bad_key;
|
goto bad_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1200,31 +1196,23 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key,
|
|||||||
|
|
||||||
bad_key:
|
bad_key:
|
||||||
memzero_explicit(&keys, sizeof(struct crypto_authenc_keys));
|
memzero_explicit(&keys, sizeof(struct crypto_authenc_keys));
|
||||||
return -EINVAL;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define GEN_SEC_AEAD_SETKEY_FUNC(name, aalg, calg, maclen, cmode) \
|
#define GEN_SEC_AEAD_SETKEY_FUNC(name, aalg, calg, cmode) \
|
||||||
static int sec_setkey_##name(struct crypto_aead *tfm, const u8 *key, \
|
static int sec_setkey_##name(struct crypto_aead *tfm, const u8 *key, u32 keylen) \
|
||||||
u32 keylen) \
|
{ \
|
||||||
{ \
|
return sec_aead_setkey(tfm, key, keylen, aalg, calg, cmode); \
|
||||||
return sec_aead_setkey(tfm, key, keylen, aalg, calg, maclen, cmode);\
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha1, SEC_A_HMAC_SHA1,
|
GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha1, SEC_A_HMAC_SHA1, SEC_CALG_AES, SEC_CMODE_CBC)
|
||||||
SEC_CALG_AES, SEC_HMAC_SHA1_MAC, SEC_CMODE_CBC)
|
GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha256, SEC_A_HMAC_SHA256, SEC_CALG_AES, SEC_CMODE_CBC)
|
||||||
GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha256, SEC_A_HMAC_SHA256,
|
GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha512, SEC_A_HMAC_SHA512, SEC_CALG_AES, SEC_CMODE_CBC)
|
||||||
SEC_CALG_AES, SEC_HMAC_SHA256_MAC, SEC_CMODE_CBC)
|
GEN_SEC_AEAD_SETKEY_FUNC(aes_ccm, 0, SEC_CALG_AES, SEC_CMODE_CCM)
|
||||||
GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha512, SEC_A_HMAC_SHA512,
|
GEN_SEC_AEAD_SETKEY_FUNC(aes_gcm, 0, SEC_CALG_AES, SEC_CMODE_GCM)
|
||||||
SEC_CALG_AES, SEC_HMAC_SHA512_MAC, SEC_CMODE_CBC)
|
GEN_SEC_AEAD_SETKEY_FUNC(sm4_ccm, 0, SEC_CALG_SM4, SEC_CMODE_CCM)
|
||||||
GEN_SEC_AEAD_SETKEY_FUNC(aes_ccm, 0, SEC_CALG_AES,
|
GEN_SEC_AEAD_SETKEY_FUNC(sm4_gcm, 0, SEC_CALG_SM4, SEC_CMODE_GCM)
|
||||||
SEC_HMAC_CCM_MAC, SEC_CMODE_CCM)
|
|
||||||
GEN_SEC_AEAD_SETKEY_FUNC(aes_gcm, 0, SEC_CALG_AES,
|
|
||||||
SEC_HMAC_GCM_MAC, SEC_CMODE_GCM)
|
|
||||||
GEN_SEC_AEAD_SETKEY_FUNC(sm4_ccm, 0, SEC_CALG_SM4,
|
|
||||||
SEC_HMAC_CCM_MAC, SEC_CMODE_CCM)
|
|
||||||
GEN_SEC_AEAD_SETKEY_FUNC(sm4_gcm, 0, SEC_CALG_SM4,
|
|
||||||
SEC_HMAC_GCM_MAC, SEC_CMODE_GCM)
|
|
||||||
|
|
||||||
static int sec_aead_sgl_map(struct sec_ctx *ctx, struct sec_req *req)
|
static int sec_aead_sgl_map(struct sec_ctx *ctx, struct sec_req *req)
|
||||||
{
|
{
|
||||||
@@ -1473,9 +1461,10 @@ static void sec_skcipher_callback(struct sec_ctx *ctx, struct sec_req *req,
|
|||||||
static void set_aead_auth_iv(struct sec_ctx *ctx, struct sec_req *req)
|
static void set_aead_auth_iv(struct sec_ctx *ctx, struct sec_req *req)
|
||||||
{
|
{
|
||||||
struct aead_request *aead_req = req->aead_req.aead_req;
|
struct aead_request *aead_req = req->aead_req.aead_req;
|
||||||
struct sec_cipher_req *c_req = &req->c_req;
|
struct crypto_aead *tfm = crypto_aead_reqtfm(aead_req);
|
||||||
|
size_t authsize = crypto_aead_authsize(tfm);
|
||||||
struct sec_aead_req *a_req = &req->aead_req;
|
struct sec_aead_req *a_req = &req->aead_req;
|
||||||
size_t authsize = ctx->a_ctx.mac_len;
|
struct sec_cipher_req *c_req = &req->c_req;
|
||||||
u32 data_size = aead_req->cryptlen;
|
u32 data_size = aead_req->cryptlen;
|
||||||
u8 flage = 0;
|
u8 flage = 0;
|
||||||
u8 cm, cl;
|
u8 cm, cl;
|
||||||
@@ -1516,10 +1505,8 @@ static void set_aead_auth_iv(struct sec_ctx *ctx, struct sec_req *req)
|
|||||||
static void sec_aead_set_iv(struct sec_ctx *ctx, struct sec_req *req)
|
static void sec_aead_set_iv(struct sec_ctx *ctx, struct sec_req *req)
|
||||||
{
|
{
|
||||||
struct aead_request *aead_req = req->aead_req.aead_req;
|
struct aead_request *aead_req = req->aead_req.aead_req;
|
||||||
struct crypto_aead *tfm = crypto_aead_reqtfm(aead_req);
|
|
||||||
size_t authsize = crypto_aead_authsize(tfm);
|
|
||||||
struct sec_cipher_req *c_req = &req->c_req;
|
|
||||||
struct sec_aead_req *a_req = &req->aead_req;
|
struct sec_aead_req *a_req = &req->aead_req;
|
||||||
|
struct sec_cipher_req *c_req = &req->c_req;
|
||||||
|
|
||||||
memcpy(c_req->c_ivin, aead_req->iv, ctx->c_ctx.ivsize);
|
memcpy(c_req->c_ivin, aead_req->iv, ctx->c_ctx.ivsize);
|
||||||
|
|
||||||
@@ -1527,15 +1514,11 @@ static void sec_aead_set_iv(struct sec_ctx *ctx, struct sec_req *req)
|
|||||||
/*
|
/*
|
||||||
* CCM 16Byte Cipher_IV: {1B_Flage,13B_IV,2B_counter},
|
* CCM 16Byte Cipher_IV: {1B_Flage,13B_IV,2B_counter},
|
||||||
* the counter must set to 0x01
|
* the counter must set to 0x01
|
||||||
|
* CCM 16Byte Auth_IV: {1B_AFlage,13B_IV,2B_Ptext_length}
|
||||||
*/
|
*/
|
||||||
ctx->a_ctx.mac_len = authsize;
|
|
||||||
/* CCM 16Byte Auth_IV: {1B_AFlage,13B_IV,2B_Ptext_length} */
|
|
||||||
set_aead_auth_iv(ctx, req);
|
set_aead_auth_iv(ctx, req);
|
||||||
}
|
} else if (ctx->c_ctx.c_mode == SEC_CMODE_GCM) {
|
||||||
|
/* GCM 12Byte Cipher_IV == Auth_IV */
|
||||||
/* GCM 12Byte Cipher_IV == Auth_IV */
|
|
||||||
if (ctx->c_ctx.c_mode == SEC_CMODE_GCM) {
|
|
||||||
ctx->a_ctx.mac_len = authsize;
|
|
||||||
memcpy(a_req->a_ivin, c_req->c_ivin, SEC_AIV_SIZE);
|
memcpy(a_req->a_ivin, c_req->c_ivin, SEC_AIV_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1545,9 +1528,11 @@ static void sec_auth_bd_fill_xcm(struct sec_auth_ctx *ctx, int dir,
|
|||||||
{
|
{
|
||||||
struct sec_aead_req *a_req = &req->aead_req;
|
struct sec_aead_req *a_req = &req->aead_req;
|
||||||
struct aead_request *aq = a_req->aead_req;
|
struct aead_request *aq = a_req->aead_req;
|
||||||
|
struct crypto_aead *tfm = crypto_aead_reqtfm(aq);
|
||||||
|
size_t authsize = crypto_aead_authsize(tfm);
|
||||||
|
|
||||||
/* C_ICV_Len is MAC size, 0x4 ~ 0x10 */
|
/* C_ICV_Len is MAC size, 0x4 ~ 0x10 */
|
||||||
sec_sqe->type2.icvw_kmode |= cpu_to_le16((u16)ctx->mac_len);
|
sec_sqe->type2.icvw_kmode |= cpu_to_le16((u16)authsize);
|
||||||
|
|
||||||
/* mode set to CCM/GCM, don't set {A_Alg, AKey_Len, MAC_Len} */
|
/* mode set to CCM/GCM, don't set {A_Alg, AKey_Len, MAC_Len} */
|
||||||
sec_sqe->type2.a_key_addr = sec_sqe->type2.c_key_addr;
|
sec_sqe->type2.a_key_addr = sec_sqe->type2.c_key_addr;
|
||||||
@@ -1571,9 +1556,11 @@ static void sec_auth_bd_fill_xcm_v3(struct sec_auth_ctx *ctx, int dir,
|
|||||||
{
|
{
|
||||||
struct sec_aead_req *a_req = &req->aead_req;
|
struct sec_aead_req *a_req = &req->aead_req;
|
||||||
struct aead_request *aq = a_req->aead_req;
|
struct aead_request *aq = a_req->aead_req;
|
||||||
|
struct crypto_aead *tfm = crypto_aead_reqtfm(aq);
|
||||||
|
size_t authsize = crypto_aead_authsize(tfm);
|
||||||
|
|
||||||
/* C_ICV_Len is MAC size, 0x4 ~ 0x10 */
|
/* C_ICV_Len is MAC size, 0x4 ~ 0x10 */
|
||||||
sqe3->c_icv_key |= cpu_to_le16((u16)ctx->mac_len << SEC_MAC_OFFSET_V3);
|
sqe3->c_icv_key |= cpu_to_le16((u16)authsize << SEC_MAC_OFFSET_V3);
|
||||||
|
|
||||||
/* mode set to CCM/GCM, don't set {A_Alg, AKey_Len, MAC_Len} */
|
/* mode set to CCM/GCM, don't set {A_Alg, AKey_Len, MAC_Len} */
|
||||||
sqe3->a_key_addr = sqe3->c_key_addr;
|
sqe3->a_key_addr = sqe3->c_key_addr;
|
||||||
@@ -1597,11 +1584,12 @@ static void sec_auth_bd_fill_ex(struct sec_auth_ctx *ctx, int dir,
|
|||||||
struct sec_aead_req *a_req = &req->aead_req;
|
struct sec_aead_req *a_req = &req->aead_req;
|
||||||
struct sec_cipher_req *c_req = &req->c_req;
|
struct sec_cipher_req *c_req = &req->c_req;
|
||||||
struct aead_request *aq = a_req->aead_req;
|
struct aead_request *aq = a_req->aead_req;
|
||||||
|
struct crypto_aead *tfm = crypto_aead_reqtfm(aq);
|
||||||
|
size_t authsize = crypto_aead_authsize(tfm);
|
||||||
|
|
||||||
sec_sqe->type2.a_key_addr = cpu_to_le64(ctx->a_key_dma);
|
sec_sqe->type2.a_key_addr = cpu_to_le64(ctx->a_key_dma);
|
||||||
|
|
||||||
sec_sqe->type2.mac_key_alg =
|
sec_sqe->type2.mac_key_alg = cpu_to_le32(authsize / SEC_SQE_LEN_RATE);
|
||||||
cpu_to_le32(ctx->mac_len / SEC_SQE_LEN_RATE);
|
|
||||||
|
|
||||||
sec_sqe->type2.mac_key_alg |=
|
sec_sqe->type2.mac_key_alg |=
|
||||||
cpu_to_le32((u32)((ctx->a_key_len) /
|
cpu_to_le32((u32)((ctx->a_key_len) /
|
||||||
@@ -1651,11 +1639,13 @@ static void sec_auth_bd_fill_ex_v3(struct sec_auth_ctx *ctx, int dir,
|
|||||||
struct sec_aead_req *a_req = &req->aead_req;
|
struct sec_aead_req *a_req = &req->aead_req;
|
||||||
struct sec_cipher_req *c_req = &req->c_req;
|
struct sec_cipher_req *c_req = &req->c_req;
|
||||||
struct aead_request *aq = a_req->aead_req;
|
struct aead_request *aq = a_req->aead_req;
|
||||||
|
struct crypto_aead *tfm = crypto_aead_reqtfm(aq);
|
||||||
|
size_t authsize = crypto_aead_authsize(tfm);
|
||||||
|
|
||||||
sqe3->a_key_addr = cpu_to_le64(ctx->a_key_dma);
|
sqe3->a_key_addr = cpu_to_le64(ctx->a_key_dma);
|
||||||
|
|
||||||
sqe3->auth_mac_key |=
|
sqe3->auth_mac_key |=
|
||||||
cpu_to_le32((u32)(ctx->mac_len /
|
cpu_to_le32((u32)(authsize /
|
||||||
SEC_SQE_LEN_RATE) << SEC_MAC_OFFSET_V3);
|
SEC_SQE_LEN_RATE) << SEC_MAC_OFFSET_V3);
|
||||||
|
|
||||||
sqe3->auth_mac_key |=
|
sqe3->auth_mac_key |=
|
||||||
@@ -1706,9 +1696,9 @@ static void sec_aead_callback(struct sec_ctx *c, struct sec_req *req, int err)
|
|||||||
{
|
{
|
||||||
struct aead_request *a_req = req->aead_req.aead_req;
|
struct aead_request *a_req = req->aead_req.aead_req;
|
||||||
struct crypto_aead *tfm = crypto_aead_reqtfm(a_req);
|
struct crypto_aead *tfm = crypto_aead_reqtfm(a_req);
|
||||||
|
size_t authsize = crypto_aead_authsize(tfm);
|
||||||
struct sec_aead_req *aead_req = &req->aead_req;
|
struct sec_aead_req *aead_req = &req->aead_req;
|
||||||
struct sec_cipher_req *c_req = &req->c_req;
|
struct sec_cipher_req *c_req = &req->c_req;
|
||||||
size_t authsize = crypto_aead_authsize(tfm);
|
|
||||||
struct sec_qp_ctx *qp_ctx = req->qp_ctx;
|
struct sec_qp_ctx *qp_ctx = req->qp_ctx;
|
||||||
struct aead_request *backlog_aead_req;
|
struct aead_request *backlog_aead_req;
|
||||||
struct sec_req *backlog_req;
|
struct sec_req *backlog_req;
|
||||||
@@ -1721,10 +1711,8 @@ static void sec_aead_callback(struct sec_ctx *c, struct sec_req *req, int err)
|
|||||||
if (!err && c_req->encrypt) {
|
if (!err && c_req->encrypt) {
|
||||||
struct scatterlist *sgl = a_req->dst;
|
struct scatterlist *sgl = a_req->dst;
|
||||||
|
|
||||||
sz = sg_pcopy_from_buffer(sgl, sg_nents(sgl),
|
sz = sg_pcopy_from_buffer(sgl, sg_nents(sgl), aead_req->out_mac,
|
||||||
aead_req->out_mac,
|
authsize, a_req->cryptlen + a_req->assoclen);
|
||||||
authsize, a_req->cryptlen +
|
|
||||||
a_req->assoclen);
|
|
||||||
if (unlikely(sz != authsize)) {
|
if (unlikely(sz != authsize)) {
|
||||||
dev_err(c->dev, "copy out mac err!\n");
|
dev_err(c->dev, "copy out mac err!\n");
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
@@ -1933,8 +1921,10 @@ static void sec_aead_exit(struct crypto_aead *tfm)
|
|||||||
|
|
||||||
static int sec_aead_ctx_init(struct crypto_aead *tfm, const char *hash_name)
|
static int sec_aead_ctx_init(struct crypto_aead *tfm, const char *hash_name)
|
||||||
{
|
{
|
||||||
|
struct aead_alg *alg = crypto_aead_alg(tfm);
|
||||||
struct sec_ctx *ctx = crypto_aead_ctx(tfm);
|
struct sec_ctx *ctx = crypto_aead_ctx(tfm);
|
||||||
struct sec_auth_ctx *auth_ctx = &ctx->a_ctx;
|
struct sec_auth_ctx *a_ctx = &ctx->a_ctx;
|
||||||
|
const char *aead_name = alg->base.cra_name;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = sec_aead_init(tfm);
|
ret = sec_aead_init(tfm);
|
||||||
@@ -1943,11 +1933,20 @@ static int sec_aead_ctx_init(struct crypto_aead *tfm, const char *hash_name)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
auth_ctx->hash_tfm = crypto_alloc_shash(hash_name, 0, 0);
|
a_ctx->hash_tfm = crypto_alloc_shash(hash_name, 0, 0);
|
||||||
if (IS_ERR(auth_ctx->hash_tfm)) {
|
if (IS_ERR(a_ctx->hash_tfm)) {
|
||||||
dev_err(ctx->dev, "aead alloc shash error!\n");
|
dev_err(ctx->dev, "aead alloc shash error!\n");
|
||||||
sec_aead_exit(tfm);
|
sec_aead_exit(tfm);
|
||||||
return PTR_ERR(auth_ctx->hash_tfm);
|
return PTR_ERR(a_ctx->hash_tfm);
|
||||||
|
}
|
||||||
|
|
||||||
|
a_ctx->fallback_aead_tfm = crypto_alloc_aead(aead_name, 0,
|
||||||
|
CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_ASYNC);
|
||||||
|
if (IS_ERR(a_ctx->fallback_aead_tfm)) {
|
||||||
|
dev_err(ctx->dev, "aead driver alloc fallback tfm error!\n");
|
||||||
|
crypto_free_shash(ctx->a_ctx.hash_tfm);
|
||||||
|
sec_aead_exit(tfm);
|
||||||
|
return PTR_ERR(a_ctx->fallback_aead_tfm);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1957,6 +1956,7 @@ static void sec_aead_ctx_exit(struct crypto_aead *tfm)
|
|||||||
{
|
{
|
||||||
struct sec_ctx *ctx = crypto_aead_ctx(tfm);
|
struct sec_ctx *ctx = crypto_aead_ctx(tfm);
|
||||||
|
|
||||||
|
crypto_free_aead(ctx->a_ctx.fallback_aead_tfm);
|
||||||
crypto_free_shash(ctx->a_ctx.hash_tfm);
|
crypto_free_shash(ctx->a_ctx.hash_tfm);
|
||||||
sec_aead_exit(tfm);
|
sec_aead_exit(tfm);
|
||||||
}
|
}
|
||||||
@@ -1983,7 +1983,6 @@ static int sec_aead_xcm_ctx_init(struct crypto_aead *tfm)
|
|||||||
sec_aead_exit(tfm);
|
sec_aead_exit(tfm);
|
||||||
return PTR_ERR(a_ctx->fallback_aead_tfm);
|
return PTR_ERR(a_ctx->fallback_aead_tfm);
|
||||||
}
|
}
|
||||||
a_ctx->fallback = false;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2264,21 +2263,20 @@ static int sec_aead_spec_check(struct sec_ctx *ctx, struct sec_req *sreq)
|
|||||||
{
|
{
|
||||||
struct aead_request *req = sreq->aead_req.aead_req;
|
struct aead_request *req = sreq->aead_req.aead_req;
|
||||||
struct crypto_aead *tfm = crypto_aead_reqtfm(req);
|
struct crypto_aead *tfm = crypto_aead_reqtfm(req);
|
||||||
size_t authsize = crypto_aead_authsize(tfm);
|
size_t sz = crypto_aead_authsize(tfm);
|
||||||
u8 c_mode = ctx->c_ctx.c_mode;
|
u8 c_mode = ctx->c_ctx.c_mode;
|
||||||
struct device *dev = ctx->dev;
|
struct device *dev = ctx->dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (unlikely(req->cryptlen + req->assoclen > MAX_INPUT_DATA_LEN ||
|
/* Hardware does not handle cases where authsize is less than 4 bytes */
|
||||||
req->assoclen > SEC_MAX_AAD_LEN)) {
|
if (unlikely(sz < MIN_MAC_LEN)) {
|
||||||
dev_err(dev, "aead input spec error!\n");
|
sreq->aead_req.fallback = true;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely((c_mode == SEC_CMODE_GCM && authsize < DES_BLOCK_SIZE) ||
|
if (unlikely(req->cryptlen + req->assoclen > MAX_INPUT_DATA_LEN ||
|
||||||
(c_mode == SEC_CMODE_CCM && (authsize < MIN_MAC_LEN ||
|
req->assoclen > SEC_MAX_AAD_LEN)) {
|
||||||
authsize & MAC_LEN_MASK)))) {
|
dev_err(dev, "aead input spec error!\n");
|
||||||
dev_err(dev, "aead input mac length error!\n");
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2297,7 +2295,7 @@ static int sec_aead_spec_check(struct sec_ctx *ctx, struct sec_req *sreq)
|
|||||||
if (sreq->c_req.encrypt)
|
if (sreq->c_req.encrypt)
|
||||||
sreq->c_req.c_len = req->cryptlen;
|
sreq->c_req.c_len = req->cryptlen;
|
||||||
else
|
else
|
||||||
sreq->c_req.c_len = req->cryptlen - authsize;
|
sreq->c_req.c_len = req->cryptlen - sz;
|
||||||
if (c_mode == SEC_CMODE_CBC) {
|
if (c_mode == SEC_CMODE_CBC) {
|
||||||
if (unlikely(sreq->c_req.c_len & (AES_BLOCK_SIZE - 1))) {
|
if (unlikely(sreq->c_req.c_len & (AES_BLOCK_SIZE - 1))) {
|
||||||
dev_err(dev, "aead crypto length error!\n");
|
dev_err(dev, "aead crypto length error!\n");
|
||||||
@@ -2323,8 +2321,8 @@ static int sec_aead_param_check(struct sec_ctx *ctx, struct sec_req *sreq)
|
|||||||
|
|
||||||
if (ctx->sec->qm.ver == QM_HW_V2) {
|
if (ctx->sec->qm.ver == QM_HW_V2) {
|
||||||
if (unlikely(!req->cryptlen || (!sreq->c_req.encrypt &&
|
if (unlikely(!req->cryptlen || (!sreq->c_req.encrypt &&
|
||||||
req->cryptlen <= authsize))) {
|
req->cryptlen <= authsize))) {
|
||||||
ctx->a_ctx.fallback = true;
|
sreq->aead_req.fallback = true;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2352,16 +2350,9 @@ static int sec_aead_soft_crypto(struct sec_ctx *ctx,
|
|||||||
bool encrypt)
|
bool encrypt)
|
||||||
{
|
{
|
||||||
struct sec_auth_ctx *a_ctx = &ctx->a_ctx;
|
struct sec_auth_ctx *a_ctx = &ctx->a_ctx;
|
||||||
struct device *dev = ctx->dev;
|
|
||||||
struct aead_request *subreq;
|
struct aead_request *subreq;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Kunpeng920 aead mode not support input 0 size */
|
|
||||||
if (!a_ctx->fallback_aead_tfm) {
|
|
||||||
dev_err(dev, "aead fallback tfm is NULL!\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = aead_request_alloc(a_ctx->fallback_aead_tfm, GFP_KERNEL);
|
subreq = aead_request_alloc(a_ctx->fallback_aead_tfm, GFP_KERNEL);
|
||||||
if (!subreq)
|
if (!subreq)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -2393,10 +2384,11 @@ static int sec_aead_crypto(struct aead_request *a_req, bool encrypt)
|
|||||||
req->aead_req.aead_req = a_req;
|
req->aead_req.aead_req = a_req;
|
||||||
req->c_req.encrypt = encrypt;
|
req->c_req.encrypt = encrypt;
|
||||||
req->ctx = ctx;
|
req->ctx = ctx;
|
||||||
|
req->aead_req.fallback = false;
|
||||||
|
|
||||||
ret = sec_aead_param_check(ctx, req);
|
ret = sec_aead_param_check(ctx, req);
|
||||||
if (unlikely(ret)) {
|
if (unlikely(ret)) {
|
||||||
if (ctx->a_ctx.fallback)
|
if (req->aead_req.fallback)
|
||||||
return sec_aead_soft_crypto(ctx, a_req, encrypt);
|
return sec_aead_soft_crypto(ctx, a_req, encrypt);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,17 +23,6 @@ enum sec_hash_alg {
|
|||||||
SEC_A_HMAC_SHA512 = 0x15,
|
SEC_A_HMAC_SHA512 = 0x15,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sec_mac_len {
|
|
||||||
SEC_HMAC_CCM_MAC = 16,
|
|
||||||
SEC_HMAC_GCM_MAC = 16,
|
|
||||||
SEC_SM3_MAC = 32,
|
|
||||||
SEC_HMAC_SM3_MAC = 32,
|
|
||||||
SEC_HMAC_MD5_MAC = 16,
|
|
||||||
SEC_HMAC_SHA1_MAC = 20,
|
|
||||||
SEC_HMAC_SHA256_MAC = 32,
|
|
||||||
SEC_HMAC_SHA512_MAC = 64,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum sec_cmode {
|
enum sec_cmode {
|
||||||
SEC_CMODE_ECB = 0x0,
|
SEC_CMODE_ECB = 0x0,
|
||||||
SEC_CMODE_CBC = 0x1,
|
SEC_CMODE_CBC = 0x1,
|
||||||
|
|||||||
@@ -469,6 +469,7 @@ static int init_ixp_crypto(struct device *dev)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
npe_id = npe_spec.args[0];
|
npe_id = npe_spec.args[0];
|
||||||
|
of_node_put(npe_spec.np);
|
||||||
|
|
||||||
ret = of_parse_phandle_with_fixed_args(np, "queue-rx", 1, 0,
|
ret = of_parse_phandle_with_fixed_args(np, "queue-rx", 1, 0,
|
||||||
&queue_spec);
|
&queue_spec);
|
||||||
@@ -477,6 +478,7 @@ static int init_ixp_crypto(struct device *dev)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
recv_qid = queue_spec.args[0];
|
recv_qid = queue_spec.args[0];
|
||||||
|
of_node_put(queue_spec.np);
|
||||||
|
|
||||||
ret = of_parse_phandle_with_fixed_args(np, "queue-txready", 1, 0,
|
ret = of_parse_phandle_with_fixed_args(np, "queue-txready", 1, 0,
|
||||||
&queue_spec);
|
&queue_spec);
|
||||||
@@ -485,6 +487,7 @@ static int init_ixp_crypto(struct device *dev)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
send_qid = queue_spec.args[0];
|
send_qid = queue_spec.args[0];
|
||||||
|
of_node_put(queue_spec.np);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Hardcoded engine when using platform data, this goes away
|
* Hardcoded engine when using platform data, this goes away
|
||||||
|
|||||||
@@ -8,12 +8,14 @@
|
|||||||
* Author: Dong Aisheng <dong.aisheng@linaro.org>
|
* Author: Dong Aisheng <dong.aisheng@linaro.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/cleanup.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/hwspinlock.h>
|
#include <linux/hwspinlock.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_address.h>
|
#include <linux/of_address.h>
|
||||||
#include <linux/of_platform.h>
|
#include <linux/of_platform.h>
|
||||||
@@ -26,7 +28,7 @@
|
|||||||
|
|
||||||
static struct platform_driver syscon_driver;
|
static struct platform_driver syscon_driver;
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(syscon_list_slock);
|
static DEFINE_MUTEX(syscon_list_lock);
|
||||||
static LIST_HEAD(syscon_list);
|
static LIST_HEAD(syscon_list);
|
||||||
|
|
||||||
struct syscon {
|
struct syscon {
|
||||||
@@ -44,7 +46,6 @@ static const struct regmap_config syscon_regmap_config = {
|
|||||||
static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
|
static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
|
||||||
{
|
{
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
struct syscon *syscon;
|
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
u32 reg_io_width;
|
u32 reg_io_width;
|
||||||
@@ -52,20 +53,18 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
|
|||||||
struct regmap_config syscon_config = syscon_regmap_config;
|
struct regmap_config syscon_config = syscon_regmap_config;
|
||||||
struct resource res;
|
struct resource res;
|
||||||
|
|
||||||
syscon = kzalloc(sizeof(*syscon), GFP_KERNEL);
|
WARN_ON(!mutex_is_locked(&syscon_list_lock));
|
||||||
|
|
||||||
|
struct syscon *syscon __free(kfree) = kzalloc(sizeof(*syscon), GFP_KERNEL);
|
||||||
if (!syscon)
|
if (!syscon)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
if (of_address_to_resource(np, 0, &res)) {
|
if (of_address_to_resource(np, 0, &res))
|
||||||
ret = -ENOMEM;
|
return ERR_PTR(-ENOMEM);
|
||||||
goto err_map;
|
|
||||||
}
|
|
||||||
|
|
||||||
base = of_iomap(np, 0);
|
base = of_iomap(np, 0);
|
||||||
if (!base) {
|
if (!base)
|
||||||
ret = -ENOMEM;
|
return ERR_PTR(-ENOMEM);
|
||||||
goto err_map;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parse the device's DT node for an endianness specification */
|
/* Parse the device's DT node for an endianness specification */
|
||||||
if (of_property_read_bool(np, "big-endian"))
|
if (of_property_read_bool(np, "big-endian"))
|
||||||
@@ -137,11 +136,9 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
|
|||||||
syscon->regmap = regmap;
|
syscon->regmap = regmap;
|
||||||
syscon->np = np;
|
syscon->np = np;
|
||||||
|
|
||||||
spin_lock(&syscon_list_slock);
|
|
||||||
list_add_tail(&syscon->list, &syscon_list);
|
list_add_tail(&syscon->list, &syscon_list);
|
||||||
spin_unlock(&syscon_list_slock);
|
|
||||||
|
|
||||||
return syscon;
|
return_ptr(syscon);
|
||||||
|
|
||||||
err_attach:
|
err_attach:
|
||||||
if (!IS_ERR(clk))
|
if (!IS_ERR(clk))
|
||||||
@@ -150,8 +147,6 @@ err_clk:
|
|||||||
regmap_exit(regmap);
|
regmap_exit(regmap);
|
||||||
err_regmap:
|
err_regmap:
|
||||||
iounmap(base);
|
iounmap(base);
|
||||||
err_map:
|
|
||||||
kfree(syscon);
|
|
||||||
return ERR_PTR(ret);
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +155,7 @@ static struct regmap *device_node_get_regmap(struct device_node *np,
|
|||||||
{
|
{
|
||||||
struct syscon *entry, *syscon = NULL;
|
struct syscon *entry, *syscon = NULL;
|
||||||
|
|
||||||
spin_lock(&syscon_list_slock);
|
mutex_lock(&syscon_list_lock);
|
||||||
|
|
||||||
list_for_each_entry(entry, &syscon_list, list)
|
list_for_each_entry(entry, &syscon_list, list)
|
||||||
if (entry->np == np) {
|
if (entry->np == np) {
|
||||||
@@ -168,17 +163,65 @@ static struct regmap *device_node_get_regmap(struct device_node *np,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock(&syscon_list_slock);
|
|
||||||
|
|
||||||
if (!syscon)
|
if (!syscon)
|
||||||
syscon = of_syscon_register(np, check_clk);
|
syscon = of_syscon_register(np, check_clk);
|
||||||
|
|
||||||
|
mutex_unlock(&syscon_list_lock);
|
||||||
|
|
||||||
if (IS_ERR(syscon))
|
if (IS_ERR(syscon))
|
||||||
return ERR_CAST(syscon);
|
return ERR_CAST(syscon);
|
||||||
|
|
||||||
return syscon->regmap;
|
return syscon->regmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* of_syscon_register_regmap() - Register regmap for specified device node
|
||||||
|
* @np: Device tree node
|
||||||
|
* @regmap: Pointer to regmap object
|
||||||
|
*
|
||||||
|
* Register an externally created regmap object with syscon for the specified
|
||||||
|
* device tree node. This regmap will then be returned to client drivers using
|
||||||
|
* the syscon_regmap_lookup_by_phandle() API.
|
||||||
|
*
|
||||||
|
* Return: 0 on success, negative error code on failure.
|
||||||
|
*/
|
||||||
|
int of_syscon_register_regmap(struct device_node *np, struct regmap *regmap)
|
||||||
|
{
|
||||||
|
struct syscon *entry, *syscon = NULL;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!np || !regmap)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
syscon = kzalloc(sizeof(*syscon), GFP_KERNEL);
|
||||||
|
if (!syscon)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
/* check if syscon entry already exists */
|
||||||
|
mutex_lock(&syscon_list_lock);
|
||||||
|
|
||||||
|
list_for_each_entry(entry, &syscon_list, list)
|
||||||
|
if (entry->np == np) {
|
||||||
|
ret = -EEXIST;
|
||||||
|
goto err_unlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
syscon->regmap = regmap;
|
||||||
|
syscon->np = np;
|
||||||
|
|
||||||
|
/* register the regmap in syscon list */
|
||||||
|
list_add_tail(&syscon->list, &syscon_list);
|
||||||
|
mutex_unlock(&syscon_list_lock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_unlock:
|
||||||
|
mutex_unlock(&syscon_list_lock);
|
||||||
|
kfree(syscon);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(of_syscon_register_regmap);
|
||||||
|
|
||||||
struct regmap *device_node_to_regmap(struct device_node *np)
|
struct regmap *device_node_to_regmap(struct device_node *np)
|
||||||
{
|
{
|
||||||
return device_node_get_regmap(np, false);
|
return device_node_get_regmap(np, false);
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
#define MLXFW_FSM_STATE_WAIT_TIMEOUT_MS 30000
|
#define MLXFW_FSM_STATE_WAIT_TIMEOUT_MS 30000
|
||||||
#define MLXFW_FSM_STATE_WAIT_ROUNDS \
|
#define MLXFW_FSM_STATE_WAIT_ROUNDS \
|
||||||
(MLXFW_FSM_STATE_WAIT_TIMEOUT_MS / MLXFW_FSM_STATE_WAIT_CYCLE_MS)
|
(MLXFW_FSM_STATE_WAIT_TIMEOUT_MS / MLXFW_FSM_STATE_WAIT_CYCLE_MS)
|
||||||
#define MLXFW_FSM_MAX_COMPONENT_SIZE (10 * (1 << 20))
|
|
||||||
|
|
||||||
static const int mlxfw_fsm_state_errno[] = {
|
static const int mlxfw_fsm_state_errno[] = {
|
||||||
[MLXFW_FSM_STATE_ERR_ERROR] = -EIO,
|
[MLXFW_FSM_STATE_ERR_ERROR] = -EIO,
|
||||||
@@ -229,7 +228,6 @@ static int mlxfw_flash_component(struct mlxfw_dev *mlxfw_dev,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
comp_max_size = min_t(u32, comp_max_size, MLXFW_FSM_MAX_COMPONENT_SIZE);
|
|
||||||
if (comp->data_size > comp_max_size) {
|
if (comp->data_size > comp_max_size) {
|
||||||
MLXFW_ERR_MSG(mlxfw_dev, extack,
|
MLXFW_ERR_MSG(mlxfw_dev, extack,
|
||||||
"Component size is bigger than limit", -EINVAL);
|
"Component size is bigger than limit", -EINVAL);
|
||||||
|
|||||||
@@ -1541,7 +1541,7 @@ void am65_cpsw_nuss_remove_tx_chns(struct am65_cpsw_common *common)
|
|||||||
for (i = 0; i < common->tx_ch_num; i++) {
|
for (i = 0; i < common->tx_ch_num; i++) {
|
||||||
struct am65_cpsw_tx_chn *tx_chn = &common->tx_chns[i];
|
struct am65_cpsw_tx_chn *tx_chn = &common->tx_chns[i];
|
||||||
|
|
||||||
if (tx_chn->irq)
|
if (tx_chn->irq > 0)
|
||||||
devm_free_irq(dev, tx_chn->irq, tx_chn);
|
devm_free_irq(dev, tx_chn->irq, tx_chn);
|
||||||
|
|
||||||
netif_napi_del(&tx_chn->napi_tx);
|
netif_napi_del(&tx_chn->napi_tx);
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ static u32 __mt7915_reg_addr(struct mt7915_dev *dev, u32 addr)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ofs = addr - dev->reg.map[i].phys;
|
ofs = addr - dev->reg.map[i].phys;
|
||||||
if (ofs > dev->reg.map[i].size)
|
if (ofs >= dev->reg.map[i].size)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return dev->reg.map[i].maps + ofs;
|
return dev->reg.map[i].maps + ofs;
|
||||||
|
|||||||
@@ -469,7 +469,13 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
|
|||||||
} else {
|
} else {
|
||||||
if (idx == *wcid_keyidx)
|
if (idx == *wcid_keyidx)
|
||||||
*wcid_keyidx = -1;
|
*wcid_keyidx = -1;
|
||||||
goto out;
|
|
||||||
|
/* For security issue we don't trigger the key deletion when
|
||||||
|
* reassociating. But we should trigger the deletion process
|
||||||
|
* to avoid using incorrect cipher after disconnection,
|
||||||
|
*/
|
||||||
|
if (vif->type != NL80211_IFTYPE_STATION || vif->cfg.assoc)
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
mt76_wcid_key_setup(&dev->mt76, wcid, key);
|
mt76_wcid_key_setup(&dev->mt76, wcid, key);
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, u8 req_type,
|
|||||||
|
|
||||||
ret = usb_control_msg(udev, pipe, req, req_type, val,
|
ret = usb_control_msg(udev, pipe, req, req_type, val,
|
||||||
offset, buf, len, MT_VEND_REQ_TOUT_MS);
|
offset, buf, len, MT_VEND_REQ_TOUT_MS);
|
||||||
if (ret == -ENODEV)
|
if (ret == -ENODEV || ret == -EPROTO)
|
||||||
set_bit(MT76_REMOVED, &dev->phy.state);
|
set_bit(MT76_REMOVED, &dev->phy.state);
|
||||||
if (ret >= 0 || ret == -ENODEV)
|
if (ret >= 0 || ret == -ENODEV || ret == -EPROTO)
|
||||||
return ret;
|
return ret;
|
||||||
usleep_range(5000, 10000);
|
usleep_range(5000, 10000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2533,24 +2533,24 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
|
|||||||
if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags) ||
|
if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags) ||
|
||||||
test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) {
|
test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) {
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
goto out;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ret = wl12xx_init_vif_data(wl, vif);
|
ret = wl12xx_init_vif_data(wl, vif);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out_unlock;
|
||||||
|
|
||||||
wlvif->wl = wl;
|
wlvif->wl = wl;
|
||||||
role_type = wl12xx_get_role_type(wl, wlvif);
|
role_type = wl12xx_get_role_type(wl, wlvif);
|
||||||
if (role_type == WL12XX_INVALID_ROLE_TYPE) {
|
if (role_type == WL12XX_INVALID_ROLE_TYPE) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = wlcore_allocate_hw_queue_base(wl, wlvif);
|
ret = wlcore_allocate_hw_queue_base(wl, wlvif);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out_unlock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: after the nvs issue will be solved, move this block
|
* TODO: after the nvs issue will be solved, move this block
|
||||||
@@ -2565,7 +2565,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
|
|||||||
|
|
||||||
ret = wl12xx_init_fw(wl);
|
ret = wl12xx_init_fw(wl);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -631,8 +631,11 @@ static int stm32_pwm_probe(struct platform_device *pdev)
|
|||||||
priv->chip.npwm = stm32_pwm_detect_channels(priv, &num_enabled);
|
priv->chip.npwm = stm32_pwm_detect_channels(priv, &num_enabled);
|
||||||
|
|
||||||
/* Initialize clock refcount to number of enabled PWM channels. */
|
/* Initialize clock refcount to number of enabled PWM channels. */
|
||||||
for (i = 0; i < num_enabled; i++)
|
for (i = 0; i < num_enabled; i++) {
|
||||||
clk_enable(priv->clk);
|
ret = clk_enable(priv->clk);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
ret = pwmchip_add(&priv->chip);
|
ret = pwmchip_add(&priv->chip);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
@@ -4571,28 +4571,24 @@ static inline u8 ieee80211_mle_common_size(const u8 *data)
|
|||||||
{
|
{
|
||||||
const struct ieee80211_multi_link_elem *mle = (const void *)data;
|
const struct ieee80211_multi_link_elem *mle = (const void *)data;
|
||||||
u16 control = le16_to_cpu(mle->control);
|
u16 control = le16_to_cpu(mle->control);
|
||||||
u8 common = 0;
|
|
||||||
|
|
||||||
switch (u16_get_bits(control, IEEE80211_ML_CONTROL_TYPE)) {
|
switch (u16_get_bits(control, IEEE80211_ML_CONTROL_TYPE)) {
|
||||||
case IEEE80211_ML_CONTROL_TYPE_BASIC:
|
case IEEE80211_ML_CONTROL_TYPE_BASIC:
|
||||||
case IEEE80211_ML_CONTROL_TYPE_PREQ:
|
case IEEE80211_ML_CONTROL_TYPE_PREQ:
|
||||||
case IEEE80211_ML_CONTROL_TYPE_TDLS:
|
case IEEE80211_ML_CONTROL_TYPE_TDLS:
|
||||||
case IEEE80211_ML_CONTROL_TYPE_RECONF:
|
case IEEE80211_ML_CONTROL_TYPE_RECONF:
|
||||||
|
case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS:
|
||||||
/*
|
/*
|
||||||
* The length is the first octet pointed by mle->variable so no
|
* The length is the first octet pointed by mle->variable so no
|
||||||
* need to add anything
|
* need to add anything
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS:
|
|
||||||
if (control & IEEE80211_MLC_PRIO_ACCESS_PRES_AP_MLD_MAC_ADDR)
|
|
||||||
common += ETH_ALEN;
|
|
||||||
return common;
|
|
||||||
default:
|
default:
|
||||||
WARN_ON(1);
|
WARN_ON(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sizeof(*mle) + common + mle->variable[0];
|
return sizeof(*mle) + mle->variable[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4645,8 +4641,7 @@ static inline bool ieee80211_mle_size_ok(const u8 *data, u8 len)
|
|||||||
check_common_len = true;
|
check_common_len = true;
|
||||||
break;
|
break;
|
||||||
case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS:
|
case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS:
|
||||||
if (control & IEEE80211_MLC_PRIO_ACCESS_PRES_AP_MLD_MAC_ADDR)
|
common = ETH_ALEN + 1;
|
||||||
common += ETH_ALEN;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* we don't know this type */
|
/* we don't know this type */
|
||||||
|
|||||||
@@ -17,20 +17,19 @@
|
|||||||
struct device_node;
|
struct device_node;
|
||||||
|
|
||||||
#ifdef CONFIG_MFD_SYSCON
|
#ifdef CONFIG_MFD_SYSCON
|
||||||
extern struct regmap *device_node_to_regmap(struct device_node *np);
|
struct regmap *device_node_to_regmap(struct device_node *np);
|
||||||
extern struct regmap *syscon_node_to_regmap(struct device_node *np);
|
struct regmap *syscon_node_to_regmap(struct device_node *np);
|
||||||
extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
|
struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
|
||||||
extern struct regmap *syscon_regmap_lookup_by_phandle(
|
struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np,
|
||||||
struct device_node *np,
|
const char *property);
|
||||||
const char *property);
|
struct regmap *syscon_regmap_lookup_by_phandle_args(struct device_node *np,
|
||||||
extern struct regmap *syscon_regmap_lookup_by_phandle_args(
|
const char *property,
|
||||||
struct device_node *np,
|
int arg_count,
|
||||||
const char *property,
|
unsigned int *out_args);
|
||||||
int arg_count,
|
struct regmap *syscon_regmap_lookup_by_phandle_optional(struct device_node *np,
|
||||||
unsigned int *out_args);
|
const char *property);
|
||||||
extern struct regmap *syscon_regmap_lookup_by_phandle_optional(
|
int of_syscon_register_regmap(struct device_node *np,
|
||||||
struct device_node *np,
|
struct regmap *regmap);
|
||||||
const char *property);
|
|
||||||
#else
|
#else
|
||||||
static inline struct regmap *device_node_to_regmap(struct device_node *np)
|
static inline struct regmap *device_node_to_regmap(struct device_node *np)
|
||||||
{
|
{
|
||||||
@@ -70,6 +69,12 @@ static inline struct regmap *syscon_regmap_lookup_by_phandle_optional(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int of_syscon_register_regmap(struct device_node *np,
|
||||||
|
struct regmap *regmap)
|
||||||
|
{
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __LINUX_MFD_SYSCON_H__ */
|
#endif /* __LINUX_MFD_SYSCON_H__ */
|
||||||
|
|||||||
@@ -959,7 +959,7 @@ static ssize_t padata_sysfs_store(struct kobject *kobj, struct attribute *attr,
|
|||||||
|
|
||||||
pinst = kobj2pinst(kobj);
|
pinst = kobj2pinst(kobj);
|
||||||
pentry = attr2pentry(attr);
|
pentry = attr2pentry(attr);
|
||||||
if (pentry->show)
|
if (pentry->store)
|
||||||
ret = pentry->store(pinst, attr, buf, count);
|
ret = pentry->store(pinst, attr, buf, count);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ static int proc_do_dev_weight(struct ctl_table *table, int write,
|
|||||||
int ret, weight;
|
int ret, weight;
|
||||||
|
|
||||||
mutex_lock(&dev_weight_mutex);
|
mutex_lock(&dev_weight_mutex);
|
||||||
ret = proc_dointvec(table, write, buffer, lenp, ppos);
|
ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
|
||||||
if (!ret && write) {
|
if (!ret && write) {
|
||||||
weight = READ_ONCE(weight_p);
|
weight = READ_ONCE(weight_p);
|
||||||
WRITE_ONCE(dev_rx_weight, weight * dev_weight_rx_bias);
|
WRITE_ONCE(dev_rx_weight, weight * dev_weight_rx_bias);
|
||||||
@@ -363,6 +363,7 @@ static struct ctl_table net_core_table[] = {
|
|||||||
.maxlen = sizeof(int),
|
.maxlen = sizeof(int),
|
||||||
.mode = 0644,
|
.mode = 0644,
|
||||||
.proc_handler = proc_do_dev_weight,
|
.proc_handler = proc_do_dev_weight,
|
||||||
|
.extra1 = SYSCTL_ONE,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.procname = "dev_weight_rx_bias",
|
.procname = "dev_weight_rx_bias",
|
||||||
@@ -370,6 +371,7 @@ static struct ctl_table net_core_table[] = {
|
|||||||
.maxlen = sizeof(int),
|
.maxlen = sizeof(int),
|
||||||
.mode = 0644,
|
.mode = 0644,
|
||||||
.proc_handler = proc_do_dev_weight,
|
.proc_handler = proc_do_dev_weight,
|
||||||
|
.extra1 = SYSCTL_ONE,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.procname = "dev_weight_tx_bias",
|
.procname = "dev_weight_tx_bias",
|
||||||
@@ -377,6 +379,7 @@ static struct ctl_table net_core_table[] = {
|
|||||||
.maxlen = sizeof(int),
|
.maxlen = sizeof(int),
|
||||||
.mode = 0644,
|
.mode = 0644,
|
||||||
.proc_handler = proc_do_dev_weight,
|
.proc_handler = proc_do_dev_weight,
|
||||||
|
.extra1 = SYSCTL_ONE,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.procname = "netdev_max_backlog",
|
.procname = "netdev_max_backlog",
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ int ethnl_ops_begin(struct net_device *dev)
|
|||||||
pm_runtime_get_sync(dev->dev.parent);
|
pm_runtime_get_sync(dev->dev.parent);
|
||||||
|
|
||||||
if (!netif_device_present(dev) ||
|
if (!netif_device_present(dev) ||
|
||||||
dev->reg_state == NETREG_UNREGISTERING) {
|
dev->reg_state >= NETREG_UNREGISTERING) {
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -392,6 +392,10 @@ static void hystart_update(struct sock *sk, u32 delay)
|
|||||||
if (after(tp->snd_una, ca->end_seq))
|
if (after(tp->snd_una, ca->end_seq))
|
||||||
bictcp_hystart_reset(sk);
|
bictcp_hystart_reset(sk);
|
||||||
|
|
||||||
|
/* hystart triggers when cwnd is larger than some threshold */
|
||||||
|
if (tcp_snd_cwnd(tp) < hystart_low_window)
|
||||||
|
return;
|
||||||
|
|
||||||
if (hystart_detect & HYSTART_ACK_TRAIN) {
|
if (hystart_detect & HYSTART_ACK_TRAIN) {
|
||||||
u32 now = bictcp_clock_us(sk);
|
u32 now = bictcp_clock_us(sk);
|
||||||
|
|
||||||
@@ -467,9 +471,7 @@ static void cubictcp_acked(struct sock *sk, const struct ack_sample *sample)
|
|||||||
if (ca->delay_min == 0 || ca->delay_min > delay)
|
if (ca->delay_min == 0 || ca->delay_min > delay)
|
||||||
ca->delay_min = delay;
|
ca->delay_min = delay;
|
||||||
|
|
||||||
/* hystart triggers when cwnd is larger than some threshold */
|
if (!ca->found && tcp_in_slow_start(tp) && hystart)
|
||||||
if (!ca->found && tcp_in_slow_start(tp) && hystart &&
|
|
||||||
tcp_snd_cwnd(tp) >= hystart_low_window)
|
|
||||||
hystart_update(sk, delay);
|
hystart_update(sk, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -588,7 +588,7 @@ static ssize_t ieee80211_if_parse_active_links(struct ieee80211_sub_if_data *sda
|
|||||||
{
|
{
|
||||||
u16 active_links;
|
u16 active_links;
|
||||||
|
|
||||||
if (kstrtou16(buf, 0, &active_links))
|
if (kstrtou16(buf, 0, &active_links) || !active_links)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
return ieee80211_set_active_links(&sdata->vif, active_links) ?: buflen;
|
return ieee80211_set_active_links(&sdata->vif, active_links) ?: buflen;
|
||||||
|
|||||||
@@ -288,6 +288,15 @@ static bool nft_flow_offload_skip(struct sk_buff *skb, int family)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void flow_offload_ct_tcp(struct nf_conn *ct)
|
||||||
|
{
|
||||||
|
/* conntrack will not see all packets, disable tcp window validation. */
|
||||||
|
spin_lock_bh(&ct->lock);
|
||||||
|
ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
|
||||||
|
ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
|
||||||
|
spin_unlock_bh(&ct->lock);
|
||||||
|
}
|
||||||
|
|
||||||
static void nft_flow_offload_eval(const struct nft_expr *expr,
|
static void nft_flow_offload_eval(const struct nft_expr *expr,
|
||||||
struct nft_regs *regs,
|
struct nft_regs *regs,
|
||||||
const struct nft_pktinfo *pkt)
|
const struct nft_pktinfo *pkt)
|
||||||
@@ -355,11 +364,8 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
|
|||||||
goto err_flow_alloc;
|
goto err_flow_alloc;
|
||||||
|
|
||||||
flow_offload_route_init(flow, &route);
|
flow_offload_route_init(flow, &route);
|
||||||
|
if (tcph)
|
||||||
if (tcph) {
|
flow_offload_ct_tcp(ct);
|
||||||
ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
|
|
||||||
ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = flow_offload_add(flowtable, flow);
|
ret = flow_offload_add(flowtable, flow);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
@@ -397,15 +397,15 @@ static int rose_setsockopt(struct socket *sock, int level, int optname,
|
|||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct rose_sock *rose = rose_sk(sk);
|
struct rose_sock *rose = rose_sk(sk);
|
||||||
int opt;
|
unsigned int opt;
|
||||||
|
|
||||||
if (level != SOL_ROSE)
|
if (level != SOL_ROSE)
|
||||||
return -ENOPROTOOPT;
|
return -ENOPROTOOPT;
|
||||||
|
|
||||||
if (optlen < sizeof(int))
|
if (optlen < sizeof(unsigned int))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (copy_from_sockptr(&opt, optval, sizeof(int)))
|
if (copy_from_sockptr(&opt, optval, sizeof(unsigned int)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
switch (optname) {
|
switch (optname) {
|
||||||
@@ -414,31 +414,31 @@ static int rose_setsockopt(struct socket *sock, int level, int optname,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case ROSE_T1:
|
case ROSE_T1:
|
||||||
if (opt < 1)
|
if (opt < 1 || opt > UINT_MAX / HZ)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
rose->t1 = opt * HZ;
|
rose->t1 = opt * HZ;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case ROSE_T2:
|
case ROSE_T2:
|
||||||
if (opt < 1)
|
if (opt < 1 || opt > UINT_MAX / HZ)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
rose->t2 = opt * HZ;
|
rose->t2 = opt * HZ;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case ROSE_T3:
|
case ROSE_T3:
|
||||||
if (opt < 1)
|
if (opt < 1 || opt > UINT_MAX / HZ)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
rose->t3 = opt * HZ;
|
rose->t3 = opt * HZ;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case ROSE_HOLDBACK:
|
case ROSE_HOLDBACK:
|
||||||
if (opt < 1)
|
if (opt < 1 || opt > UINT_MAX / HZ)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
rose->hb = opt * HZ;
|
rose->hb = opt * HZ;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case ROSE_IDLE:
|
case ROSE_IDLE:
|
||||||
if (opt < 0)
|
if (opt > UINT_MAX / (60 * HZ))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
rose->idle = opt * 60 * HZ;
|
rose->idle = opt * 60 * HZ;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1638,6 +1638,10 @@ replay:
|
|||||||
q = qdisc_lookup(dev, tcm->tcm_handle);
|
q = qdisc_lookup(dev, tcm->tcm_handle);
|
||||||
if (!q)
|
if (!q)
|
||||||
goto create_n_graft;
|
goto create_n_graft;
|
||||||
|
if (q->parent != tcm->tcm_parent) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Cannot move an existing qdisc to a different parent");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
if (n->nlmsg_flags & NLM_F_EXCL) {
|
if (n->nlmsg_flags & NLM_F_EXCL) {
|
||||||
NL_SET_ERR_MSG(extack, "Exclusivity flag on, cannot override");
|
NL_SET_ERR_MSG(extack, "Exclusivity flag on, cannot override");
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
|
|||||||
@@ -2645,7 +2645,7 @@ static int smc_accept(struct socket *sock, struct socket *new_sock,
|
|||||||
release_sock(clcsk);
|
release_sock(clcsk);
|
||||||
} else if (!atomic_read(&smc_sk(nsk)->conn.bytes_to_rcv)) {
|
} else if (!atomic_read(&smc_sk(nsk)->conn.bytes_to_rcv)) {
|
||||||
lock_sock(nsk);
|
lock_sock(nsk);
|
||||||
smc_rx_wait(smc_sk(nsk), &timeo, smc_rx_data_available);
|
smc_rx_wait(smc_sk(nsk), &timeo, 0, smc_rx_data_available);
|
||||||
release_sock(nsk);
|
release_sock(nsk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,22 +234,23 @@ out:
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_rx_data_available_and_no_splice_pend(struct smc_connection *conn)
|
static int smc_rx_data_available_and_no_splice_pend(struct smc_connection *conn, size_t peeked)
|
||||||
{
|
{
|
||||||
return atomic_read(&conn->bytes_to_rcv) &&
|
return smc_rx_data_available(conn, peeked) &&
|
||||||
!atomic_read(&conn->splice_pending);
|
!atomic_read(&conn->splice_pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* blocks rcvbuf consumer until >=len bytes available or timeout or interrupted
|
/* blocks rcvbuf consumer until >=len bytes available or timeout or interrupted
|
||||||
* @smc smc socket
|
* @smc smc socket
|
||||||
* @timeo pointer to max seconds to wait, pointer to value 0 for no timeout
|
* @timeo pointer to max seconds to wait, pointer to value 0 for no timeout
|
||||||
|
* @peeked number of bytes already peeked
|
||||||
* @fcrit add'l criterion to evaluate as function pointer
|
* @fcrit add'l criterion to evaluate as function pointer
|
||||||
* Returns:
|
* Returns:
|
||||||
* 1 if at least 1 byte available in rcvbuf or if socket error/shutdown.
|
* 1 if at least 1 byte available in rcvbuf or if socket error/shutdown.
|
||||||
* 0 otherwise (nothing in rcvbuf nor timeout, e.g. interrupted).
|
* 0 otherwise (nothing in rcvbuf nor timeout, e.g. interrupted).
|
||||||
*/
|
*/
|
||||||
int smc_rx_wait(struct smc_sock *smc, long *timeo,
|
int smc_rx_wait(struct smc_sock *smc, long *timeo, size_t peeked,
|
||||||
int (*fcrit)(struct smc_connection *conn))
|
int (*fcrit)(struct smc_connection *conn, size_t baseline))
|
||||||
{
|
{
|
||||||
DEFINE_WAIT_FUNC(wait, woken_wake_function);
|
DEFINE_WAIT_FUNC(wait, woken_wake_function);
|
||||||
struct smc_connection *conn = &smc->conn;
|
struct smc_connection *conn = &smc->conn;
|
||||||
@@ -258,7 +259,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo,
|
|||||||
struct sock *sk = &smc->sk;
|
struct sock *sk = &smc->sk;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (fcrit(conn))
|
if (fcrit(conn, peeked))
|
||||||
return 1;
|
return 1;
|
||||||
sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk);
|
sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk);
|
||||||
add_wait_queue(sk_sleep(sk), &wait);
|
add_wait_queue(sk_sleep(sk), &wait);
|
||||||
@@ -267,7 +268,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo,
|
|||||||
cflags->peer_conn_abort ||
|
cflags->peer_conn_abort ||
|
||||||
READ_ONCE(sk->sk_shutdown) & RCV_SHUTDOWN ||
|
READ_ONCE(sk->sk_shutdown) & RCV_SHUTDOWN ||
|
||||||
conn->killed ||
|
conn->killed ||
|
||||||
fcrit(conn),
|
fcrit(conn, peeked),
|
||||||
&wait);
|
&wait);
|
||||||
remove_wait_queue(sk_sleep(sk), &wait);
|
remove_wait_queue(sk_sleep(sk), &wait);
|
||||||
sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk);
|
sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk);
|
||||||
@@ -318,11 +319,11 @@ static int smc_rx_recv_urg(struct smc_sock *smc, struct msghdr *msg, int len,
|
|||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool smc_rx_recvmsg_data_available(struct smc_sock *smc)
|
static bool smc_rx_recvmsg_data_available(struct smc_sock *smc, size_t peeked)
|
||||||
{
|
{
|
||||||
struct smc_connection *conn = &smc->conn;
|
struct smc_connection *conn = &smc->conn;
|
||||||
|
|
||||||
if (smc_rx_data_available(conn))
|
if (smc_rx_data_available(conn, peeked))
|
||||||
return true;
|
return true;
|
||||||
else if (conn->urg_state == SMC_URG_VALID)
|
else if (conn->urg_state == SMC_URG_VALID)
|
||||||
/* we received a single urgent Byte - skip */
|
/* we received a single urgent Byte - skip */
|
||||||
@@ -340,10 +341,10 @@ static bool smc_rx_recvmsg_data_available(struct smc_sock *smc)
|
|||||||
int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,
|
int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,
|
||||||
struct pipe_inode_info *pipe, size_t len, int flags)
|
struct pipe_inode_info *pipe, size_t len, int flags)
|
||||||
{
|
{
|
||||||
size_t copylen, read_done = 0, read_remaining = len;
|
size_t copylen, read_done = 0, read_remaining = len, peeked_bytes = 0;
|
||||||
size_t chunk_len, chunk_off, chunk_len_sum;
|
size_t chunk_len, chunk_off, chunk_len_sum;
|
||||||
struct smc_connection *conn = &smc->conn;
|
struct smc_connection *conn = &smc->conn;
|
||||||
int (*func)(struct smc_connection *conn);
|
int (*func)(struct smc_connection *conn, size_t baseline);
|
||||||
union smc_host_cursor cons;
|
union smc_host_cursor cons;
|
||||||
int readable, chunk;
|
int readable, chunk;
|
||||||
char *rcvbuf_base;
|
char *rcvbuf_base;
|
||||||
@@ -380,14 +381,14 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,
|
|||||||
if (conn->killed)
|
if (conn->killed)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (smc_rx_recvmsg_data_available(smc))
|
if (smc_rx_recvmsg_data_available(smc, peeked_bytes))
|
||||||
goto copy;
|
goto copy;
|
||||||
|
|
||||||
if (sk->sk_shutdown & RCV_SHUTDOWN) {
|
if (sk->sk_shutdown & RCV_SHUTDOWN) {
|
||||||
/* smc_cdc_msg_recv_action() could have run after
|
/* smc_cdc_msg_recv_action() could have run after
|
||||||
* above smc_rx_recvmsg_data_available()
|
* above smc_rx_recvmsg_data_available()
|
||||||
*/
|
*/
|
||||||
if (smc_rx_recvmsg_data_available(smc))
|
if (smc_rx_recvmsg_data_available(smc, peeked_bytes))
|
||||||
goto copy;
|
goto copy;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -421,26 +422,28 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!smc_rx_data_available(conn)) {
|
if (!smc_rx_data_available(conn, peeked_bytes)) {
|
||||||
smc_rx_wait(smc, &timeo, smc_rx_data_available);
|
smc_rx_wait(smc, &timeo, peeked_bytes, smc_rx_data_available);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
copy:
|
copy:
|
||||||
/* initialize variables for 1st iteration of subsequent loop */
|
/* initialize variables for 1st iteration of subsequent loop */
|
||||||
/* could be just 1 byte, even after waiting on data above */
|
/* could be just 1 byte, even after waiting on data above */
|
||||||
readable = atomic_read(&conn->bytes_to_rcv);
|
readable = smc_rx_data_available(conn, peeked_bytes);
|
||||||
splbytes = atomic_read(&conn->splice_pending);
|
splbytes = atomic_read(&conn->splice_pending);
|
||||||
if (!readable || (msg && splbytes)) {
|
if (!readable || (msg && splbytes)) {
|
||||||
if (splbytes)
|
if (splbytes)
|
||||||
func = smc_rx_data_available_and_no_splice_pend;
|
func = smc_rx_data_available_and_no_splice_pend;
|
||||||
else
|
else
|
||||||
func = smc_rx_data_available;
|
func = smc_rx_data_available;
|
||||||
smc_rx_wait(smc, &timeo, func);
|
smc_rx_wait(smc, &timeo, peeked_bytes, func);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
smc_curs_copy(&cons, &conn->local_tx_ctrl.cons, conn);
|
smc_curs_copy(&cons, &conn->local_tx_ctrl.cons, conn);
|
||||||
|
if ((flags & MSG_PEEK) && peeked_bytes)
|
||||||
|
smc_curs_add(conn->rmb_desc->len, &cons, peeked_bytes);
|
||||||
/* subsequent splice() calls pick up where previous left */
|
/* subsequent splice() calls pick up where previous left */
|
||||||
if (splbytes)
|
if (splbytes)
|
||||||
smc_curs_add(conn->rmb_desc->len, &cons, splbytes);
|
smc_curs_add(conn->rmb_desc->len, &cons, splbytes);
|
||||||
@@ -476,6 +479,8 @@ copy:
|
|||||||
}
|
}
|
||||||
read_remaining -= chunk_len;
|
read_remaining -= chunk_len;
|
||||||
read_done += chunk_len;
|
read_done += chunk_len;
|
||||||
|
if (flags & MSG_PEEK)
|
||||||
|
peeked_bytes += chunk_len;
|
||||||
|
|
||||||
if (chunk_len_sum == copylen)
|
if (chunk_len_sum == copylen)
|
||||||
break; /* either on 1st or 2nd iteration */
|
break; /* either on 1st or 2nd iteration */
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ void smc_rx_init(struct smc_sock *smc);
|
|||||||
|
|
||||||
int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,
|
int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,
|
||||||
struct pipe_inode_info *pipe, size_t len, int flags);
|
struct pipe_inode_info *pipe, size_t len, int flags);
|
||||||
int smc_rx_wait(struct smc_sock *smc, long *timeo,
|
int smc_rx_wait(struct smc_sock *smc, long *timeo, size_t peeked,
|
||||||
int (*fcrit)(struct smc_connection *conn));
|
int (*fcrit)(struct smc_connection *conn, size_t baseline));
|
||||||
static inline int smc_rx_data_available(struct smc_connection *conn)
|
static inline int smc_rx_data_available(struct smc_connection *conn, size_t peeked)
|
||||||
{
|
{
|
||||||
return atomic_read(&conn->bytes_to_rcv);
|
return atomic_read(&conn->bytes_to_rcv) - peeked;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SMC_RX_H */
|
#endif /* SMC_RX_H */
|
||||||
|
|||||||
@@ -799,10 +799,45 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev)
|
|||||||
list_for_each_entry(intbss, &rdev->bss_list, list) {
|
list_for_each_entry(intbss, &rdev->bss_list, list) {
|
||||||
struct cfg80211_bss *res = &intbss->pub;
|
struct cfg80211_bss *res = &intbss->pub;
|
||||||
const struct cfg80211_bss_ies *ies;
|
const struct cfg80211_bss_ies *ies;
|
||||||
|
const struct element *ssid_elem;
|
||||||
|
struct cfg80211_colocated_ap *entry;
|
||||||
|
u32 s_ssid_tmp;
|
||||||
|
int ret;
|
||||||
|
|
||||||
ies = rcu_access_pointer(res->ies);
|
ies = rcu_access_pointer(res->ies);
|
||||||
count += cfg80211_parse_colocated_ap(ies,
|
count += cfg80211_parse_colocated_ap(ies,
|
||||||
&coloc_ap_list);
|
&coloc_ap_list);
|
||||||
|
|
||||||
|
/* In case the scan request specified a specific BSSID
|
||||||
|
* and the BSS is found and operating on 6GHz band then
|
||||||
|
* add this AP to the collocated APs list.
|
||||||
|
* This is relevant for ML probe requests when the lower
|
||||||
|
* band APs have not been discovered.
|
||||||
|
*/
|
||||||
|
if (is_broadcast_ether_addr(rdev_req->bssid) ||
|
||||||
|
!ether_addr_equal(rdev_req->bssid, res->bssid) ||
|
||||||
|
res->channel->band != NL80211_BAND_6GHZ)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ret = cfg80211_calc_short_ssid(ies, &ssid_elem,
|
||||||
|
&s_ssid_tmp);
|
||||||
|
if (ret)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
|
||||||
|
if (!entry)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
memcpy(entry->bssid, res->bssid, ETH_ALEN);
|
||||||
|
entry->short_ssid = s_ssid_tmp;
|
||||||
|
memcpy(entry->ssid, ssid_elem->data,
|
||||||
|
ssid_elem->datalen);
|
||||||
|
entry->ssid_len = ssid_elem->datalen;
|
||||||
|
entry->short_ssid_valid = true;
|
||||||
|
entry->center_freq = res->channel->center_freq;
|
||||||
|
|
||||||
|
list_add_tail(&entry->list, &coloc_ap_list);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
spin_unlock_bh(&rdev->bss_lock);
|
spin_unlock_bh(&rdev->bss_lock);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ static int parse_path(char *env_path, const char ***const path_list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*path_list = malloc(num_paths * sizeof(**path_list));
|
*path_list = malloc(num_paths * sizeof(**path_list));
|
||||||
|
if (!*path_list)
|
||||||
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < num_paths; i++)
|
for (i = 0; i < num_paths; i++)
|
||||||
(*path_list)[i] = strsep(&env_path, ENV_PATH_TOKEN);
|
(*path_list)[i] = strsep(&env_path, ENV_PATH_TOKEN);
|
||||||
|
|
||||||
@@ -99,6 +102,10 @@ static int populate_ruleset(const char *const env_var, const int ruleset_fd,
|
|||||||
env_path_name = strdup(env_path_name);
|
env_path_name = strdup(env_path_name);
|
||||||
unsetenv(env_var);
|
unsetenv(env_var);
|
||||||
num_paths = parse_path(env_path_name, &path_list);
|
num_paths = parse_path(env_path_name, &path_list);
|
||||||
|
if (num_paths < 0) {
|
||||||
|
fprintf(stderr, "Failed to allocate memory\n");
|
||||||
|
goto out_free_name;
|
||||||
|
}
|
||||||
if (num_paths == 1 && path_list[0][0] == '\0') {
|
if (num_paths == 1 && path_list[0][0] == '\0') {
|
||||||
/*
|
/*
|
||||||
* Allows to not use all possible restrictions (e.g. use
|
* Allows to not use all possible restrictions (e.g. use
|
||||||
|
|||||||
@@ -669,10 +669,6 @@ static inline access_mask_t get_mode_access(const umode_t mode)
|
|||||||
switch (mode & S_IFMT) {
|
switch (mode & S_IFMT) {
|
||||||
case S_IFLNK:
|
case S_IFLNK:
|
||||||
return LANDLOCK_ACCESS_FS_MAKE_SYM;
|
return LANDLOCK_ACCESS_FS_MAKE_SYM;
|
||||||
case 0:
|
|
||||||
/* A zero mode translates to S_IFREG. */
|
|
||||||
case S_IFREG:
|
|
||||||
return LANDLOCK_ACCESS_FS_MAKE_REG;
|
|
||||||
case S_IFDIR:
|
case S_IFDIR:
|
||||||
return LANDLOCK_ACCESS_FS_MAKE_DIR;
|
return LANDLOCK_ACCESS_FS_MAKE_DIR;
|
||||||
case S_IFCHR:
|
case S_IFCHR:
|
||||||
@@ -683,9 +679,12 @@ static inline access_mask_t get_mode_access(const umode_t mode)
|
|||||||
return LANDLOCK_ACCESS_FS_MAKE_FIFO;
|
return LANDLOCK_ACCESS_FS_MAKE_FIFO;
|
||||||
case S_IFSOCK:
|
case S_IFSOCK:
|
||||||
return LANDLOCK_ACCESS_FS_MAKE_SOCK;
|
return LANDLOCK_ACCESS_FS_MAKE_SOCK;
|
||||||
|
case S_IFREG:
|
||||||
|
case 0:
|
||||||
|
/* A zero mode translates to S_IFREG. */
|
||||||
default:
|
default:
|
||||||
WARN_ON_ONCE(1);
|
/* Treats weird files as regular files. */
|
||||||
return 0;
|
return LANDLOCK_ACCESS_FS_MAKE_REG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ static int apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg)
|
|||||||
struct apl_log_buffer_layout layout;
|
struct apl_log_buffer_layout layout;
|
||||||
void __iomem *addr, *buf;
|
void __iomem *addr, *buf;
|
||||||
size_t dump_size;
|
size_t dump_size;
|
||||||
u16 offset = 0;
|
u32 offset = 0;
|
||||||
u8 *dump, *pos;
|
u8 *dump, *pos;
|
||||||
|
|
||||||
dump_size = AVS_FW_REGS_SIZE + msg->ext.coredump.stack_dump_size;
|
dump_size = AVS_FW_REGS_SIZE + msg->ext.coredump.stack_dump_size;
|
||||||
|
|||||||
@@ -244,8 +244,7 @@ static void rz_ssi_stream_quit(struct rz_ssi_priv *ssi,
|
|||||||
static int rz_ssi_clk_setup(struct rz_ssi_priv *ssi, unsigned int rate,
|
static int rz_ssi_clk_setup(struct rz_ssi_priv *ssi, unsigned int rate,
|
||||||
unsigned int channels)
|
unsigned int channels)
|
||||||
{
|
{
|
||||||
static s8 ckdv[16] = { 1, 2, 4, 8, 16, 32, 64, 128,
|
static u8 ckdv[] = { 1, 2, 4, 8, 16, 32, 64, 128, 6, 12, 24, 48, 96 };
|
||||||
6, 12, 24, 48, 96, -1, -1, -1 };
|
|
||||||
unsigned int channel_bits = 32; /* System Word Length */
|
unsigned int channel_bits = 32; /* System Word Length */
|
||||||
unsigned long bclk_rate = rate * channels * channel_bits;
|
unsigned long bclk_rate = rate * channels * channel_bits;
|
||||||
unsigned int div;
|
unsigned int div;
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ struct sun4i_spdif_quirks {
|
|||||||
unsigned int reg_dac_txdata;
|
unsigned int reg_dac_txdata;
|
||||||
bool has_reset;
|
bool has_reset;
|
||||||
unsigned int val_fctl_ftx;
|
unsigned int val_fctl_ftx;
|
||||||
|
unsigned int mclk_multiplier;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sun4i_spdif_dev {
|
struct sun4i_spdif_dev {
|
||||||
@@ -314,6 +315,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream,
|
|||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
mclk *= host->quirks->mclk_multiplier;
|
||||||
|
|
||||||
ret = clk_set_rate(host->spdif_clk, mclk);
|
ret = clk_set_rate(host->spdif_clk, mclk);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -348,6 +350,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream,
|
|||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
mclk_div *= host->quirks->mclk_multiplier;
|
||||||
|
|
||||||
reg_val = 0;
|
reg_val = 0;
|
||||||
reg_val |= SUN4I_SPDIF_TXCFG_ASS;
|
reg_val |= SUN4I_SPDIF_TXCFG_ASS;
|
||||||
@@ -541,24 +544,28 @@ static struct snd_soc_dai_driver sun4i_spdif_dai = {
|
|||||||
static const struct sun4i_spdif_quirks sun4i_a10_spdif_quirks = {
|
static const struct sun4i_spdif_quirks sun4i_a10_spdif_quirks = {
|
||||||
.reg_dac_txdata = SUN4I_SPDIF_TXFIFO,
|
.reg_dac_txdata = SUN4I_SPDIF_TXFIFO,
|
||||||
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
|
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
|
||||||
|
.mclk_multiplier = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct sun4i_spdif_quirks sun6i_a31_spdif_quirks = {
|
static const struct sun4i_spdif_quirks sun6i_a31_spdif_quirks = {
|
||||||
.reg_dac_txdata = SUN4I_SPDIF_TXFIFO,
|
.reg_dac_txdata = SUN4I_SPDIF_TXFIFO,
|
||||||
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
|
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
|
||||||
.has_reset = true,
|
.has_reset = true,
|
||||||
|
.mclk_multiplier = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct sun4i_spdif_quirks sun8i_h3_spdif_quirks = {
|
static const struct sun4i_spdif_quirks sun8i_h3_spdif_quirks = {
|
||||||
.reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
|
.reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
|
||||||
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
|
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
|
||||||
.has_reset = true,
|
.has_reset = true,
|
||||||
|
.mclk_multiplier = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct sun4i_spdif_quirks sun50i_h6_spdif_quirks = {
|
static const struct sun4i_spdif_quirks sun50i_h6_spdif_quirks = {
|
||||||
.reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
|
.reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
|
||||||
.val_fctl_ftx = SUN50I_H6_SPDIF_FCTL_FTX,
|
.val_fctl_ftx = SUN50I_H6_SPDIF_FCTL_FTX,
|
||||||
.has_reset = true,
|
.has_reset = true,
|
||||||
|
.mclk_multiplier = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct of_device_id sun4i_spdif_of_match[] = {
|
static const struct of_device_id sun4i_spdif_of_match[] = {
|
||||||
|
|||||||
@@ -567,17 +567,15 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename,
|
|||||||
}
|
}
|
||||||
obj->elf = elf_begin(obj->fd, ELF_C_READ_MMAP, NULL);
|
obj->elf = elf_begin(obj->fd, ELF_C_READ_MMAP, NULL);
|
||||||
if (!obj->elf) {
|
if (!obj->elf) {
|
||||||
err = -errno;
|
|
||||||
pr_warn_elf("failed to parse ELF file '%s'", filename);
|
pr_warn_elf("failed to parse ELF file '%s'", filename);
|
||||||
return err;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check ELF file high-level properties */
|
/* Sanity check ELF file high-level properties */
|
||||||
ehdr = elf64_getehdr(obj->elf);
|
ehdr = elf64_getehdr(obj->elf);
|
||||||
if (!ehdr) {
|
if (!ehdr) {
|
||||||
err = -errno;
|
|
||||||
pr_warn_elf("failed to get ELF header for %s", filename);
|
pr_warn_elf("failed to get ELF header for %s", filename);
|
||||||
return err;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (ehdr->e_ident[EI_DATA] != host_endianness) {
|
if (ehdr->e_ident[EI_DATA] != host_endianness) {
|
||||||
err = -EOPNOTSUPP;
|
err = -EOPNOTSUPP;
|
||||||
@@ -593,9 +591,8 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (elf_getshdrstrndx(obj->elf, &obj->shstrs_sec_idx)) {
|
if (elf_getshdrstrndx(obj->elf, &obj->shstrs_sec_idx)) {
|
||||||
err = -errno;
|
|
||||||
pr_warn_elf("failed to get SHSTRTAB section index for %s", filename);
|
pr_warn_elf("failed to get SHSTRTAB section index for %s", filename);
|
||||||
return err;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
scn = NULL;
|
scn = NULL;
|
||||||
@@ -605,26 +602,23 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename,
|
|||||||
|
|
||||||
shdr = elf64_getshdr(scn);
|
shdr = elf64_getshdr(scn);
|
||||||
if (!shdr) {
|
if (!shdr) {
|
||||||
err = -errno;
|
|
||||||
pr_warn_elf("failed to get section #%zu header for %s",
|
pr_warn_elf("failed to get section #%zu header for %s",
|
||||||
sec_idx, filename);
|
sec_idx, filename);
|
||||||
return err;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sec_name = elf_strptr(obj->elf, obj->shstrs_sec_idx, shdr->sh_name);
|
sec_name = elf_strptr(obj->elf, obj->shstrs_sec_idx, shdr->sh_name);
|
||||||
if (!sec_name) {
|
if (!sec_name) {
|
||||||
err = -errno;
|
|
||||||
pr_warn_elf("failed to get section #%zu name for %s",
|
pr_warn_elf("failed to get section #%zu name for %s",
|
||||||
sec_idx, filename);
|
sec_idx, filename);
|
||||||
return err;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = elf_getdata(scn, 0);
|
data = elf_getdata(scn, 0);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
err = -errno;
|
|
||||||
pr_warn_elf("failed to get section #%zu (%s) data from %s",
|
pr_warn_elf("failed to get section #%zu (%s) data from %s",
|
||||||
sec_idx, sec_name, filename);
|
sec_idx, sec_name, filename);
|
||||||
return err;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sec = add_src_sec(obj, sec_name);
|
sec = add_src_sec(obj, sec_name);
|
||||||
@@ -2597,14 +2591,14 @@ int bpf_linker__finalize(struct bpf_linker *linker)
|
|||||||
|
|
||||||
/* Finalize ELF layout */
|
/* Finalize ELF layout */
|
||||||
if (elf_update(linker->elf, ELF_C_NULL) < 0) {
|
if (elf_update(linker->elf, ELF_C_NULL) < 0) {
|
||||||
err = -errno;
|
err = -EINVAL;
|
||||||
pr_warn_elf("failed to finalize ELF layout");
|
pr_warn_elf("failed to finalize ELF layout");
|
||||||
return libbpf_err(err);
|
return libbpf_err(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write out final ELF contents */
|
/* Write out final ELF contents */
|
||||||
if (elf_update(linker->elf, ELF_C_WRITE) < 0) {
|
if (elf_update(linker->elf, ELF_C_WRITE) < 0) {
|
||||||
err = -errno;
|
err = -EINVAL;
|
||||||
pr_warn_elf("failed to write ELF contents");
|
pr_warn_elf("failed to write ELF contents");
|
||||||
return libbpf_err(err);
|
return libbpf_err(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -653,7 +653,7 @@ static int collect_usdt_targets(struct usdt_manager *man, Elf *elf, const char *
|
|||||||
* [0] https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
|
* [0] https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
|
||||||
*/
|
*/
|
||||||
usdt_abs_ip = note.loc_addr;
|
usdt_abs_ip = note.loc_addr;
|
||||||
if (base_addr)
|
if (base_addr && note.base_addr)
|
||||||
usdt_abs_ip += base_addr - note.base_addr;
|
usdt_abs_ip += base_addr - note.base_addr;
|
||||||
|
|
||||||
/* When attaching uprobes (which is what USDTs basically are)
|
/* When attaching uprobes (which is what USDTs basically are)
|
||||||
|
|||||||
@@ -2939,8 +2939,6 @@ sub run_bisect_test {
|
|||||||
|
|
||||||
my $failed = 0;
|
my $failed = 0;
|
||||||
my $result;
|
my $result;
|
||||||
my $output;
|
|
||||||
my $ret;
|
|
||||||
|
|
||||||
$in_bisect = 1;
|
$in_bisect = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ else
|
|||||||
client_connect
|
client_connect
|
||||||
verify_data
|
verify_data
|
||||||
server_listen
|
server_listen
|
||||||
|
wait_for_port ${port} ${netcat_opt}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# bpf_skb_net_shrink does not take tunnel flags yet, cannot update L3.
|
# bpf_skb_net_shrink does not take tunnel flags yet, cannot update L3.
|
||||||
|
|||||||
@@ -709,33 +709,33 @@
|
|||||||
/* Report with actual signedness to avoid weird output. */ \
|
/* Report with actual signedness to avoid weird output. */ \
|
||||||
switch (is_signed_type(__exp) * 2 + is_signed_type(__seen)) { \
|
switch (is_signed_type(__exp) * 2 + is_signed_type(__seen)) { \
|
||||||
case 0: { \
|
case 0: { \
|
||||||
unsigned long long __exp_print = (uintptr_t)__exp; \
|
uintmax_t __exp_print = (uintmax_t)__exp; \
|
||||||
unsigned long long __seen_print = (uintptr_t)__seen; \
|
uintmax_t __seen_print = (uintmax_t)__seen; \
|
||||||
__TH_LOG("Expected %s (%llu) %s %s (%llu)", \
|
__TH_LOG("Expected %s (%ju) %s %s (%ju)", \
|
||||||
_expected_str, __exp_print, #_t, \
|
_expected_str, __exp_print, #_t, \
|
||||||
_seen_str, __seen_print); \
|
_seen_str, __seen_print); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
case 1: { \
|
case 1: { \
|
||||||
unsigned long long __exp_print = (uintptr_t)__exp; \
|
uintmax_t __exp_print = (uintmax_t)__exp; \
|
||||||
long long __seen_print = (intptr_t)__seen; \
|
intmax_t __seen_print = (intmax_t)__seen; \
|
||||||
__TH_LOG("Expected %s (%llu) %s %s (%lld)", \
|
__TH_LOG("Expected %s (%ju) %s %s (%jd)", \
|
||||||
_expected_str, __exp_print, #_t, \
|
_expected_str, __exp_print, #_t, \
|
||||||
_seen_str, __seen_print); \
|
_seen_str, __seen_print); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
case 2: { \
|
case 2: { \
|
||||||
long long __exp_print = (intptr_t)__exp; \
|
intmax_t __exp_print = (intmax_t)__exp; \
|
||||||
unsigned long long __seen_print = (uintptr_t)__seen; \
|
uintmax_t __seen_print = (uintmax_t)__seen; \
|
||||||
__TH_LOG("Expected %s (%lld) %s %s (%llu)", \
|
__TH_LOG("Expected %s (%jd) %s %s (%ju)", \
|
||||||
_expected_str, __exp_print, #_t, \
|
_expected_str, __exp_print, #_t, \
|
||||||
_seen_str, __seen_print); \
|
_seen_str, __seen_print); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
case 3: { \
|
case 3: { \
|
||||||
long long __exp_print = (intptr_t)__exp; \
|
intmax_t __exp_print = (intmax_t)__exp; \
|
||||||
long long __seen_print = (intptr_t)__seen; \
|
intmax_t __seen_print = (intmax_t)__seen; \
|
||||||
__TH_LOG("Expected %s (%lld) %s %s (%lld)", \
|
__TH_LOG("Expected %s (%jd) %s %s (%jd)", \
|
||||||
_expected_str, __exp_print, #_t, \
|
_expected_str, __exp_print, #_t, \
|
||||||
_seen_str, __seen_print); \
|
_seen_str, __seen_print); \
|
||||||
break; \
|
break; \
|
||||||
|
|||||||
@@ -1775,8 +1775,7 @@ static void test_execute(struct __test_metadata *const _metadata, const int err,
|
|||||||
ASSERT_EQ(1, WIFEXITED(status));
|
ASSERT_EQ(1, WIFEXITED(status));
|
||||||
ASSERT_EQ(err ? 2 : 0, WEXITSTATUS(status))
|
ASSERT_EQ(err ? 2 : 0, WEXITSTATUS(status))
|
||||||
{
|
{
|
||||||
TH_LOG("Unexpected return code for \"%s\": %s", path,
|
TH_LOG("Unexpected return code for \"%s\"", path);
|
||||||
strerror(errno));
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -156,8 +156,8 @@ int main(int argc, char **argv)
|
|||||||
/* Check everything is sane before we start switching asynchronously */
|
/* Check everything is sane before we start switching asynchronously */
|
||||||
if (do_sanity_check) {
|
if (do_sanity_check) {
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
printf("Validating clocksource %s\n",
|
ksft_print_msg("Validating clocksource %s\n",
|
||||||
clocksource_list[i]);
|
clocksource_list[i]);
|
||||||
if (change_clocksource(clocksource_list[i])) {
|
if (change_clocksource(clocksource_list[i])) {
|
||||||
status = -1;
|
status = -1;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Running Asynchronous Switching Tests...\n");
|
ksft_print_msg("Running Asynchronous Switching Tests...\n");
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (!pid)
|
if (!pid)
|
||||||
return run_tests(runtime);
|
return run_tests(runtime);
|
||||||
|
|||||||
Reference in New Issue
Block a user