Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: arm64: gic-v5: Introduce kvm_arm_vgic_v5_ops and register them

Only the KVM_DEV_ARM_VGIC_GRP_CTRL->KVM_DEV_ARM_VGIC_CTRL_INIT op is
currently supported. All other ops are stubbed out.

Co-authored-by: Timothy Hayes <timothy.hayes@arm.com>
Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Link: https://patch.msgid.link/20260319154937.3619520-36-sascha.bischoff@arm.com
Signed-off-by: Marc Zyngier <maz@kernel.org>

authored by

Sascha Bischoff
Timothy Hayes
and committed by
Marc Zyngier
37a25294 61d4ad51

+75
+74
arch/arm64/kvm/vgic/vgic-kvm-device.c
··· 336 336 break; 337 337 ret = kvm_vgic_register_its_device(); 338 338 break; 339 + case KVM_DEV_TYPE_ARM_VGIC_V5: 340 + ret = kvm_register_device_ops(&kvm_arm_vgic_v5_ops, 341 + KVM_DEV_TYPE_ARM_VGIC_V5); 342 + break; 339 343 } 340 344 341 345 return ret; ··· 718 714 .set_attr = vgic_v3_set_attr, 719 715 .get_attr = vgic_v3_get_attr, 720 716 .has_attr = vgic_v3_has_attr, 717 + }; 718 + 719 + static int vgic_v5_set_attr(struct kvm_device *dev, 720 + struct kvm_device_attr *attr) 721 + { 722 + switch (attr->group) { 723 + case KVM_DEV_ARM_VGIC_GRP_ADDR: 724 + case KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS: 725 + case KVM_DEV_ARM_VGIC_GRP_NR_IRQS: 726 + return -ENXIO; 727 + case KVM_DEV_ARM_VGIC_GRP_CTRL: 728 + switch (attr->attr) { 729 + case KVM_DEV_ARM_VGIC_CTRL_INIT: 730 + return vgic_set_common_attr(dev, attr); 731 + default: 732 + return -ENXIO; 733 + } 734 + default: 735 + return -ENXIO; 736 + } 737 + 738 + } 739 + 740 + static int vgic_v5_get_attr(struct kvm_device *dev, 741 + struct kvm_device_attr *attr) 742 + { 743 + switch (attr->group) { 744 + case KVM_DEV_ARM_VGIC_GRP_ADDR: 745 + case KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS: 746 + case KVM_DEV_ARM_VGIC_GRP_NR_IRQS: 747 + return -ENXIO; 748 + case KVM_DEV_ARM_VGIC_GRP_CTRL: 749 + switch (attr->attr) { 750 + case KVM_DEV_ARM_VGIC_CTRL_INIT: 751 + return vgic_get_common_attr(dev, attr); 752 + default: 753 + return -ENXIO; 754 + } 755 + default: 756 + return -ENXIO; 757 + } 758 + } 759 + 760 + static int vgic_v5_has_attr(struct kvm_device *dev, 761 + struct kvm_device_attr *attr) 762 + { 763 + switch (attr->group) { 764 + case KVM_DEV_ARM_VGIC_GRP_ADDR: 765 + case KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS: 766 + case KVM_DEV_ARM_VGIC_GRP_NR_IRQS: 767 + return -ENXIO; 768 + case KVM_DEV_ARM_VGIC_GRP_CTRL: 769 + switch (attr->attr) { 770 + case KVM_DEV_ARM_VGIC_CTRL_INIT: 771 + return 0; 772 + default: 773 + return -ENXIO; 774 + } 775 + default: 776 + return -ENXIO; 777 + } 778 + } 779 + 780 + struct kvm_device_ops kvm_arm_vgic_v5_ops = { 781 + .name = "kvm-arm-vgic-v5", 782 + .create = vgic_create, 783 + .destroy = vgic_destroy, 784 + .set_attr = vgic_v5_set_attr, 785 + .get_attr = vgic_v5_get_attr, 786 + .has_attr = vgic_v5_has_attr, 721 787 };
+1
include/linux/kvm_host.h
··· 2366 2366 extern struct kvm_device_ops kvm_mpic_ops; 2367 2367 extern struct kvm_device_ops kvm_arm_vgic_v2_ops; 2368 2368 extern struct kvm_device_ops kvm_arm_vgic_v3_ops; 2369 + extern struct kvm_device_ops kvm_arm_vgic_v5_ops; 2369 2370 2370 2371 #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT 2371 2372