Commit afcc7c50 authored by Eric Auger's avatar Eric Auger Committed by Christoffer Dall

KVM: arm/arm64: vgic-new: vgic_kvm_device: KVM_DEV_ARM_VGIC_GRP_CTRL

This patch implements the KVM_DEV_ARM_VGIC_GRP_CTRL group API
featuring KVM_DEV_ARM_VGIC_CTRL_INIT attribute. The vgic_init
function is not yet implemented though.
Signed-off-by: default avatarEric Auger <eric.auger@linaro.org>
Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
Reviewed-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
parent fca25602
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
static int vgic_set_common_attr(struct kvm_device *dev, static int vgic_set_common_attr(struct kvm_device *dev,
struct kvm_device_attr *attr) struct kvm_device_attr *attr)
{ {
int r;
switch (attr->group) { switch (attr->group) {
case KVM_DEV_ARM_VGIC_GRP_NR_IRQS: { case KVM_DEV_ARM_VGIC_GRP_NR_IRQS: {
u32 __user *uaddr = (u32 __user *)(long)attr->addr; u32 __user *uaddr = (u32 __user *)(long)attr->addr;
...@@ -55,6 +57,16 @@ static int vgic_set_common_attr(struct kvm_device *dev, ...@@ -55,6 +57,16 @@ static int vgic_set_common_attr(struct kvm_device *dev,
return ret; return ret;
} }
case KVM_DEV_ARM_VGIC_GRP_CTRL: {
switch (attr->attr) {
case KVM_DEV_ARM_VGIC_CTRL_INIT:
mutex_lock(&dev->kvm->lock);
r = vgic_init(dev->kvm);
mutex_unlock(&dev->kvm->lock);
return r;
}
break;
}
} }
return -ENXIO; return -ENXIO;
...@@ -131,6 +143,11 @@ static int vgic_v2_has_attr(struct kvm_device *dev, ...@@ -131,6 +143,11 @@ static int vgic_v2_has_attr(struct kvm_device *dev,
switch (attr->group) { switch (attr->group) {
case KVM_DEV_ARM_VGIC_GRP_NR_IRQS: case KVM_DEV_ARM_VGIC_GRP_NR_IRQS:
return 0; return 0;
case KVM_DEV_ARM_VGIC_GRP_CTRL:
switch (attr->attr) {
case KVM_DEV_ARM_VGIC_CTRL_INIT:
return 0;
}
} }
return -ENXIO; return -ENXIO;
} }
...@@ -166,6 +183,11 @@ static int vgic_v3_has_attr(struct kvm_device *dev, ...@@ -166,6 +183,11 @@ static int vgic_v3_has_attr(struct kvm_device *dev,
switch (attr->group) { switch (attr->group) {
case KVM_DEV_ARM_VGIC_GRP_NR_IRQS: case KVM_DEV_ARM_VGIC_GRP_NR_IRQS:
return 0; return 0;
case KVM_DEV_ARM_VGIC_GRP_CTRL:
switch (attr->attr) {
case KVM_DEV_ARM_VGIC_CTRL_INIT:
return 0;
}
} }
return -ENXIO; return -ENXIO;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment