[PATCH] external modules: Fix pre-2.6.18 kernels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pci_dev.msi_enabled was introduced in 2.6.18, thus building against
older kernels now fail. Fix via a compat wrapper.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---

 kernel/external-module-compat-comm.h |    7 +++++++
 kernel/x86/hack-module.awk           |    2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/kernel/external-module-compat-comm.h b/kernel/external-module-compat-comm.h
index 06af36d..937ba12 100644
--- a/kernel/external-module-compat-comm.h
+++ b/kernel/external-module-compat-comm.h
@@ -718,3 +718,10 @@ static inline void cpumask_clear_cpu(int cpu, cpumask_var_t mask)
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
 #define marker_synchronize_unregister() synchronize_sched()
 #endif
+
+/* pci_dev.msi_enable was introduced in 2.6.18 */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+#define kvm_pcidev_msi_enabled(dev)	1
+#else
+#define kvm_pcidev_msi_enabled(dev)	(dev)->msi_enabled
+#endif
diff --git a/kernel/x86/hack-module.awk b/kernel/x86/hack-module.awk
index cc50856..dbca4d6 100644
--- a/kernel/x86/hack-module.awk
+++ b/kernel/x86/hack-module.awk
@@ -29,6 +29,8 @@ BEGIN { split("INIT_WORK tsc_khz desc_struct ldttss_desc64 desc_ptr " \
     printf("MODULE_INFO(version, \"%s\");\n", version)
 }
 
+{ sub(/match->dev->msi_enabled/, "kvm_pcidev_msi_enabled(match->dev)") }
+
 /^static void __vmx_load_host_state/ {
     vmx_load_host_state = 1
 }
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux