From: Wey-Yi Guy <wey-yi.w.guy@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
Stanislaw Gruszka <sgruszka@redhat.com>,
Johannes Berg <johannes.berg@intel.com>,
Wey-Yi Guy <wey-yi.w.guy@intel.com>
Subject: [PATCH 082/101] iwlwifi: cleanup/fix memory barriers
Date: Sun, 4 Mar 2012 11:29:36 -0800 [thread overview]
Message-ID: <1330889395-533-83-git-send-email-wey-yi.w.guy@intel.com> (raw)
In-Reply-To: <1330889395-533-1-git-send-email-wey-yi.w.guy@intel.com>
From: Stanislaw Gruszka <sgruszka@redhat.com>
wmb(), rmb() are not needed when writel(), readl() are used as
accessors for MMIO. We use them indirectly via iowrite32(),
ioread32().
What is needed mmiowb(), for synchronizing writes coming from
different CPUs on PCIe bridge (see in patch comments). This
fortunately is not needed on x86, where mmiowb() is just
defined as compiler barrier. As iwlwifi devices are most likely
not used on anything other than x86, this is not so important
fix.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 1 -
drivers/net/wireless/iwlwifi/iwl-io.c | 12 +++++++-----
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 1 -
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index ce9ebeb..64bc285 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -334,7 +334,6 @@ static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,
/* Set starting address; reads will auto-increment */
iwl_write32(trans(priv), HBUS_TARG_MEM_RADDR, ptr);
- rmb();
/*
* Refuse to read more than would have fit into the log from
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c
index fa69845..081dd34 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -136,6 +136,13 @@ void iwl_release_nic_access(struct iwl_trans *trans)
lockdep_assert_held(&trans->reg_lock);
__iwl_clear_bit(trans, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
+ /*
+ * Above we read the CSR_GP_CNTRL register, which will flush
+ * any previous writes, but we need the write that clears the
+ * MAC_ACCESS_REQ bit to be performed before any other writes
+ * scheduled on different CPUs (after we drop reg_lock).
+ */
+ mmiowb();
}
u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg)
@@ -182,7 +189,6 @@ int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask,
static inline u32 __iwl_read_prph(struct iwl_trans *trans, u32 reg)
{
iwl_write32(trans, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
- rmb();
return iwl_read32(trans, HBUS_TARG_PRPH_RDAT);
}
@@ -190,7 +196,6 @@ static inline void __iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val)
{
iwl_write32(trans, HBUS_TARG_PRPH_WADDR,
((addr & 0x0000FFFF) | (3 << 24)));
- wmb();
iwl_write32(trans, HBUS_TARG_PRPH_WDAT, val);
}
@@ -270,7 +275,6 @@ void _iwl_read_targ_mem_words(struct iwl_trans *trans, u32 addr,
spin_lock_irqsave(&trans->reg_lock, flags);
if (likely(iwl_grab_nic_access(trans))) {
iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr);
- rmb();
for (offs = 0; offs < words; offs++)
vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT);
iwl_release_nic_access(trans);
@@ -297,8 +301,6 @@ int _iwl_write_targ_mem_words(struct iwl_trans *trans, u32 addr,
spin_lock_irqsave(&trans->reg_lock, flags);
if (likely(iwl_grab_nic_access(trans))) {
iwl_write32(trans, HBUS_TARG_MEM_WADDR, addr);
- wmb();
-
for (offs = 0; offs < words; offs++)
iwl_write32(trans, HBUS_TARG_MEM_WDAT, vals[offs]);
iwl_release_nic_access(trans);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 25e2f93..5b2e47a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -750,7 +750,6 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx,
/* Set starting address; reads will auto-increment */
iwl_write32(trans, HBUS_TARG_MEM_RADDR, ptr);
- rmb();
/* "time" is actually "data" for mode 0 (no timestamp).
* place event id # at far right for easier visual parsing. */
--
1.7.0.4
next prev parent reply other threads:[~2012-03-04 20:43 UTC|newest]
Thread overview: 105+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-04 19:28 [PATCH 000/101] update for 3.4: iwlwifi 2012-03-04 Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 001/101] iwlwifi: move iwl_clear_driver_stations to user Wey-Yi Guy
2012-03-05 1:32 ` David Miller
2012-03-05 0:37 ` Guy, Wey-Yi
2012-03-05 19:59 ` John W. Linville
2012-03-04 19:28 ` [PATCH 002/101] iwlwifi: remove an unused argument Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 003/101] iwlwifi: reduce sta_lock hold time in TX Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 004/101] iwlwifi: simplify code in iwlagn_key_sta_id Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 005/101] iwlwifi: build some station commands directly Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 006/101] iwlwifi: introduce per-queue locks Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 007/101] iwlwifi: make sta lock private & BH lock Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 008/101] iwlwifi: introduce statistics lock Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 009/101] iwlwifi: remove shared lock Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 010/101] iwlwifi: make EXIT_PENDING depend on mac80211 Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 011/101] iwlwifi: simplify auth/assoc flow Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 012/101] iwlwifi: remove per-device debug level Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 013/101] iwlwifi: remove SKU from config Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 014/101] iwlwifi: use valid TX/RX antenna from hw_params Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 015/101] iwlwifi: make config const Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 016/101] iwlwifi: reduce IDI code ifdef Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 017/101] iwlwifi: clean up (wowlan) suspend flow Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 018/101] iwlwifi: move wowlan bool into priv Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 019/101] iwlwifi: use ieee80211_tx_status Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 020/101] iwlwifi: pass response packet directly Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 021/101] iwlwifi: don't pass iwl_rx_mem_buffer to upper layers Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 022/101] iwlwifi: refactor PCI-E RX path Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 023/101] iwlwifi: transport's tx_agg_alloc must not sleep Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 024/101] iwlwifi: move queue functions to PCI-E Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 025/101] iwlwifi: iwl_rx_cmd_buffer belongs to transport API Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 026/101] iwlwifi: move tid_to_ac to PCI-E Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 027/101] iwlwifi: move IWL_MASK into file using it Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 028/101] iwlwifi: move traffic log definitions Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 029/101] iwlwifi: fix station HT parameters Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 030/101] iwlwifi: move uCode deallocation to drv Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 031/101] iwlwifi: move iwl_base_params to shared header Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 032/101] iwlwifi: move firmware request into drv Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 033/101] iwlwifi: move firmware completion wait Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 034/101] iwlwifi: move ucode loading to op_mode Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 035/101] iwlwifi: split out firmware store Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 036/101] iwlwifi: remove iwl-wifi.h Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 037/101] iwlwifi: add wrappers for command sending Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 038/101] iwlwifi: move RF/CT kill check to command wrapper Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 039/101] iwlwifi: move lockdep assertion into DVM Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 040/101] iwlwifi: move mutex out of shared Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 041/101] iwlwifi: move rfkill status handling out of transport Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 042/101] iwlwifi: rename ucode.h to fw-file.h Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 043/101] iwlwifi: remove AMT check from transport Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 044/101] iwlwifi: remove shadow_reg_enable from hw_params Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 045/101] iwlwifi: move status check functions out of shared Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 046/101] iwlwifi: make tracing use device as identifier Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 047/101] iwlwifi: virtualize command queue full behaviour Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 048/101] iwlwifi: clean up iwl-core.h inclusions Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 049/101] iwlwifi: remove num_of_queues module parameter Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 050/101] iwlwifi: remove max_txq_num from hw_params Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 051/101] iwlwifi: keep plcp_delta_threshold in priv Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 052/101] iwlwifi: use watchdog timeout from hw_params Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 053/101] iwlwifi: put use_rts_for_aggregation into hw_params Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 054/101] iwlwifi: constify remaining config data Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 055/101] iwlwifi: fix notification wait bug Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 056/101] iwlwifi: abstract out notification wait support Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 057/101] iwlwifi: move ucode_owner to priv Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 058/101] iwlwifi: move all uCode load variables Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 059/101] iwlwifi: move irq to PCIe Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 060/101] iwlwifi: move packet to transport Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 061/101] iwlwifi: virtualize nic_config Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 062/101] iwlwifi: remove priv from shared Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 063/101] iwlwifi: remove PA type configuration Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 064/101] iwlwifi: don't include iwl-prph.h everywhere Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 065/101] iwlwifi: clean up iwl-commands.h Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 066/101] iwlwifi: make iwl_fill_probe_req static Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 067/101] iwlwifi: remove unused arguments from iwlagn_gain_computation Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 068/101] iwlwifi: remove unused argument from rs_initialize_lq Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 069/101] iwlwifi: move iwl_sta_id_or_broadcast to user Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 070/101] iwlwifi: remove unused argument from iwl_init_hw_rates Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 071/101] iwlwifi: remove two unused arguments in testmode Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 072/101] iwlwifi: remove unused argument from iwlagn_suspend Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 073/101] iwlwifi: redesign PASSIVE_NO_RX workaround Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 074/101] iwlwifi: transport's tx_agg_disable must be atomic Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 075/101] iwlwifi: remove BT handlers from lib_ops Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 076/101] iwlwifi: move BT/HT params to shared Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 077/101] iwlwifi: make EEPROM enhanced TX power a bool Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 078/101] iwlwifi: remove unused max_nrg_cck from sensitivity and constify Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 079/101] iwlwifi: return error if loading uCode failed Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 080/101] iwlwifi: dump stack when fail to gain access to the device Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 081/101] iwlwifi: always check if got h/w access before write Wey-Yi Guy
2012-03-04 19:29 ` Wey-Yi Guy [this message]
2012-03-04 19:29 ` [PATCH 083/101] iwlwifi: use writeb,writel,readl directly Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 084/101] iwlwifi: print DMA stop timeout error only if it happened Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 085/101] iwlwifi: reintroduce iwl_enable_rfkill_int Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 086/101] iwlwifi: add testmode command for rx forwarding Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 087/101] iwlwifi: fixed testmode notifications length Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 088/101] iwlwifi: add option to test MFP Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 089/101] iwlwifi: separate status to priv and trans Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 090/101] iwlwifi: make tx_cmd_pool kmem cache global Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 091/101] iwlwifi: log stop / wake queues Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 092/101] iwlwifi: configure transport layer from dvm op mode Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 093/101] iwlwifi: move setting up fw parameters Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 094/101] iwlwifi: more status bit factoring Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 095/101] iwlwifi: move command queue number out of the iwl_shared struct Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 096/101] iwlwifi: remove messages from queue wake/stop Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 097/101] iwlwifi: make iwl_init_context static Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 098/101] iwlwifi: restore PAN support Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 099/101] iwlwifi: don't delete AP station directly Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 100/101] iwlwifi: correct status bit refactoring errors Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 101/101] iwlwifi: always monitor for stuck queues Wey-Yi Guy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330889395-533-83-git-send-email-wey-yi.w.guy@intel.com \
--to=wey-yi.w.guy@intel.com \
--cc=johannes.berg@intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=sgruszka@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).