Skip to content

Commit 78a19d5

Browse files
Miriam-Rachellucacoelho
authored andcommitted
iwlwifi: mvm: Read the PPAG and SAR tables at INIT stage
We used to read the PPAG, WRDS, EWRD, WGDS tables from ACPI in the load stage only. This prevented vendor commands from being executed before bringing the interface up. Move reading those tables to INIT stage. Signed-off-by: Miri Korenblit <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20210805141826.ce3b60f0b426.I3643bf00e714aae930880cc7d6cf390b142eaccb@changeid Signed-off-by: Luca Coelho <[email protected]>
1 parent b537ffb commit 78a19d5

File tree

5 files changed

+69
-57
lines changed

5 files changed

+69
-57
lines changed

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,6 @@ static int iwl_sar_set_profile(union acpi_object *table,
416416
{
417417
int i, j, idx = 0;
418418

419-
profile->enabled = enabled;
420-
421419
/*
422420
* The table from ACPI is flat, but we store it in a
423421
* structured array.
@@ -435,6 +433,9 @@ static int iwl_sar_set_profile(union acpi_object *table,
435433
}
436434
}
437435

436+
/* Only if all values were valid can the profile be enabled */
437+
profile->enabled = enabled;
438+
438439
return 0;
439440
}
440441

@@ -780,20 +781,11 @@ IWL_EXPORT_SYMBOL(iwl_sar_geo_support);
780781
int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
781782
struct iwl_per_chain_offset *table, u32 n_bands)
782783
{
783-
int ret, i, j;
784+
int i, j;
784785

785786
if (!iwl_sar_geo_support(fwrt))
786787
return -EOPNOTSUPP;
787788

788-
ret = iwl_sar_get_wgds_table(fwrt);
789-
if (ret < 0) {
790-
IWL_DEBUG_RADIO(fwrt,
791-
"Geo SAR BIOS table invalid or unavailable. (%d)\n",
792-
ret);
793-
/* we don't fail if the table is not available */
794-
return -ENOENT;
795-
}
796-
797789
for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
798790
for (j = 0; j < n_bands; j++) {
799791
struct iwl_per_chain_offset *chain =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static inline int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt)
265265

266266
static inline int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
267267
{
268-
return -ENOENT;
268+
return 1;
269269
}
270270

271271
static inline bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt)

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

Lines changed: 61 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,16 +1058,7 @@ static const struct dmi_system_id dmi_ppag_approved_list[] = {
10581058

10591059
static int iwl_mvm_ppag_init(struct iwl_mvm *mvm)
10601060
{
1061-
int ret;
1062-
1063-
ret = iwl_mvm_get_ppag_table(mvm);
1064-
if (ret < 0) {
1065-
IWL_DEBUG_RADIO(mvm,
1066-
"PPAG BIOS table invalid or unavailable. (%d)\n",
1067-
ret);
1068-
return 0;
1069-
}
1070-
1061+
/* no need to read the table, done in INIT stage */
10711062
if (!dmi_check_system(dmi_ppag_approved_list)) {
10721063
IWL_DEBUG_RADIO(mvm,
10731064
"System vendor '%s' is not in the approved list, disabling PPAG.\n",
@@ -1192,12 +1183,65 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
11921183
ret);
11931184
}
11941185
}
1186+
1187+
void iwl_mvm_get_acpi_tables(struct iwl_mvm *mvm)
1188+
{
1189+
int ret;
1190+
1191+
/* read PPAG table */
1192+
ret = iwl_mvm_get_ppag_table(mvm);
1193+
if (ret < 0) {
1194+
IWL_DEBUG_RADIO(mvm,
1195+
"PPAG BIOS table invalid or unavailable. (%d)\n",
1196+
ret);
1197+
}
1198+
1199+
/* read SAR tables */
1200+
ret = iwl_sar_get_wrds_table(&mvm->fwrt);
1201+
if (ret < 0) {
1202+
IWL_DEBUG_RADIO(mvm,
1203+
"WRDS SAR BIOS table invalid or unavailable. (%d)\n",
1204+
ret);
1205+
/*
1206+
* If not available, don't fail and don't bother with EWRD and
1207+
* WGDS */
1208+
1209+
if (!iwl_sar_get_wgds_table(&mvm->fwrt)) {
1210+
/*
1211+
* If basic SAR is not available, we check for WGDS,
1212+
* which should *not* be available either. If it is
1213+
* available, issue an error, because we can't use SAR
1214+
* Geo without basic SAR.
1215+
*/
1216+
IWL_ERR(mvm, "BIOS contains WGDS but no WRDS\n");
1217+
}
1218+
1219+
} else {
1220+
ret = iwl_sar_get_ewrd_table(&mvm->fwrt);
1221+
/* if EWRD is not available, we can still use
1222+
* WRDS, so don't fail */
1223+
if (ret < 0)
1224+
IWL_DEBUG_RADIO(mvm,
1225+
"EWRD SAR BIOS table invalid or unavailable. (%d)\n",
1226+
ret);
1227+
1228+
/* read geo SAR table */
1229+
if (iwl_sar_geo_support(&mvm->fwrt)) {
1230+
ret = iwl_sar_get_wgds_table(&mvm->fwrt);
1231+
if (ret < 0)
1232+
IWL_DEBUG_RADIO(mvm,
1233+
"Geo SAR BIOS table invalid or unavailable. (%d)\n",
1234+
ret);
1235+
/* we don't fail if the table is not available */
1236+
}
1237+
}
1238+
}
11951239
#else /* CONFIG_ACPI */
11961240

11971241
inline int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm,
11981242
int prof_a, int prof_b)
11991243
{
1200-
return -ENOENT;
1244+
return 1;
12011245
}
12021246

