diff mbox

[10/14] KVM: PPC: Enable the PAPR CAP for Book3S

Message ID 1314283193-10323-11-git-send-email-agraf@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Graf Aug. 25, 2011, 2:39 p.m. UTC
Now that Book3S PV mode can also run PAPR guests, we can add a PAPR cap and
enable it for all Book3S targets. Enabling that CAP switches KVM into PAPR
mode.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/powerpc.c |    5 +++++
 include/linux/kvm.h        |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

Comments

Avi Kivity Aug. 31, 2011, 8:31 a.m. UTC | #1
On 08/25/2011 05:39 PM, Alexander Graf wrote:
> Now that Book3S PV mode can also run PAPR guests, we can add a PAPR cap and
> enable it for all Book3S targets. Enabling that CAP switches KVM into PAPR
> mode.
>
>   #define KVM_CAP_PPC_RMA	65
>   #define KVM_CAP_MAX_VCPUS 66       /* returns max vcpus per vm */
>   #define KVM_CAP_PPC_HIOR 67
> +#define KVM_CAP_PPC_PAPR 68
>
>   #ifdef KVM_CAP_IRQ_ROUTING
>

Documentation/virtual/kvm/api.txt
Alexander Graf Aug. 31, 2011, 8:37 a.m. UTC | #2
On 31.08.2011, at 10:31, Avi Kivity wrote:

> On 08/25/2011 05:39 PM, Alexander Graf wrote:
>> Now that Book3S PV mode can also run PAPR guests, we can add a PAPR cap and
>> enable it for all Book3S targets. Enabling that CAP switches KVM into PAPR
>> mode.
>> 
>>  #define KVM_CAP_PPC_RMA	65
>>  #define KVM_CAP_MAX_VCPUS 66       /* returns max vcpus per vm */
>>  #define KVM_CAP_PPC_HIOR 67
>> +#define KVM_CAP_PPC_PAPR 68
>> 
>>  #ifdef KVM_CAP_IRQ_ROUTING
>> 
> 
> Documentation/virtual/kvm/api.txt

Yeah, we don't have a section for capabilities that don't have their own ioctls yet, so I didn't add it. I can create one if you like.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity Aug. 31, 2011, 8:39 a.m. UTC | #3
On 08/31/2011 11:37 AM, Alexander Graf wrote:
> On 31.08.2011, at 10:31, Avi Kivity wrote:
>
> >  On 08/25/2011 05:39 PM, Alexander Graf wrote:
> >>  Now that Book3S PV mode can also run PAPR guests, we can add a PAPR cap and
> >>  enable it for all Book3S targets. Enabling that CAP switches KVM into PAPR
> >>  mode.
> >>
> >>   #define KVM_CAP_PPC_RMA	65
> >>   #define KVM_CAP_MAX_VCPUS 66       /* returns max vcpus per vm */
> >>   #define KVM_CAP_PPC_HIOR 67
> >>  +#define KVM_CAP_PPC_PAPR 68
> >>
> >>   #ifdef KVM_CAP_IRQ_ROUTING
> >>
> >
> >  Documentation/virtual/kvm/api.txt
>
> Yeah, we don't have a section for capabilities that don't have their own ioctls yet, so I didn't add it. I can create one if you like.
>

Please do.
diff mbox

Patch

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 17a5c83..13bc798 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -189,6 +189,7 @@  int kvm_dev_ioctl_check_extension(long ext)
 #else
 	case KVM_CAP_PPC_SEGSTATE:
 	case KVM_CAP_PPC_HIOR:
+	case KVM_CAP_PPC_PAPR:
 #endif
 	case KVM_CAP_PPC_UNSET_IRQ:
 	case KVM_CAP_PPC_IRQ_LEVEL:
@@ -572,6 +573,10 @@  static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
 		r = 0;
 		vcpu->arch.osi_enabled = true;
 		break;
+	case KVM_CAP_PPC_PAPR:
+		r = 0;
+		vcpu->arch.papr_enabled = true;
+		break;
 	default:
 		r = -EINVAL;
 		break;
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 4d33f78..2d7161c 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -555,6 +555,7 @@  struct kvm_ppc_pvinfo {
 #define KVM_CAP_PPC_RMA	65
 #define KVM_CAP_MAX_VCPUS 66       /* returns max vcpus per vm */
 #define KVM_CAP_PPC_HIOR 67
+#define KVM_CAP_PPC_PAPR 68
 
 #ifdef KVM_CAP_IRQ_ROUTING