diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2013-10-07 12:47:53 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-10-17 09:24:26 -0400 |
commit | 3a167beac07cba597856c12b87638a06b0d53db7 (patch) | |
tree | b7d484f8cb3519aec3177f914304b1d5e129d193 /arch/powerpc/kvm/booke.c | |
parent | 9975f5e3692d320b4259a4d2edd8a979adb1e535 (diff) |
kvm: powerpc: Add kvmppc_ops callback
This patch add a new callback kvmppc_ops. This will help us in enabling
both HV and PR KVM together in the same kernel. The actual change to
enable them together is done in the later patch in the series.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[agraf: squash in booke changes]
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r-- | arch/powerpc/kvm/booke.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 8b6a790c0562..e5f8ba793c31 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c | |||
@@ -1415,7 +1415,7 @@ static int set_sregs_arch206(struct kvm_vcpu *vcpu, | |||
1415 | return 0; | 1415 | return 0; |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | void kvmppc_get_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) | 1418 | int kvmppc_get_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) |
1419 | { | 1419 | { |
1420 | sregs->u.e.features |= KVM_SREGS_E_IVOR; | 1420 | sregs->u.e.features |= KVM_SREGS_E_IVOR; |
1421 | 1421 | ||
@@ -1435,6 +1435,7 @@ void kvmppc_get_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) | |||
1435 | sregs->u.e.ivor_low[13] = vcpu->arch.ivor[BOOKE_IRQPRIO_DTLB_MISS]; | 1435 | sregs->u.e.ivor_low[13] = vcpu->arch.ivor[BOOKE_IRQPRIO_DTLB_MISS]; |
1436 | sregs->u.e.ivor_low[14] = vcpu->arch.ivor[BOOKE_IRQPRIO_ITLB_MISS]; | 1436 | sregs->u.e.ivor_low[14] = vcpu->arch.ivor[BOOKE_IRQPRIO_ITLB_MISS]; |
1437 | sregs->u.e.ivor_low[15] = vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG]; | 1437 | sregs->u.e.ivor_low[15] = vcpu->arch.ivor[BOOKE_IRQPRIO_DEBUG]; |
1438 | return 0; | ||
1438 | } | 1439 | } |
1439 | 1440 | ||
1440 | int kvmppc_set_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) | 1441 | int kvmppc_set_sregs_ivor(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) |
@@ -1469,8 +1470,7 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, | |||
1469 | 1470 | ||
1470 | get_sregs_base(vcpu, sregs); | 1471 | get_sregs_base(vcpu, sregs); |
1471 | get_sregs_arch206(vcpu, sregs); | 1472 | get_sregs_arch206(vcpu, sregs); |
1472 | kvmppc_core_get_sregs(vcpu, sregs); | 1473 | return kvmppc_ops->get_sregs(vcpu, sregs); |
1473 | return 0; | ||
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, | 1476 | int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, |
@@ -1489,7 +1489,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, | |||
1489 | if (ret < 0) | 1489 | if (ret < 0) |
1490 | return ret; | 1490 | return ret; |
1491 | 1491 | ||
1492 | return kvmppc_core_set_sregs(vcpu, sregs); | 1492 | return kvmppc_ops->set_sregs(vcpu, sregs); |
1493 | } | 1493 | } |
1494 | 1494 | ||
1495 | int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) | 1495 | int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) |
@@ -1546,7 +1546,7 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) | |||
1546 | val = get_reg_val(reg->id, vcpu->arch.vrsave); | 1546 | val = get_reg_val(reg->id, vcpu->arch.vrsave); |
1547 | break; | 1547 | break; |
1548 | default: | 1548 | default: |
1549 | r = kvmppc_get_one_reg(vcpu, reg->id, &val); | 1549 | r = kvmppc_ops->get_one_reg(vcpu, reg->id, &val); |
1550 | break; | 1550 | break; |
1551 | } | 1551 | } |
1552 | 1552 | ||
@@ -1629,7 +1629,7 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) | |||
1629 | vcpu->arch.vrsave = set_reg_val(reg->id, val); | 1629 | vcpu->arch.vrsave = set_reg_val(reg->id, val); |
1630 | break; | 1630 | break; |
1631 | default: | 1631 | default: |
1632 | r = kvmppc_set_one_reg(vcpu, reg->id, &val); | 1632 | r = kvmppc_ops->set_one_reg(vcpu, reg->id, &val); |
1633 | break; | 1633 | break; |
1634 | } | 1634 | } |
1635 | 1635 | ||
@@ -1907,6 +1907,41 @@ void kvmppc_booke_vcpu_put(struct kvm_vcpu *vcpu) | |||
1907 | kvmppc_clear_dbsr(); | 1907 | kvmppc_clear_dbsr(); |
1908 | } | 1908 | } |
1909 | 1909 | ||
1910 | void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) | ||
1911 | { | ||
1912 | kvmppc_ops->mmu_destroy(vcpu); | ||
1913 | } | ||
1914 | |||
1915 | int kvmppc_core_init_vm(struct kvm *kvm) | ||
1916 | { | ||
1917 | return kvmppc_ops->init_vm(kvm); | ||
1918 | } | ||
1919 | |||
1920 | struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) | ||
1921 | { | ||
1922 | return kvmppc_ops->vcpu_create(kvm, id); | ||
1923 | } | ||
1924 | |||
1925 | void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) | ||
1926 | { | ||
1927 | kvmppc_ops->vcpu_free(vcpu); | ||
1928 | } | ||
1929 | |||
1930 | void kvmppc_core_destroy_vm(struct kvm *kvm) | ||
1931 | { | ||
1932 | kvmppc_ops->destroy_vm(kvm); | ||
1933 | } | ||
1934 | |||
1935 | void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | ||
1936 | { | ||
1937 | kvmppc_ops->vcpu_load(vcpu, cpu); | ||
1938 | } | ||
1939 | |||
1940 | void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) | ||
1941 | { | ||
1942 | kvmppc_ops->vcpu_put(vcpu); | ||
1943 | } | ||
1944 | |||
1910 | int __init kvmppc_booke_init(void) | 1945 | int __init kvmppc_booke_init(void) |
1911 | { | 1946 | { |
1912 | #ifndef CONFIG_KVM_BOOKE_HV | 1947 | #ifndef CONFIG_KVM_BOOKE_HV |