* [PATCH] external modules: Fix pre-2.6.18 kernels
@ 2009-01-27 16:29 Jan Kiszka
2009-01-27 17:51 ` Marcelo Tosatti
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2009-01-27 16:29 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: Avi Kivity, kvm-devel
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@siemens.com>
---
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
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] external modules: Fix pre-2.6.18 kernels
2009-01-27 16:29 [PATCH] external modules: Fix pre-2.6.18 kernels Jan Kiszka
@ 2009-01-27 17:51 ` Marcelo Tosatti
2009-01-29 14:38 ` Sheng Yang
0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Tosatti @ 2009-01-27 17:51 UTC (permalink / raw)
To: Jan Kiszka, Yang, Sheng; +Cc: Avi Kivity, kvm-devel
On Tue, Jan 27, 2009 at 05:29:17PM +0100, Jan Kiszka wrote:
> 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@siemens.com>
> ---
>
> 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
I think this will break device assignment for if the device is not MSI
capable (if works at all in such older kernels).
Need some other way to check if the device is MSI enabled. Perhaps
PCI_MSI_FLAGS_ENABLE bit? Sheng?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] external modules: Fix pre-2.6.18 kernels
2009-01-27 17:51 ` Marcelo Tosatti
@ 2009-01-29 14:38 ` Sheng Yang
0 siblings, 0 replies; 3+ messages in thread
From: Sheng Yang @ 2009-01-29 14:38 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: Jan Kiszka, Yang, Sheng, Avi Kivity, kvm-devel
On Tue, Jan 27, 2009 at 03:51:08PM -0200, Marcelo Tosatti wrote:
> On Tue, Jan 27, 2009 at 05:29:17PM +0100, Jan Kiszka wrote:
> > 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@siemens.com>
> > ---
> >
> > 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
>
> I think this will break device assignment for if the device is not MSI
> capable (if works at all in such older kernels).
>
> Need some other way to check if the device is MSI enabled. Perhaps
> PCI_MSI_FLAGS_ENABLE bit? Sheng?
Yes. I checked 2.6.17's code, seems if we indeed need this, the only way
is converting it to a function which read from PCI configuration space
and check PCI_MSI_FLAGS_ENABLE bit... (Or we can simply disable it for the
old ones, but I think it's not desired).
--
regards
Yang, Sheng |Intel Opensource Technology Center
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-29 14:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-27 16:29 [PATCH] external modules: Fix pre-2.6.18 kernels Jan Kiszka
2009-01-27 17:51 ` Marcelo Tosatti
2009-01-29 14:38 ` Sheng Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox