All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Get rid of mandatory huge page defines
@ 2013-10-02 21:22 ` Christoffer Dall
  0 siblings, 0 replies; 39+ messages in thread
From: Christoffer Dall @ 2013-10-02 21:22 UTC (permalink / raw)
  To: kvm-ia64

The current KVM code relies on a number of definitions to exist for each
architecture:
  KVM_HPAGE_GFN_SHIFT
  KVM_NR_HPAGE_SIZES
  KVM_PAGES_PER_HPAGE

However, these defines are only used in the gfn_to_index function, which
is only used in the x86 code.  This series moves the gfn_to_index
function from the generic KVM code into the x86 world and gets rid of
the definitions from archiectures that don't use them.  s390 actually
uses these values in other code, so we leave that part untouched.

Patches based on kvm/next and available here:
git://git.linaro.org/people/cdall/linux-kvm-arm.git kvm-pagesize-cleanup

Christoffer Dall (6):
  KVM: Move gfn_to_index to x86 specific code
  KVM: ARM: Get rid of KVM_HPAGE defines
  KVM: arm64: Get rid of KVM_HPAGE defines
  KVM: mips: Get rid of KVM_HPAGE defines
  KVM: ia64: Get rid of KVM_HPAGE defines
  KVM: PPC: Get rid of KVM_HPAGE defines

 arch/arm/include/asm/kvm_host.h     |    5 -----
 arch/arm64/include/asm/kvm_host.h   |    5 -----
 arch/ia64/include/asm/kvm_host.h    |    4 ----
 arch/mips/include/asm/kvm_host.h    |    7 -------
 arch/powerpc/include/asm/kvm_host.h |    5 -----
 arch/x86/include/asm/kvm_host.h     |    7 +++++++
 include/linux/kvm_host.h            |    7 -------
 7 files changed, 7 insertions(+), 33 deletions(-)

-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 39+ messages in thread
* [PATCH 1/6] KVM: Move gfn_to_index to x86 specific code
  2013-10-02 21:22 ` Christoffer Dall
  (?)
@ 2013-10-02 21:22 ` Christoffer Dall
  -1 siblings, 0 replies; 39+ messages in thread
From: Christoffer Dall @ 2013-10-02 21:22 UTC (permalink / raw)
  To: kvm-ia64

The gfn_to_index function relies on huge page defines which either may
not make sense on systems that don't support huge pages or are defined
in an unconvenient way for other architectures.  Since this is
x86-specific, move the function to arch/x86/include/asm/kvm_host.h.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/x86/include/asm/kvm_host.h |    7 +++++++
 include/linux/kvm_host.h        |    7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index c76ff74..4134cf6 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -79,6 +79,13 @@
 #define KVM_HPAGE_MASK(x)	(~(KVM_HPAGE_SIZE(x) - 1))
 #define KVM_PAGES_PER_HPAGE(x)	(KVM_HPAGE_SIZE(x) / PAGE_SIZE)
 
+static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
+{
+	/* KVM_HPAGE_GFN_SHIFT(PT_PAGE_TABLE_LEVEL) must be 0. */
+	return (gfn >> KVM_HPAGE_GFN_SHIFT(level)) -
+		(base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
+}
+
 #define SELECTOR_TI_MASK (1 << 2)
 #define SELECTOR_RPL_MASK 0x03
 
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ca645a0..5a1e553 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -841,13 +841,6 @@ static inline int memslot_id(struct kvm *kvm, gfn_t gfn)
 	return gfn_to_memslot(kvm, gfn)->id;
 }
 
-static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
-{
-	/* KVM_HPAGE_GFN_SHIFT(PT_PAGE_TABLE_LEVEL) must be 0. */
-	return (gfn >> KVM_HPAGE_GFN_SHIFT(level)) -
-		(base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
-}
-
 static inline gfn_t
 hva_to_gfn_memslot(unsigned long hva, struct kvm_memory_slot *slot)
 {
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [PATCH 2/6] KVM: ARM: Get rid of KVM_HPAGE defines
  2013-10-02 21:22 ` Christoffer Dall
  (?)
@ 2013-10-02 21:22 ` Christoffer Dall
  -1 siblings, 0 replies; 39+ messages in thread
From: Christoffer Dall @ 2013-10-02 21:22 UTC (permalink / raw)
  To: kvm-ia64

The KVM_HPAGE_DEFINES are a little artificial on ARM, since the huge
page size is statically defined at compile time and there is only a
single huge page size.

Now when the main kvm code relying on these defines has been moved to
the x86 specific part of the world, we can get rid of these.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/arm/include/asm/kvm_host.h |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 7d22517..e45a74b 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -38,11 +38,6 @@
 
 #define KVM_VCPU_MAX_FEATURES 1
 
-/* We don't currently support large pages. */
-#define KVM_HPAGE_GFN_SHIFT(x)	0
-#define KVM_NR_PAGE_SIZES	1
-#define KVM_PAGES_PER_HPAGE(x)	(1UL<<31)
-
 #include <kvm/arm_vgic.h>
 
 struct kvm_vcpu;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [PATCH 3/6] KVM: arm64: Get rid of KVM_HPAGE defines
  2013-10-02 21:22 ` Christoffer Dall
  (?)
