Skip to content

Commit 2619f90

Browse files
author
Kalle Valo
committed
Merge tag 'iwlwifi-next-for-kalle-2021-10-28' of git://git.kernel.org/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) <[email protected]>" [full] # gpg: aka "Luciano Roth Coelho (Intel) <[email protected]>" [full]
2 parents 89f8765 + cbaa6ae commit 2619f90

File tree

26 files changed

+804
-401
lines changed

26 files changed

+804
-401
lines changed

drivers/net/wireless/intel/iwlwifi/cfg/22000.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "iwl-prph.h"
1010

1111
/* Highest firmware API version supported */
12-
#define IWL_22000_UCODE_API_MAX 66
12+
#define IWL_22000_UCODE_API_MAX 67
1313

1414
/* Lowest firmware API version supported */
1515
#define IWL_22000_UCODE_API_MIN 39

drivers/net/wireless/intel/iwlwifi/fw/acpi.c

Lines changed: 105 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,11 @@ int iwl_acpi_get_dsm_u32(struct device *dev, int rev, int func,
184184
}
185185
IWL_EXPORT_SYMBOL(iwl_acpi_get_dsm_u32);
186186

187-
union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
188-
union acpi_object *data,
189-
int data_size, int *tbl_rev)
187+
union acpi_object *iwl_acpi_get_wifi_pkg_range(struct device *dev,
188+
union acpi_object *data,
189+
int min_data_size,
190+
int max_data_size,
191+
int *tbl_rev)
190192
{
191193
int i;
192194
union acpi_object *wifi_pkg;
@@ -196,7 +198,7 @@ union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
196198
* describes the domain, and one more entry, otherwise there's
197199
* no point in reading it.
198200
*/
199-
if (WARN_ON_ONCE(data_size < 2))
201+
if (WARN_ON_ONCE(min_data_size < 2 || min_data_size > max_data_size))
200202
return ERR_PTR(-EINVAL);
201203

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

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

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

241244
int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt,
242245
__le32 *block_list_array,
@@ -707,49 +710,103 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
707710
{
708711
union acpi_object *wifi_pkg, *data;
709712
int i, j, k, ret, tbl_rev;
710-
int idx = 1; /* start from one to skip the domain */
711-
u8 num_bands;
713+
u8 num_bands, num_profiles;
714+
static const struct {
715+
u8 revisions;
716+
u8 bands;
717+
u8 profiles;
718+
u8 min_profiles;
719+
} rev_data[] = {
720+
{
721+
.revisions = BIT(3),
722+
.bands = ACPI_GEO_NUM_BANDS_REV2,
723+
.profiles = ACPI_NUM_GEO_PROFILES_REV3,
724+
.min_profiles = 3,
725+
},
726+
{
727+
.revisions = BIT(2),
728+
.bands = ACPI_GEO_NUM_BANDS_REV2,
729+
.profiles = ACPI_NUM_GEO_PROFILES,
730+
},
731+
{
732+
.revisions = BIT(0) | BIT(1),
733+
.bands = ACPI_GEO_NUM_BANDS_REV0,
734+
.profiles = ACPI_NUM_GEO_PROFILES,
735+
},
736+
};
737+
int idx;
738+
/* start from one to skip the domain */
739+
int entry_idx = 1;
740+
741+
BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES_REV3 != IWL_NUM_GEO_PROFILES_V3);
742+
BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES != IWL_NUM_GEO_PROFILES);
712743

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

