Skip to content

Commit

Permalink
NTB: Clear property bits in BAR value
Browse files Browse the repository at this point in the history
The lower bits read from a BAR register will contain property bits
that we do not care about. Clear those so that we can use the BAR
values for limit and xlat registers.

Reported-by: Conrad Meyer <[email protected]>
Signed-off-by: Dave Jiang <[email protected]>
Signed-off-by: Jon Mason <[email protected]>
  • Loading branch information
davejiang authored and jonmason committed Jan 11, 2016
1 parent 179f912 commit 703872c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/ntb/hw/intel/ntb_hw_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ static int intel_ntb_mw_set_trans(struct ntb_dev *ntb, int idx,
limit_reg = bar2_off(ndev->xlat_reg->bar2_limit, bar);

if (bar < 4 || !ndev->bar4_split) {
base = ioread64(mmio + base_reg);
base = ioread64(mmio + base_reg) & NTB_BAR_MASK_64;

/* Set the limit if supported, if size is not mw_size */
if (limit_reg && size != mw_size)
Expand Down Expand Up @@ -906,7 +906,7 @@ static int intel_ntb_mw_set_trans(struct ntb_dev *ntb, int idx,
if ((addr + size) & (~0ull << 32))
return -EINVAL;

base = ioread32(mmio + base_reg);
base = ioread32(mmio + base_reg) & NTB_BAR_MASK_32;

/* Set the limit if supported, if size is not mw_size */
if (limit_reg && size != mw_size)
Expand Down
3 changes: 3 additions & 0 deletions drivers/ntb/hw/intel/ntb_hw_intel.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@
#define NTB_UNSAFE_DB BIT_ULL(0)
#define NTB_UNSAFE_SPAD BIT_ULL(1)

#define NTB_BAR_MASK_64 ~(0xfull)
#define NTB_BAR_MASK_32 ~(0xfu)

struct intel_ntb_dev;

struct intel_ntb_reg {
Expand Down

0 comments on commit 703872c

Please sign in to comment.