diff mbox

KVM: PPC: Always select KVM_VFIO, plus Makefile cleanup

Message ID 20160819014159.GA3337@oak.ozlabs.ibm.com
State Accepted
Headers show

Commit Message

Paul Mackerras Aug. 19, 2016, 1:41 a.m. UTC
As discussed recently on the kvm mailing list, David Gibson's
intention in commit 178a78750212 ("vfio: Enable VFIO device for
powerpc", 2016-02-01) was to have the KVM VFIO device built in
on all powerpc platforms.  This patch adds the "select KVM_VFIO"
statement that makes this happen.

Currently, arch/powerpc/kvm/Makefile doesn't include vfio.o for
the 64-bit kvm module, because the list of objects doesn't use
the $(common-objs-y) list.  The reason it doesn't is because we
don't necessarily want coalesced_mmio.o or emulate.o (for example
if HV KVM is the only target), and common-objs-y includes both.

Since this is confusing, this patch adjusts the definitions so that
we now use $(common-objs-y) in the list for the 64-bit kvm.ko
module, emulate.o is removed from common-objs-y and added in the
places that need it, and the inclusion of coalesced_mmio.o now
depends on CONFIG_KVM_MMIO.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
 arch/powerpc/kvm/Kconfig  |  1 +
 arch/powerpc/kvm/Makefile | 19 ++++++++-----------
 2 files changed, 9 insertions(+), 11 deletions(-)

Comments

Paolo Bonzini Aug. 19, 2016, 10:22 a.m. UTC | #1
On 19/08/2016 03:41, Paul Mackerras wrote:
> As discussed recently on the kvm mailing list, David Gibson's
> intention in commit 178a78750212 ("vfio: Enable VFIO device for
> powerpc", 2016-02-01) was to have the KVM VFIO device built in
> on all powerpc platforms.  This patch adds the "select KVM_VFIO"
> statement that makes this happen.
> 
> Currently, arch/powerpc/kvm/Makefile doesn't include vfio.o for
> the 64-bit kvm module, because the list of objects doesn't use
> the $(common-objs-y) list.  The reason it doesn't is because we
> don't necessarily want coalesced_mmio.o or emulate.o (for example
> if HV KVM is the only target), and common-objs-y includes both.
> 
> Since this is confusing, this patch adjusts the definitions so that
> we now use $(common-objs-y) in the list for the 64-bit kvm.ko
> module, emulate.o is removed from common-objs-y and added in the
> places that need it, and the inclusion of coalesced_mmio.o now
> depends on CONFIG_KVM_MMIO.

> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
> ---
>  arch/powerpc/kvm/Kconfig  |  1 +
>  arch/powerpc/kvm/Makefile | 19 ++++++++-----------
>  2 files changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
> index c2024ac..c0a2478 100644
> --- a/arch/powerpc/kvm/Kconfig
> +++ b/arch/powerpc/kvm/Kconfig
> @@ -22,6 +22,7 @@ config KVM
>  	select ANON_INODES
>  	select HAVE_KVM_EVENTFD
>  	select SRCU
> +	select KVM_VFIO
>  
>  config KVM_BOOK3S_HANDLER
>  	bool
> diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
> index 1f9e552..bd9b82f 100644
> --- a/arch/powerpc/kvm/Makefile
> +++ b/arch/powerpc/kvm/Makefile
> @@ -7,16 +7,16 @@ subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
>  ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm
>  KVM := ../../../virt/kvm
>  
> -common-objs-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \
> -		$(KVM)/eventfd.o
> +common-objs-y = $(KVM)/kvm_main.o $(KVM)/eventfd.o
>  common-objs-$(CONFIG_KVM_VFIO) += $(KVM)/vfio.o
> +common-objs-$(CONFIG_KVM_MMIO) += $(KVM)/coalesced_mmio.o
>  
>  CFLAGS_e500_mmu.o := -I.
>  CFLAGS_e500_mmu_host.o := -I.
>  CFLAGS_emulate.o  := -I.
>  CFLAGS_emulate_loadstore.o  := -I.
>  
> -common-objs-y += powerpc.o emulate.o emulate_loadstore.o
> +common-objs-y += powerpc.o emulate_loadstore.o
>  obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o
>  obj-$(CONFIG_KVM_BOOK3S_HANDLER) += book3s_exports.o
>  
> @@ -24,6 +24,7 @@ AFLAGS_booke_interrupts.o := -I$(objtree)/$(obj)
>  
>  kvm-e500-objs := \
>  	$(common-objs-y) \
> +	emulate.o \
>  	booke.o \
>  	booke_emulate.o \
>  	booke_interrupts.o \
> @@ -35,6 +36,7 @@ kvm-objs-$(CONFIG_KVM_E500V2) := $(kvm-e500-objs)
>  
>  kvm-e500mc-objs := \
>  	$(common-objs-y) \
> +	emulate.o \
>  	booke.o \
>  	booke_emulate.o \
>  	bookehv_interrupts.o \
> @@ -61,9 +63,6 @@ kvm-pr-y := \
>  	book3s_32_mmu.o
>  
>  ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
> -kvm-book3s_64-module-objs := \
> -	$(KVM)/coalesced_mmio.o
> -
>  kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \
>  	book3s_rmhandlers.o
>  endif
> @@ -88,11 +87,8 @@ endif
>  kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \
>  	book3s_xics.o
>  
> -kvm-book3s_64-module-objs += \
> -	$(KVM)/kvm_main.o \
> -	$(KVM)/eventfd.o \
> -	powerpc.o \
> -	emulate_loadstore.o \
> +kvm-book3s_64-module-objs := \
> +	$(common-objs-y) \
>  	book3s.o \
>  	book3s_64_vio.o \
>  	book3s_rtas.o \
> @@ -102,6 +98,7 @@ kvm-objs-$(CONFIG_KVM_BOOK3S_64) := $(kvm-book3s_64-module-objs)
>  
>  kvm-book3s_32-objs := \
>  	$(common-objs-y) \
> +	emulate.o \
>  	fpu.o \
>  	book3s_paired_singles.o \
>  	book3s.o \
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Gibson Aug. 22, 2016, 10:56 a.m. UTC | #2
On Fri, Aug 19, 2016 at 11:41:59AM +1000, Paul Mackerras wrote:
> As discussed recently on the kvm mailing list, David Gibson's
> intention in commit 178a78750212 ("vfio: Enable VFIO device for
> powerpc", 2016-02-01) was to have the KVM VFIO device built in
> on all powerpc platforms.  This patch adds the "select KVM_VFIO"
> statement that makes this happen.
> 
> Currently, arch/powerpc/kvm/Makefile doesn't include vfio.o for
> the 64-bit kvm module, because the list of objects doesn't use
> the $(common-objs-y) list.  The reason it doesn't is because we
> don't necessarily want coalesced_mmio.o or emulate.o (for example
> if HV KVM is the only target), and common-objs-y includes both.
> 
> Since this is confusing, this patch adjusts the definitions so that
> we now use $(common-objs-y) in the list for the 64-bit kvm.ko
> module, emulate.o is removed from common-objs-y and added in the
> places that need it, and the inclusion of coalesced_mmio.o now
> depends on CONFIG_KVM_MMIO.
> 
> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  arch/powerpc/kvm/Kconfig  |  1 +
>  arch/powerpc/kvm/Makefile | 19 ++++++++-----------
>  2 files changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
> index c2024ac..c0a2478 100644
> --- a/arch/powerpc/kvm/Kconfig
> +++ b/arch/powerpc/kvm/Kconfig
> @@ -22,6 +22,7 @@ config KVM
>  	select ANON_INODES
>  	select HAVE_KVM_EVENTFD
>  	select SRCU
> +	select KVM_VFIO
>  
>  config KVM_BOOK3S_HANDLER
>  	bool
> diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
> index 1f9e552..bd9b82f 100644
> --- a/arch/powerpc/kvm/Makefile
> +++ b/arch/powerpc/kvm/Makefile
> @@ -7,16 +7,16 @@ subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
>  ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm
>  KVM := ../../../virt/kvm
>  
> -common-objs-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \
> -		$(KVM)/eventfd.o
> +common-objs-y = $(KVM)/kvm_main.o $(KVM)/eventfd.o
>  common-objs-$(CONFIG_KVM_VFIO) += $(KVM)/vfio.o
> +common-objs-$(CONFIG_KVM_MMIO) += $(KVM)/coalesced_mmio.o
>  
>  CFLAGS_e500_mmu.o := -I.
>  CFLAGS_e500_mmu_host.o := -I.
>  CFLAGS_emulate.o  := -I.
>  CFLAGS_emulate_loadstore.o  := -I.
>  
> -common-objs-y += powerpc.o emulate.o emulate_loadstore.o
> +common-objs-y += powerpc.o emulate_loadstore.o
>  obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o
>  obj-$(CONFIG_KVM_BOOK3S_HANDLER) += book3s_exports.o
>  
> @@ -24,6 +24,7 @@ AFLAGS_booke_interrupts.o := -I$(objtree)/$(obj)
>  
>  kvm-e500-objs := \
>  	$(common-objs-y) \
> +	emulate.o \
>  	booke.o \
>  	booke_emulate.o \
>  	booke_interrupts.o \
> @@ -35,6 +36,7 @@ kvm-objs-$(CONFIG_KVM_E500V2) := $(kvm-e500-objs)
>  
>  kvm-e500mc-objs := \
>  	$(common-objs-y) \
> +	emulate.o \
>  	booke.o \
>  	booke_emulate.o \
>  	bookehv_interrupts.o \
> @@ -61,9 +63,6 @@ kvm-pr-y := \
>  	book3s_32_mmu.o
>  
>  ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
> -kvm-book3s_64-module-objs := \
> -	$(KVM)/coalesced_mmio.o
> -
>  kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \
>  	book3s_rmhandlers.o
>  endif
> @@ -88,11 +87,8 @@ endif
>  kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \
>  	book3s_xics.o
>  
> -kvm-book3s_64-module-objs += \
> -	$(KVM)/kvm_main.o \
> -	$(KVM)/eventfd.o \
> -	powerpc.o \
> -	emulate_loadstore.o \
> +kvm-book3s_64-module-objs := \
> +	$(common-objs-y) \
>  	book3s.o \
>  	book3s_64_vio.o \
>  	book3s_rtas.o \
> @@ -102,6 +98,7 @@ kvm-objs-$(CONFIG_KVM_BOOK3S_64) := $(kvm-book3s_64-module-objs)
>  
>  kvm-book3s_32-objs := \
>  	$(common-objs-y) \
> +	emulate.o \
>  	fpu.o \
>  	book3s_paired_singles.o \
>  	book3s.o \
diff mbox

