aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-08-15 02:04:24 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:52:15 -0400
commit8b6db3bc965c204db6868d4005808b4fdc9c46d7 (patch)
tree973d040d221d5fd3448c97b1c102d014fe6e6687 /arch/powerpc/include/asm
parentad0873763a83e7b31ba87a85ec2027dd6a9d7b55 (diff)
KVM: PPC: Implement correct SID mapping on Book3s_32
Up until now we were doing segment mappings wrong on Book3s_32. For Book3s_64 we were using a trick where we know that a single mmu_context gives us 16 bits of context ids. The mm system on Book3s_32 instead uses a clever algorithm to distribute VSIDs across the available range, so a context id really only gives us 16 available VSIDs. To keep at least a few guest processes in the SID shadow, let's map a number of contexts that we can use as VSID pool. This makes the code be actually correct and shouldn't hurt performance too much. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/include/asm')
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index be8aac24ba83..d62e703f1214 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -60,6 +60,13 @@ struct kvmppc_sid_map {
60#define SID_MAP_NUM (1 << SID_MAP_BITS) 60#define SID_MAP_NUM (1 << SID_MAP_BITS)
61#define SID_MAP_MASK (SID_MAP_NUM - 1) 61#define SID_MAP_MASK (SID_MAP_NUM - 1)
62 62
63#ifdef CONFIG_PPC_BOOK3S_64
64#define SID_CONTEXTS 1
65#else
66#define SID_CONTEXTS 128
67#define VSID_POOL_SIZE (SID_CONTEXTS * 16)
68#endif
69
63struct kvmppc_vcpu_book3s { 70struct kvmppc_vcpu_book3s {
64 struct kvm_vcpu vcpu; 71 struct kvm_vcpu vcpu;
65 struct kvmppc_book3s_shadow_vcpu *shadow_vcpu; 72 struct kvmppc_book3s_shadow_vcpu *shadow_vcpu;
@@ -78,10 +85,14 @@ struct kvmppc_vcpu_book3s {
78 u64 sdr1; 85 u64 sdr1;
79 u64 hior; 86 u64 hior;
80 u64 msr_mask; 87 u64 msr_mask;
81 u64 vsid_first;
82 u64 vsid_next; 88 u64 vsid_next;
89#ifdef CONFIG_PPC_BOOK3S_32
90 u32 vsid_pool[VSID_POOL_SIZE];
91#else
92 u64 vsid_first;
83 u64 vsid_max; 93 u64 vsid_max;
84 int context_id; 94#endif
95 int context_id[SID_CONTEXTS];
85 ulong prog_flags; /* flags to inject when giving a 700 trap */ 96 ulong prog_flags; /* flags to inject when giving a 700 trap */
86}; 97};
87 98