Skip to content

Commit

Permalink
Merge tag 'iwlwifi-next-for-kalle-2021-10-28' of git://git.kernel.org…
Browse files Browse the repository at this point in the history
…/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next

iwlwifi patches for v5.16

* Support a new ACPI table revision;
* Improvements in the device selection code;
* New HW support;
* Some fixes in the Geographic SAR implementation;
* Support for WiFi 6E enablement via BIOS;
* Support FW API version 67;
* Improve debugging support;
* Some fixes in session protection;
* Some other small fixes, clean-ups and improvements.

# gpg: Signature made Thu 28 Oct 2021 12:11:27 PM EEST
# gpg:                using RSA key 1772CD7E06F604F5A6EBCB26A1479CA21A3CC5FA
# gpg: Good signature from "Luciano Roth Coelho (Luca) <luca@coelho.fi>" [full]
# gpg:                 aka "Luciano Roth Coelho (Intel) <luciano.coelho@intel.com>" [full]
  • Loading branch information
Kalle Valo committed Oct 28, 2021
2 parents 89f8765 + cbaa6ae commit 2619f90
Show file tree
Hide file tree
Showing 26 changed files with 804 additions and 401 deletions.
2 changes: 1 addition & 1 deletion drivers/net/wireless/intel/iwlwifi/cfg/22000.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "iwl-prph.h"

/* Highest firmware API version supported */
#define IWL_22000_UCODE_API_MAX 66
#define IWL_22000_UCODE_API_MAX 67

/* Lowest firmware API version supported */
#define IWL_22000_UCODE_API_MIN 39
Expand Down
150 changes: 105 additions & 45 deletions drivers/net/wireless/intel/iwlwifi/fw/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,11 @@ int iwl_acpi_get_dsm_u32(struct device *dev, int rev, int func,
}
IWL_EXPORT_SYMBOL(iwl_acpi_get_dsm_u32);

union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
union acpi_object *data,
int data_size, int *tbl_rev)
union acpi_object *iwl_acpi_get_wifi_pkg_range(struct device *dev,
union acpi_object *data,
int min_data_size,
int max_data_size,
int *tbl_rev)
{
int i;
union acpi_object *wifi_pkg;
Expand All @@ -196,7 +198,7 @@ union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
* describes the domain, and one more entry, otherwise there's
* no point in reading it.
*/
if (WARN_ON_ONCE(data_size < 2))
if (WARN_ON_ONCE(min_data_size < 2 || min_data_size > max_data_size))
return ERR_PTR(-EINVAL);

/*
Expand All @@ -222,7 +224,8 @@ union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,

/* skip entries that are not a package with the right size */
if (wifi_pkg->type != ACPI_TYPE_PACKAGE ||
wifi_pkg->package.count != data_size)
wifi_pkg->package.count < min_data_size ||
wifi_pkg->package.count > max_data_size)
continue;

domain = &wifi_pkg->package.elements[0];
Expand All @@ -236,7 +239,7 @@ union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
found:
return wifi_pkg;
}
IWL_EXPORT_SYMBOL(iwl_acpi_get_wifi_pkg);
IWL_EXPORT_SYMBOL(iwl_acpi_get_wifi_pkg_range);

int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt,
__le32 *block_list_array,
Expand Down Expand Up @@ -707,49 +710,103 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
{
union acpi_object *wifi_pkg, *data;
int i, j, k, ret, tbl_rev;
int idx = 1; /* start from one to skip the domain */
u8 num_bands;
u8 num_bands, num_profiles;
static const struct {
u8 revisions;
u8 bands;
u8 profiles;
u8 min_profiles;
} rev_data[] = {
{
.revisions = BIT(3),
.bands = ACPI_GEO_NUM_BANDS_REV2,
.profiles = ACPI_NUM_GEO_PROFILES_REV3,
.min_profiles = 3,
},
{
.revisions = BIT(2),
.bands = ACPI_GEO_NUM_BANDS_REV2,
.profiles = ACPI_NUM_GEO_PROFILES,
},
{
.revisions = BIT(0) | BIT(1),
.bands = ACPI_GEO_NUM_BANDS_REV0,
.profiles = ACPI_NUM_GEO_PROFILES,
},
};
int idx;
/* start from one to skip the domain */
int entry_idx = 1;

BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES_REV3 != IWL_NUM_GEO_PROFILES_V3);
BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES != IWL_NUM_GEO_PROFILES);

