aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Zwisler <ross.zwisler@linux.intel.com>2016-07-29 16:59:12 -0400
committerDan Williams <dan.j.williams@intel.com>2016-08-08 12:26:13 -0400
commit68202c9f0ad6e16ee806fbadbc5838d55fe5aa5c (patch)
tree8dee9e0c6fef5951f60e99228ba3d456d4806499
parent29b4817d4018df78086157ea3a55c1d9424a7cfc (diff)
libnvdimm, nd_blk: mask off reserved status bits
The "NVDIMM Block Window Driver Writer's Guide": http://pmem.io/documents/NVDIMM_DriverWritersGuide-July-2016.pdf ...defines the layout of the block window status register. For the July 2016 version of the spec linked to above, this happens in Figure 4 on page 26. The only bits defined in this spec are bits 31, 5, 4, 2, 1 and 0. The rest of the bits in the status register are reserved, and there is a warning following the diagram that says: Note: The driver cannot assume the value of the RESERVED bits in the status register are zero. These reserved bits need to be masked off, and the driver must avoid checking the state of those bits. This change ensures that for hardware implementations that set these reserved bits in the status register, the driver won't incorrectly fail the block I/Os. Cc: <stable@vger.kernel.org> #v4.2+ Reviewed-by: Lee, Chun-Yi <jlee@suse.com> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/acpi/nfit/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 8c234dd9b8bc..80cc7c089a15 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -1527,11 +1527,12 @@ static u32 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw)
1527{ 1527{
1528 struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR]; 1528 struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR];
1529 u64 offset = nfit_blk->stat_offset + mmio->size * bw; 1529 u64 offset = nfit_blk->stat_offset + mmio->size * bw;
1530 const u32 STATUS_MASK = 0x80000037;
1530 1531
1531 if (mmio->num_lines) 1532 if (mmio->num_lines)
1532 offset = to_interleave_offset(offset, mmio); 1533 offset = to_interleave_offset(offset, mmio);
1533 1534
1534 return readl(mmio->addr.base + offset); 1535 return readl(mmio->addr.base + offset) & STATUS_MASK;
1535} 1536}
1536 1537
1537static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw, 1538static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw,