diff options
| author | David S. Miller <[email protected]> | 2021-02-12 16:54:17 -0800 | 
|---|---|---|
| committer | David S. Miller <[email protected]> | 2021-02-12 16:54:17 -0800 | 
| commit | 4b47ad0079f064a5b62c23e6301d034203bcc32e (patch) | |
| tree | f7f792a45ab805ce885fbcd13c969d0f50eaa9d9 /drivers/net/ipa/ipa_cmd.c | |
| parent | 21cc70c75be0d1a38da34095d1933a75ce784b1d (diff) | |
| parent | 6170b6dab2d4cc14242afb92b980a84113f654ae (diff) | |
Merge branch 'ipa-cleanups'
Alex Elder says:
====================
net: ipa: some more cleanup
Version 3 of this series uses dev_err_probe() in the second patch,
as suggested by Heiner Kallweit.
Version 2 was sent to ensure the series was based on current
net-next/master, and added copyright updates to files touched.
The original introduction is below.
This is another fairly innocuous set of cleanup patches.
The first was motivated by a bug found that would affect IPA v4.5.
It maintain a new GSI address pointer; one is the "raw" (original
mapped) address, and the other will have been adjusted if necessary
for use on newer platforms.
The second just quiets some unnecessary noise during early probe.
The third fixes some errors that show up when IPA_VALIDATION is
enabled.
The last two just create helper functions to improve readability.
====================
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'drivers/net/ipa/ipa_cmd.c')
| -rw-r--r-- | drivers/net/ipa/ipa_cmd.c | 32 | 
1 files changed, 24 insertions, 8 deletions
| diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index 97b50fee6008..35e35852c25c 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -1,7 +1,7 @@  // SPDX-License-Identifier: GPL-2.0  /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2020 Linaro Ltd. + * Copyright (C) 2019-2021 Linaro Ltd.   */  #include <linux/types.h> @@ -244,11 +244,15 @@ static bool ipa_cmd_register_write_offset_valid(struct ipa *ipa,  	if (ipa->version != IPA_VERSION_3_5_1)  		bit_count += hweight32(REGISTER_WRITE_FLAGS_OFFSET_HIGH_FMASK);  	BUILD_BUG_ON(bit_count > 32); -	offset_max = ~0 >> (32 - bit_count); +	offset_max = ~0U >> (32 - bit_count); +	/* Make sure the offset can be represented by the field(s) +	 * that holds it.  Also make sure the offset is not outside +	 * the overall IPA memory range. +	 */  	if (offset > offset_max || ipa->mem_offset > offset_max - offset) {  		dev_err(dev, "%s offset too large 0x%04x + 0x%04x > 0x%04x)\n", -				ipa->mem_offset + offset, offset_max); +			name, ipa->mem_offset, offset, offset_max);  		return false;  	} @@ -261,12 +265,24 @@ static bool ipa_cmd_register_write_valid(struct ipa *ipa)  	const char *name;  	u32 offset; -	offset = ipa_reg_filt_rout_hash_flush_offset(ipa->version); -	name = "filter/route hash flush"; -	if (!ipa_cmd_register_write_offset_valid(ipa, name, offset)) -		return false; +	/* If hashed tables are supported, ensure the hash flush register +	 * offset will fit in a register write IPA immediate command. +	 */ +	if (ipa_table_hash_support(ipa)) { +		offset = ipa_reg_filt_rout_hash_flush_offset(ipa->version); +		name = "filter/route hash flush"; +		if (!ipa_cmd_register_write_offset_valid(ipa, name, offset)) +			return false; +	} -	offset = IPA_REG_ENDP_STATUS_N_OFFSET(IPA_ENDPOINT_COUNT); +	/* Each endpoint can have a status endpoint associated with it, +	 * and this is recorded in an endpoint register.  If the modem +	 * crashes, we reset the status endpoint for all modem endpoints +	 * using a register write IPA immediate command.  Make sure the +	 * worst case (highest endpoint number) offset of that endpoint +	 * fits in the register write command field(s) that must hold it. +	 */ +	offset = IPA_REG_ENDP_STATUS_N_OFFSET(IPA_ENDPOINT_COUNT - 1);  	name = "maximal endpoint status";  	if (!ipa_cmd_register_write_offset_valid(ipa, name, offset))  		return false; |