On 07/28 13:26, Mathieu Poirier wrote:
> From: Jean-Philippe Brucker <[email protected]>
> 
> This is a temporary patch intended for testing purposes only. It provides
> definitions related to supporting Realms by the QEMU-VMM.
> 
> Signed-off-by: Jean-Philippe Brucker <[email protected]>
> Signed-off-by: Mathieu Poirier <[email protected]>
> ---
>  linux-headers/asm-arm64/kvm.h |  9 +++++++++
>  linux-headers/linux/kvm.h     | 10 +++++++++-
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h
> index 6aefe7973814..4c08631ec7d2 100644
> --- a/linux-headers/asm-arm64/kvm.h
> +++ b/linux-headers/asm-arm64/kvm.h
> @@ -208,6 +208,15 @@ struct kvm_arm_counter_offset {
>       __u64 reserved;
>  };
>  
> +#define KVM_ARM_RMI_POPULATE_FLAGS_MEASURE     (1 << 0)
> +struct kvm_arm_rmi_populate {
> +     __u64 base;
> +     __u64 size;
> +     __u64 source_uaddr;
> +     __u32 flags;
> +     __u32 reserved;
> +};
> +
>  #define KVM_ARM_TAGS_TO_GUEST                0
>  #define KVM_ARM_TAGS_FROM_GUEST              1
>  
> diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
> index dd52e2a65bfd..cdd5ad11f85a 100644
> --- a/linux-headers/linux/kvm.h
> +++ b/linux-headers/linux/kvm.h
> @@ -689,14 +689,19 @@ struct kvm_enable_cap {
>   * address size for the VM. Bits[7-0] are reserved for the guest
>   * PA size shift (i.e, log2(PA_Size)). For backward compatibility,
>   * value 0 implies the default IPA size, 40bits.
> + *
> + * Bits[30-31] are reserved for the VM type
>   */
>  #define KVM_VM_TYPE_ARM_IPA_SIZE_MASK        0xffULL
>  #define KVM_VM_TYPE_ARM_IPA_SIZE(x)          \
>       ((x) & KVM_VM_TYPE_ARM_IPA_SIZE_MASK)
>  
> +#define KVM_VM_TYPE_ARM_NORMAL               0
> +#define KVM_VM_TYPE_ARM_REALM                (1UL << 30)
>  #define KVM_VM_TYPE_ARM_PROTECTED    (1UL << 31)
>  #define KVM_VM_TYPE_ARM_MASK         (KVM_VM_TYPE_ARM_IPA_SIZE_MASK | \
> -                                      KVM_VM_TYPE_ARM_PROTECTED)
> +                                      KVM_VM_TYPE_ARM_PROTECTED | \
> +                                      KVM_VM_TYPE_ARM_REALM)
>  
>  /*
>   * ioctls for /dev/kvm fds:
> @@ -719,6 +724,8 @@ struct kvm_enable_cap {
>  #define KVM_GET_EMULATED_CPUID         _IOWR(KVMIO, 0x09, struct kvm_cpuid2)
>  #define KVM_GET_MSR_FEATURE_INDEX_LIST    _IOWR(KVMIO, 0x0a, struct 
> kvm_msr_list)
>  
> +#define KVM_ARM_RMI_POPULATE   _IOWR(KVMIO, 0xd7, struct 
> kvm_arm_rmi_populate)
> +
>  /*
>   * Extension capability list.
>   */
> @@ -986,6 +993,7 @@ struct kvm_enable_cap {
>  #define KVM_CAP_S390_KEYOP 247
>  #define KVM_CAP_S390_VSIE_ESAMODE 248
>  #define KVM_CAP_S390_HPAGE_2G 249
> +#define KVM_CAP_ARM_RMI 250

Not a big deal, but a note for anyone testing this series:

Use Linaro's Linux kernel tree, as mentioned in the cover letter:
https://gitlab.com/Linaro/cca-public/linux/-/tree/upstream-v2?ref_type=heads

Alternetively, if you're using Arm's tree or other trees with Steven
Price's v14 series as I am:

You'll need to adjust the definition of KVM_CAP_ARM_RMI, since it uses a
differenct capability number.

>  
>  struct kvm_irq_routing_irqchip {
>       __u32 irqchip;
> -- 
> 2.43.0
> 

Reply via email to