717-
/* start by trying to read revision 2 */
718-
wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
719-
ACPI_WGDS_WIFI_DATA_SIZE_REV2,
720-
&tbl_rev);
721-
if (!IS_ERR(wifi_pkg)) {
722-
if (tbl_rev != 2) {
723-
ret = PTR_ERR(wifi_pkg);
724-
goto out_free;
725-
}
726-
727-
num_bands = ACPI_GEO_NUM_BANDS_REV2;
728-
729-
goto read_table;
730-
}
731-
732-
/* then try revision 0 (which is the same as 1) */
733-
wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
734-
ACPI_WGDS_WIFI_DATA_SIZE_REV0,
735-
&tbl_rev);
736-
if (!IS_ERR(wifi_pkg)) {
737-
if (tbl_rev != 0 && tbl_rev != 1) {
738-
ret = PTR_ERR(wifi_pkg);
739-
goto out_free;
748+
/* read the highest revision we understand first */
749+
for (idx = 0; idx < ARRAY_SIZE(rev_data); idx++) {
750+
/* min_profiles != 0 requires num_profiles header */
751+
u32 hdr_size = 1 + !!rev_data[idx].min_profiles;
752+
u32 profile_size = ACPI_GEO_PER_CHAIN_SIZE *
753+
rev_data[idx].bands;
754+
u32 max_size = hdr_size + profile_size * rev_data[idx].profiles;
755+
u32 min_size;
756+
757+
if (!rev_data[idx].min_profiles)
758+
min_size = max_size;
759+
else
760+
min_size = hdr_size +
761+
profile_size * rev_data[idx].min_profiles;
762+
763+
wifi_pkg = iwl_acpi_get_wifi_pkg_range(fwrt->dev, data,
764+
min_size, max_size,
765+
&tbl_rev);
766+
if (!IS_ERR(wifi_pkg)) {
767+
if (!(BIT(tbl_rev) & rev_data[idx].revisions))
768+
continue;
769+
770+
num_bands = rev_data[idx].bands;
771+
num_profiles = rev_data[idx].profiles;
772+
773+
if (rev_data[idx].min_profiles) {
774+
/* read header that says # of profiles */
775+
union acpi_object *entry;
776+
777+
entry = &wifi_pkg->package.elements[entry_idx];
778+
entry_idx++;
779+
if (entry->type != ACPI_TYPE_INTEGER ||
780+
entry->integer.value > num_profiles) {
781+
ret = -EINVAL;
782+
goto out_free;
783+
}
784+
num_profiles = entry->integer.value;
785+
786+
/*
787+
* this also validates >= min_profiles since we
788+
* otherwise wouldn't have gotten the data when
789+
* looking up in ACPI
790+
*/
791+
if (wifi_pkg->package.count !=
792+
min_size + profile_size * num_profiles) {
793+
ret = -EINVAL;
794+
goto out_free;
795+
}
796+
}
797+
goto read_table;
740798
}
741-
742-
num_bands = ACPI_GEO_NUM_BANDS_REV0;
743-
744-
goto read_table;
745799
}
746800

747-
ret = PTR_ERR(wifi_pkg);
801+
if (idx < ARRAY_SIZE(rev_data))
802+
ret = PTR_ERR(wifi_pkg);
803+
else
804+
ret = -ENOENT;
748805
goto out_free;
749806

750807
read_table:
751808
fwrt->geo_rev = tbl_rev;
752-
for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
809+
for (i = 0; i < num_profiles; i++) {
753810
for (j = 0; j < ACPI_GEO_NUM_BANDS_REV2; j++) {
754811
union acpi_object *entry;
755812

@@ -762,7 +819,8 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
762819
fwrt->geo_profiles[i].bands[j].max =
763820
fwrt->geo_profiles[i].bands[1].max;
764821
} else {
765-
entry = &wifi_pkg->package.elements[idx++];
822+
entry = &wifi_pkg->package.elements[entry_idx];
823+
entry_idx++;
766824
if (entry->type != ACPI_TYPE_INTEGER ||
767825
entry->integer.value > U8_MAX) {
768826
ret = -EINVAL;
@@ -779,7 +837,8 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
779837
fwrt->geo_profiles[i].bands[j].chains[k] =
780838
fwrt->geo_profiles[i].bands[1].chains[k];
781839
} else {
782-
entry = &wifi_pkg->package.elements[idx++];
840+
entry = &wifi_pkg->package.elements[entry_idx];
841+
entry_idx++;
783842
if (entry->type != ACPI_TYPE_INTEGER ||
784843
entry->integer.value > U8_MAX) {
785844
ret = -EINVAL;
@@ -803,10 +862,10 @@ IWL_EXPORT_SYMBOL(iwl_sar_get_wgds_table);
803862
bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt)
804863
{
805864
/*
806-
* The GEO_TX_POWER_LIMIT command is not supported on earlier
807-
* firmware versions. Unfortunately, we don't have a TLV API
808-
* flag to rely on, so rely on the major version which is in
809-
* the first byte of ucode_ver. This was implemented
865+
* The PER_CHAIN_LIMIT_OFFSET_CMD command is not supported on
866+
* earlier firmware versions. Unfortunately, we don't have a
867+
* TLV API flag to rely on, so rely on the major version which
868+
* is in the first byte of ucode_ver. This was implemented
810869
* initially on version 38 and then backported to 17. It was
811870
* also backported to 29, but only for 7265D devices. The
812871
* intention was to have it in 36 as well, but not all 8000
@@ -822,14 +881,15 @@ bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt)
822881
IWL_EXPORT_SYMBOL(iwl_sar_geo_support);
823882

824883
int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
825-
struct iwl_per_chain_offset *table, u32 n_bands)
884+
struct iwl_per_chain_offset *table,
885+
u32 n_bands, u32 n_profiles)
826886
{
827887
int i, j;
828888

829889
if (!iwl_sar_geo_support(fwrt))
830890
return -EOPNOTSUPP;
831891

832-
for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
892+
for (i = 0; i < n_profiles; i++) {
833893
for (j = 0; j < n_bands; j++) {
834894
struct iwl_per_chain_offset *chain =
835895
&table[i * n_bands + j];

drivers/net/wireless/intel/iwlwifi/fw/acpi.h

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#define ACPI_SAR_PROFILE_NUM 4
3030

3131
#define ACPI_NUM_GEO_PROFILES 3
32+
#define ACPI_NUM_GEO_PROFILES_REV3 8
3233
#define ACPI_GEO_PER_CHAIN_SIZE 3
3334

3435
#define ACPI_SAR_NUM_CHAINS_REV0 2
@@ -59,13 +60,6 @@
5960
#define ACPI_GEO_NUM_BANDS_REV2 3
6061
#define ACPI_GEO_NUM_CHAINS 2
6162

62-
#define ACPI_WGDS_WIFI_DATA_SIZE_REV0 (ACPI_NUM_GEO_PROFILES * \
63-
ACPI_GEO_NUM_BANDS_REV0 * \
64-
ACPI_GEO_PER_CHAIN_SIZE + 1)
65-
#define ACPI_WGDS_WIFI_DATA_SIZE_REV2 (ACPI_NUM_GEO_PROFILES * \
66-
ACPI_GEO_NUM_BANDS_REV2 * \
67-
ACPI_GEO_PER_CHAIN_SIZE + 1)
68-
6963
#define ACPI_WRDD_WIFI_DATA_SIZE 2
7064
#define ACPI_SPLC_WIFI_DATA_SIZE 2
7165
#define ACPI_ECKV_WIFI_DATA_SIZE 2
@@ -115,6 +109,7 @@ enum iwl_dsm_funcs_rev_0 {
115109
DSM_FUNC_QUERY = 0,
116110
DSM_FUNC_DISABLE_SRD = 1,
117111
DSM_FUNC_ENABLE_INDONESIA_5G2 = 2,
112+
DSM_FUNC_ENABLE_6E = 3,
118113
DSM_FUNC_11AX_ENABLEMENT = 6,
119114
DSM_FUNC_ENABLE_UNII4_CHAN = 7,
120115
DSM_FUNC_ACTIVATE_CHANNEL = 8
@@ -159,10 +154,11 @@ int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func,
159154
int iwl_acpi_get_dsm_u32(struct device *dev, int rev, int func,
160155
const guid_t *guid, u32 *value);
161156

162-
union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
163-
union acpi_object *data,
164-
int data_size, int *tbl_rev);
165-
157+
union acpi_object *iwl_acpi_get_wifi_pkg_range(struct device *dev,
158+
union acpi_object *data,
159+
int min_data_size,
160+
int max_data_size,
161+
int *tbl_rev);
166162
/**
167163
* iwl_acpi_get_mcc - read MCC from ACPI, if available
168164
*
@@ -199,7 +195,8 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt);
199195
bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt);
200196

201197
int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
202-
struct iwl_per_chain_offset *table, u32 n_bands);
198+
struct iwl_per_chain_offset *table,
199+
u32 n_bands, u32 n_profiles);
203200

204201
int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt, __le32 *block_list_array,
205202
int *block_list_size);
@@ -231,10 +228,11 @@ static inline int iwl_acpi_get_dsm_u32(struct device *dev, int rev, int func,
231228
return -ENOENT;
232229
}
233230

234-
static inline union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
235-
union acpi_object *data,
236-
int data_size,
237-
int *tbl_rev)
231+
static inline union acpi_object *
232+
iwl_acpi_get_wifi_pkg_range(struct device *dev,
233+
union acpi_object *data,
234+
int min_data_size, int max_data_size,
235+
int *tbl_rev)
238236
{
239237
return ERR_PTR(-ENOENT);
240238
}
@@ -294,4 +292,14 @@ static inline __le32 iwl_acpi_get_lari_config_bitmap(struct iwl_fw_runtime *fwrt
294292
}
295293

296294
#endif /* CONFIG_ACPI */
295+
296+
static inline union acpi_object *
297+
iwl_acpi_get_wifi_pkg(struct device *dev,
298+
union acpi_object *data,
299+
int data_size, int *tbl_rev)
300+
{
301+
return iwl_acpi_get_wifi_pkg_range(dev, data, data_size, data_size,
302+
tbl_rev);
303+
}
304+
297305
#endif /* __iwl_fw_acpi__ */

drivers/net/wireless/intel/iwlwifi/fw/api/d3.h

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -693,49 +693,6 @@ struct iwl_wowlan_status_v9 {
693693
u8 wake_packet[]; /* can be truncated from _length to _bufsize */
694694
} __packed; /* WOWLAN_STATUSES_RSP_API_S_VER_9 */
695695

696-
/**
697-
* struct iwl_wowlan_status - WoWLAN status
698-
* @gtk: GTK data
699-
* @igtk: IGTK data
700-
* @bigtk: BIGTK data
701-
* @replay_ctr: GTK rekey replay counter
702-
* @pattern_number: number of the matched pattern
703-
* @non_qos_seq_ctr: non-QoS sequence counter to use next
704-
* @qos_seq_ctr: QoS sequence counters to use next
705-
* @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
706-
* @num_of_gtk_rekeys: number of GTK rekeys
707-
* @tid_tear_down: bitmap of TIDs torn down
708-
* @reserved: reserved
709-
* @received_beacons: number of received beacons
710-
* @wake_packet_length: wakeup packet length
711-
* @wake_packet_bufsize: wakeup packet buffer size
712-
* @tid_tear_down: bit mask of tids whose BA sessions were closed
713-
* in suspend state
714-
* @wake_packet: wakeup packet
715-
*/
716-
struct iwl_wowlan_status {
717-
struct iwl_wowlan_gtk_status gtk[1];
718-
struct iwl_wowlan_igtk_status igtk[1];
719-
struct iwl_wowlan_igtk_status bigtk[WOWLAN_IGTK_KEYS_NUM];
720-
__le64 replay_ctr;
721-
__le16 pattern_number;
722-
__le16 non_qos_seq_ctr;
723-
__le16 qos_seq_ctr[8];
724-
__le32 wakeup_reasons;
725-
__le32 num_of_gtk_rekeys;
726-
u8 tid_tear_down;
727-
u8 reserved[3];
728-
__le32 received_beacons;
729-
__le32 wake_packet_length;
730-
__le32 wake_packet_bufsize;
731-
u8 wake_packet[]; /* can be truncated from _length to _bufsize */
732-
} __packed; /* WOWLAN_STATUSES_API_S_VER_11 */
733-
734-
static inline u8 iwlmvm_wowlan_gtk_idx(struct iwl_wowlan_gtk_status *gtk)
735-
{
736-
return gtk->key_flags & IWL_WOWLAN_GTK_IDX_MASK;
737-
}
738-
739696
/* TODO: NetDetect API */
740697

741698
#endif /* __iwl_fw_api_d3_h__ */

0 commit comments

Comments
 (0)