Skip to contentSkip to conversation

nfit, nd_blk: BLK status register is only 32 bits

PATCH In review Ross Zwisler 2 participants 3 messages Aug 20, 2015 – Aug 24, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfit, nd_blk: BLK status register is only 32 bits

Only read 32 bits for the BLK status register in read_blk_stat().

The format and size of this register is defined in the "NVDIMM Driver Writer's guide":

http://pmem.io/documents/NVDIMM_Driver_Writers_Guide.pdf

---
 drivers/acpi/nfit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/nfit.c +2 -2
index 7c2638f..8689ee1 100644
@@ -1009,7 +1009,7 @@ static void wmb_blk(struct nfit_blk *nfit_blk)
 		wmb_pmem();
 }
 
-static u64 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw)
+static u32 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw)
 {
 	struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR];
 	u64 offset = nfit_blk->stat_offset + mmio->size * bw;
@@ -1017,7 +1017,7 @@ static u64 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw)
 	if (mmio->num_lines)
 		offset = to_interleave_offset(offset, mmio);
 
-	return readq(mmio->base + offset);
+	return readl(mmio->base + offset);
 }
 
 static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw,
Signature · 1 line
2.1.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Ross Zwisler

Only read 32 bits for the BLK status register in read_blk_stat().

The format and size of this register is defined in the "NVDIMM Driver Writer's guide":

http://pmem.io/documents/NVDIMM_Driver_Writers_Guide.pdf

Looks fine,

However, now that you've drawn attention to that code, I'll note that there is no checking of the pending or retry bits. In fact, ACPI_NFIT_CONTROL_BUFFERED isn't even checked upon loading the tables. Is this on a todo list somewhere?

Cheers,
Jeff

Quoted 26 lines
---
 drivers/acpi/nfit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/nfit.c +2 -2
index 7c2638f..8689ee1 100644
@@ -1009,7 +1009,7 @@ static void wmb_blk(struct nfit_blk *nfit_blk)
 		wmb_pmem();
 }
 
-static u64 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw)
+static u32 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw)
 {
 	struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR];
 	u64 offset = nfit_blk->stat_offset + mmio->size * bw;
@@ -1017,7 +1017,7 @@ static u64 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw)
 	if (mmio->num_lines)
 		offset = to_interleave_offset(offset, mmio);
 
-	return readq(mmio->base + offset);
+	return readl(mmio->base + offset);
 }
 
 static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw,
#2 lore raw
Quoted 12 lines · Jeff Moyer
Quoted 9 lines · Ross Zwisler

Only read 32 bits for the BLK status register in read_blk_stat().

The format and size of this register is defined in the "NVDIMM Driver Writer's guide":

http://pmem.io/documents/NVDIMM_Driver_Writers_Guide.pdf

Quoted 8 lines

Looks fine,

However, now that you've drawn attention to that code, I'll note that there is no checking of the pending or retry bits. In fact, ACPI_NFIT_CONTROL_BUFFERED isn't even checked upon loading the tables. Is this on a todo list somewhere?

Yep, you're right, we do need to add support for each of these. I'm planning on doing it unless someone else gets to it first.