On 12/8/20 3:30 AM, Dan Williams wrote:
On Mon, Oct 5, 2020 at 6:01 PM Santosh Sivaraj
<santosh(a)fossix.org> wrote:
...
> +static int ndtest_blk_do_io(struct nd_blk_region *ndbr,
resource_size_t dpa,
> + void *iobuf, u64 len, int rw)
> +{
> + struct ndtest_dimm *dimm = ndbr->blk_provider_data;
> + struct ndtest_blk_mmio *mmio = dimm->mmio;
> + struct nd_region *nd_region = &ndbr->nd_region;
> + unsigned int lane;
> +
> + lane = nd_region_acquire_lane(nd_region);
> +
> + if (rw)
> + memcpy(mmio->base + dpa, iobuf, len);
> + else {
> + memcpy(iobuf, mmio->base + dpa, len);
> + arch_invalidate_pmem(mmio->base + dpa, len);
> + }
> +
> + nd_region_release_lane(nd_region, lane);
> +
> + return 0;
> +}
> +
> +static int ndtest_blk_region_enable(struct nvdimm_bus *nvdimm_bus,
> + struct device *dev)
> +{
> + struct nd_blk_region *ndbr = to_nd_blk_region(dev);
> + struct nvdimm *nvdimm;
> + struct ndtest_dimm *p;
> + struct ndtest_blk_mmio *mmio;
> +
> + nvdimm = nd_blk_region_to_dimm(ndbr);
> + p = nvdimm_provider_data(nvdimm);
> +
> + nd_blk_region_set_provider_data(ndbr, p);
> + p->region = to_nd_region(dev);
> +
> + mmio = devm_kzalloc(dev, sizeof(struct ndtest_blk_mmio), GFP_KERNEL);
> + if (!mmio)
> + return -ENOMEM;
> +
> + mmio->base = devm_nvdimm_memremap(dev, p->address, 12,
> + nd_blk_memremap_flags(ndbr));
> + if (!mmio->base) {
> + dev_err(dev, "%s failed to map blk dimm\n",
nvdimm_name(nvdimm));
> + return -ENOMEM;
> + }
> +
> + p->mmio = mmio;
> +
> + return 0;
> +}
Are there any ppc nvdimm that will use BLK mode? As far as I know
BLK-mode is only an abandoned mechanism in the ACPI specification, not
anything that has made it into a shipping implementation. I'd prefer
to not extend it if it's not necessary.
That is correct. There is no BLK mode/type usage in ppc64. But IIUC, we
also had difficulty in isolating the BLK test to ACPI systems. The test
code had dependencies and splitting that out was making it complex.
-aneesh