@ 2013-10-02 21:22 ` Christoffer Dall
  -1 siblings, 0 replies; 39+ messages in thread
From: Christoffer Dall @ 2013-10-02 21:22 UTC (permalink / raw)
  To: kvm-ia64

Now when the main kvm code relying on these defines has been moved to
the x86 specific part of the world, we can get rid of these.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/arm64/include/asm/kvm_host.h |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 0859a4d..54c064f 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -36,11 +36,6 @@
 
 #define KVM_VCPU_MAX_FEATURES 2
 
-/* We don't currently support large pages. */
-#define KVM_HPAGE_GFN_SHIFT(x)	0
-#define KVM_NR_PAGE_SIZES	1
-#define KVM_PAGES_PER_HPAGE(x)	(1UL<<31)
-
 struct kvm_vcpu;
 int kvm_target_cpu(void);
 int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [PATCH 4/6] KVM: mips: Get rid of KVM_HPAGE defines
  2013-10-02 21:22 ` Christoffer Dall
  (?)
@ 2013-10-02 21:22 ` Christoffer Dall
  -1 siblings, 0 replies; 39+ messages in thread
From: Christoffer Dall @ 2013-10-02 21:22 UTC (permalink / raw)
  To: kvm-ia64

Now when the main kvm code relying on these defines has been moved to
the x86 specific part of the world, we can get rid of these.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/mips/include/asm/kvm_host.h |    7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index 4d6fa0b..3296696 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -27,13 +27,6 @@
 
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 
-/* Don't support huge pages */
-#define KVM_HPAGE_GFN_SHIFT(x)	0
-
-/* We don't currently support large pages. */
-#define KVM_NR_PAGE_SIZES	1
-#define KVM_PAGES_PER_HPAGE(x)	1
-
 
 
 /* Special address that contains the comm page, used for reducing # of traps */
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [PATCH 5/6] KVM: ia64: Get rid of KVM_HPAGE defines
  2013-10-02 21:22 ` Christoffer Dall
  (?)
@ 2013-10-02 21:22 ` Christoffer Dall
  -1 siblings, 0 replies; 39+ messages in thread
From: Christoffer Dall @ 2013-10-02 21:22 UTC (permalink / raw)
  To: kvm-ia64

Now when the main kvm code relying on these defines has been moved to
the x86 specific part of the world, we can get rid of these.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/ia64/include/asm/kvm_host.h |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index 989dd3f..95a3ff9 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -234,10 +234,6 @@ struct kvm_vm_data {
 #define KVM_REQ_PTC_G		32
 #define KVM_REQ_RESUME		33
 
-#define KVM_HPAGE_GFN_SHIFT(x)	0
-#define KVM_NR_PAGE_SIZES	1
-#define KVM_PAGES_PER_HPAGE(x)	1
-
 struct kvm;
 struct kvm_vcpu;
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [PATCH 6/6] KVM: PPC: Get rid of KVM_HPAGE defines
  2013-10-02 21:22 ` Christoffer Dall
  (?)
@ 2013-10-02 21:22 ` Christoffer Dall
  -1 siblings, 0 replies; 39+ messages in thread
From: Christoffer Dall @ 2013-10-02 21:22 UTC (permalink / raw)
  To: kvm-ia64

Now when the main kvm code relying on these defines has been moved to
the x86 specific part of the world, we can get rid of these.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/powerpc/include/asm/kvm_host.h |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 3328353..0866230 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -63,11 +63,6 @@ extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
 
 #endif
 
-/* We don't currently support large pages. */
-#define KVM_HPAGE_GFN_SHIFT(x)	0
-#define KVM_NR_PAGE_SIZES	1
-#define KVM_PAGES_PER_HPAGE(x)	(1UL<<31)
-
 #define HPTEG_CACHE_NUM			(1 << 15)
 #define HPTEG_HASH_BITS_PTE		13
 #define HPTEG_HASH_BITS_PTE_LONG	12
-- 
1.7.10.4


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

end of thread, other threads:[~2013-10-14  7:21 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02 21:22 [PATCH 0/6] Get rid of mandatory huge page defines Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-12 17:36 ` Christoffer Dall
2013-10-12 17:36   ` Christoffer Dall
2013-10-12 17:36   ` Christoffer Dall
2013-10-13  9:31 ` Gleb Natapov
2013-10-13  9:31   ` Gleb Natapov
2013-10-13  9:31   ` Gleb Natapov
2013-10-13 17:41 ` Christoffer Dall
2013-10-13 17:41   ` Christoffer Dall
2013-10-13 17:41   ` Christoffer Dall
2013-10-13 17:49 ` Gleb Natapov
2013-10-13 17:49   ` Gleb Natapov
2013-10-13 17:49   ` Gleb Natapov
2013-10-13 19:29 ` Christoffer Dall
2013-10-13 19:29   ` Christoffer Dall
2013-10-13 19:29   ` Christoffer Dall
2013-10-14  7:20 ` Gleb Natapov
2013-10-14  7:20   ` Gleb Natapov
2013-10-14  7:20   ` Gleb Natapov
  -- strict thread matches above, loose matches on Subject: below --
2013-10-02 21:22 [PATCH 1/6] KVM: Move gfn_to_index to x86 specific code Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 [PATCH 2/6] KVM: ARM: Get rid of KVM_HPAGE defines Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 [PATCH 3/6] KVM: arm64: " Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 [PATCH 4/6] KVM: mips: " Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 [PATCH 5/6] KVM: ia64: " Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 [PATCH 6/6] KVM: PPC: " Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall
2013-10-02 21:22 ` Christoffer Dall

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.