kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kvm-86 fails to compile with "'IOMMU_CACHE' undeclared"
@ 2009-05-20 17:48 René Pfeiffer
  2009-05-20 20:30 ` Nikola Ciprich
  0 siblings, 1 reply; 7+ messages in thread
From: René Pfeiffer @ 2009-05-20 17:48 UTC (permalink / raw)
  To: KVM list

[-- Attachment #1: Type: text/plain, Size: 1704 bytes --]

Hello!

I just tried to compile kvm-86 on two test machines and I get the
following error:

[...]
  CC [M]  /usr/src/build/kvm-86/kvm/kernel/x86/iommu.o
/usr/src/build/kvm-86/kvm/kernel/x86/iommu.c: In function ‘kvm_iommu_map_pages’:
/usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:90: error: ‘IOMMU_CACHE’ undeclared (first use in this function)
/usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:90: error: (Each undeclared identifier is reported only once
/usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:90: error: for each function it appears in.)
/usr/src/build/kvm-86/kvm/kernel/x86/iommu.c: In function ‘kvm_assign_device’:
/usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:155: error: implicit declaration of function ‘iommu_domain_has_cap’
/usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:156: error: ‘IOMMU_CAP_CACHE_COHERENCY’ undeclared (first use in this function)
make[4]: *** [/usr/src/build/kvm-86/kvm/kernel/x86/iommu.o] Error 1
make[3]: *** [/usr/src/build/kvm-86/kvm/kernel/x86] Error 2
make[2]: *** [_module_/usr/src/build/kvm-86/kvm/kernel] Error 2
make[1]: *** [all] Error 2
make: *** [kvm-kmod] Error 2

Both machines run Debian Lenny with a custom kernel (2.6.29.1 and
2.6.29.3). One machine is Intel-based (Core2Duo), one is AMD-based. Both
compiled earlier versions of kvm just fine. configure was run without
options.

Best,
René.

-- 
  )\._.,--....,'``.  fL  Let GNU/Linux work for you while you take a nap.
 /,   _.. \   _\  (`._ ,. R. Pfeiffer <lynx at luchs.at> + http://web.luchs.at/
`._.-(,_..'--(,_..'`-.;.'  - System administration + Consulting + Teaching -
Got mail delivery problems?  http://web.luchs.at/information/blockedmail.php

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kvm-86 fails to compile with "'IOMMU_CACHE' undeclared"
  2009-05-20 17:48 kvm-86 fails to compile with "'IOMMU_CACHE' undeclared" René Pfeiffer
@ 2009-05-20 20:30 ` Nikola Ciprich
  2009-05-20 20:45   ` Nikola Ciprich
  2009-05-22  7:51   ` kvm-86 fails to compile with "'IOMMU_CACHE' undeclared" René Pfeiffer
  0 siblings, 2 replies; 7+ messages in thread
From: Nikola Ciprich @ 2009-05-20 20:30 UTC (permalink / raw)
  To: René Pfeiffer; +Cc: KVM list, nikola.ciprich

Hi Rene,
as a workaround, You can disable 
	AMD IOMMU support (AMD_IOMMU) and 
	Support for DMA Remapping Devices (EXPERIMENTAL) (DMAR)
in Your host kernel.
I'll post patch to disable KVM IOMMU support for kernels <2.6.30 soon.
BR
nik

On Wed, May 20, 2009 at 07:48:59PM +0200, René Pfeiffer wrote:
> Hello!
> 
> I just tried to compile kvm-86 on two test machines and I get the
> following error:
> 
> [...]
>   CC [M]  /usr/src/build/kvm-86/kvm/kernel/x86/iommu.o
> /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c: In function ‘kvm_iommu_map_pages’:
> /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:90: error: ‘IOMMU_CACHE’ undeclared (first use in this function)
> /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:90: error: (Each undeclared identifier is reported only once
> /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:90: error: for each function it appears in.)
> /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c: In function ‘kvm_assign_device’:
> /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:155: error: implicit declaration of function ‘iommu_domain_has_cap’
> /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:156: error: ‘IOMMU_CAP_CACHE_COHERENCY’ undeclared (first use in this function)
> make[4]: *** [/usr/src/build/kvm-86/kvm/kernel/x86/iommu.o] Error 1
> make[3]: *** [/usr/src/build/kvm-86/kvm/kernel/x86] Error 2
> make[2]: *** [_module_/usr/src/build/kvm-86/kvm/kernel] Error 2
> make[1]: *** [all] Error 2
> make: *** [kvm-kmod] Error 2
> 
> Both machines run Debian Lenny with a custom kernel (2.6.29.1 and
> 2.6.29.3). One machine is Intel-based (Core2Duo), one is AMD-based. Both
> compiled earlier versions of kvm just fine. configure was run without
> options.
> 
> Best,
> René.
> 
> -- 
>   )\._.,--....,'``.  fL  Let GNU/Linux work for you while you take a nap.
>  /,   _.. \   _\  (`._ ,. R. Pfeiffer <lynx at luchs.at> + http://web.luchs.at/
> `._.-(,_..'--(,_..'`-.;.'  - System administration + Consulting + Teaching -
> Got mail delivery problems?  http://web.luchs.at/information/blockedmail.php