data = iwl_acpi_get_object(fwrt->dev, ACPI_WGDS_METHOD);
if (IS_ERR(data))
return PTR_ERR(data);

/* start by trying to read revision 2 */
wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
ACPI_WGDS_WIFI_DATA_SIZE_REV2,
&tbl_rev);
if (!IS_ERR(wifi_pkg)) {
if (tbl_rev != 2) {
ret = PTR_ERR(wifi_pkg);
goto out_free;
}

num_bands = ACPI_GEO_NUM_BANDS_REV2;

goto read_table;
}

/* then try revision 0 (which is the same as 1) */
wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
ACPI_WGDS_WIFI_DATA_SIZE_REV0,
&tbl_rev);
if (!IS_ERR(wifi_pkg)) {
if (tbl_rev != 0 && tbl_rev != 1) {
ret = PTR_ERR(wifi_pkg);
goto out_free;
/* read the highest revision we understand first */
for (idx = 0; idx < ARRAY_SIZE(rev_data); idx++) {
/* min_profiles != 0 requires num_profiles header */
u32 hdr_size = 1 + !!rev_data[idx].min_profiles;
u32 profile_size = ACPI_GEO_PER_CHAIN_SIZE *
rev_data[idx].bands;
u32 max_size = hdr_size + profile_size * rev_data[idx].profiles;
u32 min_size;

if (!rev_data[idx].min_profiles)
min_size = max_size;
else
min_size = hdr_size +
profile_size * rev_data[idx].min_profiles;

wifi_pkg = iwl_acpi_get_wifi_pkg_range(fwrt->dev, data,
min_size, max_size,
&tbl_rev);
if (!IS_ERR(wifi_pkg)) {
if (!(BIT(tbl_rev) & rev_data[idx].revisions))
continue;

num_bands = rev_data[idx].bands;
num_profiles = rev_data[idx].profiles;

if (rev_data[idx].min_profiles) {
/* read header that says # of profiles */
union acpi_object *entry;

entry = &wifi_pkg->package.elements[entry_idx];
entry_idx++;
if (entry->type != ACPI_TYPE_INTEGER ||
entry->integer.value > num_profiles) {
ret = -EINVAL;
goto out_free;
}
num_profiles = entry->integer.value;

/*
* this also validates >= min_profiles since we
* otherwise wouldn't have gotten the data when
* looking up in ACPI
*/
if (wifi_pkg->package.count !=
min_size + profile_size * num_profiles) {
ret = -EINVAL;
goto out_free;
}
}
goto read_table;
}

num_bands = ACPI_GEO_NUM_BANDS_REV0;

goto read_table;
}

ret = PTR_ERR(wifi_pkg);
if (idx < ARRAY_SIZE(rev_data))
ret = PTR_ERR(wifi_pkg);
else
ret = -ENOENT;
goto out_free;

read_table:
fwrt->geo_rev = tbl_rev;
for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
for (i = 0; i < num_profiles; i++) {
for (j = 0; j < ACPI_GEO_NUM_BANDS_REV2; j++) {
union acpi_object *entry;

Expand All @@ -762,7 +819,8 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
fwrt->geo_profiles[i].bands[j].max =
fwrt->geo_profiles[i].bands[1].max;
} else {
entry = &wifi_pkg->package.elements[idx++];
entry = &wifi_pkg->package.elements[entry_idx];
entry_idx++;
if (entry->type != ACPI_TYPE_INTEGER ||
entry->integer.value > U8_MAX) {
ret = -EINVAL;
Expand All @@ -779,7 +837,8 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
fwrt->geo_profiles[i].bands[j].chains[k] =
fwrt->geo_profiles[i].bands[1].chains[k];
} else {
entry = &wifi_pkg->package.elements[idx++];
entry = &wifi_pkg->package.elements[entry_idx];
entry_idx++;
if (entry->type != ACPI_TYPE_INTEGER ||
entry->integer.value > U8_MAX) {
ret = -EINVAL;
Expand All @@ -803,10 +862,10 @@ IWL_EXPORT_SYMBOL(iwl_sar_get_wgds_table);
bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt)
{
/*
* The GEO_TX_POWER_LIMIT command is not supported on earlier
* firmware versions. Unfortunately, we don't have a TLV API
* flag to rely on, so rely on the major version which is in
* the first byte of ucode_ver. This was implemented
* The PER_CHAIN_LIMIT_OFFSET_CMD command is not supported on
* earlier firmware versions. Unfortunately, we don't have a
* TLV API flag to rely on, so rely on the major version which
* is in the first byte of ucode_ver. This was implemented
* initially on version 38 and then backported to 17. It was
* also backported to 29, but only for 7265D devices. The
* intention was to have it in 36 as well, but not all 8000
Expand All @@ -822,14 +881,15 @@ bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt)
IWL_EXPORT_SYMBOL(iwl_sar_geo_support);

int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
struct iwl_per_chain_offset *table, u32 n_bands)
struct iwl_per_chain_offset *table,
u32 n_bands, u32 n_profiles)
{
int i, j;

if (!iwl_sar_geo_support(fwrt))
return -EOPNOTSUPP;

for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
for (i = 0; i < n_profiles; i++) {
for (j = 0; j < n_bands; j++) {
struct iwl_per_chain_offset *chain =
&table[i * n_bands + j];
Expand Down
40 changes: 24 additions & 16 deletions drivers/net/wireless/intel/iwlwifi/fw/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#define ACPI_SAR_PROFILE_NUM 4

#define ACPI_NUM_GEO_PROFILES 3
#define ACPI_NUM_GEO_PROFILES_REV3 8
#define ACPI_GEO_PER_CHAIN_SIZE 3

#define ACPI_SAR_NUM_CHAINS_REV0 2
Expand Down Expand Up @@ -59,13 +60,6 @@
#define ACPI_GEO_NUM_BANDS_REV2 3
#define ACPI_GEO_NUM_CHAINS 2

#define ACPI_WGDS_WIFI_DATA_SIZE_REV0 (ACPI_NUM_GEO_PROFILES * \
ACPI_GEO_NUM_BANDS_REV0 * \
ACPI_GEO_PER_CHAIN_SIZE + 1)
#define ACPI_WGDS_WIFI_DATA_SIZE_REV2 (ACPI_NUM_GEO_PROFILES * \
ACPI_GEO_NUM_BANDS_REV2 * \
ACPI_GEO_PER_CHAIN_SIZE + 1)

#define ACPI_WRDD_WIFI_DATA_SIZE 2
#define ACPI_SPLC_WIFI_DATA_SIZE 2
#define ACPI_ECKV_WIFI_DATA_SIZE 2
Expand Down Expand Up @@ -115,6 +109,7 @@ enum iwl_dsm_funcs_rev_0 {
DSM_FUNC_QUERY = 0,
DSM_FUNC_DISABLE_SRD = 1,
DSM_FUNC_ENABLE_INDONESIA_5G2 = 2,
DSM_FUNC_ENABLE_6E = 3,
DSM_FUNC_11AX_ENABLEMENT = 6,
DSM_FUNC_ENABLE_UNII4_CHAN = 7,
DSM_FUNC_ACTIVATE_CHANNEL = 8
Expand Down Expand Up @@ -159,10 +154,11 @@ int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func,
int iwl_acpi_get_dsm_u32(struct device *dev, int rev, int func,
const guid_t *guid, u32 *value);

union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
union acpi_object *data,
int data_size, int *tbl_rev);

union acpi_object *iwl_acpi_get_wifi_pkg_range(struct device *dev,
union acpi_object *data,
int min_data_size,
int max_data_size,
int *tbl_rev);
/**
* iwl_acpi_get_mcc - read MCC from ACPI, if available
*
Expand Down Expand Up @@ -199,7 +195,8 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt);
bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt);

int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
struct iwl_per_chain_offset *table, u32 n_bands);
struct iwl_per_chain_offset *table,
u32 n_bands, u32 n_profiles);

int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt, __le32 *block_list_array,
int *block_list_size);
Expand Down Expand Up @@ -231,10 +228,11 @@ static inline int iwl_acpi_get_dsm_u32(struct device *dev, int rev, int func,
return -ENOENT;
}

static inline union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
union acpi_object *data,
int data_size,
int *tbl_rev)
static inline union acpi_object *
iwl_acpi_get_wifi_pkg_range(struct device *dev,
union acpi_object *data,
int min_data_size, int max_data_size,
int *tbl_rev)
{
return ERR_PTR(-ENOENT);
}
Expand Down Expand Up @@ -294,4 +292,14 @@ static inline __le32 iwl_acpi_get_lari_config_bitmap(struct iwl_fw_runtime *fwrt
}

#endif /* CONFIG_ACPI */

static inline union acpi_object *
iwl_acpi_get_wifi_pkg(struct device *dev,
union acpi_object *data,
int data_size, int *tbl_rev)
{
return iwl_acpi_get_wifi_pkg_range(dev, data, data_size, data_size,
tbl_rev);
}

#endif /* __iwl_fw_acpi__ */
43 changes: 0 additions & 43 deletions drivers/net/wireless/intel/iwlwifi/fw/api/d3.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,49 +693,6 @@ struct iwl_wowlan_status_v9 {
u8 wake_packet[]; /* can be truncated from _length to _bufsize */
} __packed; /* WOWLAN_STATUSES_RSP_API_S_VER_9 */

/**
* struct iwl_wowlan_status - WoWLAN status
* @gtk: GTK data
* @igtk: IGTK data
* @bigtk: BIGTK data
* @replay_ctr: GTK rekey replay counter
* @pattern_number: number of the matched pattern
* @non_qos_seq_ctr: non-QoS sequence counter to use next
* @qos_seq_ctr: QoS sequence counters to use next
* @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
* @num_of_gtk_rekeys: number of GTK rekeys
* @tid_tear_down: bitmap of TIDs torn down
* @reserved: reserved
* @received_beacons: number of received beacons
* @wake_packet_length: wakeup packet length
* @wake_packet_bufsize: wakeup packet buffer size
* @tid_tear_down: bit mask of tids whose BA sessions were closed
* in suspend state
* @wake_packet: wakeup packet
*/
struct iwl_wowlan_status {
struct iwl_wowlan_gtk_status gtk[1];
struct iwl_wowlan_igtk_status igtk[1];
struct iwl_wowlan_igtk_status bigtk[WOWLAN_IGTK_KEYS_NUM];
__le64 replay_ctr;
__le16 pattern_number;
__le16 non_qos_seq_ctr;
__le16 qos_seq_ctr[8];
__le32 wakeup_reasons;
__le32 num_of_gtk_rekeys;
u8 tid_tear_down;
u8 reserved[3];
__le32 received_beacons;
__le32 wake_packet_length;
__le32 wake_packet_bufsize;
u8 wake_packet[]; /* can be truncated from _length to _bufsize */
} __packed; /* WOWLAN_STATUSES_API_S_VER_11 */

static inline u8 iwlmvm_wowlan_gtk_idx(struct iwl_wowlan_gtk_status *gtk)
{
return gtk->key_flags & IWL_WOWLAN_GTK_IDX_MASK;
}

/* TODO: NetDetect API */

#endif /* __iwl_fw_api_d3_h__ */
Loading

0 comments on commit 2619f90

Please sign in to comment.