diff options
-rw-r--r-- | Documentation/virtual/kvm/api.txt | 1 | ||||
-rw-r--r-- | arch/powerpc/include/uapi/asm/kvm.h | 6 | ||||
-rw-r--r-- | arch/powerpc/kvm/booke.c | 21 |
3 files changed, 27 insertions, 1 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index a98ed09269d7..09905cbcbb0b 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt | |||
@@ -1774,6 +1774,7 @@ registers, find a list below: | |||
1774 | PPC | KVM_REG_PPC_VPA_SLB | 128 | 1774 | PPC | KVM_REG_PPC_VPA_SLB | 128 |
1775 | PPC | KVM_REG_PPC_VPA_DTL | 128 | 1775 | PPC | KVM_REG_PPC_VPA_DTL | 128 |
1776 | PPC | KVM_REG_PPC_EPCR | 32 | 1776 | PPC | KVM_REG_PPC_EPCR | 32 |
1777 | PPC | KVM_REG_PPC_EPR | 32 | ||
1777 | 1778 | ||
1778 | 4.69 KVM_GET_ONE_REG | 1779 | 4.69 KVM_GET_ONE_REG |
1779 | 1780 | ||
diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h index 2fba8a66fb10..16064d00adb9 100644 --- a/arch/powerpc/include/uapi/asm/kvm.h +++ b/arch/powerpc/include/uapi/asm/kvm.h | |||
@@ -114,7 +114,10 @@ struct kvm_regs { | |||
114 | /* Embedded Floating Point (SPE) -- IVOR32-34 if KVM_SREGS_E_IVOR */ | 114 | /* Embedded Floating Point (SPE) -- IVOR32-34 if KVM_SREGS_E_IVOR */ |
115 | #define KVM_SREGS_E_SPE (1 << 9) | 115 | #define KVM_SREGS_E_SPE (1 << 9) |
116 | 116 | ||
117 | /* External Proxy (EXP) -- EPR */ | 117 | /* |
118 | * DEPRECATED! USE ONE_REG FOR THIS ONE! | ||
119 | * External Proxy (EXP) -- EPR | ||
120 | */ | ||
118 | #define KVM_SREGS_EXP (1 << 10) | 121 | #define KVM_SREGS_EXP (1 << 10) |
119 | 122 | ||
120 | /* External PID (E.PD) -- EPSC/EPLC */ | 123 | /* External PID (E.PD) -- EPSC/EPLC */ |
@@ -412,5 +415,6 @@ struct kvm_get_htab_header { | |||
412 | #define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84) | 415 | #define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84) |
413 | 416 | ||
414 | #define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85) | 417 | #define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85) |
418 | #define KVM_REG_PPC_EPR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x86) | ||
415 | 419 | ||
416 | #endif /* __LINUX_KVM_POWERPC_H */ | 420 | #endif /* __LINUX_KVM_POWERPC_H */ |
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 940ec806187e..8779cd4c52d9 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c | |||
@@ -300,6 +300,15 @@ static void set_guest_esr(struct kvm_vcpu *vcpu, u32 esr) | |||
300 | #endif | 300 | #endif |
301 | } | 301 | } |
302 | 302 | ||
303 | static unsigned long get_guest_epr(struct kvm_vcpu *vcpu) | ||
304 | { | ||
305 | #ifdef CONFIG_KVM_BOOKE_HV | ||
306 | return mfspr(SPRN_GEPR); | ||
307 | #else | ||
308 | return vcpu->arch.epr; | ||
309 | #endif | ||
310 | } | ||
311 | |||
303 | /* Deliver the interrupt of the corresponding priority, if possible. */ | 312 | /* Deliver the interrupt of the corresponding priority, if possible. */ |
304 | static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu, | 313 | static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu, |
305 | unsigned int priority) | 314 | unsigned int priority) |
@@ -1405,6 +1414,11 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) | |||
1405 | &vcpu->arch.dbg_reg.dac[dac], sizeof(u64)); | 1414 | &vcpu->arch.dbg_reg.dac[dac], sizeof(u64)); |
1406 | break; | 1415 | break; |
1407 | } | 1416 | } |
1417 | case KVM_REG_PPC_EPR: { | ||
1418 | u32 epr = get_guest_epr(vcpu); | ||
1419 | r = put_user(epr, (u32 __user *)(long)reg->addr); | ||
1420 | break; | ||
1421 | } | ||
1408 | #if defined(CONFIG_64BIT) | 1422 | #if defined(CONFIG_64BIT) |
1409 | case KVM_REG_PPC_EPCR: | 1423 | case KVM_REG_PPC_EPCR: |
1410 | r = put_user(vcpu->arch.epcr, (u32 __user *)(long)reg->addr); | 1424 | r = put_user(vcpu->arch.epcr, (u32 __user *)(long)reg->addr); |
@@ -1437,6 +1451,13 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) | |||
1437 | (u64 __user *)(long)reg->addr, sizeof(u64)); | 1451 | (u64 __user *)(long)reg->addr, sizeof(u64)); |
1438 | break; | 1452 | break; |
1439 | } | 1453 | } |
1454 | case KVM_REG_PPC_EPR: { | ||
1455 | u32 new_epr; | ||
1456 | r = get_user(new_epr, (u32 __user *)(long)reg->addr); | ||
1457 | if (!r) | ||
1458 | kvmppc_set_epr(vcpu, new_epr); | ||
1459 | break; | ||
1460 | } | ||
1440 | #if defined(CONFIG_64BIT) | 1461 | #if defined(CONFIG_64BIT) |
1441 | case KVM_REG_PPC_EPCR: { | 1462 | case KVM_REG_PPC_EPCR: { |
1442 | u32 new_epcr; | 1463 | u32 new_epcr; |