Commit 59d3daafa17265f01149df8eab3fb69b9b42cb2e

Authored by Joerg Roedel
1 parent 6bf078715c

dma-debug: add kernel command line parameters

Impact: add dma_debug= and dma_debug_entries= kernel parameters

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>

Showing 2 changed files with 48 additions and 0 deletions Side-by-side Diff

Documentation/kernel-parameters.txt
... ... @@ -491,6 +491,16 @@
491 491 Range: 0 - 8192
492 492 Default: 64
493 493  
  494 + dma_debug=off If the kernel is compiled with DMA_API_DEBUG support
  495 + this option disables the debugging code at boot.
  496 +
  497 + dma_debug_entries=<number>
  498 + This option allows to tune the number of preallocated
  499 + entries for DMA-API debugging code. One entry is
  500 + required per DMA-API allocation. Use this if the
  501 + DMA-API debugging code disables itself because the
  502 + architectural default is too low.
  503 +
494 504 hpet= [X86-32,HPET] option to control HPET usage
495 505 Format: { enable (default) | disable | force }
496 506 disable: disable HPET and use PIT instead
... ... @@ -64,6 +64,9 @@
64 64 static u32 num_free_entries;
65 65 static u32 min_free_entries;
66 66  
  67 +/* number of preallocated entries requested by kernel cmdline */
  68 +static u32 req_entries;
  69 +
67 70 /*
68 71 * Hash related functions
69 72 *
... ... @@ -253,6 +256,9 @@
253 256 dma_entry_hash[i].lock = SPIN_LOCK_UNLOCKED;
254 257 }
255 258  
  259 + if (req_entries)
  260 + num_entries = req_entries;
  261 +
256 262 if (prealloc_memory(num_entries) != 0) {
257 263 printk(KERN_ERR "DMA-API: debugging out of memory error "
258 264 "- disabled\n");
... ... @@ -263,4 +269,36 @@
263 269  
264 270 printk(KERN_INFO "DMA-API: debugging enabled by kernel config\n");
265 271 }
  272 +
  273 +static __init int dma_debug_cmdline(char *str)
  274 +{
  275 + if (!str)
  276 + return -EINVAL;
  277 +
  278 + if (strncmp(str, "off", 3) == 0) {
  279 + printk(KERN_INFO "DMA-API: debugging disabled on kernel "
  280 + "command line\n");
  281 + global_disable = true;
  282 + }
  283 +
  284 + return 0;
  285 +}
  286 +
  287 +static __init int dma_debug_entries_cmdline(char *str)
  288 +{
  289 + int res;
  290 +
  291 + if (!str)
  292 + return -EINVAL;
  293 +
  294 + res = get_option(&str, &req_entries);
  295 +
  296 + if (!res)
  297 + req_entries = 0;
  298 +
  299 + return 0;
  300 +}
  301 +
  302 +__setup("dma_debug=", dma_debug_cmdline);
  303 +__setup("dma_debug_entries=", dma_debug_entries_cmdline);