Lines Matching refs:nvdimm

31 	struct nvdimm *nvdimm = to_nvdimm(dev);  in nvdimm_check_config_data()  local
33 if (!nvdimm->cmd_mask || in nvdimm_check_config_data()
34 !test_bit(ND_CMD_GET_CONFIG_DATA, &nvdimm->cmd_mask)) { in nvdimm_check_config_data()
35 if (test_bit(NDD_ALIASING, &nvdimm->flags)) in nvdimm_check_config_data()
178 struct nvdimm *nvdimm = to_nvdimm(dev); in nvdimm_set_aliasing() local
180 set_bit(NDD_ALIASING, &nvdimm->flags); in nvdimm_set_aliasing()
185 struct nvdimm *nvdimm = to_nvdimm(dev); in nvdimm_set_locked() local
187 set_bit(NDD_LOCKED, &nvdimm->flags); in nvdimm_set_locked()
192 struct nvdimm *nvdimm = to_nvdimm(dev); in nvdimm_clear_locked() local
194 clear_bit(NDD_LOCKED, &nvdimm->flags); in nvdimm_clear_locked()
199 struct nvdimm *nvdimm = to_nvdimm(dev); in nvdimm_release() local
201 ida_simple_remove(&dimm_ida, nvdimm->id); in nvdimm_release()
202 kfree(nvdimm); in nvdimm_release()
215 struct nvdimm *to_nvdimm(struct device *dev) in to_nvdimm()
217 struct nvdimm *nvdimm = container_of(dev, struct nvdimm, dev); in to_nvdimm() local
220 return nvdimm; in to_nvdimm()
224 struct nvdimm *nd_blk_region_to_dimm(struct nd_blk_region *ndbr) in nd_blk_region_to_dimm()
229 return nd_mapping->nvdimm; in nd_blk_region_to_dimm()
242 struct nvdimm *nvdimm = nd_mapping->nvdimm; in to_ndd() local
244 WARN_ON_ONCE(!is_nvdimm_bus_locked(&nvdimm->dev)); in to_ndd()
246 return dev_get_drvdata(&nvdimm->dev); in to_ndd()
278 const char *nvdimm_name(struct nvdimm *nvdimm) in nvdimm_name() argument
280 return dev_name(&nvdimm->dev); in nvdimm_name()
284 struct kobject *nvdimm_kobj(struct nvdimm *nvdimm) in nvdimm_kobj() argument
286 return &nvdimm->dev.kobj; in nvdimm_kobj()
290 unsigned long nvdimm_cmd_mask(struct nvdimm *nvdimm) in nvdimm_cmd_mask() argument
292 return nvdimm->cmd_mask; in nvdimm_cmd_mask()
296 void *nvdimm_provider_data(struct nvdimm *nvdimm) in nvdimm_provider_data() argument
298 if (nvdimm) in nvdimm_provider_data()
299 return nvdimm->provider_data; in nvdimm_provider_data()
307 struct nvdimm *nvdimm = to_nvdimm(dev); in commands_show() local
310 if (!nvdimm->cmd_mask) in commands_show()
313 for_each_set_bit(cmd, &nvdimm->cmd_mask, BITS_PER_LONG) in commands_show()
323 struct nvdimm *nvdimm = to_nvdimm(dev); in flags_show() local
326 test_bit(NDD_ALIASING, &nvdimm->flags) ? "alias " : "", in flags_show()
327 test_bit(NDD_LOCKED, &nvdimm->flags) ? "lock " : ""); in flags_show()
334 struct nvdimm *nvdimm = to_nvdimm(dev); in state_show() local
342 return sprintf(buf, "%s\n", atomic_read(&nvdimm->busy) in state_show()
373 struct nvdimm *nvdimm = to_nvdimm(dev); in security_show() local
375 if (test_bit(NVDIMM_SECURITY_DISABLED, &nvdimm->sec.flags)) in security_show()
377 if (test_bit(NVDIMM_SECURITY_UNLOCKED, &nvdimm->sec.flags)) in security_show()
379 if (test_bit(NVDIMM_SECURITY_LOCKED, &nvdimm->sec.flags)) in security_show()
381 if (test_bit(NVDIMM_SECURITY_OVERWRITE, &nvdimm->sec.flags)) in security_show()
389 struct nvdimm *nvdimm = to_nvdimm(dev); in frozen_show() local
392 &nvdimm->sec.flags)); in frozen_show()
431 struct nvdimm *nvdimm = to_nvdimm(dev); in nvdimm_visible() local
435 if (!nvdimm->sec.flags) in nvdimm_visible()
440 if (nvdimm->sec.ops->freeze || nvdimm->sec.ops->disable in nvdimm_visible()
441 || nvdimm->sec.ops->change_key in nvdimm_visible()
442 || nvdimm->sec.ops->erase in nvdimm_visible()
443 || nvdimm->sec.ops->overwrite) in nvdimm_visible()
448 if (nvdimm->sec.ops->freeze) in nvdimm_visible()
459 struct nvdimm *__nvdimm_create(struct nvdimm_bus *nvdimm_bus, in __nvdimm_create()
465 struct nvdimm *nvdimm = kzalloc(sizeof(*nvdimm), GFP_KERNEL); in __nvdimm_create() local
468 if (!nvdimm) in __nvdimm_create()
471 nvdimm->id = ida_simple_get(&dimm_ida, 0, 0, GFP_KERNEL); in __nvdimm_create()
472 if (nvdimm->id < 0) { in __nvdimm_create()
473 kfree(nvdimm); in __nvdimm_create()
477 nvdimm->dimm_id = dimm_id; in __nvdimm_create()
478 nvdimm->provider_data = provider_data; in __nvdimm_create()
481 nvdimm->flags = flags; in __nvdimm_create()
482 nvdimm->cmd_mask = cmd_mask; in __nvdimm_create()
483 nvdimm->num_flush = num_flush; in __nvdimm_create()
484 nvdimm->flush_wpq = flush_wpq; in __nvdimm_create()
485 atomic_set(&nvdimm->busy, 0); in __nvdimm_create()
486 dev = &nvdimm->dev; in __nvdimm_create()
487 dev_set_name(dev, "nmem%d", nvdimm->id); in __nvdimm_create()
490 dev->devt = MKDEV(nvdimm_major, nvdimm->id); in __nvdimm_create()
492 nvdimm->sec.ops = sec_ops; in __nvdimm_create()
493 nvdimm->sec.overwrite_tmo = 0; in __nvdimm_create()
494 INIT_DELAYED_WORK(&nvdimm->dwork, nvdimm_security_overwrite_query); in __nvdimm_create()
500 nvdimm->sec.flags = nvdimm_security_flags(nvdimm, NVDIMM_USER); in __nvdimm_create()
501 nvdimm->sec.ext_flags = nvdimm_security_flags(nvdimm, NVDIMM_MASTER); in __nvdimm_create()
504 return nvdimm; in __nvdimm_create()
510 struct nvdimm *nvdimm = data; in shutdown_security_notify() local
512 sysfs_put(nvdimm->sec.overwrite_state); in shutdown_security_notify()
517 struct nvdimm *nvdimm = to_nvdimm(dev); in nvdimm_security_setup_events() local
519 if (!nvdimm->sec.flags || !nvdimm->sec.ops in nvdimm_security_setup_events()
520 || !nvdimm->sec.ops->overwrite) in nvdimm_security_setup_events()
522 nvdimm->sec.overwrite_state = sysfs_get_dirent(dev->kobj.sd, "security"); in nvdimm_security_setup_events()
523 if (!nvdimm->sec.overwrite_state) in nvdimm_security_setup_events()
526 return devm_add_action_or_reset(dev, shutdown_security_notify, nvdimm); in nvdimm_security_setup_events()
530 int nvdimm_in_overwrite(struct nvdimm *nvdimm) in nvdimm_in_overwrite() argument
532 return test_bit(NDD_SECURITY_OVERWRITE, &nvdimm->flags); in nvdimm_in_overwrite()
536 int nvdimm_security_freeze(struct nvdimm *nvdimm) in nvdimm_security_freeze() argument
540 WARN_ON_ONCE(!is_nvdimm_bus_locked(&nvdimm->dev)); in nvdimm_security_freeze()
542 if (!nvdimm->sec.ops || !nvdimm->sec.ops->freeze) in nvdimm_security_freeze()
545 if (!nvdimm->sec.flags) in nvdimm_security_freeze()
548 if (test_bit(NDD_SECURITY_OVERWRITE, &nvdimm->flags)) { in nvdimm_security_freeze()
549 dev_warn(&nvdimm->dev, "Overwrite operation in progress.\n"); in nvdimm_security_freeze()
553 rc = nvdimm->sec.ops->freeze(nvdimm); in nvdimm_security_freeze()
554 nvdimm->sec.flags = nvdimm_security_flags(nvdimm, NVDIMM_USER); in nvdimm_security_freeze()
575 if (nd_mapping->nvdimm == info->nd_mapping->nvdimm) in alias_dpa_busy()
685 if (__reserve_free_pmem(&nd_region->dev, nd_mapping->nvdimm)) in nd_pmem_max_contiguous_dpa()