aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2011-12-20 10:34:31 -0500
committerAvi Kivity <avi@redhat.com>2012-04-08 05:51:09 -0400
commitfc6cf99509eb8e5f16e0f81db0c71f5301193005 (patch)
tree43d0d269dbc6c54e638f4c79743a0d5ab4b50658 /arch/powerpc
parent29a5a6f9102aed97a06aa984cc294e0e603b3a79 (diff)
KVM: PPC: e500: merge <asm/kvm_e500.h> into arch/powerpc/kvm/e500.h
Keeping two separate headers for e500-specific things was a pain, and wasn't even organized along any logical boundary. There was TLB stuff in <asm/kvm_e500.h> despite the existence of arch/powerpc/kvm/e500_tlb.h, and nothing in <asm/kvm_e500.h> needed to be referenced from outside arch/powerpc/kvm. Signed-off-by: Scott Wood <scottwood@freescale.com> [agraf: fix bisectability] Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/kvm_e500.h96
-rw-r--r--arch/powerpc/kvm/e500.c1
-rw-r--r--arch/powerpc/kvm/e500.h82
-rw-r--r--arch/powerpc/kvm/e500_emulate.c1
-rw-r--r--arch/powerpc/kvm/e500_tlb.c1
5 files changed, 78 insertions, 103 deletions
diff --git a/arch/powerpc/include/asm/kvm_e500.h b/arch/powerpc/include/asm/kvm_e500.h
deleted file mode 100644
index 8cd50a514271..000000000000
--- a/arch/powerpc/include/asm/kvm_e500.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * Copyright (C) 2008-2011 Freescale Semiconductor, Inc. All rights reserved.
3 *
4 * Author: Yu Liu, <yu.liu@freescale.com>
5 *
6 * Description:
7 * This file is derived from arch/powerpc/include/asm/kvm_44x.h,
8 * by Hollis Blanchard <hollisb@us.ibm.com>.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License, version 2, as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_KVM_E500_H__
16#define __ASM_KVM_E500_H__
17
18#include <linux/kvm_host.h>
19
20#define BOOKE_INTERRUPT_SIZE 36
21
22#define E500_PID_NUM 3
23#define E500_TLB_NUM 2
24
25#define E500_TLB_VALID 1
26#define E500_TLB_DIRTY 2
27
28struct tlbe_ref {
29 pfn_t pfn;
30 unsigned int flags; /* E500_TLB_* */
31};
32
33struct tlbe_priv {
34 struct tlbe_ref ref; /* TLB0 only -- TLB1 uses tlb_refs */
35};
36
37struct vcpu_id_table;
38
39struct kvmppc_e500_tlb_params {
40 int entries, ways, sets;
41};
42
43struct kvmppc_vcpu_e500 {
44 /* Unmodified copy of the guest's TLB -- shared with host userspace. */
45 struct kvm_book3e_206_tlb_entry *gtlb_arch;
46
47 /* Starting entry number in gtlb_arch[] */
48 int gtlb_offset[E500_TLB_NUM];
49
50 /* KVM internal information associated with each guest TLB entry */
51 struct tlbe_priv *gtlb_priv[E500_TLB_NUM];
52
53 struct kvmppc_e500_tlb_params gtlb_params[E500_TLB_NUM];
54
55 unsigned int gtlb_nv[E500_TLB_NUM];
56
57 /*
58 * information associated with each host TLB entry --
59 * TLB1 only for now. If/when guest TLB1 entries can be
60 * mapped with host TLB0, this will be used for that too.
61 *
62 * We don't want to use this for guest TLB0 because then we'd
63 * have the overhead of doing the translation again even if
64 * the entry is still in the guest TLB (e.g. we swapped out
65 * and back, and our host TLB entries got evicted).
66 */
67 struct tlbe_ref *tlb_refs[E500_TLB_NUM];
68 unsigned int host_tlb1_nv;
69
70 u32 host_pid[E500_PID_NUM];
71 u32 pid[E500_PID_NUM];
72 u32 svr;
73
74 /* vcpu id table */
75 struct vcpu_id_table *idt;
76
77 u32 l1csr0;
78 u32 l1csr1;
79 u32 hid0;
80 u32 hid1;
81 u32 tlb0cfg;
82 u32 tlb1cfg;
83 u64 mcar;
84
85 struct page **shared_tlb_pages;
86 int num_shared_tlb_pages;
87
88 struct kvm_vcpu vcpu;
89};
90
91static inline struct kvmppc_vcpu_e500 *to_e500(struct kvm_vcpu *vcpu)
92{
93 return container_of(vcpu, struct kvmppc_vcpu_e500, vcpu);
94}
95
96#endif /* __ASM_KVM_E500_H__ */
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c
index 5c450ba003b8..76b35d8f099f 100644
--- a/arch/powerpc/kvm/e500.c
+++ b/arch/powerpc/kvm/e500.c
@@ -20,7 +20,6 @@
20#include <asm/reg.h> 20#include <asm/reg.h>
21#include <asm/cputable.h> 21#include <asm/cputable.h>
22#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
23#include <asm/kvm_e500.h>
24#include <asm/kvm_ppc.h> 23#include <asm/kvm_ppc.h>
25 24
26#include "booke.h" 25#include "booke.h"
diff --git a/arch/powerpc/kvm/e500.h b/arch/powerpc/kvm/e500.h
index 02ecde261bc1..51d13bd40153 100644
--- a/arch/powerpc/kvm/e500.h
+++ b/arch/powerpc/kvm/e500.h
@@ -1,11 +1,12 @@
1/* 1/*
2 * Copyright (C) 2008-2011 Freescale Semiconductor, Inc. All rights reserved. 2 * Copyright (C) 2008-2011 Freescale Semiconductor, Inc. All rights reserved.
3 * 3 *
4 * Author: Yu Liu, yu.liu@freescale.com 4 * Author: Yu Liu <yu.liu@freescale.com>
5 * 5 *
6 * Description: 6 * Description:
7 * This file is based on arch/powerpc/kvm/44x_tlb.h, 7 * This file is based on arch/powerpc/kvm/44x_tlb.h and
8 * by Hollis Blanchard <hollisb@us.ibm.com>. 8 * arch/powerpc/include/asm/kvm_44x.h by Hollis Blanchard <hollisb@us.ibm.com>,
9 * Copyright IBM Corp. 2007-2008
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License, version 2, as 12 * it under the terms of the GNU General Public License, version 2, as
@@ -18,7 +19,80 @@
18#include <linux/kvm_host.h> 19#include <linux/kvm_host.h>
19#include <asm/mmu-book3e.h> 20#include <asm/mmu-book3e.h>
20#include <asm/tlb.h> 21#include <asm/tlb.h>
21#include <asm/kvm_e500.h> 22
23#define E500_PID_NUM 3
24#define E500_TLB_NUM 2
25
26#define E500_TLB_VALID 1
27#define E500_TLB_DIRTY 2
28
29struct tlbe_ref {
30 pfn_t pfn;
31 unsigned int flags; /* E500_TLB_* */
32};
33
34struct tlbe_priv {
35 struct tlbe_ref ref; /* TLB0 only -- TLB1 uses tlb_refs */
36};
37
38struct vcpu_id_table;
39
40struct kvmppc_e500_tlb_params {
41 int entries, ways, sets;
42};
43
44struct kvmppc_vcpu_e500 {
45 /* Unmodified copy of the guest's TLB -- shared with host userspace. */
46 struct kvm_book3e_206_tlb_entry *gtlb_arch;
47
48 /* Starting entry number in gtlb_arch[] */
49 int gtlb_offset[E500_TLB_NUM];
50
51 /* KVM internal information associated with each guest TLB entry */
52 struct tlbe_priv *gtlb_priv[E500_TLB_NUM];
53
54 struct kvmppc_e500_tlb_params gtlb_params[E500_TLB_NUM];
55
56 unsigned int gtlb_nv[E500_TLB_NUM];
57
58 /*
59 * information associated with each host TLB entry --
60 * TLB1 only for now. If/when guest TLB1 entries can be
61 * mapped with host TLB0, this will be used for that too.
62 *
63 * We don't want to use this for guest TLB0 because then we'd
64 * have the overhead of doing the translation again even if
65 * the entry is still in the guest TLB (e.g. we swapped out
66 * and back, and our host TLB entries got evicted).
67 */
68 struct tlbe_ref *tlb_refs[E500_TLB_NUM];
69 unsigned int host_tlb1_nv;
70
71 u32 host_pid[E500_PID_NUM];
72 u32 pid[E500_PID_NUM];
73 u32 svr;
74
75 /* vcpu id table */
76 struct vcpu_id_table *idt;
77
78 u32 l1csr0;
79 u32 l1csr1;
80 u32 hid0;
81 u32 hid1;
82 u32 tlb0cfg;
83 u32 tlb1cfg;
84 u64 mcar;
85
86 struct page **shared_tlb_pages;
87 int num_shared_tlb_pages;
88
89 struct kvm_vcpu vcpu;
90};
91
92static inline struct kvmppc_vcpu_e500 *to_e500(struct kvm_vcpu *vcpu)
93{
94 return container_of(vcpu, struct kvmppc_vcpu_e500, vcpu);
95}
22 96
23/* This geometry is the legacy default -- can be overridden by userspace */ 97/* This geometry is the legacy default -- can be overridden by userspace */
24#define KVM_E500_TLB0_WAY_SIZE 128 98#define KVM_E500_TLB0_WAY_SIZE 128
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index 2a1a22822066..7e2d592bf562 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -14,7 +14,6 @@
14 14
15#include <asm/kvm_ppc.h> 15#include <asm/kvm_ppc.h>
16#include <asm/disassemble.h> 16#include <asm/disassemble.h>
17#include <asm/kvm_e500.h>
18 17
19#include "booke.h" 18#include "booke.h"
20#include "e500.h" 19#include "e500.h"
diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
index 1d623a085dcc..7d4a918a0ab0 100644
--- a/arch/powerpc/kvm/e500_tlb.c
+++ b/arch/powerpc/kvm/e500_tlb.c
@@ -26,7 +26,6 @@
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/hugetlb.h> 27#include <linux/hugetlb.h>
28#include <asm/kvm_ppc.h> 28#include <asm/kvm_ppc.h>
29#include <asm/kvm_e500.h>
30 29
31#include "../mm/mmu_decl.h" 30#include "../mm/mmu_decl.h"
32#include "e500.h" 31#include "e500.h"