Lines Matching refs:cxl_nvb
31 struct cxl_nvdimm_bridge *cxl_nvb = cxl_nvd->bridge; in unregister_nvdimm() local
35 device_lock(&cxl_nvb->dev); in unregister_nvdimm()
39 device_unlock(&cxl_nvb->dev); in unregister_nvdimm()
44 device_lock(&cxl_nvb->dev); in unregister_nvdimm()
46 device_unlock(&cxl_nvb->dev); in unregister_nvdimm()
58 struct cxl_nvdimm_bridge *cxl_nvb; in cxl_nvdimm_probe() local
62 cxl_nvb = cxl_find_nvdimm_bridge(dev); in cxl_nvdimm_probe()
63 if (!cxl_nvb) in cxl_nvdimm_probe()
66 device_lock(&cxl_nvb->dev); in cxl_nvdimm_probe()
67 if (!cxl_nvb->nvdimm_bus) { in cxl_nvdimm_probe()
81 nvdimm = nvdimm_create(cxl_nvb->nvdimm_bus, cxl_nvd, NULL, flags, in cxl_nvdimm_probe()
89 cxl_nvd->bridge = cxl_nvb; in cxl_nvdimm_probe()
92 device_unlock(&cxl_nvb->dev); in cxl_nvdimm_probe()
93 put_device(&cxl_nvb->dev); in cxl_nvdimm_probe()
219 static bool online_nvdimm_bus(struct cxl_nvdimm_bridge *cxl_nvb) in online_nvdimm_bus() argument
221 if (cxl_nvb->nvdimm_bus) in online_nvdimm_bus()
223 cxl_nvb->nvdimm_bus = in online_nvdimm_bus()
224 nvdimm_bus_register(&cxl_nvb->dev, &cxl_nvb->nd_desc); in online_nvdimm_bus()
225 return cxl_nvb->nvdimm_bus != NULL; in online_nvdimm_bus()
228 static int cxl_nvdimm_release_driver(struct device *dev, void *cxl_nvb) in cxl_nvdimm_release_driver() argument
236 if (cxl_nvd->bridge != cxl_nvb) in cxl_nvdimm_release_driver()
243 static int cxl_pmem_region_release_driver(struct device *dev, void *cxl_nvb) in cxl_pmem_region_release_driver() argument
251 if (cxlr_pmem->bridge != cxl_nvb) in cxl_pmem_region_release_driver()
258 static void offline_nvdimm_bus(struct cxl_nvdimm_bridge *cxl_nvb, in offline_nvdimm_bus() argument
269 bus_for_each_dev(&cxl_bus_type, NULL, cxl_nvb, in offline_nvdimm_bus()
271 bus_for_each_dev(&cxl_bus_type, NULL, cxl_nvb, in offline_nvdimm_bus()
278 struct cxl_nvdimm_bridge *cxl_nvb = in cxl_nvb_update_state() local
279 container_of(work, typeof(*cxl_nvb), state_work); in cxl_nvb_update_state()
283 device_lock(&cxl_nvb->dev); in cxl_nvb_update_state()
284 switch (cxl_nvb->state) { in cxl_nvb_update_state()
286 if (!online_nvdimm_bus(cxl_nvb)) { in cxl_nvb_update_state()
287 dev_err(&cxl_nvb->dev, in cxl_nvb_update_state()
295 victim_bus = cxl_nvb->nvdimm_bus; in cxl_nvb_update_state()
296 cxl_nvb->nvdimm_bus = NULL; in cxl_nvb_update_state()
301 device_unlock(&cxl_nvb->dev); in cxl_nvb_update_state()
304 device_release_driver(&cxl_nvb->dev); in cxl_nvb_update_state()
308 dev_dbg(&cxl_nvb->dev, "rescan: %d\n", rc); in cxl_nvb_update_state()
310 offline_nvdimm_bus(cxl_nvb, victim_bus); in cxl_nvb_update_state()
312 put_device(&cxl_nvb->dev); in cxl_nvb_update_state()
315 static void cxl_nvdimm_bridge_state_work(struct cxl_nvdimm_bridge *cxl_nvb) in cxl_nvdimm_bridge_state_work() argument
321 get_device(&cxl_nvb->dev); in cxl_nvdimm_bridge_state_work()
322 if (!queue_work(cxl_pmem_wq, &cxl_nvb->state_work)) in cxl_nvdimm_bridge_state_work()
323 put_device(&cxl_nvb->dev); in cxl_nvdimm_bridge_state_work()
328 struct cxl_nvdimm_bridge *cxl_nvb = to_cxl_nvdimm_bridge(dev); in cxl_nvdimm_bridge_remove() local
330 if (cxl_nvb->state == CXL_NVB_ONLINE) in cxl_nvdimm_bridge_remove()
331 cxl_nvb->state = CXL_NVB_OFFLINE; in cxl_nvdimm_bridge_remove()
332 cxl_nvdimm_bridge_state_work(cxl_nvb); in cxl_nvdimm_bridge_remove()
337 struct cxl_nvdimm_bridge *cxl_nvb = to_cxl_nvdimm_bridge(dev); in cxl_nvdimm_bridge_probe() local
339 if (cxl_nvb->state == CXL_NVB_DEAD) in cxl_nvdimm_bridge_probe()
342 if (cxl_nvb->state == CXL_NVB_NEW) { in cxl_nvdimm_bridge_probe()
343 cxl_nvb->nd_desc = (struct nvdimm_bus_descriptor) { in cxl_nvdimm_bridge_probe()
349 INIT_WORK(&cxl_nvb->state_work, cxl_nvb_update_state); in cxl_nvdimm_bridge_probe()
352 cxl_nvb->state = CXL_NVB_ONLINE; in cxl_nvdimm_bridge_probe()
353 cxl_nvdimm_bridge_state_work(cxl_nvb); in cxl_nvdimm_bridge_probe()
405 struct cxl_nvdimm_bridge *cxl_nvb = cxlr_pmem->bridge; in release_mappings() local
407 device_lock(&cxl_nvb->dev); in release_mappings()
414 device_unlock(&cxl_nvb->dev); in release_mappings()
433 struct cxl_nvdimm_bridge *cxl_nvb; in cxl_pmem_region_probe() local
441 cxl_nvb = cxl_find_nvdimm_bridge(&cxlr_pmem->mapping[0].cxlmd->dev); in cxl_pmem_region_probe()
442 if (!cxl_nvb) { in cxl_pmem_region_probe()
446 cxlr_pmem->bridge = cxl_nvb; in cxl_pmem_region_probe()
448 device_lock(&cxl_nvb->dev); in cxl_pmem_region_probe()
449 if (!cxl_nvb->nvdimm_bus) { in cxl_pmem_region_probe()
565 nvdimm_pmem_region_create(cxl_nvb->nvdimm_bus, &ndr_desc); in cxl_pmem_region_probe()
576 device_unlock(&cxl_nvb->dev); in cxl_pmem_region_probe()
577 put_device(&cxl_nvb->dev); in cxl_pmem_region_probe()
594 struct cxl_nvdimm_bridge *cxl_nvb; in cxl_nvdimm_bridge_reset() local
599 cxl_nvb = to_cxl_nvdimm_bridge(dev); in cxl_nvdimm_bridge_reset()
601 cxl_nvb->state = CXL_NVB_NEW; in cxl_nvdimm_bridge_reset()