Subject: Re: [kvm-devel] [PATCH 4 of 4] [KVM POWERPC] PowerPC 440 KVM implementation

From: Christian Ehrhardt <[email-masked]>
Date: Thu, 17 Apr 2008 16:00:37 +0200

Avi Kivity wrote:
> Avi Kivity wrote:
>> Hollis Blanchard wrote:
>>> +config KVM
>>> + tristate "Kernel-based Virtual Machine (KVM) support"
>>> + depends on EXPERIMENTAL
>>> + select PREEMPT_NOTIFIERS
>>> + select ANON_INODES
>>> + ---help---
>>> + Support hosting virtualized guest machines. You will also
>>> + need to select one or more of the processor modules below.
>>> +
>>> + This module provides access to the hardware capabilities through
>>> + a character device node named /dev/kvm.
>>> +
>>> + To compile this as a module, choose M here: the module
>>> + will be called kvm.
>>> +
>>> + If unsure, say N.
>>
>> In my ignorance, I set KVM=m on a non-44x build, which then failed. 
>> This needs either to depend on 44x, or to be fixed to compile.
> 
> Setting 44x, I get
>> AS [M] arch/powerpc/kvm/booke_interrupts.o
>> arch/powerpc/kvm/booke_interrupts.S: Assembler messages:
>> arch/powerpc/kvm/booke_interrupts.S:351: Error: unsupported relocation 
>> against VCPU_HOST_TLB
>> arch/powerpc/kvm/booke_interrupts.S:352: Error: unsupported relocation 
>> against VCPU_SHADOW_TLB

Afaik we just don't support building kvm as module atm. So a simple and fast solution would be to change the Kconfig options from tristate to bool.
Additionally we still have some cross references between the code build on the two used symbols (KVM&KVM_BOOKE_HOST) which means that we need to ensure that if KVM if configured for powerpc we also select exactly one host implementation. To do so I changed the second option to a choice field which eventually has always selected one suboption.

To ensure that the only existent suboption we have atm can be selected we need the smallest commonality as dependency at the KVM config option which atm put "depends 44x" there.
We can change that once we support modules and/or separate selections.

A patch for that is attached, but I would like to wait for Hollis comments on that before you apply that.

> So further Kconfig restrictions are needed, or perhaps a patch. .config 
> attached.
> 
> 
[...]

-- 

Grüsse / regards, 
Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization
--- arch/powerpc/kvm/Kconfig.save	2008-04-17 15:21:54.000000000 +0200
+++ arch/powerpc/kvm/Kconfig	2008-04-17 15:58:52.000000000 +0200
@@ -15,8 +15,8 @@
 if VIRTUALIZATION
 
 config KVM
-	tristate "Kernel-based Virtual Machine (KVM) support"
-	depends on EXPERIMENTAL
+	bool "Kernel-based Virtual Machine (KVM) support"
+	depends on EXPERIMENTAL && 44x
 	select PREEMPT_NOTIFIERS
 	select ANON_INODES
 	---help---
@@ -31,13 +31,22 @@
 
 	  If unsure, say N.
 
+choice
+	prompt "KVM host PowerPC processor support"
+	depends on KVM && 44x
+	default KVM_BOOKE_HOST
+	help
+	  This option sets the Kind of PowerPC processor to virtualize.
+
 config KVM_BOOKE_HOST
-	tristate "KVM host support for Book E PowerPC processors"
+	bool "Book E"
 	depends on KVM && 44x
 	---help---
 	  Provides host support for KVM on Book E PowerPC processors. Currently
 	  this works on 440 processors only.
 
+endchoice
+
 source drivers/virtio/Kconfig
 
 endif # VIRTUALIZATION