diff options
author | Mihai Caraman <mihai.caraman@freescale.com> | 2014-08-20 09:36:25 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-09-22 04:11:33 -0400 |
commit | 3840edc8033ad5b86deee309c1c321ca54257452 (patch) | |
tree | 3c193a8480a3a9f54a7a4559a4be2265c9741c4d /arch/powerpc/kvm | |
parent | 8a41ea53b32ffbe7524e3424cf0403fa3b4c73fb (diff) |
KVM: PPC: Move ONE_REG AltiVec support to powerpc
Move ONE_REG AltiVec support to powerpc generic layer.
Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r-- | arch/powerpc/kvm/book3s.c | 42 | ||||
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 42 |
2 files changed, 42 insertions, 42 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index 26868e207ff0..1b5adda2a224 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c | |||
@@ -558,25 +558,6 @@ int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, | |||
558 | case KVM_REG_PPC_FPSCR: | 558 | case KVM_REG_PPC_FPSCR: |
559 | *val = get_reg_val(id, vcpu->arch.fp.fpscr); | 559 | *val = get_reg_val(id, vcpu->arch.fp.fpscr); |
560 | break; | 560 | break; |
561 | #ifdef CONFIG_ALTIVEC | ||
562 | case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31: | ||
563 | if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { | ||
564 | r = -ENXIO; | ||
565 | break; | ||
566 | } | ||
567 | val->vval = vcpu->arch.vr.vr[id - KVM_REG_PPC_VR0]; | ||
568 | break; | ||
569 | case KVM_REG_PPC_VSCR: | ||
570 | if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { | ||
571 | r = -ENXIO; | ||
572 | break; | ||
573 | } | ||
574 | *val = get_reg_val(id, vcpu->arch.vr.vscr.u[3]); | ||
575 | break; | ||
576 | case KVM_REG_PPC_VRSAVE: | ||
577 | *val = get_reg_val(id, vcpu->arch.vrsave); | ||
578 | break; | ||
579 | #endif /* CONFIG_ALTIVEC */ | ||
580 | #ifdef CONFIG_VSX | 561 | #ifdef CONFIG_VSX |
581 | case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: | 562 | case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: |
582 | if (cpu_has_feature(CPU_FTR_VSX)) { | 563 | if (cpu_has_feature(CPU_FTR_VSX)) { |
@@ -653,29 +634,6 @@ int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, | |||
653 | case KVM_REG_PPC_FPSCR: | 634 | case KVM_REG_PPC_FPSCR: |
654 | vcpu->arch.fp.fpscr = set_reg_val(id, *val); | 635 | vcpu->arch.fp.fpscr = set_reg_val(id, *val); |
655 | break; | 636 | break; |
656 | #ifdef CONFIG_ALTIVEC | ||
657 | case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31: | ||
658 | if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { | ||
659 | r = -ENXIO; | ||
660 | break; | ||
661 | } | ||
662 | vcpu->arch.vr.vr[id - KVM_REG_PPC_VR0] = val->vval; | ||
663 | break; | ||
664 | case KVM_REG_PPC_VSCR: | ||
665 | if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { | ||
666 | r = -ENXIO; | ||
667 | break; | ||
668 | } | ||
669 | vcpu->arch.vr.vscr.u[3] = set_reg_val(id, *val); | ||
670 | break; | ||
671 | case KVM_REG_PPC_VRSAVE: | ||
672 | if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { | ||
673 | r = -ENXIO; | ||
674 | break; | ||
675 | } | ||
676 | vcpu->arch.vrsave = set_reg_val(id, *val); | ||
677 | break; | ||
678 | #endif /* CONFIG_ALTIVEC */ | ||
679 | #ifdef CONFIG_VSX | 637 | #ifdef CONFIG_VSX |
680 | case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: | 638 | case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: |
681 | if (cpu_has_feature(CPU_FTR_VSX)) { | 639 | if (cpu_has_feature(CPU_FTR_VSX)) { |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 8a26126db482..0c7d1917c23d 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -921,6 +921,29 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) | |||
921 | if (r == -EINVAL) { | 921 | if (r == -EINVAL) { |
922 | r = 0; | 922 | r = 0; |
923 | switch (reg->id) { | 923 | switch (reg->id) { |
924 | #ifdef CONFIG_ALTIVEC | ||
925 | case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31: | ||
926 | if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { | ||
927 | r = -ENXIO; | ||
928 | break; | ||
929 | } | ||
930 | vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0] = val.vval; | ||
931 | break; | ||
932 | case KVM_REG_PPC_VSCR: | ||
933 | if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { | ||
934 | r = -ENXIO; | ||
935 | break; | ||
936 | } | ||
937 | vcpu->arch.vr.vscr.u[3] = set_reg_val(reg->id, val); | ||
938 | break; | ||
939 | case KVM_REG_PPC_VRSAVE: | ||
940 | if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { | ||
941 | r = -ENXIO; | ||
942 | break; | ||
943 | } | ||
944 | vcpu->arch.vrsave = set_reg_val(reg->id, val); | ||
945 | break; | ||
946 | #endif /* CONFIG_ALTIVEC */ | ||
924 | default: | 947 | default: |
925 | r = -EINVAL; | 948 | r = -EINVAL; |
926 | break; | 949 | break; |
@@ -953,6 +976,25 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) | |||
953 | if (r == -EINVAL) { | 976 | if (r == -EINVAL) { |
954 | r = 0; | 977 | r = 0; |
955 | switch (reg->id) { | 978 | switch (reg->id) { |
979 | #ifdef CONFIG_ALTIVEC | ||
980 | case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31: | ||
981 | if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { | ||
982 | r = -ENXIO; | ||
983 | break; | ||
984 | } | ||
985 | val.vval = vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0]; | ||
986 | break; | ||
987 | case KVM_REG_PPC_VSCR: | ||
988 | if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { | ||
989 | r = -ENXIO; | ||
990 | break; | ||
991 | } | ||
992 | val = get_reg_val(reg->id, vcpu->arch.vr.vscr.u[3]); | ||
993 | break; | ||
994 | case KVM_REG_PPC_VRSAVE: | ||
995 | val = get_reg_val(reg->id, vcpu->arch.vrsave); | ||
996 | break; | ||
997 | #endif /* CONFIG_ALTIVEC */ | ||
956 | default: | 998 | default: |
957 | r = -EINVAL; | 999 | r = -EINVAL; |
958 | break; | 1000 | break; |