All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm
@ 2013-05-03 14:02 ` Marc Zyngier
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-03 14:02 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm, kvm; +Cc: cdall, catalin.marinas

As KVM/arm64 is looming on the horizon, it makes sense to move some
of the common code to a single location in order to reduce duplication.

The code could live anywhere. Actually, most of KVM is already built
with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
not exactly talking about style here. But maybe it is time to start
moving into a less ugly direction.

The include files must be in a "public" location, as they are accessed
from non-KVM files (arch/arm/kernel/asm-offsets.c).

For this purpose, introduce two new locations:
- virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
  virt/kvm, so this could be seen as a (very ugly) precedent.
- include/kvm/  : there is already an include/xen, and while the
  intent is slightly different, this seems as good a location as
  any

Once the code has been moved, it becomes easy to build it in a
less hackish way, which makes the code easily reusable by KVM/arm64.

Marc Zyngier (2):
  ARM: KVM: move GIC/timer code to a common location
  ARM: KVM: standalone Makefile for vgic and timers

 Makefile                                               | 2 +-
 arch/arm/include/asm/kvm_host.h                        | 4 ++--
 arch/arm/kvm/Makefile                                  | 5 ++---
 {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
 {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
 virt/Makefile                                          | 1 +
 virt/kvm/Makefile                                      | 1 +
 virt/kvm/arm/Makefile                                  | 2 ++
 {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
 {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
 10 files changed, 11 insertions(+), 8 deletions(-)
 rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
 rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
 create mode 100644 virt/Makefile
 create mode 100644 virt/kvm/Makefile
 create mode 100644 virt/kvm/arm/Makefile
 rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
 rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)

-- 
1.8.2.1



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

* [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm
@ 2013-05-03 14:02 ` Marc Zyngier
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-03 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

As KVM/arm64 is looming on the horizon, it makes sense to move some
of the common code to a single location in order to reduce duplication.

The code could live anywhere. Actually, most of KVM is already built
with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
not exactly talking about style here. But maybe it is time to start
moving into a less ugly direction.

The include files must be in a "public" location, as they are accessed
from non-KVM files (arch/arm/kernel/asm-offsets.c).

For this purpose, introduce two new locations:
- virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
  virt/kvm, so this could be seen as a (very ugly) precedent.
- include/kvm/  : there is already an include/xen, and while the
  intent is slightly different, this seems as good a location as
  any

Once the code has been moved, it becomes easy to build it in a
less hackish way, which makes the code easily reusable by KVM/arm64.