-- 
-------------------------------------
Nikola CIPRICH
LinuxBox.cz, s.r.o.
28. rijna 168, 709 01 Ostrava

tel.:   +420 596 603 142
fax:    +420 596 621 273
mobil:  +420 777 093 799

www.linuxbox.cz

mobil servis: +420 737 238 656
email servis: servis@linuxbox.cz
-------------------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kvm-86 fails to compile with "'IOMMU_CACHE' undeclared"
  2009-05-20 20:30 ` Nikola Ciprich
@ 2009-05-20 20:45   ` Nikola Ciprich
  2009-05-21  5:33     ` Chris Wright
  2009-05-22  7:51   ` kvm-86 fails to compile with "'IOMMU_CACHE' undeclared" René Pfeiffer
  1 sibling, 1 reply; 7+ messages in thread
From: Nikola Ciprich @ 2009-05-20 20:45 UTC (permalink / raw)
  To: René Pfeiffer; +Cc: KVM list, nikola.ciprich, Avi Kivity

Hi, 
KVM-86 IOMMU uses features available since 2.6.30-rcXX, attached patch
disables its compilation on older kernels. I'm not sure if this is the
best way to disable it, but You can use it as a workaround.
Avi, is this OK? if so, please apply.
nik

diff -Naur kvm-kmod-devel-86/external-module-compat-comm.h kvm-kmod-devel-86-disable-iommu-for-old-kernels/external-module-compat-comm.h
--- kvm-kmod-devel-86/external-module-compat-comm.h     2009-05-20 15:59:56.000000000 +0200
+++ kvm-kmod-devel-86-disable-iommu-for-old-kernels/external-module-compat-comm.h       2009-05-20 22:37:23.632038570 +0200
@@ -791,3 +791,7 @@
 }

 #endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
+#undef CONFIG_IOMMU_API
+#endif
diff -Naur kvm-kmod-devel-86/x86/iommu.c kvm-kmod-devel-86-disable-iommu-for-old-kernels/x86/iommu.c
--- kvm-kmod-devel-86/x86/iommu.c       2009-05-20 16:00:00.000000000 +0200
+++ kvm-kmod-devel-86-disable-iommu-for-old-kernels/x86/iommu.c 2009-05-20 22:37:43.840878726 +0200
@@ -1,3 +1,4 @@
+#ifdef CONFIG_IOMMU_API
 #ifndef KVM_UNIFDEF_H
 #define KVM_UNIFDEF_H

@@ -271,3 +272,4 @@
        iommu_domain_free(domain);
        return 0;
 }
+#endif