12031247
inline int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm)
@@ -1232,6 +1276,10 @@ static u8 iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm)
12321276
{
12331277
return DSM_VALUE_RFI_DISABLE;
12341278
}
1279+
1280+
void iwl_mvm_get_acpi_tables(struct iwl_mvm *mvm)
1281+
{
1282+
}
12351283
#endif /* CONFIG_ACPI */
12361284

12371285
void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags)
@@ -1287,27 +1335,6 @@ void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags)
12871335

12881336
static int iwl_mvm_sar_init(struct iwl_mvm *mvm)
12891337
{
1290-
int ret;
1291-
1292-
ret = iwl_sar_get_wrds_table(&mvm->fwrt);
1293-
if (ret < 0) {
1294-
IWL_DEBUG_RADIO(mvm,
1295-
"WRDS SAR BIOS table invalid or unavailable. (%d)\n",
1296-
ret);
1297-
/*
1298-
* If not available, don't fail and don't bother with EWRD.
1299-
* Return 1 to tell that we can't use WGDS either.
1300-
*/
1301-
return 1;
1302-
}
1303-
1304-
ret = iwl_sar_get_ewrd_table(&mvm->fwrt);
1305-
/* if EWRD is not available, we can still use WRDS, so don't fail */
1306-
if (ret < 0)
1307-
IWL_DEBUG_RADIO(mvm,
1308-
"EWRD SAR BIOS table invalid or unavailable. (%d)\n",
1309-
ret);
1310-
13111338
return iwl_mvm_sar_select_profile(mvm, 1, 1);
13121339
}
13131340

@@ -1543,19 +1570,9 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
15431570
goto error;
15441571

15451572
ret = iwl_mvm_sar_init(mvm);
1546-
if (ret == 0) {
1573+
if (ret == 0)
15471574
ret = iwl_mvm_sar_geo_init(mvm);
1548-
} else if (ret == -ENOENT && !iwl_sar_get_wgds_table(&mvm->fwrt)) {
1549-
/*
1550-
* If basic SAR is not available, we check for WGDS,
1551-
* which should *not* be available either. If it is
1552-
* available, issue an error, because we can't use SAR
1553-
* Geo without basic SAR.
1554-
*/
1555-
IWL_ERR(mvm, "BIOS contains WGDS but no WRDS\n");
1556-
}
1557-
1558-
if (ret < 0)
1575+
else if (ret < 0)
15591576
goto error;
15601577

15611578
iwl_mvm_tas_init(mvm);

drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,6 +2043,7 @@ void iwl_mvm_event_frame_timeout_callback(struct iwl_mvm *mvm,
20432043
int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b);
20442044
int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm);
20452045
int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm);
2046+
void iwl_mvm_get_acpi_tables(struct iwl_mvm *mvm);
20462047
#ifdef CONFIG_IWLWIFI_DEBUGFS
20472048
void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
20482049
struct ieee80211_vif *vif,

drivers/net/wireless/intel/iwlwifi/mvm/ops.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
771771
iwl_fw_runtime_init(&mvm->fwrt, trans, fw, &iwl_mvm_fwrt_ops, mvm,
772772
dbgfs_dir);
773773

774+
iwl_mvm_get_acpi_tables(mvm);
775+
774776
mvm->init_status = 0;
775777

776778
if (iwl_mvm_has_new_rx_api(mvm)) {

0 commit comments

Comments
 (0)