kvm_44x.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License, version 2, as
  4. * published by the Free Software Foundation.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program; if not, write to the Free Software
  13. * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  14. *
  15. * Copyright IBM Corp. 2008
  16. *
  17. * Authors: Hollis Blanchard <hollisb@us.ibm.com>
  18. */
  19. #ifndef __ASM_44X_H__
  20. #define __ASM_44X_H__
  21. #include <linux/kvm_host.h>
  22. #define PPC44x_TLB_SIZE 64
  23. /* If the guest is expecting it, this can be as large as we like; we'd just
  24. * need to find some way of advertising it. */
  25. #define KVM44x_GUEST_TLB_SIZE 64
  26. struct kvmppc_44x_tlbe {
  27. u32 tid; /* Only the low 8 bits are used. */
  28. u32 word0;
  29. u32 word1;
  30. u32 word2;
  31. };
  32. struct kvmppc_44x_shadow_ref {
  33. struct page *page;
  34. u16 gtlb_index;
  35. u8 writeable;
  36. u8 tid;
  37. };
  38. struct kvmppc_vcpu_44x {
  39. /* Unmodified copy of the guest's TLB. */
  40. struct kvmppc_44x_tlbe guest_tlb[KVM44x_GUEST_TLB_SIZE];
  41. /* References to guest pages in the hardware TLB. */
  42. struct kvmppc_44x_shadow_ref shadow_refs[PPC44x_TLB_SIZE];
  43. /* State of the shadow TLB at guest context switch time. */
  44. struct kvmppc_44x_tlbe shadow_tlb[PPC44x_TLB_SIZE];
  45. u8 shadow_tlb_mod[PPC44x_TLB_SIZE];
  46. struct kvm_vcpu vcpu;
  47. };
  48. static inline struct kvmppc_vcpu_44x *to_44x(struct kvm_vcpu *vcpu)
  49. {
  50. return container_of(vcpu, struct kvmppc_vcpu_44x, vcpu);
  51. }
  52. void kvmppc_44x_tlb_put(struct kvm_vcpu *vcpu);
  53. void kvmppc_44x_tlb_load(struct kvm_vcpu *vcpu);
  54. #endif /* __ASM_44X_H__ */