On Wed, May 20, 2009 at 10:30:22PM +0200, Nikola Ciprich wrote:
> Hi Rene,
> as a workaround, You can disable 
> 	AMD IOMMU support (AMD_IOMMU) and 
> 	Support for DMA Remapping Devices (EXPERIMENTAL) (DMAR)
> in Your host kernel.
> I'll post patch to disable KVM IOMMU support for kernels <2.6.30 soon.
> BR
> nik
> 
> On Wed, May 20, 2009 at 07:48:59PM +0200, René Pfeiffer wrote:
> > Hello!
> > 
> > I just tried to compile kvm-86 on two test machines and I get the
> > following error:
> > 
> > [...]
> >   CC [M]  /usr/src/build/kvm-86/kvm/kernel/x86/iommu.o
> > /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c: In function ‘kvm_iommu_map_pages’:
> > /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:90: error: ‘IOMMU_CACHE’ undeclared (first use in this function)
> > /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:90: error: (Each undeclared identifier is reported only once
> > /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:90: error: for each function it appears in.)
> > /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c: In function ‘kvm_assign_device’:
> > /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:155: error: implicit declaration of function ‘iommu_domain_has_cap’
> > /usr/src/build/kvm-86/kvm/kernel/x86/iommu.c:156: error: ‘IOMMU_CAP_CACHE_COHERENCY’ undeclared (first use in this function)
> > make[4]: *** [/usr/src/build/kvm-86/kvm/kernel/x86/iommu.o] Error 1
> > make[3]: *** [/usr/src/build/kvm-86/kvm/kernel/x86] Error 2
> > make[2]: *** [_module_/usr/src/build/kvm-86/kvm/kernel] Error 2
> > make[1]: *** [all] Error 2
> > make: *** [kvm-kmod] Error 2
> > 
> > Both machines run Debian Lenny with a custom kernel (2.6.29.1 and
> > 2.6.29.3). One machine is Intel-based (Core2Duo), one is AMD-based. Both
> > compiled earlier versions of kvm just fine. configure was run without
> > options.
> > 
> > Best,
> > René.
> > 
> > -- 
> >   )\._.,--....,'``.  fL  Let GNU/Linux work for you while you take a nap.
> >  /,   _.. \   _\  (`._ ,. R. Pfeiffer <lynx at luchs.at> + http://web.luchs.at/
> > `._.-(,_..'--(,_..'`-.;.'  - System administration + Consulting + Teaching -
> > Got mail delivery problems?  http://web.luchs.at/information/blockedmail.php
> 
> 
> 
> -- 
> -------------------------------------
> Nikola CIPRICH
> LinuxBox.cz, s.r.o.
> 28. rijna 168, 709 01 Ostrava
> 
> tel.:   +420 596 603 142
> fax:    +420 596 621 273
> mobil:  +420 777 093 799
> 
> www.linuxbox.cz
> 
> mobil servis: +420 737 238 656
> email servis: servis@linuxbox.cz
> -------------------------------------
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
-------------------------------------
Nikola CIPRICH
LinuxBox.cz, s.r.o.
28. rijna 168, 709 01 Ostrava

tel.:   +420 596 603 142
fax:    +420 596 621 273
mobil:  +420 777 093 799

www.linuxbox.cz

mobil servis: +420 737 238 656
email servis: servis@linuxbox.cz
-------------------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kvm-86 fails to compile with "'IOMMU_CACHE' undeclared"
  2009-05-20 20:45   ` Nikola Ciprich
@ 2009-05-21  5:33     ` Chris Wright
  2009-05-21  6:18       ` [PATCH kvm-kmod] build fix for !#defined IOMMU_CACHE Chris Wright
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Wright @ 2009-05-21  5:33 UTC (permalink / raw)
  To: Nikola Ciprich; +Cc: René Pfeiffer, KVM list, nikola.ciprich, Avi Kivity

* Nikola Ciprich (extmaillist@linuxbox.cz) wrote:
> diff -Naur kvm-kmod-devel-86/external-module-compat-comm.h kvm-kmod-devel-86-disable-iommu-for-old-kernels/external-module-compat-comm.h
> --- kvm-kmod-devel-86/external-module-compat-comm.h     2009-05-20 15:59:56.000000000 +0200
> +++ kvm-kmod-devel-86-disable-iommu-for-old-kernels/external-module-compat-comm.h       2009-05-20 22:37:23.632038570 +0200
> @@ -791,3 +791,7 @@
>  }
> 
>  #endif
> +
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
> +#undef CONFIG_IOMMU_API
> +#endif

This is too heavy handed.  The only thing that's new is newer iommu
code provides a query for cache coherency.  You could do something as
simple as:

#ifndef IOMMU_CACHE
#define IOMMU_CACHE	(4)
#define IOMMU_CAP_CACHE_COHERENCY	0x1
static inline int kvm_iommu_domain_has_cap(struct iommu_domain *domain,
					   unsigned long cap)
{
	return 0;
}
#else
#define kvm_iommu_domain_has_cap iommu_domain_has_cap
#endif

and add it to the compat_api list in the sync script

> diff -Naur kvm-kmod-devel-86/x86/iommu.c kvm-kmod-devel-86-disable-iommu-for-old-kernels/x86/iommu.c
> --- kvm-kmod-devel-86/x86/iommu.c       2009-05-20 16:00:00.000000000 +0200
> +++ kvm-kmod-devel-86-disable-iommu-for-old-kernels/x86/iommu.c 2009-05-20 22:37:43.840878726 +0200
> @@ -1,3 +1,4 @@
> +#ifdef CONFIG_IOMMU_API
>  #ifndef KVM_UNIFDEF_H
>  #define KVM_UNIFDEF_H
> 
> @@ -271,3 +272,4 @@
>         iommu_domain_free(domain);
>         return 0;
>  }
> +#endif

