libnvdimm: fix phys_addr for nvdimm_clear_poison
PATCH 1/1 libnvdimm: fix phys_addr for nvdimm_clear_poison
nvdimm_clear_poison() expects a physical address, not an offset. Fix nsio_rw_bytes() to call nvdimm_clear_poison() with a physical address.
--- drivers/nvdimm/claim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvdimm/claim.c +2 -1
@@ -254,7 +254,8 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns, && (!ndns->claim || !is_nd_btt(ndns->claim))) {long cleared; - cleared =nvdimm_clear_poison (&ndns->dev, offset, size); + cleared =nvdimm_clear_poison (&ndns->dev, + nsio->res.start + offset, size);if (cleared < size) rc = -EIO ;if (cleared >0 && cleared /512 ) {
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Vishal Verma
maintainerQuoted 3 lines · Toshi Kani
nvdimm_clear_poison()expects a physical address, not an offset. Fixnsio_rw_bytes()to callnvdimm_clear_poison()with a physical address.
Good catch!
Quoted 14 lines
Signed-off-by Toshi Kani <[email protected]>Cc Dan Williams <[email protected]>Cc Dave Jiang <[email protected]>Cc Vishal Verma <[email protected]>--- drivers/nvdimm/claim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/nvdimm/claim.c +0
-0
drivers/nvdimm/claim.c static int nsio_rw_bytes(struct nd_namespace_common *ndns, · line 258
Quoted 6 lines
drivers/nvdimm/claim.c +2
-1@@ -254,7 +254,8 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns, && (!ndns->claim || !is_nd_btt(ndns->claim))) {long cleared; - cleared =nvdimm_clear_poison (&ndns->dev, offset, size); + cleared =nvdimm_clear_poison (&ndns->dev, + nsio->res.start + offset, size);
Should we be using nsio->res.start here or nsio->addr ?
drivers/nvdimm/claim.c static int nsio_rw_bytes(struct nd_namespace_common *ndns, · line 261
Quoted 3 lines
drivers/nvdimm/claim.c +0
-0if (cleared < size) rc = -EIO ;if (cleared >0 && cleared /512 ) {
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 25 lines · Vishal Verma
Quoted 3 lines · Toshi Kani
nvdimm_clear_poison()expects a physical address, not an offset. Fixnsio_rw_bytes()to callnvdimm_clear_poison()with a physical address.Good catch!
Quoted 18 lines
Signed-off-by Toshi Kani <[email protected]>Cc Dan Williams <[email protected]>Cc Dave Jiang <[email protected]>Cc Vishal Verma <[email protected]>---
drivers/nvdimm/claim.c | 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/nvdimm/claim.c +0
-0@@ -254,7 +254,8 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,&& (!ndns->claim || !is_nd_btt(ndns->claim))) {
long cleared;
Quoted 8 lines
Quoted 6 lines
drivers/nvdimm/claim.c +0
-1- cleared = nvdimm_clear_poison(&ndns->dev,offset, size);
drivers/nvdimm/claim.c +2
-0+ cleared = nvdimm_clear_poison(&ndns->dev, + nsio->res.start + offset,size);
Should we be using
nsio->res.starthere ornsio->addr?
nsio->addr is a virtual address. We need to pass the physical address of this range.
Thanks,
-Toshi
Quoted 4 lines
Quoted 4 lines
if (cleared < size)
rc =-EIO;
if (cleared > 0 && cleared / 512) {
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 2 lines · Toshimitsu
Quoted 1 line · Vishal Verma
On 04/25, Toshi Kani wrote:
[...]
Quoted 5 lines
Quoted 2 lines
Should we be using
nsio->res.starthere ornsio->addr?
nsio->addris a virtual address. We need to pass the physical address of this range.
I see - makes sense.
You can add
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 5 lines · Vishal Verma
Quoted 2 lines · Toshimitsu
Quoted 1 line · Vishal Verma
On 04/25, Toshi Kani wrote:
[...]
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Should we be using
nsio->res.starthere ornsio->addr?
nsio->addris a virtual address. We need to pass the physical address of this range.I see - makes sense.
You can addReviewed-by Vishal Verma <[email protected]>
Thanks, applied.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm