Useful helper for getting length of register given id.

Signed-off-by: Rusty Russell <rusty.russ...@linaro.org>
---
 include/linux/kvm.h |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index d808694..8c3760e 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -744,6 +744,8 @@ struct kvm_dirty_tlb {
 #define KVM_REG_SIZE_U256      0x0050000000000000ULL
 #define KVM_REG_SIZE_U512      0x0060000000000000ULL
 #define KVM_REG_SIZE_U1024     0x0070000000000000ULL
+#define KVM_REG_SIZE(id)                                               \
+       (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
 
 struct kvm_one_reg {
        __u64 id;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to