Skip to content

Commit

Permalink
IB/ehca: Tolerate dynamic memory operations before driver load
Browse files Browse the repository at this point in the history
Implement toleration of dynamic memory operations and 16 GB gigantic
pages, where "toleration" means that the driver can cope with dynamic
memory operations that happen before the driver is loaded.  While the
ehca driver is loaded, dynamic memory operations are still prohibited
by returning NOTIFY_BAD from the memory notifier.

On module load the driver walks through available system memory,
checks for available memory ranges and then registers the kernel
internal memory region accordingly.  The translation of address ranges
is implemented via a 3-level busmap.

Signed-off-by: Hannes Hering <hering2@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Hannes Hering authored and Roland Dreier committed Jun 23, 2009
1 parent 65795ef commit 0cf89dc
Show file tree
Hide file tree
Showing 3 changed files with 522 additions and 17 deletions.
18 changes: 15 additions & 3 deletions drivers/infiniband/hw/ehca/ehca_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ static int ehca_init_device(struct ehca_shca *shca)
shca->ib_device.detach_mcast = ehca_detach_mcast;
shca->ib_device.process_mad = ehca_process_mad;
shca->ib_device.mmap = ehca_mmap;
shca->ib_device.dma_ops = &ehca_dma_mapping_ops;

if (EHCA_BMASK_GET(HCA_CAP_SRQ, shca->hca_cap)) {
shca->ib_device.uverbs_cmd_mask |=
Expand Down Expand Up @@ -1028,17 +1029,23 @@ static int __init ehca_module_init(void)
goto module_init1;
}

ret = ehca_create_busmap();
if (ret) {
ehca_gen_err("Cannot create busmap.");
goto module_init2;
}

ret = ibmebus_register_driver(&ehca_driver);
if (ret) {
ehca_gen_err("Cannot register eHCA device driver");
ret = -EINVAL;
goto module_init2;
goto module_init3;
}

ret = register_memory_notifier(&ehca_mem_nb);
if (ret) {
ehca_gen_err("Failed registering memory add/remove notifier");
goto module_init3;
goto module_init4;
}

if (ehca_poll_all_eqs != 1) {
Expand All @@ -1053,9 +1060,12 @@ static int __init ehca_module_init(void)

return 0;

module_init3:
module_init4:
ibmebus_unregister_driver(&ehca_driver);

module_init3:
ehca_destroy_busmap();

module_init2:
ehca_destroy_slab_caches();

Expand All @@ -1073,6 +1083,8 @@ static void __exit ehca_module_exit(void)

unregister_memory_notifier(&ehca_mem_nb);

ehca_destroy_busmap();

ehca_destroy_slab_caches();

ehca_destroy_comp_pool();
Expand Down
Loading

0 comments on commit 0cf89dc

Please sign in to comment.