blob: ce75cc3f41fb21584ae34c11113999ae68761232 [file] [log] [blame]
Dan Williamse6dfb2d2015-04-25 03:56:17 -04001/*
2 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 */
13#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Dan Williams4d88a972015-05-31 14:41:48 -040014#include <linux/vmalloc.h>
Dan Williamse6dfb2d2015-04-25 03:56:17 -040015#include <linux/device.h>
Dan Williams62232e452015-06-08 14:27:06 -040016#include <linux/ndctl.h>
Dan Williamse6dfb2d2015-04-25 03:56:17 -040017#include <linux/slab.h>
18#include <linux/io.h>
19#include <linux/fs.h>
20#include <linux/mm.h>
21#include "nd-core.h"
Dan Williams0ba1c632015-05-30 12:35:36 -040022#include "label.h"
Dan Williams4d88a972015-05-31 14:41:48 -040023#include "nd.h"
Dan Williamse6dfb2d2015-04-25 03:56:17 -040024
25static DEFINE_IDA(dimm_ida);
26
Dan Williams4d88a972015-05-31 14:41:48 -040027/*
28 * Retrieve bus and dimm handle and return if this bus supports
29 * get_config_data commands
30 */
31static int __validate_dimm(struct nvdimm_drvdata *ndd)
32{
33 struct nvdimm *nvdimm;
34
35 if (!ndd)
36 return -EINVAL;
37
38 nvdimm = to_nvdimm(ndd->dev);
39
Dan Williamse3654ec2016-04-28 16:17:07 -070040 if (!nvdimm->cmd_mask)
Dan Williams4d88a972015-05-31 14:41:48 -040041 return -ENXIO;
Dan Williamse3654ec2016-04-28 16:17:07 -070042 if (!test_bit(ND_CMD_GET_CONFIG_DATA, &nvdimm->cmd_mask))
Dan Williams4d88a972015-05-31 14:41:48 -040043 return -ENXIO;
44
45 return 0;
46}
47
48static int validate_dimm(struct nvdimm_drvdata *ndd)
49{
50 int rc = __validate_dimm(ndd);
51
52 if (rc && ndd)
53 dev_dbg(ndd->dev, "%pf: %s error: %d\n",
54 __builtin_return_address(0), __func__, rc);
55 return rc;
56}
57
58/**
59 * nvdimm_init_nsarea - determine the geometry of a dimm's namespace area
60 * @nvdimm: dimm to initialize
61 */
62int nvdimm_init_nsarea(struct nvdimm_drvdata *ndd)
63{
64 struct nd_cmd_get_config_size *cmd = &ndd->nsarea;
65 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev);
66 struct nvdimm_bus_descriptor *nd_desc;
67 int rc = validate_dimm(ndd);
68
69 if (rc)
70 return rc;
71
72 if (cmd->config_size)
73 return 0; /* already valid */
74
75 memset(cmd, 0, sizeof(*cmd));
76 nd_desc = nvdimm_bus->nd_desc;
77 return nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev),
Dan Williamsaef25332016-02-12 17:01:11 -080078 ND_CMD_GET_CONFIG_SIZE, cmd, sizeof(*cmd), NULL);
Dan Williams4d88a972015-05-31 14:41:48 -040079}
80
81int nvdimm_init_config_data(struct nvdimm_drvdata *ndd)
82{
83 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev);
84 struct nd_cmd_get_config_data_hdr *cmd;
85 struct nvdimm_bus_descriptor *nd_desc;
86 int rc = validate_dimm(ndd);
87 u32 max_cmd_size, config_size;
88 size_t offset;
89
90 if (rc)
91 return rc;
92
93 if (ndd->data)
94 return 0;
95
Dan Williams4a826c82015-06-09 16:09:36 -040096 if (ndd->nsarea.status || ndd->nsarea.max_xfer == 0
97 || ndd->nsarea.config_size < ND_LABEL_MIN_SIZE) {
98 dev_dbg(ndd->dev, "failed to init config data area: (%d:%d)\n",
99 ndd->nsarea.max_xfer, ndd->nsarea.config_size);
Dan Williams4d88a972015-05-31 14:41:48 -0400100 return -ENXIO;
Dan Williams4a826c82015-06-09 16:09:36 -0400101 }
Dan Williams4d88a972015-05-31 14:41:48 -0400102
103 ndd->data = kmalloc(ndd->nsarea.config_size, GFP_KERNEL);
104 if (!ndd->data)
105 ndd->data = vmalloc(ndd->nsarea.config_size);
106
107 if (!ndd->data)
108 return -ENOMEM;
109
110 max_cmd_size = min_t(u32, PAGE_SIZE, ndd->nsarea.max_xfer);
111 cmd = kzalloc(max_cmd_size + sizeof(*cmd), GFP_KERNEL);
112 if (!cmd)
113 return -ENOMEM;
114
115 nd_desc = nvdimm_bus->nd_desc;
116 for (config_size = ndd->nsarea.config_size, offset = 0;
117 config_size; config_size -= cmd->in_length,
118 offset += cmd->in_length) {
119 cmd->in_length = min(config_size, max_cmd_size);
120 cmd->in_offset = offset;
121 rc = nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev),
122 ND_CMD_GET_CONFIG_DATA, cmd,
Dan Williamsaef25332016-02-12 17:01:11 -0800123 cmd->in_length + sizeof(*cmd), NULL);
Dan Williams4d88a972015-05-31 14:41:48 -0400124 if (rc || cmd->status) {
125 rc = -ENXIO;
126 break;
127 }
128 memcpy(ndd->data + offset, cmd->out_buf, cmd->in_length);
129 }
130 dev_dbg(ndd->dev, "%s: len: %zu rc: %d\n", __func__, offset, rc);
131 kfree(cmd);
132
133 return rc;
134}
135
Dan Williamsf524bf22015-05-30 12:36:02 -0400136int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset,
137 void *buf, size_t len)
138{
139 int rc = validate_dimm(ndd);
140 size_t max_cmd_size, buf_offset;
141 struct nd_cmd_set_config_hdr *cmd;
142 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev);
143 struct nvdimm_bus_descriptor *nd_desc = nvdimm_bus->nd_desc;
144
145 if (rc)
146 return rc;
147
148 if (!ndd->data)
149 return -ENXIO;
150
151 if (offset + len > ndd->nsarea.config_size)
152 return -ENXIO;
153
154 max_cmd_size = min_t(u32, PAGE_SIZE, len);
155 max_cmd_size = min_t(u32, max_cmd_size, ndd->nsarea.max_xfer);
156 cmd = kzalloc(max_cmd_size + sizeof(*cmd) + sizeof(u32), GFP_KERNEL);
157 if (!cmd)
158 return -ENOMEM;
159
160 for (buf_offset = 0; len; len -= cmd->in_length,
161 buf_offset += cmd->in_length) {
162 size_t cmd_size;
163 u32 *status;
164
165 cmd->in_offset = offset + buf_offset;
166 cmd->in_length = min(max_cmd_size, len);
167 memcpy(cmd->in_buf, buf + buf_offset, cmd->in_length);
168
169 /* status is output in the last 4-bytes of the command buffer */
170 cmd_size = sizeof(*cmd) + cmd->in_length + sizeof(u32);
171 status = ((void *) cmd) + cmd_size - sizeof(u32);
172
173 rc = nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev),
Dan Williamsaef25332016-02-12 17:01:11 -0800174 ND_CMD_SET_CONFIG_DATA, cmd, cmd_size, NULL);
Dan Williamsf524bf22015-05-30 12:36:02 -0400175 if (rc || *status) {
176 rc = rc ? rc : -ENXIO;
177 break;
178 }
179 }
180 kfree(cmd);
181
182 return rc;
183}
184
Dan Williamse6dfb2d2015-04-25 03:56:17 -0400185static void nvdimm_release(struct device *dev)
186{
187 struct nvdimm *nvdimm = to_nvdimm(dev);
188
189 ida_simple_remove(&dimm_ida, nvdimm->id);
190 kfree(nvdimm);
191}
192
193static struct device_type nvdimm_device_type = {
194 .name = "nvdimm",
195 .release = nvdimm_release,
196};
197
Dan Williams62232e452015-06-08 14:27:06 -0400198bool is_nvdimm(struct device *dev)
Dan Williamse6dfb2d2015-04-25 03:56:17 -0400199{
200 return dev->type == &nvdimm_device_type;
201}
202
203struct nvdimm *to_nvdimm(struct device *dev)
204{
205 struct nvdimm *nvdimm = container_of(dev, struct nvdimm, dev);
206
207 WARN_ON(!is_nvdimm(dev));
208 return nvdimm;
209}
210EXPORT_SYMBOL_GPL(to_nvdimm);
211
Ross Zwisler047fc8a2015-06-25 04:21:02 -0400212struct nvdimm *nd_blk_region_to_dimm(struct nd_blk_region *ndbr)
213{
214 struct nd_region *nd_region = &ndbr->nd_region;
215 struct nd_mapping *nd_mapping = &nd_region->mapping[0];
216
217 return nd_mapping->nvdimm;
218}
219EXPORT_SYMBOL_GPL(nd_blk_region_to_dimm);
220
Dan Williamsbf9bccc2015-06-17 17:14:46 -0400221struct nvdimm_drvdata *to_ndd(struct nd_mapping *nd_mapping)
222{
223 struct nvdimm *nvdimm = nd_mapping->nvdimm;
224
225 WARN_ON_ONCE(!is_nvdimm_bus_locked(&nvdimm->dev));
226
227 return dev_get_drvdata(&nvdimm->dev);
228}
229EXPORT_SYMBOL(to_ndd);
230
231void nvdimm_drvdata_release(struct kref *kref)
232{
233 struct nvdimm_drvdata *ndd = container_of(kref, typeof(*ndd), kref);
234 struct device *dev = ndd->dev;
235 struct resource *res, *_r;
236
237 dev_dbg(dev, "%s\n", __func__);
238
239 nvdimm_bus_lock(dev);
240 for_each_dpa_resource_safe(ndd, res, _r)
241 nvdimm_free_dpa(ndd, res);
242 nvdimm_bus_unlock(dev);
243
yalin wanga06a7572015-08-27 19:35:48 -0400244 kvfree(ndd->data);
Dan Williamsbf9bccc2015-06-17 17:14:46 -0400245 kfree(ndd);
246 put_device(dev);
247}
248
249void get_ndd(struct nvdimm_drvdata *ndd)
250{
251 kref_get(&ndd->kref);
252}
253
254void put_ndd(struct nvdimm_drvdata *ndd)
255{
256 if (ndd)
257 kref_put(&ndd->kref, nvdimm_drvdata_release);
258}
259
Dan Williamse6dfb2d2015-04-25 03:56:17 -0400260const char *nvdimm_name(struct nvdimm *nvdimm)
261{
262 return dev_name(&nvdimm->dev);
263}
264EXPORT_SYMBOL_GPL(nvdimm_name);
265
Dan Williamsba9c8dd2016-08-22 19:28:37 -0700266struct kobject *nvdimm_kobj(struct nvdimm *nvdimm)
267{
268 return &nvdimm->dev.kobj;
269}
270EXPORT_SYMBOL_GPL(nvdimm_kobj);
271
Dan Williamse3654ec2016-04-28 16:17:07 -0700272unsigned long nvdimm_cmd_mask(struct nvdimm *nvdimm)
273{
274 return nvdimm->cmd_mask;
275}
276EXPORT_SYMBOL_GPL(nvdimm_cmd_mask);
277
Dan Williamse6dfb2d2015-04-25 03:56:17 -0400278void *nvdimm_provider_data(struct nvdimm *nvdimm)
279{
Dan Williams62232e452015-06-08 14:27:06 -0400280 if (nvdimm)
281 return nvdimm->provider_data;
282 return NULL;
Dan Williamse6dfb2d2015-04-25 03:56:17 -0400283}
284EXPORT_SYMBOL_GPL(nvdimm_provider_data);
285
Dan Williams62232e452015-06-08 14:27:06 -0400286static ssize_t commands_show(struct device *dev,
287 struct device_attribute *attr, char *buf)
288{
289 struct nvdimm *nvdimm = to_nvdimm(dev);
290 int cmd, len = 0;
291
Dan Williamse3654ec2016-04-28 16:17:07 -0700292 if (!nvdimm->cmd_mask)
Dan Williams62232e452015-06-08 14:27:06 -0400293 return sprintf(buf, "\n");
294
Dan Williamse3654ec2016-04-28 16:17:07 -0700295 for_each_set_bit(cmd, &nvdimm->cmd_mask, BITS_PER_LONG)
Dan Williams62232e452015-06-08 14:27:06 -0400296 len += sprintf(buf + len, "%s ", nvdimm_cmd_name(cmd));
297 len += sprintf(buf + len, "\n");
298 return len;
299}
300static DEVICE_ATTR_RO(commands);
301
Dan Williamseaf96152015-05-01 13:11:27 -0400302static ssize_t state_show(struct device *dev, struct device_attribute *attr,
303 char *buf)
304{
305 struct nvdimm *nvdimm = to_nvdimm(dev);
306
307 /*
308 * The state may be in the process of changing, userspace should
309 * quiesce probing if it wants a static answer
310 */
311 nvdimm_bus_lock(dev);
312 nvdimm_bus_unlock(dev);
313 return sprintf(buf, "%s\n", atomic_read(&nvdimm->busy)
314 ? "active" : "idle");
315}
316static DEVICE_ATTR_RO(state);
317
Dan Williams0ba1c632015-05-30 12:35:36 -0400318static ssize_t available_slots_show(struct device *dev,
319 struct device_attribute *attr, char *buf)
320{
321 struct nvdimm_drvdata *ndd = dev_get_drvdata(dev);
322 ssize_t rc;
323 u32 nfree;
324
325 if (!ndd)
326 return -ENXIO;
327
328 nvdimm_bus_lock(dev);
329 nfree = nd_label_nfree(ndd);
330 if (nfree - 1 > nfree) {
331 dev_WARN_ONCE(dev, 1, "we ate our last label?\n");
332 nfree = 0;
333 } else
334 nfree--;
335 rc = sprintf(buf, "%d\n", nfree);
336 nvdimm_bus_unlock(dev);
337 return rc;
338}
339static DEVICE_ATTR_RO(available_slots);
340
Dan Williams62232e452015-06-08 14:27:06 -0400341static struct attribute *nvdimm_attributes[] = {
Dan Williamseaf96152015-05-01 13:11:27 -0400342 &dev_attr_state.attr,
Dan Williams62232e452015-06-08 14:27:06 -0400343 &dev_attr_commands.attr,
Dan Williams0ba1c632015-05-30 12:35:36 -0400344 &dev_attr_available_slots.attr,
Dan Williams62232e452015-06-08 14:27:06 -0400345 NULL,
346};
347
348struct attribute_group nvdimm_attribute_group = {
349 .attrs = nvdimm_attributes,
350};
351EXPORT_SYMBOL_GPL(nvdimm_attribute_group);
352
Dan Williamse6dfb2d2015-04-25 03:56:17 -0400353struct nvdimm *nvdimm_create(struct nvdimm_bus *nvdimm_bus, void *provider_data,
Dan Williams62232e452015-06-08 14:27:06 -0400354 const struct attribute_group **groups, unsigned long flags,
Dan Williamse5ae3b22016-06-07 17:00:04 -0700355 unsigned long cmd_mask, int num_flush,
356 struct resource *flush_wpq)
Dan Williamse6dfb2d2015-04-25 03:56:17 -0400357{
358 struct nvdimm *nvdimm = kzalloc(sizeof(*nvdimm), GFP_KERNEL);
359 struct device *dev;
360
361 if (!nvdimm)
362 return NULL;
363
364 nvdimm->id = ida_simple_get(&dimm_ida, 0, 0, GFP_KERNEL);
365 if (nvdimm->id < 0) {
366 kfree(nvdimm);
367 return NULL;
368 }
369 nvdimm->provider_data = provider_data;
370 nvdimm->flags = flags;
Dan Williamse3654ec2016-04-28 16:17:07 -0700371 nvdimm->cmd_mask = cmd_mask;
Dan Williamse5ae3b22016-06-07 17:00:04 -0700372 nvdimm->num_flush = num_flush;
373 nvdimm->flush_wpq = flush_wpq;
Dan Williamseaf96152015-05-01 13:11:27 -0400374 atomic_set(&nvdimm->busy, 0);
Dan Williamse6dfb2d2015-04-25 03:56:17 -0400375 dev = &nvdimm->dev;
376 dev_set_name(dev, "nmem%d", nvdimm->id);
377 dev->parent = &nvdimm_bus->dev;
378 dev->type = &nvdimm_device_type;
Dan Williams62232e452015-06-08 14:27:06 -0400379 dev->devt = MKDEV(nvdimm_major, nvdimm->id);
Dan Williamse6dfb2d2015-04-25 03:56:17 -0400380 dev->groups = groups;
Dan Williams4d88a972015-05-31 14:41:48 -0400381 nd_device_register(dev);
Dan Williamse6dfb2d2015-04-25 03:56:17 -0400382
383 return nvdimm;
384}
385EXPORT_SYMBOL_GPL(nvdimm_create);
Dan Williams4d88a972015-05-31 14:41:48 -0400386
Dan Williamsbf9bccc2015-06-17 17:14:46 -0400387/**
Dan Williams1b40e092015-05-01 13:34:01 -0400388 * nd_blk_available_dpa - account the unused dpa of BLK region
389 * @nd_mapping: container of dpa-resource-root + labels
390 *
391 * Unlike PMEM, BLK namespaces can occupy discontiguous DPA ranges.
392 */
393resource_size_t nd_blk_available_dpa(struct nd_mapping *nd_mapping)
394{
395 struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
396 resource_size_t map_end, busy = 0, available;
397 struct resource *res;
398
399 if (!ndd)
400 return 0;
401
402 map_end = nd_mapping->start + nd_mapping->size - 1;
403 for_each_dpa_resource(ndd, res)
404 if (res->start >= nd_mapping->start && res->start < map_end) {
405 resource_size_t end = min(map_end, res->end);
406
407 busy += end - res->start + 1;
408 } else if (res->end >= nd_mapping->start
409 && res->end <= map_end) {
410 busy += res->end - nd_mapping->start;
411 } else if (nd_mapping->start > res->start
412 && nd_mapping->start < res->end) {
413 /* total eclipse of the BLK region mapping */
414 busy += nd_mapping->size;
415 }
416
417 available = map_end - nd_mapping->start + 1;
418 if (busy < available)
419 return available - busy;
420 return 0;
421}
422
423/**
Dan Williamsbf9bccc2015-06-17 17:14:46 -0400424 * nd_pmem_available_dpa - for the given dimm+region account unallocated dpa
425 * @nd_mapping: container of dpa-resource-root + labels
426 * @nd_region: constrain available space check to this reference region
427 * @overlap: calculate available space assuming this level of overlap
428 *
429 * Validate that a PMEM label, if present, aligns with the start of an
430 * interleave set and truncate the available size at the lowest BLK
431 * overlap point.
432 *
433 * The expectation is that this routine is called multiple times as it
434 * probes for the largest BLK encroachment for any single member DIMM of
435 * the interleave set. Once that value is determined the PMEM-limit for
436 * the set can be established.
437 */
438resource_size_t nd_pmem_available_dpa(struct nd_region *nd_region,
439 struct nd_mapping *nd_mapping, resource_size_t *overlap)
440{
441 resource_size_t map_start, map_end, busy = 0, available, blk_start;
442 struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
443 struct resource *res;
444 const char *reason;
445
446 if (!ndd)
447 return 0;
448
449 map_start = nd_mapping->start;
450 map_end = map_start + nd_mapping->size - 1;
451 blk_start = max(map_start, map_end + 1 - *overlap);
452 for_each_dpa_resource(ndd, res)
453 if (res->start >= map_start && res->start < map_end) {
454 if (strncmp(res->name, "blk", 3) == 0)
455 blk_start = min(blk_start, res->start);
456 else if (res->start != map_start) {
457 reason = "misaligned to iset";
458 goto err;
459 } else {
460 if (busy) {
461 reason = "duplicate overlapping PMEM reservations?";
462 goto err;
463 }
464 busy += resource_size(res);
465 continue;
466 }
467 } else if (res->end >= map_start && res->end <= map_end) {
468 if (strncmp(res->name, "blk", 3) == 0) {
469 /*
470 * If a BLK allocation overlaps the start of
471 * PMEM the entire interleave set may now only
472 * be used for BLK.
473 */
474 blk_start = map_start;
475 } else {
476 reason = "misaligned to iset";
477 goto err;
478 }
479 } else if (map_start > res->start && map_start < res->end) {
480 /* total eclipse of the mapping */
481 busy += nd_mapping->size;
482 blk_start = map_start;
483 }
484
485 *overlap = map_end + 1 - blk_start;
486 available = blk_start - map_start;
487 if (busy < available)
488 return available - busy;
489 return 0;
490
491 err:
492 /*
493 * Something is wrong, PMEM must align with the start of the
494 * interleave set, and there can only be one allocation per set.
495 */
496 nd_dbg_dpa(nd_region, ndd, res, "%s\n", reason);
497 return 0;
498}
499
Dan Williams4a826c82015-06-09 16:09:36 -0400500void nvdimm_free_dpa(struct nvdimm_drvdata *ndd, struct resource *res)
501{
502 WARN_ON_ONCE(!is_nvdimm_bus_locked(ndd->dev));
503 kfree(res->name);
504 __release_region(&ndd->dpa, res->start, resource_size(res));
505}
506
507struct resource *nvdimm_allocate_dpa(struct nvdimm_drvdata *ndd,
508 struct nd_label_id *label_id, resource_size_t start,
509 resource_size_t n)
510{
511 char *name = kmemdup(label_id, sizeof(*label_id), GFP_KERNEL);
512 struct resource *res;
513
514 if (!name)
515 return NULL;
516
517 WARN_ON_ONCE(!is_nvdimm_bus_locked(ndd->dev));
518 res = __request_region(&ndd->dpa, start, n, name, 0);
519 if (!res)
520 kfree(name);
521 return res;
522}
523
Dan Williamsbf9bccc2015-06-17 17:14:46 -0400524/**
525 * nvdimm_allocated_dpa - sum up the dpa currently allocated to this label_id
526 * @nvdimm: container of dpa-resource-root + labels
527 * @label_id: dpa resource name of the form {pmem|blk}-<human readable uuid>
528 */
529resource_size_t nvdimm_allocated_dpa(struct nvdimm_drvdata *ndd,
530 struct nd_label_id *label_id)
531{
532 resource_size_t allocated = 0;
533 struct resource *res;
534
535 for_each_dpa_resource(ndd, res)
536 if (strcmp(res->name, label_id->id) == 0)
537 allocated += resource_size(res);
538
539 return allocated;
540}
541
Dan Williams4d88a972015-05-31 14:41:48 -0400542static int count_dimms(struct device *dev, void *c)
543{
544 int *count = c;
545
546 if (is_nvdimm(dev))
547 (*count)++;
548 return 0;
549}
550
551int nvdimm_bus_check_dimm_count(struct nvdimm_bus *nvdimm_bus, int dimm_count)
552{
553 int count = 0;
554 /* Flush any possible dimm registration failures */
555 nd_synchronize();
556
557 device_for_each_child(&nvdimm_bus->dev, &count, count_dimms);
558 dev_dbg(&nvdimm_bus->dev, "%s: count: %d\n", __func__, count);
559 if (count != dimm_count)
560 return -ENXIO;
561 return 0;
562}
563EXPORT_SYMBOL_GPL(nvdimm_bus_check_dimm_count);
Dan Williamsb354aba2016-05-17 20:24:16 -0700564
565void __exit nvdimm_devs_exit(void)
566{
567 ida_destroy(&dimm_ida);
568}