All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 03/23] Add PPC64 fields to vcpu structs
@ 2009-07-07 14:17 Alexander Graf
  2009-07-07 15:42 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Graf @ 2009-07-07 14:17 UTC (permalink / raw)
  To: kvm-ppc

We need to store more information than we currently have for vcpus
when running on PPC64.

So let's extend the internal struct definitions.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/include/asm/kvm_host.h |   80 ++++++++++++++++++++++++++++++++++-
 1 files changed, 79 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index c9c930e..80eeef7 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -37,6 +37,8 @@
 #define KVM_NR_PAGE_SIZES	1
 #define KVM_PAGES_PER_HPAGE(x)	(1UL<<31)
 
+#define HPTEG_CACHE_NUM 1024
+
 struct kvm;
 struct kvm_run;
 struct kvm_vcpu;
@@ -63,6 +65,17 @@ struct kvm_vcpu_stat {
 	u32 dec_exits;
 	u32 ext_intr_exits;
 	u32 halt_wakeup;
+#ifdef CONFIG_PPC64
+	u32 pf_storage;
+	u32 pf_instruc;
+	u32 sp_storage;
+	u32 sp_instruc;
+	u32 queue_intr;
+	u32 ld;
+	u32 ld_slow;
+	u32 st;
+	u32 st_slow;
+#endif
 };
 
 enum kvm_exit_types {
@@ -109,9 +122,53 @@ struct kvmppc_exit_timing {
 struct kvm_arch {
 };
 
+struct kvmppc_pte {
+	u64 eaddr;
+	u64 vpage;
+	u64 raddr;
+	bool may_read;
+	bool may_write;
+	bool may_execute;
+};
+
+struct kvmppc_mmu {
+	/* 970 only */
+	void (*slbmte)(struct kvm_vcpu *vcpu, u64 rb, u64 rs);
+	u64  (*slbmfee)(struct kvm_vcpu *vcpu, u64 slb_nr);
+	u64  (*slbmfev)(struct kvm_vcpu *vcpu, u64 slb_nr);
+	void (*slbie)(struct kvm_vcpu *vcpu, u64 slb_nr);
+	void (*slbia)(struct kvm_vcpu *vcpu);
+	/* all desktop ppc cores */
+	void (*mtsrin)(struct kvm_vcpu *vcpu, u32 srnum, ulong value);
+	u32  (*mfsrin)(struct kvm_vcpu *vcpu, u32 srnum);
+	int  (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr, struct kvmppc_pte *pte, bool data);
+	void (*reset_msr)(struct kvm_vcpu *vcpu);
+	void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large);
+	u64  (*esid_to_vsid)(struct kvm_vcpu *vcpu, u64 esid);
+	u64  (*ea_to_vp)(struct kvm_vcpu *vcpu, gva_t eaddr, bool data);
+	bool (*is_dcbz32)(struct kvm_vcpu *vcpu);
+};
+
+struct hpte_cache {
+	u64 host_va;
+	u64 pfn;
+	ulong slot;
+	struct kvmppc_pte pte;
+};
+
 struct kvm_vcpu_arch {
-	u32 host_stack;
+	ulong host_stack;
 	u32 host_pid;
+#ifdef CONFIG_PPC64
+	ulong host_msr;
+	ulong host_r2;
+	void *host_retip;
+	ulong trampoline_lowmem;
+	ulong trampoline_enter;
+	ulong highmem_handler;
+	ulong host_paca_phys;
+	struct kvmppc_mmu mmu;
+#endif
 
 	u64 fpr[32];
 	ulong gpr[32];
@@ -123,6 +180,10 @@ struct kvm_vcpu_arch {
 	ulong xer;
 
 	ulong msr;
+#ifdef CONFIG_PPC64
+	ulong shadow_msr;
+	ulong hflags;
+#endif
 	u32 mmucr;
 	ulong sprg0;
 	ulong sprg1;
@@ -149,6 +210,9 @@ struct kvm_vcpu_arch {
 	u32 ivor[64];
 	ulong ivpr;
 	u32 pir;
+#ifdef CONFIG_PPC64
+	u32 pvr;
+#endif
 
 	u32 shadow_pid;
 	u32 pid;
@@ -174,6 +238,11 @@ struct kvm_vcpu_arch {
 #endif
 
 	u32 last_inst;
+#ifdef CONFIG_PPC64
+	ulong last_mmio;
+	ulong last_mmio_raddr;
+	ulong fault_dsisr;
+#endif
 	ulong fault_dear;
 	ulong fault_esr;
 	gpa_t paddr_accessed;
@@ -186,7 +255,16 @@ struct kvm_vcpu_arch {
 	u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */
 
 	struct timer_list dec_timer;
+	u64 dec_jiffies;
 	unsigned long pending_exceptions;
+
+#ifdef CONFIG_PPC64
+	struct mm_struct* mm_guest;
+	struct mm_struct* mm_guest_real;
+	struct mm_struct* mm_host;
+	struct hpte_cache hpte_cache[HPTEG_CACHE_NUM];
+	int hpte_cache_offset;
+#endif
 };
 
 #endif /* __POWERPC_KVM_HOST_H__ */
-- 
1.6.0.2


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

* Re: [PATCH 03/23] Add PPC64 fields to vcpu structs
  2009-07-07 14:17 [PATCH 03/23] Add PPC64 fields to vcpu structs Alexander Graf
@ 2009-07-07 15:42 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2009-07-07 15:42 UTC (permalink / raw)
  To: kvm-ppc

On 07/07/2009 05:17 PM, Alexander Graf wrote:
> We need to store more information than we currently have for vcpus
> when running on PPC64.
>
> So let's extend the internal struct definitions.
>
> Signed-off-by: Alexander Graf<agraf@suse.de>
> ---
>   arch/powerpc/include/asm/kvm_host.h |   80 ++++++++++++++++++++++++++++++++++-
>   1 files changed, 79 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
> index c9c930e..80eeef7 100644
> --- a/arch/powerpc/include/asm/kvm_host.h
> +++ b/arch/powerpc/include/asm/kvm_host.h
> @@ -37,6 +37,8 @@
>   #define KVM_NR_PAGE_SIZES	1
>   #define KVM_PAGES_PER_HPAGE(x)	(1UL<<31)
>
> +#define HPTEG_CACHE_NUM 1024
> +
>   struct kvm;
>   struct kvm_run;
>   struct kvm_vcpu;
> @@ -63,6 +65,17 @@ struct kvm_vcpu_stat {
>   	u32 dec_exits;
>   	u32 ext_intr_exits;
>   	u32 halt_wakeup;
> +#ifdef CONFIG_PPC64
> +	u32 pf_storage;
> +	u32 pf_instruc;
> +	u32 sp_storage;
> +	u32 sp_instruc;
> +	u32 queue_intr;
> +	u32 ld;
> +	u32 ld_slow;
> +	u32 st;
> +	u32 st_slow;
> +#endif
>   };
>
>    

My plan is to drop kvm_vcpu_stat in favor of tracepoints (you can have 
ftrace count tracepoints instead of recording them).

You can do that later if you want to avoid the churn.

-- 
error compiling committee.c: too many arguments to function


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

end of thread, other threads:[~2009-07-07 15:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-07 14:17 [PATCH 03/23] Add PPC64 fields to vcpu structs Alexander Graf
2009-07-07 15:42 ` Avi Kivity

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.