Patch

diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index c2024ac..c0a2478 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -22,6 +22,7 @@  config KVM
 	select ANON_INODES
 	select HAVE_KVM_EVENTFD
 	select SRCU
+	select KVM_VFIO
 
 config KVM_BOOK3S_HANDLER
 	bool
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index 1f9e552..bd9b82f 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -7,16 +7,16 @@  subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
 ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm
 KVM := ../../../virt/kvm
 
-common-objs-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \
-		$(KVM)/eventfd.o
+common-objs-y = $(KVM)/kvm_main.o $(KVM)/eventfd.o
 common-objs-$(CONFIG_KVM_VFIO) += $(KVM)/vfio.o
+common-objs-$(CONFIG_KVM_MMIO) += $(KVM)/coalesced_mmio.o
 
 CFLAGS_e500_mmu.o := -I.
 CFLAGS_e500_mmu_host.o := -I.
 CFLAGS_emulate.o  := -I.
 CFLAGS_emulate_loadstore.o  := -I.
 
-common-objs-y += powerpc.o emulate.o emulate_loadstore.o
+common-objs-y += powerpc.o emulate_loadstore.o
 obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o
 obj-$(CONFIG_KVM_BOOK3S_HANDLER) += book3s_exports.o
 
@@ -24,6 +24,7 @@  AFLAGS_booke_interrupts.o := -I$(objtree)/$(obj)
 
 kvm-e500-objs := \
 	$(common-objs-y) \
+	emulate.o \
 	booke.o \
 	booke_emulate.o \
 	booke_interrupts.o \
@@ -35,6 +36,7 @@  kvm-objs-$(CONFIG_KVM_E500V2) := $(kvm-e500-objs)
 
 kvm-e500mc-objs := \
 	$(common-objs-y) \
+	emulate.o \
 	booke.o \
 	booke_emulate.o \
 	bookehv_interrupts.o \
@@ -61,9 +63,6 @@  kvm-pr-y := \
 	book3s_32_mmu.o
 
 ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
-kvm-book3s_64-module-objs := \
-	$(KVM)/coalesced_mmio.o
-
 kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \
 	book3s_rmhandlers.o
 endif
@@ -88,11 +87,8 @@  endif
 kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \
 	book3s_xics.o
 
-kvm-book3s_64-module-objs += \
-	$(KVM)/kvm_main.o \
-	$(KVM)/eventfd.o \
-	powerpc.o \
-	emulate_loadstore.o \
+kvm-book3s_64-module-objs := \
+	$(common-objs-y) \
 	book3s.o \
 	book3s_64_vio.o \
 	book3s_rtas.o \
@@ -102,6 +98,7 @@  kvm-objs-$(CONFIG_KVM_BOOK3S_64) := $(kvm-book3s_64-module-objs)
 
 kvm-book3s_32-objs := \
 	$(common-objs-y) \
+	emulate.o \
 	fpu.o \
 	book3s_paired_singles.o \
 	book3s.o \