BTW, just to clarify something...this file isn't part of kvm-kmod repo,
it's a generated file from the 'make sync' process.

thanks,
-chris

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH kvm-kmod] build fix for !#defined IOMMU_CACHE
  2009-05-21  5:33     ` Chris Wright
@ 2009-05-21  6:18       ` Chris Wright
  2009-05-21  7:46         ` Avi Kivity
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Wright @ 2009-05-21  6:18 UTC (permalink / raw)
  To: Nikola Ciprich
  Cc: Chris Wright, René Pfeiffer, KVM list, nikola.ciprich,
	Avi Kivity

This should fix the build for kernels that don't have IOMMU_CACHE,
IOMMU_CAP_CACHE_COHERENCY or iommu_domain_has_cap defined.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
 external-module-compat-comm.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
index f6975e0..adf45c5 100644
--- a/external-module-compat-comm.h
+++ b/external-module-compat-comm.h
@@ -791,3 +793,16 @@ static inline struct page *compound_head(struct page *page)
 }
 
 #endif
+
+#include <linux/iommu.h>
+#ifndef IOMMU_CACHE
+
+#define IOMMU_CACHE	(4)
+#define IOMMU_CAP_CACHE_COHERENCY	0x1
+static inline int iommu_domain_has_cap(struct iommu_domain *domain,
+				       unsigned long cap)
+{
+	return 0;
+}
+
+#endif

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH kvm-kmod] build fix for !#defined IOMMU_CACHE
  2009-05-21  6:18       ` [PATCH kvm-kmod] build fix for !#defined IOMMU_CACHE Chris Wright
@ 2009-05-21  7:46         ` Avi Kivity
  0 siblings, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2009-05-21  7:46 UTC (permalink / raw)
  To: Chris Wright; +Cc: Nikola Ciprich, René Pfeiffer, KVM list, nikola.ciprich

Chris Wright wrote:
> This should fix the build for kernels that don't have IOMMU_CACHE,
> IOMMU_CAP_CACHE_COHERENCY or iommu_domain_has_cap defined.
>
>   

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kvm-86 fails to compile with "'IOMMU_CACHE' undeclared"
  2009-05-20 20:30 ` Nikola Ciprich
  2009-05-20 20:45   ` Nikola Ciprich
@ 2009-05-22  7:51   ` René Pfeiffer
  1 sibling, 0 replies; 7+ messages in thread
From: René Pfeiffer @ 2009-05-22  7:51 UTC (permalink / raw)
  To: KVM list; +Cc: nikola.ciprich

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

On May 20, 2009 at 2230 +0200, Nikola Ciprich appeared and said:
> Hi Rene,
> as a workaround, You can disable 
> 	AMD IOMMU support (AMD_IOMMU) and 
> 	Support for DMA Remapping Devices (EXPERIMENTAL) (DMAR)
> in Your host kernel.

Ok, thanks for the clarification. I wasn't sure what the cause for the
error was. I suspected the kernel, but I didn't check thoroughly. I'll
be moving to 2.6.30 anyway on the test machines. 

Thanks for the patch.

Best,
René.

-- 
  )\._.,--....,'``.  fL  Let GNU/Linux work for you while you take a nap.
 /,   _.. \   _\  (`._ ,. R. Pfeiffer <lynx at luchs.at> + http://web.luchs.at/
`._.-(,_..'--(,_..'`-.;.'  - System administration + Consulting + Teaching -
Got mail delivery problems?  http://web.luchs.at/information/blockedmail.php

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-05-22  7:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-20 17:48 kvm-86 fails to compile with "'IOMMU_CACHE' undeclared" René Pfeiffer
2009-05-20 20:30 ` Nikola Ciprich
2009-05-20 20:45   ` Nikola Ciprich
2009-05-21  5:33     ` Chris Wright
2009-05-21  6:18       ` [PATCH kvm-kmod] build fix for !#defined IOMMU_CACHE Chris Wright
2009-05-21  7:46         ` Avi Kivity
2009-05-22  7:51   ` kvm-86 fails to compile with "'IOMMU_CACHE' undeclared" René Pfeiffer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).