Marc Zyngier (2):
  ARM: KVM: move GIC/timer code to a common location
  ARM: KVM: standalone Makefile for vgic and timers

 Makefile                                               | 2 +-
 arch/arm/include/asm/kvm_host.h                        | 4 ++--
 arch/arm/kvm/Makefile                                  | 5 ++---
 {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
 {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
 virt/Makefile                                          | 1 +
 virt/kvm/Makefile                                      | 1 +
 virt/kvm/arm/Makefile                                  | 2 ++
 {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
 {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
 10 files changed, 11 insertions(+), 8 deletions(-)
 rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
 rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
 create mode 100644 virt/Makefile
 create mode 100644 virt/kvm/Makefile
 create mode 100644 virt/kvm/arm/Makefile
 rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
 rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)

-- 
1.8.2.1

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

* [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
  2013-05-03 14:02 ` Marc Zyngier
@ 2013-05-03 14:02   ` Marc Zyngier
  -1 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-03 14:02 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm, kvm; +Cc: cdall, catalin.marinas

As KVM/arm64 is looming on the horizon, it makes sense to move some
of the common code to a single location in order to reduce duplication.

The code could live anywhere. Actually, most of KVM is already built
with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
not exactly talking about style here. But maybe it is time to start
moving into a less ugly direction.

The include files must be in a "public" location, as they are accessed
from non-KVM files (arch/arm/kernel/asm-offsets.c).

For this purpose, introduce two new locations:
- virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
  virt/kvm, so this could be seen as a (very ugly) precedent.
- include/kvm/  : there is already an include/xen, and while the
  intent is slightly different, this seems as good a location as
  any

Eventually, we should probably have independant Makefiles at every
levels (just like everywhere else in the kernel), but this is just
the first step.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/include/asm/kvm_host.h                        | 4 ++--
 arch/arm/kvm/Makefile                                  | 7 ++++---
 {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
 {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
 {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
 {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
 6 files changed, 8 insertions(+), 7 deletions(-)
 rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
 rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
 rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
 rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)

diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index ff49193..4ad51e6 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -23,7 +23,7 @@
 #include <asm/kvm_asm.h>
 #include <asm/kvm_mmio.h>
 #include <asm/fpstate.h>
-#include <asm/kvm_arch_timer.h>
+#include <kvm/kvm_arch_timer.h>
 
 #define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
 #define KVM_USER_MEM_SLOTS 32
@@ -38,7 +38,7 @@
 #define KVM_NR_PAGE_SIZES	1
 #define KVM_PAGES_PER_HPAGE(x)	(1UL<<31)
 
-#include <asm/kvm_vgic.h>
+#include <kvm/kvm_vgic.h>
 
 struct kvm_vcpu;
 u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index 53c5ed8..110d6da 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -14,10 +14,11 @@ CFLAGS_mmu.o := -I.
 AFLAGS_init.o := -Wa,-march=armv7-a$(plus_virt)
 AFLAGS_interrupts.o := -Wa,-march=armv7-a$(plus_virt)
 
-kvm-arm-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o)
+KVM := ../../../virt/kvm
+kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o)
 
 obj-y += kvm-arm.o init.o interrupts.o
 obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
 obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
-obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
-obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
+obj-$(CONFIG_KVM_ARM_VGIC) += $(addprefix $(KVM)/arm/, vgic.o)
+obj-$(CONFIG_KVM_ARM_TIMER) += $(addprefix $(KVM)/arm/, arch_timer.o)
diff --git a/arch/arm/include/asm/kvm_arch_timer.h b/include/kvm/kvm_arch_timer.h
similarity index 100%
rename from arch/arm/include/asm/kvm_arch_timer.h
rename to include/kvm/kvm_arch_timer.h
diff --git a/arch/arm/include/asm/kvm_vgic.h b/include/kvm/kvm_vgic.h
similarity index 100%
rename from arch/arm/include/asm/kvm_vgic.h
rename to include/kvm/kvm_vgic.h
diff --git a/arch/arm/kvm/arch_timer.c b/virt/kvm/arm/arch_timer.c
similarity index 99%
rename from arch/arm/kvm/arch_timer.c
rename to virt/kvm/arm/arch_timer.c
index 49a7516..0728904 100644
--- a/arch/arm/kvm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -25,8 +25,8 @@
 #include <clocksource/arm_arch_timer.h>
 #include <asm/arch_timer.h>
 
-#include <asm/kvm_vgic.h>
-#include <asm/kvm_arch_timer.h>
+#include <kvm/kvm_vgic.h>
+#include <kvm/kvm_arch_timer.h>
 
 static struct timecounter *timecounter;
 static struct workqueue_struct *wqueue;
diff --git a/arch/arm/kvm/vgic.c b/virt/kvm/arm/vgic.c
similarity index 100%
rename from arch/arm/kvm/vgic.c
rename to virt/kvm/arm/vgic.c
-- 
1.8.2.1



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

* [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
@ 2013-05-03 14:02   ` Marc Zyngier
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-03 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

As KVM/arm64 is looming on the horizon, it makes sense to move some
of the common code to a single location in order to reduce duplication.

The code could live anywhere. Actually, most of KVM is already built
with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
not exactly talking about style here. But maybe it is time to start
moving into a less ugly direction.

The include files must be in a "public" location, as they are accessed
from non-KVM files (arch/arm/kernel/asm-offsets.c).

For this purpose, introduce two new locations:
- virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
  virt/kvm, so this could be seen as a (very ugly) precedent.
- include/kvm/  : there is already an include/xen, and while the
  intent is slightly different, this seems as good a location as
  any

Eventually, we should probably have independant Makefiles at every
levels (just like everywhere else in the kernel), but this is just
the first step.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/include/asm/kvm_host.h                        | 4 ++--
 arch/arm/kvm/Makefile                                  | 7 ++++---
 {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
 {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
 {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
 {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
 6 files changed, 8 insertions(+), 7 deletions(-)
 rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
 rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
 rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
 rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)

diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index ff49193..4ad51e6 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -23,7 +23,7 @@
 #include <asm/kvm_asm.h>
 #include <asm/kvm_mmio.h>
 #include <asm/fpstate.h>
-#include <asm/kvm_arch_timer.h>
+#include <kvm/kvm_arch_timer.h>
 
 #define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
 #define KVM_USER_MEM_SLOTS 32
@@ -38,7 +38,7 @@
 #define KVM_NR_PAGE_SIZES	1
 #define KVM_PAGES_PER_HPAGE(x)	(1UL<<31)
 
-#include <asm/kvm_vgic.h>
+#include <kvm/kvm_vgic.h>
 
 struct kvm_vcpu;
 u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index 53c5ed8..110d6da 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -14,10 +14,11 @@ CFLAGS_mmu.o := -I.
 AFLAGS_init.o := -Wa,-march=armv7-a$(plus_virt)
 AFLAGS_interrupts.o := -Wa,-march=armv7-a$(plus_virt)
 
-kvm-arm-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o)
+KVM := ../../../virt/kvm
+kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o)
 
 obj-y += kvm-arm.o init.o interrupts.o
 obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
 obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
-obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
-obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
+obj-$(CONFIG_KVM_ARM_VGIC) += $(addprefix $(KVM)/arm/, vgic.o)
+obj-$(CONFIG_KVM_ARM_TIMER) += $(addprefix $(KVM)/arm/, arch_timer.o)
diff --git a/arch/arm/include/asm/kvm_arch_timer.h b/include/kvm/kvm_arch_timer.h
similarity index 100%
rename from arch/arm/include/asm/kvm_arch_timer.h
rename to include/kvm/kvm_arch_timer.h
diff --git a/arch/arm/include/asm/kvm_vgic.h b/include/kvm/kvm_vgic.h
similarity index 100%
rename from arch/arm/include/asm/kvm_vgic.h
rename to include/kvm/kvm_vgic.h
diff --git a/arch/arm/kvm/arch_timer.c b/virt/kvm/arm/arch_timer.c
similarity index 99%
rename from arch/arm/kvm/arch_timer.c
rename to virt/kvm/arm/arch_timer.c
index 49a7516..0728904 100644
--- a/arch/arm/kvm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -25,8 +25,8 @@
 #include <clocksource/arm_arch_timer.h>
 #include <asm/arch_timer.h>
 
-#include <asm/kvm_vgic.h>
-#include <asm/kvm_arch_timer.h>
+#include <kvm/kvm_vgic.h>
+#include <kvm/kvm_arch_timer.h>
 
 static struct timecounter *timecounter;
 static struct workqueue_struct *wqueue;
diff --git a/arch/arm/kvm/vgic.c b/virt/kvm/arm/vgic.c
similarity index 100%
rename from arch/arm/kvm/vgic.c
rename to virt/kvm/arm/vgic.c
-- 
1.8.2.1

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

* [RFC PATCH 2/2] ARM: KVM: standalone Makefile for vgic and timers
  2013-05-03 14:02 ` Marc Zyngier
@ 2013-05-03 14:02   ` Marc Zyngier
  -1 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-03 14:02 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm, kvm; +Cc: cdall, catalin.marinas

On the road to turn KVM/arm64 into something more sensible, change
the way we compile the VGIC and arch_timer code by using local
Makefiles instead of the very backward method we used before.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 Makefile              | 2 +-
 arch/arm/kvm/Makefile | 2 --
 virt/Makefile         | 1 +
 virt/kvm/Makefile     | 1 +
 virt/kvm/arm/Makefile | 2 ++
 5 files changed, 5 insertions(+), 3 deletions(-)
 create mode 100644 virt/Makefile
 create mode 100644 virt/kvm/Makefile
 create mode 100644 virt/kvm/arm/Makefile

diff --git a/Makefile b/Makefile
index 6db672b..19d51df 100644
--- a/Makefile
+++ b/Makefile
@@ -732,7 +732,7 @@ export mod_sign_cmd
 
 
 ifeq ($(KBUILD_EXTMOD),)
-core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/
+core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/ virt/
 
 vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
 		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index 110d6da..e0540fd 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -20,5 +20,3 @@ kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o)
 obj-y += kvm-arm.o init.o interrupts.o
 obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
 obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
-obj-$(CONFIG_KVM_ARM_VGIC) += $(addprefix $(KVM)/arm/, vgic.o)
-obj-$(CONFIG_KVM_ARM_TIMER) += $(addprefix $(KVM)/arm/, arch_timer.o)
diff --git a/virt/Makefile b/virt/Makefile
new file mode 100644
index 0000000..c3b9ad0
--- /dev/null
+++ b/virt/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_KVM)	+= kvm/
diff --git a/virt/kvm/Makefile b/virt/kvm/Makefile
new file mode 100644
index 0000000..dc87943
--- /dev/null
+++ b/virt/kvm/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_KVM_ARM_HOST)	+= arm/
diff --git a/virt/kvm/arm/Makefile b/virt/kvm/arm/Makefile
new file mode 100644
index 0000000..4df943b
--- /dev/null
+++ b/virt/kvm/arm/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
+obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
-- 
1.8.2.1



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

* [RFC PATCH 2/2] ARM: KVM: standalone Makefile for vgic and timers
@ 2013-05-03 14:02   ` Marc Zyngier
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-03 14:02 UTC (permalink / raw)
  To: linux-arm-kernel

On the road to turn KVM/arm64 into something more sensible, change
the way we compile the VGIC and arch_timer code by using local
Makefiles instead of the very backward method we used before.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 Makefile              | 2 +-
 arch/arm/kvm/Makefile | 2 --
 virt/Makefile         | 1 +
 virt/kvm/Makefile     | 1 +
 virt/kvm/arm/Makefile | 2 ++
 5 files changed, 5 insertions(+), 3 deletions(-)
 create mode 100644 virt/Makefile
 create mode 100644 virt/kvm/Makefile
 create mode 100644 virt/kvm/arm/Makefile

diff --git a/Makefile b/Makefile
index 6db672b..19d51df 100644
--- a/Makefile
+++ b/Makefile
@@ -732,7 +732,7 @@ export mod_sign_cmd
 
 
 ifeq ($(KBUILD_EXTMOD),)
-core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/
+core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/ virt/
 
 vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
 		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index 110d6da..e0540fd 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -20,5 +20,3 @@ kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o)
 obj-y += kvm-arm.o init.o interrupts.o
 obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
 obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
-obj-$(CONFIG_KVM_ARM_VGIC) += $(addprefix $(KVM)/arm/, vgic.o)
-obj-$(CONFIG_KVM_ARM_TIMER) += $(addprefix $(KVM)/arm/, arch_timer.o)
diff --git a/virt/Makefile b/virt/Makefile
new file mode 100644
index 0000000..c3b9ad0
--- /dev/null
+++ b/virt/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_KVM)	+= kvm/
diff --git a/virt/kvm/Makefile b/virt/kvm/Makefile
new file mode 100644
index 0000000..dc87943
--- /dev/null
+++ b/virt/kvm/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_KVM_ARM_HOST)	+= arm/
diff --git a/virt/kvm/arm/Makefile b/virt/kvm/arm/Makefile
new file mode 100644
index 0000000..4df943b
--- /dev/null
+++ b/virt/kvm/arm/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
+obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
-- 
1.8.2.1

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

* Re: [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm
  2013-05-03 14:02 ` Marc Zyngier
@ 2013-05-03 15:31   ` Anup Patel
  -1 siblings, 0 replies; 28+ messages in thread
From: Anup Patel @ 2013-05-03 15:31 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: linux-arm-kernel, kvmarm, kvm, Christoffer Dall, catalin.marinas

On Fri, May 3, 2013 at 7:32 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> As KVM/arm64 is looming on the horizon, it makes sense to move some
> of the common code to a single location in order to reduce duplication.
>
> The code could live anywhere. Actually, most of KVM is already built
> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
> not exactly talking about style here. But maybe it is time to start
> moving into a less ugly direction.
>
> The include files must be in a "public" location, as they are accessed
> from non-KVM files (arch/arm/kernel/asm-offsets.c).
>
> For this purpose, introduce two new locations:
> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
>   virt/kvm, so this could be seen as a (very ugly) precedent.
> - include/kvm/  : there is already an include/xen, and while the
>   intent is slightly different, this seems as good a location as
>   any
>
> Once the code has been moved, it becomes easy to build it in a
> less hackish way, which makes the code easily reusable by KVM/arm64.
>
> Marc Zyngier (2):
>   ARM: KVM: move GIC/timer code to a common location
>   ARM: KVM: standalone Makefile for vgic and timers
>
>  Makefile                                               | 2 +-
>  arch/arm/include/asm/kvm_host.h                        | 4 ++--
>  arch/arm/kvm/Makefile                                  | 5 ++---
>  {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
>  {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
>  virt/Makefile                                          | 1 +
>  virt/kvm/Makefile                                      | 1 +
>  virt/kvm/arm/Makefile                                  | 2 ++
>  {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
>  {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
>  10 files changed, 11 insertions(+), 8 deletions(-)
>  rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
>  rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
>  create mode 100644 virt/Makefile
>  create mode 100644 virt/kvm/Makefile
>  create mode 100644 virt/kvm/arm/Makefile
>  rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
>  rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)
>
> --
> 1.8.2.1
>
>
>
> _______________________________________________
> kvmarm mailing list
> kvmarm@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm

The source files arch/arm/kvm/arm.c and arch/arm/kvm/mmu.c are also
shared between KVM ARM and KVM ARM64.

Can we move these files in virt/arm ?

--Anup

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

* [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm
@ 2013-05-03 15:31   ` Anup Patel
  0 siblings, 0 replies; 28+ messages in thread
From: Anup Patel @ 2013-05-03 15:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 3, 2013 at 7:32 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> As KVM/arm64 is looming on the horizon, it makes sense to move some
> of the common code to a single location in order to reduce duplication.
>
> The code could live anywhere. Actually, most of KVM is already built
> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
> not exactly talking about style here. But maybe it is time to start
> moving into a less ugly direction.
>
> The include files must be in a "public" location, as they are accessed
> from non-KVM files (arch/arm/kernel/asm-offsets.c).
>
> For this purpose, introduce two new locations:
> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
>   virt/kvm, so this could be seen as a (very ugly) precedent.
> - include/kvm/  : there is already an include/xen, and while the
>   intent is slightly different, this seems as good a location as
>   any
>
> Once the code has been moved, it becomes easy to build it in a
> less hackish way, which makes the code easily reusable by KVM/arm64.
>
> Marc Zyngier (2):
>   ARM: KVM: move GIC/timer code to a common location
>   ARM: KVM: standalone Makefile for vgic and timers
>
>  Makefile                                               | 2 +-
>  arch/arm/include/asm/kvm_host.h                        | 4 ++--
>  arch/arm/kvm/Makefile                                  | 5 ++---
>  {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
>  {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
>  virt/Makefile                                          | 1 +
>  virt/kvm/Makefile                                      | 1 +
>  virt/kvm/arm/Makefile                                  | 2 ++
>  {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
>  {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
>  10 files changed, 11 insertions(+), 8 deletions(-)
>  rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
>  rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
>  create mode 100644 virt/Makefile
>  create mode 100644 virt/kvm/Makefile
>  create mode 100644 virt/kvm/arm/Makefile
>  rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
>  rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)
>
> --
> 1.8.2.1
>
>
>
> _______________________________________________
> kvmarm mailing list
> kvmarm at lists.cs.columbia.edu
> https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm

The source files arch/arm/kvm/arm.c and arch/arm/kvm/mmu.c are also
shared between KVM ARM and KVM ARM64.

Can we move these files in virt/arm ?

--Anup

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

* Re: [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm
  2013-05-03 15:31   ` Anup Patel
@ 2013-05-03 15:55     ` Marc Zyngier
  -1 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-03 15:55 UTC (permalink / raw)
  To: Anup Patel
  Cc: linux-arm-kernel, kvmarm, kvm, Christoffer Dall, Catalin Marinas

On 03/05/13 16:31, Anup Patel wrote:
> On Fri, May 3, 2013 at 7:32 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>> As KVM/arm64 is looming on the horizon, it makes sense to move some
>> of the common code to a single location in order to reduce duplication.
>>
>> The code could live anywhere. Actually, most of KVM is already built
>> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
>> not exactly talking about style here. But maybe it is time to start
>> moving into a less ugly direction.
>>
>> The include files must be in a "public" location, as they are accessed
>> from non-KVM files (arch/arm/kernel/asm-offsets.c).
>>
>> For this purpose, introduce two new locations:
>> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
>>   virt/kvm, so this could be seen as a (very ugly) precedent.
>> - include/kvm/  : there is already an include/xen, and while the
>>   intent is slightly different, this seems as good a location as
>>   any
>>
>> Once the code has been moved, it becomes easy to build it in a
>> less hackish way, which makes the code easily reusable by KVM/arm64.
>>
>> Marc Zyngier (2):
>>   ARM: KVM: move GIC/timer code to a common location
>>   ARM: KVM: standalone Makefile for vgic and timers
>>
>>  Makefile                                               | 2 +-
>>  arch/arm/include/asm/kvm_host.h                        | 4 ++--
>>  arch/arm/kvm/Makefile                                  | 5 ++---
>>  {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
>>  {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
>>  virt/Makefile                                          | 1 +
>>  virt/kvm/Makefile                                      | 1 +
>>  virt/kvm/arm/Makefile                                  | 2 ++
>>  {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
>>  {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
>>  10 files changed, 11 insertions(+), 8 deletions(-)
>>  rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
>>  rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
>>  create mode 100644 virt/Makefile
>>  create mode 100644 virt/kvm/Makefile
>>  create mode 100644 virt/kvm/arm/Makefile
>>  rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
>>  rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)
>>
>> --
>> 1.8.2.1
>>
>>
>>
>> _______________________________________________
>> kvmarm mailing list
>> kvmarm@lists.cs.columbia.edu
>> https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm
> 
> The source files arch/arm/kvm/arm.c and arch/arm/kvm/mmu.c are also
> shared between KVM ARM and KVM ARM64.
> 
> Can we move these files in virt/arm ?

I suggest we start by finding out if there is an agreement on the
location, method and overall usefulness of this particular patch.

Moving core ARM code around is quite different from sharing what is
basically device emulation stuff.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...


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

* [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm
@ 2013-05-03 15:55     ` Marc Zyngier
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-03 15:55 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/05/13 16:31, Anup Patel wrote:
> On Fri, May 3, 2013 at 7:32 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>> As KVM/arm64 is looming on the horizon, it makes sense to move some
>> of the common code to a single location in order to reduce duplication.
>>
>> The code could live anywhere. Actually, most of KVM is already built
>> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
>> not exactly talking about style here. But maybe it is time to start
>> moving into a less ugly direction.
>>
>> The include files must be in a "public" location, as they are accessed
>> from non-KVM files (arch/arm/kernel/asm-offsets.c).
>>
>> For this purpose, introduce two new locations:
>> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
>>   virt/kvm, so this could be seen as a (very ugly) precedent.
>> - include/kvm/  : there is already an include/xen, and while the
>>   intent is slightly different, this seems as good a location as
>>   any
>>
>> Once the code has been moved, it becomes easy to build it in a
>> less hackish way, which makes the code easily reusable by KVM/arm64.
>>
>> Marc Zyngier (2):
>>   ARM: KVM: move GIC/timer code to a common location
>>   ARM: KVM: standalone Makefile for vgic and timers
>>
>>  Makefile                                               | 2 +-
>>  arch/arm/include/asm/kvm_host.h                        | 4 ++--
>>  arch/arm/kvm/Makefile                                  | 5 ++---
>>  {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
>>  {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
>>  virt/Makefile                                          | 1 +
>>  virt/kvm/Makefile                                      | 1 +
>>  virt/kvm/arm/Makefile                                  | 2 ++
>>  {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
>>  {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
>>  10 files changed, 11 insertions(+), 8 deletions(-)
>>  rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
>>  rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
>>  create mode 100644 virt/Makefile
>>  create mode 100644 virt/kvm/Makefile
>>  create mode 100644 virt/kvm/arm/Makefile
>>  rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
>>  rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)
>>
>> --
>> 1.8.2.1
>>
>>
>>
>> _______________________________________________
>> kvmarm mailing list
>> kvmarm at lists.cs.columbia.edu
>> https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm
> 
> The source files arch/arm/kvm/arm.c and arch/arm/kvm/mmu.c are also
> shared between KVM ARM and KVM ARM64.
> 
> Can we move these files in virt/arm ?

I suggest we start by finding out if there is an agreement on the
location, method and overall usefulness of this particular patch.

Moving core ARM code around is quite different from sharing what is
basically device emulation stuff.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

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

* Re: [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
  2013-05-03 14:02   ` Marc Zyngier
@ 2013-05-09 18:11     ` Christoffer Dall
  -1 siblings, 0 replies; 28+ messages in thread
From: Christoffer Dall @ 2013-05-09 18:11 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: linux-arm-kernel, kvmarm, kvm, catalin.marinas

On Fri, May 03, 2013 at 03:02:52PM +0100, Marc Zyngier wrote:
> As KVM/arm64 is looming on the horizon, it makes sense to move some
> of the common code to a single location in order to reduce duplication.
> 
> The code could live anywhere. Actually, most of KVM is already built
> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
> not exactly talking about style here. But maybe it is time to start
> moving into a less ugly direction.
> 
> The include files must be in a "public" location, as they are accessed
> from non-KVM files (arch/arm/kernel/asm-offsets.c).
> 
> For this purpose, introduce two new locations:
> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
>   virt/kvm, so this could be seen as a (very ugly) precedent.
> - include/kvm/  : there is already an include/xen, and while the
>   intent is slightly different, this seems as good a location as
>   any

This overall looks ok, just a few points:

1. Should we have a namespace per arch in the include directory, as in
   include/kvm/arm?

2. We could drop the kvm_ prefix from the include files now

> 
> Eventually, we should probably have independant Makefiles at every
> levels (just like everywhere else in the kernel), but this is just
> the first step.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  arch/arm/include/asm/kvm_host.h                        | 4 ++--
>  arch/arm/kvm/Makefile                                  | 7 ++++---
>  {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
>  {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
>  {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
>  {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
>  6 files changed, 8 insertions(+), 7 deletions(-)
>  rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
>  rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
>  rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
>  rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)
> 
> diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
> index ff49193..4ad51e6 100644
> --- a/arch/arm/include/asm/kvm_host.h
> +++ b/arch/arm/include/asm/kvm_host.h
> @@ -23,7 +23,7 @@
>  #include <asm/kvm_asm.h>
>  #include <asm/kvm_mmio.h>
>  #include <asm/fpstate.h>
> -#include <asm/kvm_arch_timer.h>
> +#include <kvm/kvm_arch_timer.h>
>  
>  #define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
>  #define KVM_USER_MEM_SLOTS 32
> @@ -38,7 +38,7 @@
>  #define KVM_NR_PAGE_SIZES	1
>  #define KVM_PAGES_PER_HPAGE(x)	(1UL<<31)
>  
> -#include <asm/kvm_vgic.h>
> +#include <kvm/kvm_vgic.h>
>  
>  struct kvm_vcpu;
>  u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
> diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
> index 53c5ed8..110d6da 100644
> --- a/arch/arm/kvm/Makefile
> +++ b/arch/arm/kvm/Makefile
> @@ -14,10 +14,11 @@ CFLAGS_mmu.o := -I.
>  AFLAGS_init.o := -Wa,-march=armv7-a$(plus_virt)
>  AFLAGS_interrupts.o := -Wa,-march=armv7-a$(plus_virt)
>  
> -kvm-arm-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o)
> +KVM := ../../../virt/kvm
> +kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o)
>  
>  obj-y += kvm-arm.o init.o interrupts.o
>  obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
>  obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
> -obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
> -obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
> +obj-$(CONFIG_KVM_ARM_VGIC) += $(addprefix $(KVM)/arm/, vgic.o)
> +obj-$(CONFIG_KVM_ARM_TIMER) += $(addprefix $(KVM)/arm/, arch_timer.o)
> diff --git a/arch/arm/include/asm/kvm_arch_timer.h b/include/kvm/kvm_arch_timer.h
> similarity index 100%
> rename from arch/arm/include/asm/kvm_arch_timer.h
> rename to include/kvm/kvm_arch_timer.h
> diff --git a/arch/arm/include/asm/kvm_vgic.h b/include/kvm/kvm_vgic.h
> similarity index 100%
> rename from arch/arm/include/asm/kvm_vgic.h
> rename to include/kvm/kvm_vgic.h
> diff --git a/arch/arm/kvm/arch_timer.c b/virt/kvm/arm/arch_timer.c
> similarity index 99%
> rename from arch/arm/kvm/arch_timer.c
> rename to virt/kvm/arm/arch_timer.c
> index 49a7516..0728904 100644
> --- a/arch/arm/kvm/arch_timer.c
> +++ b/virt/kvm/arm/arch_timer.c
> @@ -25,8 +25,8 @@
>  #include <clocksource/arm_arch_timer.h>
>  #include <asm/arch_timer.h>
>  
> -#include <asm/kvm_vgic.h>
> -#include <asm/kvm_arch_timer.h>
> +#include <kvm/kvm_vgic.h>
> +#include <kvm/kvm_arch_timer.h>
>  
>  static struct timecounter *timecounter;
>  static struct workqueue_struct *wqueue;
> diff --git a/arch/arm/kvm/vgic.c b/virt/kvm/arm/vgic.c
> similarity index 100%
> rename from arch/arm/kvm/vgic.c
> rename to virt/kvm/arm/vgic.c
> -- 
> 1.8.2.1
> 
> 
> --
> 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

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

* [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
@ 2013-05-09 18:11     ` Christoffer Dall
  0 siblings, 0 replies; 28+ messages in thread
From: Christoffer Dall @ 2013-05-09 18:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 03, 2013 at 03:02:52PM +0100, Marc Zyngier wrote:
> As KVM/arm64 is looming on the horizon, it makes sense to move some
> of the common code to a single location in order to reduce duplication.
> 
> The code could live anywhere. Actually, most of KVM is already built
> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
> not exactly talking about style here. But maybe it is time to start
> moving into a less ugly direction.
> 
> The include files must be in a "public" location, as they are accessed
> from non-KVM files (arch/arm/kernel/asm-offsets.c).
> 
> For this purpose, introduce two new locations:
> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
>   virt/kvm, so this could be seen as a (very ugly) precedent.
> - include/kvm/  : there is already an include/xen, and while the
>   intent is slightly different, this seems as good a location as
>   any

This overall looks ok, just a few points:

1. Should we have a namespace per arch in the include directory, as in
   include/kvm/arm?

2. We could drop the kvm_ prefix from the include files now

> 
> Eventually, we should probably have independant Makefiles at every
> levels (just like everywhere else in the kernel), but this is just
> the first step.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  arch/arm/include/asm/kvm_host.h                        | 4 ++--
>  arch/arm/kvm/Makefile                                  | 7 ++++---
>  {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
>  {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
>  {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
>  {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
>  6 files changed, 8 insertions(+), 7 deletions(-)
>  rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
>  rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
>  rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
>  rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)
> 
> diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
> index ff49193..4ad51e6 100644
> --- a/arch/arm/include/asm/kvm_host.h
> +++ b/arch/arm/include/asm/kvm_host.h
> @@ -23,7 +23,7 @@
>  #include <asm/kvm_asm.h>
>  #include <asm/kvm_mmio.h>
>  #include <asm/fpstate.h>
> -#include <asm/kvm_arch_timer.h>
> +#include <kvm/kvm_arch_timer.h>
>  
>  #define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
>  #define KVM_USER_MEM_SLOTS 32
> @@ -38,7 +38,7 @@
>  #define KVM_NR_PAGE_SIZES	1
>  #define KVM_PAGES_PER_HPAGE(x)	(1UL<<31)
>  
> -#include <asm/kvm_vgic.h>
> +#include <kvm/kvm_vgic.h>
>  
>  struct kvm_vcpu;
>  u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
> diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
> index 53c5ed8..110d6da 100644
> --- a/arch/arm/kvm/Makefile
> +++ b/arch/arm/kvm/Makefile
> @@ -14,10 +14,11 @@ CFLAGS_mmu.o := -I.
>  AFLAGS_init.o := -Wa,-march=armv7-a$(plus_virt)
>  AFLAGS_interrupts.o := -Wa,-march=armv7-a$(plus_virt)
>  
> -kvm-arm-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o)
> +KVM := ../../../virt/kvm
> +kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o)
>  
>  obj-y += kvm-arm.o init.o interrupts.o
>  obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
>  obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
> -obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
> -obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
> +obj-$(CONFIG_KVM_ARM_VGIC) += $(addprefix $(KVM)/arm/, vgic.o)
> +obj-$(CONFIG_KVM_ARM_TIMER) += $(addprefix $(KVM)/arm/, arch_timer.o)
> diff --git a/arch/arm/include/asm/kvm_arch_timer.h b/include/kvm/kvm_arch_timer.h
> similarity index 100%
> rename from arch/arm/include/asm/kvm_arch_timer.h
> rename to include/kvm/kvm_arch_timer.h
> diff --git a/arch/arm/include/asm/kvm_vgic.h b/include/kvm/kvm_vgic.h
> similarity index 100%
> rename from arch/arm/include/asm/kvm_vgic.h
> rename to include/kvm/kvm_vgic.h
> diff --git a/arch/arm/kvm/arch_timer.c b/virt/kvm/arm/arch_timer.c
> similarity index 99%
> rename from arch/arm/kvm/arch_timer.c
> rename to virt/kvm/arm/arch_timer.c
> index 49a7516..0728904 100644
> --- a/arch/arm/kvm/arch_timer.c
> +++ b/virt/kvm/arm/arch_timer.c
> @@ -25,8 +25,8 @@
>  #include <clocksource/arm_arch_timer.h>
>  #include <asm/arch_timer.h>
>  
> -#include <asm/kvm_vgic.h>
> -#include <asm/kvm_arch_timer.h>
> +#include <kvm/kvm_vgic.h>
> +#include <kvm/kvm_arch_timer.h>
>  
>  static struct timecounter *timecounter;
>  static struct workqueue_struct *wqueue;
> diff --git a/arch/arm/kvm/vgic.c b/virt/kvm/arm/vgic.c
> similarity index 100%
> rename from arch/arm/kvm/vgic.c
> rename to virt/kvm/arm/vgic.c
> -- 
> 1.8.2.1
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
  2013-05-09 18:11     ` Christoffer Dall
@ 2013-05-10  7:23       ` Marc Zyngier
  -1 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-10  7:23 UTC (permalink / raw)
  To: Christoffer Dall
  Cc: catalin.marinas, kvmarm, linux-arm-kernel, kvm, gleb, pbonzini

On Thu, 9 May 2013 11:11:01 -0700, Christoffer Dall
<cdall@cs.columbia.edu>
wrote:
> On Fri, May 03, 2013 at 03:02:52PM +0100, Marc Zyngier wrote:
>> As KVM/arm64 is looming on the horizon, it makes sense to move some
>> of the common code to a single location in order to reduce duplication.
>> 
>> The code could live anywhere. Actually, most of KVM is already built
>> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
>> not exactly talking about style here. But maybe it is time to start
>> moving into a less ugly direction.
>> 
>> The include files must be in a "public" location, as they are accessed
>> from non-KVM files (arch/arm/kernel/asm-offsets.c).
>> 
>> For this purpose, introduce two new locations:
>> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
>>   virt/kvm, so this could be seen as a (very ugly) precedent.
>> - include/kvm/  : there is already an include/xen, and while the
>>   intent is slightly different, this seems as good a location as
>>   any
> 
> This overall looks ok, just a few points:
> 
> 1. Should we have a namespace per arch in the include directory, as in
>    include/kvm/arm?

So I thought of that at one point, but discarded the idea because it seems
to convey the wrong message:
We're moving the include files because they are architecture independent,
and referring to an architecture name in the path feels a bit odd. Or maybe
arm-common?

I don't have strong feelings about it though...

> 2. We could drop the kvm_ prefix from the include files now

Agreed.

It would be interesting to see what the KVM maintainers think of all this.
Gleb? Paolo?

        M.
-- 
Fast, cheap, reliable. Pick two.

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

* [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
@ 2013-05-10  7:23       ` Marc Zyngier
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-10  7:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 9 May 2013 11:11:01 -0700, Christoffer Dall
<cdall@cs.columbia.edu>
wrote:
> On Fri, May 03, 2013 at 03:02:52PM +0100, Marc Zyngier wrote:
>> As KVM/arm64 is looming on the horizon, it makes sense to move some
>> of the common code to a single location in order to reduce duplication.
>> 
>> The code could live anywhere. Actually, most of KVM is already built
>> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
>> not exactly talking about style here. But maybe it is time to start
>> moving into a less ugly direction.
>> 
>> The include files must be in a "public" location, as they are accessed
>> from non-KVM files (arch/arm/kernel/asm-offsets.c).
>> 
>> For this purpose, introduce two new locations:
>> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
>>   virt/kvm, so this could be seen as a (very ugly) precedent.
>> - include/kvm/  : there is already an include/xen, and while the
>>   intent is slightly different, this seems as good a location as
>>   any
> 
> This overall looks ok, just a few points:
> 
> 1. Should we have a namespace per arch in the include directory, as in
>    include/kvm/arm?

So I thought of that at one point, but discarded the idea because it seems
to convey the wrong message:
We're moving the include files because they are architecture independent,
and referring to an architecture name in the path feels a bit odd. Or maybe
arm-common?

I don't have strong feelings about it though...

> 2. We could drop the kvm_ prefix from the include files now

Agreed.

It would be interesting to see what the KVM maintainers think of all this.
Gleb? Paolo?

        M.
-- 
Fast, cheap, reliable. Pick two.

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

* Re: [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
  2013-05-10  7:23       ` Marc Zyngier
@ 2013-05-10  8:09         ` Paolo Bonzini
  -1 siblings, 0 replies; 28+ messages in thread
From: Paolo Bonzini @ 2013-05-10  8:09 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Christoffer Dall, kvm, gleb, catalin.marinas, kvmarm, linux-arm-kernel

Il 10/05/2013 09:23, Marc Zyngier ha scritto:
> On Thu, 9 May 2013 11:11:01 -0700, Christoffer Dall
> <cdall@cs.columbia.edu>
> wrote:
>> On Fri, May 03, 2013 at 03:02:52PM +0100, Marc Zyngier wrote:
>>> As KVM/arm64 is looming on the horizon, it makes sense to move some
>>> of the common code to a single location in order to reduce duplication.
>>>
>>> The code could live anywhere. Actually, most of KVM is already built
>>> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
>>> not exactly talking about style here. But maybe it is time to start
>>> moving into a less ugly direction.
>>>
>>> The include files must be in a "public" location, as they are accessed
>>> from non-KVM files (arch/arm/kernel/asm-offsets.c).
>>>
>>> For this purpose, introduce two new locations:
>>> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
>>>   virt/kvm, so this could be seen as a (very ugly) precedent.
>>> - include/kvm/  : there is already an include/xen, and while the
>>>   intent is slightly different, this seems as good a location as
>>>   any
>>
>> This overall looks ok, just a few points:
>>
>> 1. Should we have a namespace per arch in the include directory, as in
>>    include/kvm/arm?
> 
> So I thought of that at one point, but discarded the idea because it seems
> to convey the wrong message:
> We're moving the include files because they are architecture independent,
> and referring to an architecture name in the path feels a bit odd. Or maybe
> arm-common?
> 
> I don't have strong feelings about it though...
> 
>> 2. We could drop the kvm_ prefix from the include files now
> 
> Agreed.
> 
> It would be interesting to see what the KVM maintainers think of all this.
> Gleb? Paolo?

include/kvm is good, there is no user-level API to care about.  Perhaps
you can name the includes kvm/arm_vgic.h and kvm/arm_arch_timer.h.  It
keeps the tree shallow but at the same time it suggests some parallel
between the source tree and the include tree.

virt/kvm/arm is certainly better than anything else that comes to mind
:) but I'm not a big fan of $(addprefix); this looks tidier to me:

KVM := ../../../virt/kvm

kvm-arm-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o
...
+obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o
+obj-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o

Paolo

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

* [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
@ 2013-05-10  8:09         ` Paolo Bonzini
  0 siblings, 0 replies; 28+ messages in thread
From: Paolo Bonzini @ 2013-05-10  8:09 UTC (permalink / raw)
  To: linux-arm-kernel

Il 10/05/2013 09:23, Marc Zyngier ha scritto:
> On Thu, 9 May 2013 11:11:01 -0700, Christoffer Dall
> <cdall@cs.columbia.edu>
> wrote:
>> On Fri, May 03, 2013 at 03:02:52PM +0100, Marc Zyngier wrote:
>>> As KVM/arm64 is looming on the horizon, it makes sense to move some
>>> of the common code to a single location in order to reduce duplication.
>>>
>>> The code could live anywhere. Actually, most of KVM is already built
>>> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
>>> not exactly talking about style here. But maybe it is time to start
>>> moving into a less ugly direction.
>>>
>>> The include files must be in a "public" location, as they are accessed
>>> from non-KVM files (arch/arm/kernel/asm-offsets.c).
>>>
>>> For this purpose, introduce two new locations:
>>> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
>>>   virt/kvm, so this could be seen as a (very ugly) precedent.
>>> - include/kvm/  : there is already an include/xen, and while the
>>>   intent is slightly different, this seems as good a location as
>>>   any
>>
>> This overall looks ok, just a few points:
>>
>> 1. Should we have a namespace per arch in the include directory, as in
>>    include/kvm/arm?
> 
> So I thought of that at one point, but discarded the idea because it seems
> to convey the wrong message:
> We're moving the include files because they are architecture independent,
> and referring to an architecture name in the path feels a bit odd. Or maybe
> arm-common?
> 
> I don't have strong feelings about it though...
> 
>> 2. We could drop the kvm_ prefix from the include files now
> 
> Agreed.
> 
> It would be interesting to see what the KVM maintainers think of all this.
> Gleb? Paolo?

include/kvm is good, there is no user-level API to care about.  Perhaps
you can name the includes kvm/arm_vgic.h and kvm/arm_arch_timer.h.  It
keeps the tree shallow but at the same time it suggests some parallel
between the source tree and the include tree.

virt/kvm/arm is certainly better than anything else that comes to mind
:) but I'm not a big fan of $(addprefix); this looks tidier to me:

KVM := ../../../virt/kvm

kvm-arm-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o
...
+obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o
+obj-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o

Paolo

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

* Re: [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
  2013-05-10  7:23       ` Marc Zyngier
@ 2013-05-10  8:11         ` Paolo Bonzini
  -1 siblings, 0 replies; 28+ messages in thread
From: Paolo Bonzini @ 2013-05-10  8:11 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Christoffer Dall, catalin.marinas, kvmarm, linux-arm-kernel, kvm, gleb

Il 10/05/2013 09:23, Marc Zyngier ha scritto:
>> > 1. Should we have a namespace per arch in the include directory, as in
>> >    include/kvm/arm?
> So I thought of that at one point, but discarded the idea because it seems
> to convey the wrong message:
> We're moving the include files because they are architecture independent,
> and referring to an architecture name in the path feels a bit odd. Or maybe
> arm-common?

As I wrote in the other message, Linux in general has a shallow include/
tree, so I think putting them in include/kvm/ is good.

Is there any precedent for naming stuff that is common to arm and
aarch64?  I think to 99% of the world they will both be "arm", but of
course the remaining 1% is likely over-represented among KVM-ARM
maintainers. :)

Paolo

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

* [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
@ 2013-05-10  8:11         ` Paolo Bonzini
  0 siblings, 0 replies; 28+ messages in thread
From: Paolo Bonzini @ 2013-05-10  8:11 UTC (permalink / raw)
  To: linux-arm-kernel

Il 10/05/2013 09:23, Marc Zyngier ha scritto:
>> > 1. Should we have a namespace per arch in the include directory, as in
>> >    include/kvm/arm?
> So I thought of that at one point, but discarded the idea because it seems
> to convey the wrong message:
> We're moving the include files because they are architecture independent,
> and referring to an architecture name in the path feels a bit odd. Or maybe
> arm-common?

As I wrote in the other message, Linux in general has a shallow include/
tree, so I think putting them in include/kvm/ is good.

Is there any precedent for naming stuff that is common to arm and
aarch64?  I think to 99% of the world they will both be "arm", but of
course the remaining 1% is likely over-represented among KVM-ARM
maintainers. :)

Paolo

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

* Re: [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
  2013-05-10  8:11         ` Paolo Bonzini
@ 2013-05-10  8:46           ` Marc Zyngier
  -1 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-10  8:46 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Christoffer Dall, Catalin Marinas, kvmarm, linux-arm-kernel, kvm, gleb

On 10/05/13 09:11, Paolo Bonzini wrote:
> Il 10/05/2013 09:23, Marc Zyngier ha scritto:
>>>> 1. Should we have a namespace per arch in the include directory, as in
>>>>    include/kvm/arm?
>> So I thought of that at one point, but discarded the idea because it seems
>> to convey the wrong message:
>> We're moving the include files because they are architecture independent,
>> and referring to an architecture name in the path feels a bit odd. Or maybe
>> arm-common?
> 
> As I wrote in the other message, Linux in general has a shallow include/
> tree, so I think putting them in include/kvm/ is good.
> 
> Is there any precedent for naming stuff that is common to arm and
> aarch64?  

So far, we have:
- include/linux/irqchip/arm-gic.h
- include/clocksource/arm_arch_timer.h

So the trend seems to use "arm" as a prefix, and I will rename the files
to match this convention (which you actually suggested in your other email).

> I think to 99% of the world they will both be "arm", but of
> course the remaining 1% is likely over-represented among KVM-ARM
> maintainers. :)

Who? What? ;-)

Do you have any comment about patch 2/2? It is a bit more invasive, but
it is a cleanup in my opinion.

Thanks for the feedback,

	M.
-- 
Jazz is not dead. It just smells funny...


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

* [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location
@ 2013-05-10  8:46           ` Marc Zyngier
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-10  8:46 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/05/13 09:11, Paolo Bonzini wrote:
> Il 10/05/2013 09:23, Marc Zyngier ha scritto:
>>>> 1. Should we have a namespace per arch in the include directory, as in
>>>>    include/kvm/arm?
>> So I thought of that at one point, but discarded the idea because it seems
>> to convey the wrong message:
>> We're moving the include files because they are architecture independent,
>> and referring to an architecture name in the path feels a bit odd. Or maybe
>> arm-common?
> 
> As I wrote in the other message, Linux in general has a shallow include/
> tree, so I think putting them in include/kvm/ is good.
> 
> Is there any precedent for naming stuff that is common to arm and
> aarch64?  

So far, we have:
- include/linux/irqchip/arm-gic.h
- include/clocksource/arm_arch_timer.h

So the trend seems to use "arm" as a prefix, and I will rename the files
to match this convention (which you actually suggested in your other email).

> I think to 99% of the world they will both be "arm", but of
> course the remaining 1% is likely over-represented among KVM-ARM
> maintainers. :)

Who? What? ;-)

Do you have any comment about patch 2/2? It is a bit more invasive, but
it is a cleanup in my opinion.

Thanks for the feedback,

	M.
-- 
Jazz is not dead. It just smells funny...

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

* Re: [RFC PATCH 2/2] ARM: KVM: standalone Makefile for vgic and timers
  2013-05-03 14:02   ` Marc Zyngier
@ 2013-05-10  9:39     ` Paolo Bonzini
  -1 siblings, 0 replies; 28+ messages in thread
From: Paolo Bonzini @ 2013-05-10  9:39 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: cdall, catalin.marinas, kvmarm, linux-arm-kernel, kvm

Il 03/05/2013 16:02, Marc Zyngier ha scritto:
> On the road to turn KVM/arm64 into something more sensible, change
> the way we compile the VGIC and arch_timer code by using local
> Makefiles instead of the very backward method we used before.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  Makefile              | 2 +-
>  arch/arm/kvm/Makefile | 2 --
>  virt/Makefile         | 1 +
>  virt/kvm/Makefile     | 1 +
>  virt/kvm/arm/Makefile | 2 ++
>  5 files changed, 5 insertions(+), 3 deletions(-)
>  create mode 100644 virt/Makefile
>  create mode 100644 virt/kvm/Makefile
>  create mode 100644 virt/kvm/arm/Makefile
> 
> diff --git a/Makefile b/Makefile
> index 6db672b..19d51df 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -732,7 +732,7 @@ export mod_sign_cmd
>  
>  
>  ifeq ($(KBUILD_EXTMOD),)
> -core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/
> +core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/ virt/
>  
>  vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
>  		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
> diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
> index 110d6da..e0540fd 100644
> --- a/arch/arm/kvm/Makefile
> +++ b/arch/arm/kvm/Makefile
> @@ -20,5 +20,3 @@ kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o)
>  obj-y += kvm-arm.o init.o interrupts.o
>  obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
>  obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
> -obj-$(CONFIG_KVM_ARM_VGIC) += $(addprefix $(KVM)/arm/, vgic.o)
> -obj-$(CONFIG_KVM_ARM_TIMER) += $(addprefix $(KVM)/arm/, arch_timer.o)
> diff --git a/virt/Makefile b/virt/Makefile
> new file mode 100644
> index 0000000..c3b9ad0
> --- /dev/null
> +++ b/virt/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_KVM)	+= kvm/
> diff --git a/virt/kvm/Makefile b/virt/kvm/Makefile
> new file mode 100644
> index 0000000..dc87943
> --- /dev/null
> +++ b/virt/kvm/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_KVM_ARM_HOST)	+= arm/
> diff --git a/virt/kvm/arm/Makefile b/virt/kvm/arm/Makefile
> new file mode 100644
> index 0000000..4df943b
> --- /dev/null
> +++ b/virt/kvm/arm/Makefile
> @@ -0,0 +1,2 @@
> +obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
> +obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
> 

I'm not sure it is a good idea to do this just for ARM, and I think the
patch would look quite different if you were to support x86 (because x86
builds KVM as a module).  So I would hold off this for now.

OTOH, it is a good idea to use the same idiom to access
../../../virt/kvm from the arch directories.  Can you change
x86/PPC/s390/ia64 as well to use $(KVM) instead of $(addprefix)?

Paolo

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

* [RFC PATCH 2/2] ARM: KVM: standalone Makefile for vgic and timers
@ 2013-05-10  9:39     ` Paolo Bonzini
  0 siblings, 0 replies; 28+ messages in thread
From: Paolo Bonzini @ 2013-05-10  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

Il 03/05/2013 16:02, Marc Zyngier ha scritto:
> On the road to turn KVM/arm64 into something more sensible, change
> the way we compile the VGIC and arch_timer code by using local
> Makefiles instead of the very backward method we used before.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  Makefile              | 2 +-
>  arch/arm/kvm/Makefile | 2 --
>  virt/Makefile         | 1 +
>  virt/kvm/Makefile     | 1 +
>  virt/kvm/arm/Makefile | 2 ++
>  5 files changed, 5 insertions(+), 3 deletions(-)
>  create mode 100644 virt/Makefile
>  create mode 100644 virt/kvm/Makefile
>  create mode 100644 virt/kvm/arm/Makefile
> 
> diff --git a/Makefile b/Makefile
> index 6db672b..19d51df 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -732,7 +732,7 @@ export mod_sign_cmd
>  
>  
>  ifeq ($(KBUILD_EXTMOD),)
> -core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/
> +core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/ virt/
>  
>  vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
>  		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
> diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
> index 110d6da..e0540fd 100644
> --- a/arch/arm/kvm/Makefile
> +++ b/arch/arm/kvm/Makefile
> @@ -20,5 +20,3 @@ kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o)
>  obj-y += kvm-arm.o init.o interrupts.o
>  obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
>  obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
> -obj-$(CONFIG_KVM_ARM_VGIC) += $(addprefix $(KVM)/arm/, vgic.o)
> -obj-$(CONFIG_KVM_ARM_TIMER) += $(addprefix $(KVM)/arm/, arch_timer.o)
> diff --git a/virt/Makefile b/virt/Makefile
> new file mode 100644
> index 0000000..c3b9ad0
> --- /dev/null
> +++ b/virt/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_KVM)	+= kvm/
> diff --git a/virt/kvm/Makefile b/virt/kvm/Makefile
> new file mode 100644
> index 0000000..dc87943
> --- /dev/null
> +++ b/virt/kvm/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_KVM_ARM_HOST)	+= arm/
> diff --git a/virt/kvm/arm/Makefile b/virt/kvm/arm/Makefile
> new file mode 100644
> index 0000000..4df943b
> --- /dev/null
> +++ b/virt/kvm/arm/Makefile
> @@ -0,0 +1,2 @@
> +obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
> +obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
> 

I'm not sure it is a good idea to do this just for ARM, and I think the
patch would look quite different if you were to support x86 (because x86
builds KVM as a module).  So I would hold off this for now.

OTOH, it is a good idea to use the same idiom to access
../../../virt/kvm from the arch directories.  Can you change
x86/PPC/s390/ia64 as well to use $(KVM) instead of $(addprefix)?

Paolo

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

* Re: [RFC PATCH 2/2] ARM: KVM: standalone Makefile for vgic and timers
  2013-05-10  9:39     ` Paolo Bonzini
@ 2013-05-10  9:59       ` Marc Zyngier
  -1 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-10  9:59 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: linux-arm-kernel, kvmarm, kvm, cdall, Catalin Marinas

On 10/05/13 10:39, Paolo Bonzini wrote:
> Il 03/05/2013 16:02, Marc Zyngier ha scritto:
>> On the road to turn KVM/arm64 into something more sensible, change
>> the way we compile the VGIC and arch_timer code by using local
>> Makefiles instead of the very backward method we used before.
>>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>> ---
>>  Makefile              | 2 +-
>>  arch/arm/kvm/Makefile | 2 --
>>  virt/Makefile         | 1 +
>>  virt/kvm/Makefile     | 1 +
>>  virt/kvm/arm/Makefile | 2 ++
>>  5 files changed, 5 insertions(+), 3 deletions(-)
>>  create mode 100644 virt/Makefile
>>  create mode 100644 virt/kvm/Makefile
>>  create mode 100644 virt/kvm/arm/Makefile
>>
>> diff --git a/Makefile b/Makefile
>> index 6db672b..19d51df 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -732,7 +732,7 @@ export mod_sign_cmd
>>  
>>  
>>  ifeq ($(KBUILD_EXTMOD),)
>> -core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/
>> +core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/ virt/
>>  
>>  vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
>>  		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
>> diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
>> index 110d6da..e0540fd 100644
>> --- a/arch/arm/kvm/Makefile
>> +++ b/arch/arm/kvm/Makefile
>> @@ -20,5 +20,3 @@ kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o)
>>  obj-y += kvm-arm.o init.o interrupts.o
>>  obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
>>  obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
>> -obj-$(CONFIG_KVM_ARM_VGIC) += $(addprefix $(KVM)/arm/, vgic.o)
>> -obj-$(CONFIG_KVM_ARM_TIMER) += $(addprefix $(KVM)/arm/, arch_timer.o)
>> diff --git a/virt/Makefile b/virt/Makefile
>> new file mode 100644
>> index 0000000..c3b9ad0
>> --- /dev/null
>> +++ b/virt/Makefile
>> @@ -0,0 +1 @@
>> +obj-$(CONFIG_KVM)	+= kvm/
>> diff --git a/virt/kvm/Makefile b/virt/kvm/Makefile
>> new file mode 100644
>> index 0000000..dc87943
>> --- /dev/null
>> +++ b/virt/kvm/Makefile
>> @@ -0,0 +1 @@
>> +obj-$(CONFIG_KVM_ARM_HOST)	+= arm/
>> diff --git a/virt/kvm/arm/Makefile b/virt/kvm/arm/Makefile
>> new file mode 100644
>> index 0000000..4df943b
>> --- /dev/null
>> +++ b/virt/kvm/arm/Makefile
>> @@ -0,0 +1,2 @@
>> +obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
>> +obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
>>
> 
> I'm not sure it is a good idea to do this just for ARM, and I think the
> patch would look quite different if you were to support x86 (because x86
> builds KVM as a module).  So I would hold off this for now.

Fair enough.

> OTOH, it is a good idea to use the same idiom to access
> ../../../virt/kvm from the arch directories.  Can you change
> x86/PPC/s390/ia64 as well to use $(KVM) instead of $(addprefix)?

Sure. I'll rework the series to include the other arches.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...


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

* [RFC PATCH 2/2] ARM: KVM: standalone Makefile for vgic and timers
@ 2013-05-10  9:59       ` Marc Zyngier
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Zyngier @ 2013-05-10  9:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/05/13 10:39, Paolo Bonzini wrote:
> Il 03/05/2013 16:02, Marc Zyngier ha scritto:
>> On the road to turn KVM/arm64 into something more sensible, change
>> the way we compile the VGIC and arch_timer code by using local
>> Makefiles instead of the very backward method we used before.
>>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>> ---
>>  Makefile              | 2 +-
>>  arch/arm/kvm/Makefile | 2 --
>>  virt/Makefile         | 1 +
>>  virt/kvm/Makefile     | 1 +
>>  virt/kvm/arm/Makefile | 2 ++
>>  5 files changed, 5 insertions(+), 3 deletions(-)
>>  create mode 100644 virt/Makefile
>>  create mode 100644 virt/kvm/Makefile
>>  create mode 100644 virt/kvm/arm/Makefile
>>
>> diff --git a/Makefile b/Makefile
>> index 6db672b..19d51df 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -732,7 +732,7 @@ export mod_sign_cmd
>>  
>>  
>>  ifeq ($(KBUILD_EXTMOD),)
>> -core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/
>> +core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/ virt/
>>  
>>  vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
>>  		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
>> diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
>> index 110d6da..e0540fd 100644
>> --- a/arch/arm/kvm/Makefile
>> +++ b/arch/arm/kvm/Makefile
>> @@ -20,5 +20,3 @@ kvm-arm-y = $(addprefix $(KVM)/, kvm_main.o coalesced_mmio.o)
>>  obj-y += kvm-arm.o init.o interrupts.o
>>  obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
>>  obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
>> -obj-$(CONFIG_KVM_ARM_VGIC) += $(addprefix $(KVM)/arm/, vgic.o)
>> -obj-$(CONFIG_KVM_ARM_TIMER) += $(addprefix $(KVM)/arm/, arch_timer.o)
>> diff --git a/virt/Makefile b/virt/Makefile
>> new file mode 100644
>> index 0000000..c3b9ad0
>> --- /dev/null
>> +++ b/virt/Makefile
>> @@ -0,0 +1 @@
>> +obj-$(CONFIG_KVM)	+= kvm/
>> diff --git a/virt/kvm/Makefile b/virt/kvm/Makefile
>> new file mode 100644
>> index 0000000..dc87943
>> --- /dev/null
>> +++ b/virt/kvm/Makefile
>> @@ -0,0 +1 @@
>> +obj-$(CONFIG_KVM_ARM_HOST)	+= arm/
>> diff --git a/virt/kvm/arm/Makefile b/virt/kvm/arm/Makefile
>> new file mode 100644
>> index 0000000..4df943b
>> --- /dev/null
>> +++ b/virt/kvm/arm/Makefile
>> @@ -0,0 +1,2 @@
>> +obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
>> +obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
>>
> 
> I'm not sure it is a good idea to do this just for ARM, and I think the
> patch would look quite different if you were to support x86 (because x86
> builds KVM as a module).  So I would hold off this for now.

Fair enough.

> OTOH, it is a good idea to use the same idiom to access
> ../../../virt/kvm from the arch directories.  Can you change
> x86/PPC/s390/ia64 as well to use $(KVM) instead of $(addprefix)?

Sure. I'll rework the series to include the other arches.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

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

* Re: [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm
  2013-05-03 15:55     ` Marc Zyngier
@ 2013-05-12  9:03       ` Gleb Natapov
  -1 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2013-05-12  9:03 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Anup Patel, linux-arm-kernel, kvmarm, kvm, Christoffer Dall,
	Catalin Marinas

On Fri, May 03, 2013 at 04:55:01PM +0100, Marc Zyngier wrote:
> On 03/05/13 16:31, Anup Patel wrote:
> > On Fri, May 3, 2013 at 7:32 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> >> As KVM/arm64 is looming on the horizon, it makes sense to move some
> >> of the common code to a single location in order to reduce duplication.
> >>
> >> The code could live anywhere. Actually, most of KVM is already built
> >> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
> >> not exactly talking about style here. But maybe it is time to start
> >> moving into a less ugly direction.
> >>
> >> The include files must be in a "public" location, as they are accessed
> >> from non-KVM files (arch/arm/kernel/asm-offsets.c).
> >>
> >> For this purpose, introduce two new locations:
> >> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
> >>   virt/kvm, so this could be seen as a (very ugly) precedent.
> >> - include/kvm/  : there is already an include/xen, and while the
> >>   intent is slightly different, this seems as good a location as
> >>   any
> >>
> >> Once the code has been moved, it becomes easy to build it in a
> >> less hackish way, which makes the code easily reusable by KVM/arm64.
> >>
> >> Marc Zyngier (2):
> >>   ARM: KVM: move GIC/timer code to a common location
> >>   ARM: KVM: standalone Makefile for vgic and timers
> >>
> >>  Makefile                                               | 2 +-
> >>  arch/arm/include/asm/kvm_host.h                        | 4 ++--
> >>  arch/arm/kvm/Makefile                                  | 5 ++---
> >>  {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
> >>  {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
> >>  virt/Makefile                                          | 1 +
> >>  virt/kvm/Makefile                                      | 1 +
> >>  virt/kvm/arm/Makefile                                  | 2 ++
> >>  {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
> >>  {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
> >>  10 files changed, 11 insertions(+), 8 deletions(-)
> >>  rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
> >>  rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
> >>  create mode 100644 virt/Makefile
> >>  create mode 100644 virt/kvm/Makefile
> >>  create mode 100644 virt/kvm/arm/Makefile
> >>  rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
> >>  rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)
> >>
> >> --
> >> 1.8.2.1
> >>
> >>
> >>
> >> _______________________________________________
> >> kvmarm mailing list
> >> kvmarm@lists.cs.columbia.edu
> >> https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm
> > 
> > The source files arch/arm/kvm/arm.c and arch/arm/kvm/mmu.c are also
> > shared between KVM ARM and KVM ARM64.
> > 
> > Can we move these files in virt/arm ?
> 
> I suggest we start by finding out if there is an agreement on the
> location, method and overall usefulness of this particular patch.
> 
> Moving core ARM code around is quite different from sharing what is
> basically device emulation stuff.
> 
Yes, so the question in this regard: are there any plans to eventually
merge arch/arm and arch/arm64 like it happened with arch/i386
and arch/x86_64?  Is it even feasible?  Looking at the dark days of
i386/x86_64 split there were a lot of ../../i386/ and -Iarch/i386/kernel
in arch/x86_64. Isn't there some code, outside of kvm, that can be shared
between arm/arm64? How will it be shared?

--
			Gleb.

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

* [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm
@ 2013-05-12  9:03       ` Gleb Natapov
  0 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2013-05-12  9:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 03, 2013 at 04:55:01PM +0100, Marc Zyngier wrote:
> On 03/05/13 16:31, Anup Patel wrote:
> > On Fri, May 3, 2013 at 7:32 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> >> As KVM/arm64 is looming on the horizon, it makes sense to move some
> >> of the common code to a single location in order to reduce duplication.
> >>
> >> The code could live anywhere. Actually, most of KVM is already built
> >> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
> >> not exactly talking about style here. But maybe it is time to start
> >> moving into a less ugly direction.
> >>
> >> The include files must be in a "public" location, as they are accessed
> >> from non-KVM files (arch/arm/kernel/asm-offsets.c).
> >>
> >> For this purpose, introduce two new locations:
> >> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
> >>   virt/kvm, so this could be seen as a (very ugly) precedent.
> >> - include/kvm/  : there is already an include/xen, and while the
> >>   intent is slightly different, this seems as good a location as
> >>   any
> >>
> >> Once the code has been moved, it becomes easy to build it in a
> >> less hackish way, which makes the code easily reusable by KVM/arm64.
> >>
> >> Marc Zyngier (2):
> >>   ARM: KVM: move GIC/timer code to a common location
> >>   ARM: KVM: standalone Makefile for vgic and timers
> >>
> >>  Makefile                                               | 2 +-
> >>  arch/arm/include/asm/kvm_host.h                        | 4 ++--
> >>  arch/arm/kvm/Makefile                                  | 5 ++---
> >>  {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
> >>  {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
> >>  virt/Makefile                                          | 1 +
> >>  virt/kvm/Makefile                                      | 1 +
> >>  virt/kvm/arm/Makefile                                  | 2 ++
> >>  {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
> >>  {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
> >>  10 files changed, 11 insertions(+), 8 deletions(-)
> >>  rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
> >>  rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
> >>  create mode 100644 virt/Makefile
> >>  create mode 100644 virt/kvm/Makefile
> >>  create mode 100644 virt/kvm/arm/Makefile
> >>  rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
> >>  rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)
> >>
> >> --
> >> 1.8.2.1
> >>
> >>
> >>
> >> _______________________________________________
> >> kvmarm mailing list
> >> kvmarm at lists.cs.columbia.edu
> >> https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm
> > 
> > The source files arch/arm/kvm/arm.c and arch/arm/kvm/mmu.c are also
> > shared between KVM ARM and KVM ARM64.
> > 
> > Can we move these files in virt/arm ?
> 
> I suggest we start by finding out if there is an agreement on the
> location, method and overall usefulness of this particular patch.
> 
> Moving core ARM code around is quite different from sharing what is
> basically device emulation stuff.
> 
Yes, so the question in this regard: are there any plans to eventually
merge arch/arm and arch/arm64 like it happened with arch/i386
and arch/x86_64?  Is it even feasible?  Looking at the dark days of
i386/x86_64 split there were a lot of ../../i386/ and -Iarch/i386/kernel
in arch/x86_64. Isn't there some code, outside of kvm, that can be shared
between arm/arm64? How will it be shared?

--
			Gleb.

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

* Re: [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm
  2013-05-12  9:03       ` Gleb Natapov
@ 2013-05-12 10:23         ` Catalin Marinas
  -1 siblings, 0 replies; 28+ messages in thread
From: Catalin Marinas @ 2013-05-12 10:23 UTC (permalink / raw)
  To: Gleb Natapov
  Cc: Marc Zyngier, Anup Patel, linux-arm-kernel, kvmarm, kvm,
	Christoffer Dall

Hi Gleb,

On Sun, May 12, 2013 at 10:03:59AM +0100, Gleb Natapov wrote:
> On Fri, May 03, 2013 at 04:55:01PM +0100, Marc Zyngier wrote:
> > On 03/05/13 16:31, Anup Patel wrote:
> > > On Fri, May 3, 2013 at 7:32 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> > >> As KVM/arm64 is looming on the horizon, it makes sense to move some
> > >> of the common code to a single location in order to reduce duplication.
> > >>
> > >> The code could live anywhere. Actually, most of KVM is already built
> > >> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
> > >> not exactly talking about style here. But maybe it is time to start
> > >> moving into a less ugly direction.
> > >>
> > >> The include files must be in a "public" location, as they are accessed
> > >> from non-KVM files (arch/arm/kernel/asm-offsets.c).
> > >>
> > >> For this purpose, introduce two new locations:
> > >> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
> > >>   virt/kvm, so this could be seen as a (very ugly) precedent.
> > >> - include/kvm/  : there is already an include/xen, and while the
> > >>   intent is slightly different, this seems as good a location as
> > >>   any
> > >>
> > >> Once the code has been moved, it becomes easy to build it in a
> > >> less hackish way, which makes the code easily reusable by KVM/arm64.
> > >>
> > >> Marc Zyngier (2):
> > >>   ARM: KVM: move GIC/timer code to a common location
> > >>   ARM: KVM: standalone Makefile for vgic and timers
> > >>
> > >>  Makefile                                               | 2 +-
> > >>  arch/arm/include/asm/kvm_host.h                        | 4 ++--
> > >>  arch/arm/kvm/Makefile                                  | 5 ++---
> > >>  {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
> > >>  {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
> > >>  virt/Makefile                                          | 1 +
> > >>  virt/kvm/Makefile                                      | 1 +
> > >>  virt/kvm/arm/Makefile                                  | 2 ++
> > >>  {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
> > >>  {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
> > >>  10 files changed, 11 insertions(+), 8 deletions(-)
> > >>  rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
> > >>  rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
> > >>  create mode 100644 virt/Makefile
> > >>  create mode 100644 virt/kvm/Makefile
> > >>  create mode 100644 virt/kvm/arm/Makefile
> > >>  rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
> > >>  rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)
> > > 
> > > The source files arch/arm/kvm/arm.c and arch/arm/kvm/mmu.c are also
> > > shared between KVM ARM and KVM ARM64.
> > > 
> > > Can we move these files in virt/arm ?
> > 
> > I suggest we start by finding out if there is an agreement on the
> > location, method and overall usefulness of this particular patch.
> > 
> > Moving core ARM code around is quite different from sharing what is
> > basically device emulation stuff.
> > 
> Yes, so the question in this regard: are there any plans to eventually
> merge arch/arm and arch/arm64 like it happened with arch/i386
> and arch/x86_64?  Is it even feasible?  Looking at the dark days of
> i386/x86_64 split there were a lot of ../../i386/ and -Iarch/i386/kernel
> in arch/x86_64. Isn't there some code, outside of kvm, that can be shared
> between arm/arm64? How will it be shared?

There are similarities between arm and arm64 (especially since the arm64
port started as a fork of arm) and few other bits that could be shared
but the benefits of a clean port outweigh a bit of code duplication.
Most of the SoC support is now going into drivers, so it's pretty much
architecture code left under arch/arm64.

KVM is the first to make references to ../arm/ from arm64 and I don't
see an easy solution (and I wouldn't like to see common arm/arm64 code
under the top kvm directory either, apart form device emulation). Of
course, a lot of the code like page table maintenance, mapping/unmapping
ranges is pretty generic and could be shared with other architectures
(e.g. x86) but it's not a trivial task.

-- 
Catalin

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

* [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm
@ 2013-05-12 10:23         ` Catalin Marinas
  0 siblings, 0 replies; 28+ messages in thread
From: Catalin Marinas @ 2013-05-12 10:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Gleb,

On Sun, May 12, 2013 at 10:03:59AM +0100, Gleb Natapov wrote:
> On Fri, May 03, 2013 at 04:55:01PM +0100, Marc Zyngier wrote:
> > On 03/05/13 16:31, Anup Patel wrote:
> > > On Fri, May 3, 2013 at 7:32 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> > >> As KVM/arm64 is looming on the horizon, it makes sense to move some
> > >> of the common code to a single location in order to reduce duplication.
> > >>
> > >> The code could live anywhere. Actually, most of KVM is already built
> > >> with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
> > >> not exactly talking about style here. But maybe it is time to start
> > >> moving into a less ugly direction.
> > >>
> > >> The include files must be in a "public" location, as they are accessed
> > >> from non-KVM files (arch/arm/kernel/asm-offsets.c).
> > >>
> > >> For this purpose, introduce two new locations:
> > >> - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
> > >>   virt/kvm, so this could be seen as a (very ugly) precedent.
> > >> - include/kvm/  : there is already an include/xen, and while the
> > >>   intent is slightly different, this seems as good a location as
> > >>   any
> > >>
> > >> Once the code has been moved, it becomes easy to build it in a
> > >> less hackish way, which makes the code easily reusable by KVM/arm64.
> > >>
> > >> Marc Zyngier (2):
> > >>   ARM: KVM: move GIC/timer code to a common location
> > >>   ARM: KVM: standalone Makefile for vgic and timers
> > >>
> > >>  Makefile                                               | 2 +-
> > >>  arch/arm/include/asm/kvm_host.h                        | 4 ++--
> > >>  arch/arm/kvm/Makefile                                  | 5 ++---
> > >>  {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h | 0
> > >>  {arch/arm/include/asm => include/kvm}/kvm_vgic.h       | 0
> > >>  virt/Makefile                                          | 1 +
> > >>  virt/kvm/Makefile                                      | 1 +
> > >>  virt/kvm/arm/Makefile                                  | 2 ++
> > >>  {arch/arm/kvm => virt/kvm/arm}/arch_timer.c            | 4 ++--
> > >>  {arch/arm/kvm => virt/kvm/arm}/vgic.c                  | 0
> > >>  10 files changed, 11 insertions(+), 8 deletions(-)
> > >>  rename {arch/arm/include/asm => include/kvm}/kvm_arch_timer.h (100%)
> > >>  rename {arch/arm/include/asm => include/kvm}/kvm_vgic.h (100%)
> > >>  create mode 100644 virt/Makefile
> > >>  create mode 100644 virt/kvm/Makefile
> > >>  create mode 100644 virt/kvm/arm/Makefile
> > >>  rename {arch/arm/kvm => virt/kvm/arm}/arch_timer.c (99%)
> > >>  rename {arch/arm/kvm => virt/kvm/arm}/vgic.c (100%)
> > > 
> > > The source files arch/arm/kvm/arm.c and arch/arm/kvm/mmu.c are also
> > > shared between KVM ARM and KVM ARM64.
> > > 
> > > Can we move these files in virt/arm ?
> > 
> > I suggest we start by finding out if there is an agreement on the
> > location, method and overall usefulness of this particular patch.
> > 
> > Moving core ARM code around is quite different from sharing what is
> > basically device emulation stuff.
> > 
> Yes, so the question in this regard: are there any plans to eventually
> merge arch/arm and arch/arm64 like it happened with arch/i386
> and arch/x86_64?  Is it even feasible?  Looking at the dark days of
> i386/x86_64 split there were a lot of ../../i386/ and -Iarch/i386/kernel
> in arch/x86_64. Isn't there some code, outside of kvm, that can be shared
> between arm/arm64? How will it be shared?

There are similarities between arm and arm64 (especially since the arm64
port started as a fork of arm) and few other bits that could be shared
but the benefits of a clean port outweigh a bit of code duplication.
Most of the SoC support is now going into drivers, so it's pretty much
architecture code left under arch/arm64.

KVM is the first to make references to ../arm/ from arm64 and I don't
see an easy solution (and I wouldn't like to see common arm/arm64 code
under the top kvm directory either, apart form device emulation). Of
course, a lot of the code like page table maintenance, mapping/unmapping
ranges is pretty generic and could be shared with other architectures
(e.g. x86) but it's not a trivial task.

-- 
Catalin

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

end of thread, other threads:[~2013-05-12 10:24 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-03 14:02 [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm Marc Zyngier
2013-05-03 14:02 ` Marc Zyngier
2013-05-03 14:02 ` [RFC PATCH 1/2] ARM: KVM: move GIC/timer code to a common location Marc Zyngier
2013-05-03 14:02   ` Marc Zyngier
2013-05-09 18:11   ` Christoffer Dall
2013-05-09 18:11     ` Christoffer Dall
2013-05-10  7:23     ` Marc Zyngier
2013-05-10  7:23       ` Marc Zyngier
2013-05-10  8:09       ` Paolo Bonzini
2013-05-10  8:09         ` Paolo Bonzini
2013-05-10  8:11       ` Paolo Bonzini
2013-05-10  8:11         ` Paolo Bonzini
2013-05-10  8:46         ` Marc Zyngier
2013-05-10  8:46           ` Marc Zyngier
2013-05-03 14:02 ` [RFC PATCH 2/2] ARM: KVM: standalone Makefile for vgic and timers Marc Zyngier
2013-05-03 14:02   ` Marc Zyngier
2013-05-10  9:39   ` Paolo Bonzini
2013-05-10  9:39     ` Paolo Bonzini
2013-05-10  9:59     ` Marc Zyngier
2013-05-10  9:59       ` Marc Zyngier
2013-05-03 15:31 ` [RFC PATCH 0/2] ARM: KVM: Moving GIC/timer out of arch/arm Anup Patel
2013-05-03 15:31   ` Anup Patel
2013-05-03 15:55   ` Marc Zyngier
2013-05-03 15:55     ` Marc Zyngier
2013-05-12  9:03     ` Gleb Natapov
2013-05-12  9:03       ` Gleb Natapov
2013-05-12 10:23       ` Catalin Marinas
2013-05-12 10:23         ` Catalin Marinas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.