Skip to contentSkip to conversation

kvm/e500: Add shadow ID mapping support

PATCH New Liu Yu 1 participant 1 message May 15, 2009

Subsystems (2)
lore
Share & tools
lore

Liu Yu

author
#0 lore raw

PATCH 2/5 kvm/e500: Add shadow ID mapping support

Based on Hollis's idea,
this patch map (vcpu, as, pid) to individual shadow id.

Every vcpu has a mapping table,
which keep the mapping from guest (as, id) to shadow id.

Every hardware core has a shadow id reference table, which keep the mapping from shadow id to (vcpu, as, pid).

When mapping is created, both vcpu and core need to update their tables. But they can destroy the mapping one-sided.

When shadow id get exhausted,
a flush is needed for shadow id reference table.

---
 arch/powerpc/include/asm/kvm_e500.h |    3 +
 arch/powerpc/kvm/e500_tlb.c         |   96 +++++++++++++++++++++++++++++++++++
 arch/powerpc/kvm/e500_tlb.h         |    4 +-
 3 files changed, 102 insertions(+), 1 deletions(-)
arch/powerpc/include/asm/kvm_e500.h +3 -0
index b248f31..bc73abe 100644
@@ -42,6 +42,9 @@ struct kvmppc_vcpu_e500 {
 	/* Pages which are referenced in the shadow TLB. */
 	struct kvmppc_e500_shadow_ref *shadow_refs[E500_TLB_NUM];
 
+	/* MMU id mapping */
+	void *id_mapping;
+
 	unsigned int guest_tlb_size[E500_TLB_NUM];
 	unsigned int shadow_tlb_size[E500_TLB_NUM];
 	unsigned int guest_tlb_nv[E500_TLB_NUM];
arch/powerpc/kvm/e500_tlb.c +96 -0

116 lines not on this page · raw message

arch/powerpc/kvm/e500_tlb.h +3 -1
index 45b064b..eb36514 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright (C) 2008 - 2009 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Author: Yu Liu, [email protected]
  *
@@ -55,6 +55,8 @@ extern void kvmppc_e500_tlb_load(struct kvm_vcpu *, int);
 extern int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *);
 extern void kvmppc_e500_tlb_uninit(struct kvmppc_vcpu_e500 *);
 extern void kvmppc_e500_tlb_setup(struct kvmppc_vcpu_e500 *);
+extern unsigned int kvmppc_e500_get_sid(struct kvmppc_vcpu_e500 *vcpu_e500,
+					int as, int gid);
 
 /* TLB helper functions */
 static inline unsigned int get_tlb_size(const struct tlbe *tlbe)
Signature · 1 line
1.5.4