aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2015-06-15 08:22:30 -0400
committerJon Mason <jdmason@kudzu.us>2015-07-04 14:09:30 -0400
commitfd839bf88485878ec602dbb3146fd44769eb3784 (patch)
treec19299e08d3b0d1ff0d4e69f99b53db0ef918d31
parent7eb387813db6730a5793cd53077b4039d948d17f (diff)
NTB: Change WARN_ON_ONCE to pr_warn_once on unsafe
The unsafe doorbell and scratchpad access should display reason when WARN is called. Otherwise we get a stack dump without any explanation. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
-rw-r--r--drivers/ntb/hw/intel/ntb_hw_intel.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c b/drivers/ntb/hw/intel/ntb_hw_intel.c
index 70924e5c0c72..ba4dc0d7e1f3 100644
--- a/drivers/ntb/hw/intel/ntb_hw_intel.c
+++ b/drivers/ntb/hw/intel/ntb_hw_intel.c
@@ -246,7 +246,8 @@ static inline int ndev_db_addr(struct intel_ntb_dev *ndev,
246 phys_addr_t *db_addr, resource_size_t *db_size, 246 phys_addr_t *db_addr, resource_size_t *db_size,
247 phys_addr_t reg_addr, unsigned long reg) 247 phys_addr_t reg_addr, unsigned long reg)
248{ 248{
249 WARN_ON_ONCE(ndev_is_unsafe(ndev, NTB_UNSAFE_DB)); 249 if (ndev_is_unsafe(ndev, NTB_UNSAFE_DB))
250 pr_warn_once("%s: NTB unsafe doorbell access", __func__);
250 251
251 if (db_addr) { 252 if (db_addr) {
252 *db_addr = reg_addr + reg; 253 *db_addr = reg_addr + reg;
@@ -264,7 +265,8 @@ static inline int ndev_db_addr(struct intel_ntb_dev *ndev,
264static inline u64 ndev_db_read(struct intel_ntb_dev *ndev, 265static inline u64 ndev_db_read(struct intel_ntb_dev *ndev,
265 void __iomem *mmio) 266 void __iomem *mmio)
266{ 267{
267 WARN_ON_ONCE(ndev_is_unsafe(ndev, NTB_UNSAFE_DB)); 268 if (ndev_is_unsafe(ndev, NTB_UNSAFE_DB))
269 pr_warn_once("%s: NTB unsafe doorbell access", __func__);
268 270
269 return ndev->reg->db_ioread(mmio); 271 return ndev->reg->db_ioread(mmio);
270} 272}
@@ -272,7 +274,8 @@ static inline u64 ndev_db_read(struct intel_ntb_dev *ndev,
272static inline int ndev_db_write(struct intel_ntb_dev *ndev, u64 db_bits, 274static inline int ndev_db_write(struct intel_ntb_dev *ndev, u64 db_bits,
273 void __iomem *mmio) 275 void __iomem *mmio)
274{ 276{
275 WARN_ON_ONCE(ndev_is_unsafe(ndev, NTB_UNSAFE_DB)); 277 if (ndev_is_unsafe(ndev, NTB_UNSAFE_DB))
278 pr_warn_once("%s: NTB unsafe doorbell access", __func__);
276 279
277 if (db_bits & ~ndev->db_valid_mask) 280 if (db_bits & ~ndev->db_valid_mask)
278 return -EINVAL; 281 return -EINVAL;
@@ -287,7 +290,8 @@ static inline int ndev_db_set_mask(struct intel_ntb_dev *ndev, u64 db_bits,
287{ 290{
288 unsigned long irqflags; 291 unsigned long irqflags;
289 292
290 WARN_ON_ONCE(ndev_is_unsafe(ndev, NTB_UNSAFE_DB)); 293 if (ndev_is_unsafe(ndev, NTB_UNSAFE_DB))
294 pr_warn_once("%s: NTB unsafe doorbell access", __func__);
291 295
292 if (db_bits & ~ndev->db_valid_mask) 296 if (db_bits & ~ndev->db_valid_mask)
293 return -EINVAL; 297 return -EINVAL;
@@ -307,7 +311,8 @@ static inline int ndev_db_clear_mask(struct intel_ntb_dev *ndev, u64 db_bits,
307{ 311{
308 unsigned long irqflags; 312 unsigned long irqflags;
309 313
310 WARN_ON_ONCE(ndev_is_unsafe(ndev, NTB_UNSAFE_DB)); 314 if (ndev_is_unsafe(ndev, NTB_UNSAFE_DB))
315 pr_warn_once("%s: NTB unsafe doorbell access", __func__);
311 316
312 if (db_bits & ~ndev->db_valid_mask) 317 if (db_bits & ~ndev->db_valid_mask)
313 return -EINVAL; 318 return -EINVAL;
@@ -336,7 +341,8 @@ static inline int ndev_spad_addr(struct intel_ntb_dev *ndev, int idx,
336 phys_addr_t *spad_addr, phys_addr_t reg_addr, 341 phys_addr_t *spad_addr, phys_addr_t reg_addr,
337 unsigned long reg) 342 unsigned long reg)
338{ 343{
339 WARN_ON_ONCE(ndev_is_unsafe(ndev, NTB_UNSAFE_SPAD)); 344 if (ndev_is_unsafe(ndev, NTB_UNSAFE_SPAD))
345 pr_warn_once("%s: NTB unsafe scratchpad access", __func__);
340 346
341 if (idx < 0 || idx >= ndev->spad_count) 347 if (idx < 0 || idx >= ndev->spad_count)
342 return -EINVAL; 348 return -EINVAL;
@@ -352,7 +358,8 @@ static inline int ndev_spad_addr(struct intel_ntb_dev *ndev, int idx,
352static inline u32 ndev_spad_read(struct intel_ntb_dev *ndev, int idx, 358static inline u32 ndev_spad_read(struct intel_ntb_dev *ndev, int idx,
353 void __iomem *mmio) 359 void __iomem *mmio)
354{ 360{
355 WARN_ON_ONCE(ndev_is_unsafe(ndev, NTB_UNSAFE_SPAD)); 361 if (ndev_is_unsafe(ndev, NTB_UNSAFE_SPAD))
362 pr_warn_once("%s: NTB unsafe scratchpad access", __func__);
356 363
357 if (idx < 0 || idx >= ndev->spad_count) 364 if (idx < 0 || idx >= ndev->spad_count)
358 return 0; 365 return 0;
@@ -363,7 +370,8 @@ static inline u32 ndev_spad_read(struct intel_ntb_dev *ndev, int idx,
363static inline int ndev_spad_write(struct intel_ntb_dev *ndev, int idx, u32 val, 370static inline int ndev_spad_write(struct intel_ntb_dev *ndev, int idx, u32 val,
364 void __iomem *mmio) 371 void __iomem *mmio)
365{ 372{
366 WARN_ON_ONCE(ndev_is_unsafe(ndev, NTB_UNSAFE_SPAD)); 373 if (ndev_is_unsafe(ndev, NTB_UNSAFE_SPAD))
374 pr_warn_once("%s: NTB unsafe scratchpad access", __func__);
367 375
368 if (idx < 0 || idx >= ndev->spad_count) 376 if (idx < 0 || idx >= ndev->spad_count)
369 return -EINVAL; 377 return -EINVAL;