Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i7300_idle: allow testing on i5000-series hardware w/o re-compile

Testing the i7300_idle driver on i5000-series hardware required
an edit to i7300_idle.h to "#define SUPPORT_I5000 1" and a re-build
of both i7300_idle and ioat_dma.

Replace that build-time scheme with a load-time module parameter:
"7300_idle.forceload=1" to make it easier to test the driver
on hardware that while not officially validated, works fine
and is much more commonly available.

By default (no modparam) the driver will continue to load
only on the i7300.

Note that ioat_dma runs a copy of i7300_idle's probe routine
to know to reserve an IOAT channel for i7300_idle.
This change makes ioat_dma do that always on the i5000,
just like it does on the i7300.

Signed-off-by: Len Brown <len.brown@intel.com>
Acked-by: Andrew Henroid <andrew.d.henroid@intel.com>

Len Brown 2f102607 cd86a536

+16 -12
+1 -1
drivers/dma/ioat_dma.c
··· 173 173 xfercap = (xfercap_scale == 0 ? -1 : (1UL << xfercap_scale)); 174 174 175 175 #ifdef CONFIG_I7300_IDLE_IOAT_CHANNEL 176 - if (i7300_idle_platform_probe(NULL, NULL) == 0) { 176 + if (i7300_idle_platform_probe(NULL, NULL, 1) == 0) { 177 177 device->common.chancnt--; 178 178 } 179 179 #endif
+5 -1
drivers/idle/i7300_idle.c
··· 41 41 module_param_named(debug, debug, uint, 0644); 42 42 MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); 43 43 44 + static int forceload; 45 + module_param_named(forceload, forceload, uint, 0644); 46 + MODULE_PARM_DESC(debug, "Enable driver testing on unvalidated i5000"); 47 + 44 48 #define dprintk(fmt, arg...) \ 45 49 do { if (debug) printk(KERN_INFO I7300_PRINT fmt, ##arg); } while (0) 46 50 ··· 556 552 cpus_clear(idle_cpumask); 557 553 total_us = 0; 558 554 559 - if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev)) 555 + if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev, forceload)) 560 556 return -ENODEV; 561 557 562 558 if (i7300_idle_thrt_save())
+10 -10
include/linux/i7300_idle.h
··· 16 16 struct fbd_ioat { 17 17 unsigned int vendor; 18 18 unsigned int ioat_dev; 19 + unsigned int enabled; 19 20 }; 20 21 21 22 /* 22 23 * The i5000 chip-set has the same hooks as the i7300 23 - * but support is disabled by default because this driver 24 - * has not been validated on that platform. 24 + * but it is not enabled by default and must be manually 25 + * manually enabled with "forceload=1" because it is 26 + * only lightly validated. 25 27 */ 26 - #define SUPPORT_I5000 0 27 28 28 29 static const struct fbd_ioat fbd_ioat_list[] = { 29 - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB}, 30 - #if SUPPORT_I5000 31 - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT}, 32 - #endif 30 + {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB, 1}, 31 + {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT, 0}, 33 32 {0, 0} 34 33 }; 35 34 36 35 /* table of devices that work with this driver */ 37 36 static const struct pci_device_id pci_tbl[] = { 38 37 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) }, 39 - #if SUPPORT_I5000 40 38 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) }, 41 - #endif 42 39 { } /* Terminating entry */ 43 40 }; 44 41 45 42 /* Check for known platforms with I/O-AT */ 46 43 static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev, 47 - struct pci_dev **ioat_dev) 44 + struct pci_dev **ioat_dev, 45 + int enable_all) 48 46 { 49 47 int i; 50 48 struct pci_dev *memdev, *dmadev; ··· 67 69 for (i = 0; fbd_ioat_list[i].vendor != 0; i++) { 68 70 if (dmadev->vendor == fbd_ioat_list[i].vendor && 69 71 dmadev->device == fbd_ioat_list[i].ioat_dev) { 72 + if (!(fbd_ioat_list[i].enabled || enable_all)) 73 + continue; 70 74 if (fbd_dev) 71 75 *fbd_dev = memdev; 72 76 if (ioat_dev)