163e158a0SMatt Evans /* 263e158a0SMatt Evans * PPC64 cpu-specific definitions 363e158a0SMatt Evans * 463e158a0SMatt Evans * Copyright 2011 Matt Evans <matt@ozlabs.org>, IBM Corporation. 563e158a0SMatt Evans * 663e158a0SMatt Evans * This program is free software; you can redistribute it and/or modify it 763e158a0SMatt Evans * under the terms of the GNU General Public License version 2 as published 863e158a0SMatt Evans * by the Free Software Foundation. 963e158a0SMatt Evans */ 1063e158a0SMatt Evans 1163e158a0SMatt Evans #ifndef KVM__KVM_CPU_ARCH_H 1263e158a0SMatt Evans #define KVM__KVM_CPU_ARCH_H 1363e158a0SMatt Evans 1463e158a0SMatt Evans /* Architecture-specific kvm_cpu definitions. */ 1563e158a0SMatt Evans 1663e158a0SMatt Evans #include <linux/kvm.h> /* for struct kvm_regs */ 175e8d833bSMatt Evans #include <stdbool.h> 1863e158a0SMatt Evans #include <pthread.h> 1963e158a0SMatt Evans 20*e6655b75SMichael Ellerman #define MSR_SF (1ULL<<63) 21*e6655b75SMichael Ellerman #define MSR_HV (1ULL<<60) 22*e6655b75SMichael Ellerman #define MSR_VEC (1ULL<<25) 23*e6655b75SMichael Ellerman #define MSR_VSX (1ULL<<23) 24*e6655b75SMichael Ellerman #define MSR_POW (1ULL<<18) 25*e6655b75SMichael Ellerman #define MSR_EE (1ULL<<15) 26*e6655b75SMichael Ellerman #define MSR_PR (1ULL<<14) 27*e6655b75SMichael Ellerman #define MSR_FP (1ULL<<13) 28*e6655b75SMichael Ellerman #define MSR_ME (1ULL<<12) 29*e6655b75SMichael Ellerman #define MSR_FE0 (1ULL<<11) 30*e6655b75SMichael Ellerman #define MSR_SE (1ULL<<10) 31*e6655b75SMichael Ellerman #define MSR_BE (1ULL<<9) 32*e6655b75SMichael Ellerman #define MSR_FE1 (1ULL<<8) 33*e6655b75SMichael Ellerman #define MSR_IR (1ULL<<5) 34*e6655b75SMichael Ellerman #define MSR_DR (1ULL<<4) 35*e6655b75SMichael Ellerman #define MSR_PMM (1ULL<<2) 36*e6655b75SMichael Ellerman #define MSR_RI (1ULL<<1) 37*e6655b75SMichael Ellerman #define MSR_LE (1ULL<<0) 3863e158a0SMatt Evans 39f17e5a37SMatt Evans #define POWER7_EXT_IRQ 0 40f17e5a37SMatt Evans 4163e158a0SMatt Evans struct kvm; 4263e158a0SMatt Evans 4363e158a0SMatt Evans struct kvm_cpu { 4463e158a0SMatt Evans pthread_t thread; /* VCPU thread */ 4563e158a0SMatt Evans 4663e158a0SMatt Evans unsigned long cpu_id; 4763e158a0SMatt Evans 4863e158a0SMatt Evans struct kvm *kvm; /* parent KVM */ 4963e158a0SMatt Evans int vcpu_fd; /* For VCPU ioctls() */ 5063e158a0SMatt Evans struct kvm_run *kvm_run; 5163e158a0SMatt Evans 5263e158a0SMatt Evans struct kvm_regs regs; 5363e158a0SMatt Evans struct kvm_sregs sregs; 5463e158a0SMatt Evans struct kvm_fpu fpu; 5563e158a0SMatt Evans 5663e158a0SMatt Evans u8 is_running; 5763e158a0SMatt Evans u8 paused; 5863e158a0SMatt Evans u8 needs_nmi; 5963e158a0SMatt Evans /* 6063e158a0SMatt Evans * Although PPC KVM doesn't yet support coalesced MMIO, generic code 6163e158a0SMatt Evans * needs this in our kvm_cpu: 6263e158a0SMatt Evans */ 6363e158a0SMatt Evans struct kvm_coalesced_mmio_ring *ring; 6463e158a0SMatt Evans }; 6563e158a0SMatt Evans 6663e158a0SMatt Evans void kvm_cpu__irq(struct kvm_cpu *vcpu, int pin, int level); 6763e158a0SMatt Evans 685e8d833bSMatt Evans /* This is never actually called on PPC. */ 694123ca55SMarc Zyngier static inline bool kvm_cpu__emulate_io(struct kvm_cpu *vcpu, u16 port, void *data, int direction, int size, u32 count) 705e8d833bSMatt Evans { 715e8d833bSMatt Evans return false; 725e8d833bSMatt Evans } 735e8d833bSMatt Evans 749b735910SMarc Zyngier bool kvm_cpu__emulate_mmio(struct kvm_cpu *vcpu, u64 phys_addr, u8 *data, u32 len, u8 is_write); 755e8d833bSMatt Evans 7663e158a0SMatt Evans #endif /* KVM__KVM_CPU_ARCH_H */ 77