Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d5abfd8 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wil6210: take mem_lock for writing in crash dump collection"

parents bc10e773 544ffd37
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -3672,9 +3672,7 @@ static int wil_nl_60g_handle_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
				     "NL_60G_GEN_FW_RESET, resetting...\n");

			mutex_lock(&wil->mutex);
			down_write(&wil->mem_lock);
			rc = wil_reset(wil, true);
			up_write(&wil->mem_lock);
			mutex_unlock(&wil->mutex);

			break;
+6 −4
Original line number Diff line number Diff line
@@ -1747,6 +1747,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
	/* Disable device led before reset*/
	wmi_led_cfg(wil, false);

	down_write(&wil->mem_lock);

	/* prevent NAPI from being scheduled and prevent wmi commands */
	mutex_lock(&wil->wmi_mutex);
	if (test_bit(wil_status_suspending, wil->status))
@@ -1802,6 +1804,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)

		if  (wil->secured_boot) {
			wil_err(wil, "secured boot is not supported\n");
			up_write(&wil->mem_lock);
			return -ENOTSUPP;
		}

@@ -1832,6 +1835,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)

	clear_bit(wil_status_resetting, wil->status);

	up_write(&wil->mem_lock);

	if (load_fw) {
		wil_unmask_irq(wil);

@@ -1899,6 +1904,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
	return rc;

out:
	up_write(&wil->mem_lock);
	clear_bit(wil_status_resetting, wil->status);
	return rc;
}
@@ -1924,9 +1930,7 @@ int __wil_up(struct wil6210_priv *wil)

	WARN_ON(!mutex_is_locked(&wil->mutex));

	down_write(&wil->mem_lock);
	rc = wil_reset(wil, true);
	up_write(&wil->mem_lock);
	if (rc)
		return rc;

@@ -2019,9 +2023,7 @@ int __wil_down(struct wil6210_priv *wil)
	wil_abort_scan_all_vifs(wil, false);
	mutex_unlock(&wil->vif_mutex);

	down_write(&wil->mem_lock);
	rc = wil_reset(wil, false);
	up_write(&wil->mem_lock);

	return rc;
}
+12 −5
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ static int wil_fw_get_crash_dump_bounds(struct wil6210_priv *wil,

int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size)
{
	int i, rc;
	int i;
	const struct fw_map *map;
	void *data;
	u32 host_min, dump_size, offset, len;
@@ -62,9 +62,15 @@ int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size)
		return -EINVAL;
	}

	rc = wil_mem_access_lock(wil);
	if (rc)
		return rc;
	down_write(&wil->mem_lock);

	if (test_bit(wil_status_suspending, wil->status) ||
	    test_bit(wil_status_suspended, wil->status)) {
		wil_err(wil,
			"suspend/resume in progress. cannot copy crash dump\n");
		up_write(&wil->mem_lock);
		return -EBUSY;
	}

	/* copy to crash dump area */
	for (i = 0; i < ARRAY_SIZE(fw_mapping); i++) {
@@ -84,7 +90,8 @@ int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size)
		wil_memcpy_fromio_32((void * __force)(dest + offset),
				     (const void __iomem * __force)data, len);
	}
	wil_mem_access_unlock(wil);

	up_write(&wil->mem_lock);

	return 0;
}