Skip to content

Commit a764b56

Browse files
author
Marc Zyngier
committed
KVM: arm64: Allow kvm_has_feat() to take variable arguments
In order to be able to write more compact (and easier to read) code, let kvm_has_feat() and co take variable arguments. This enables constructs such as: #define FEAT_SME ID_AA64PFR1_EL1, SME, IMP if (kvm_has_feat(kvm, FEAT_SME)) [...] which is admitedly more readable. Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent c6cbe6a commit a764b56

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,12 +1572,16 @@ void kvm_set_vm_id_reg(struct kvm *kvm, u32 reg, u64 val);
15721572
kvm_cmp_feat_signed(kvm, id, fld, op, limit) : \
15731573
kvm_cmp_feat_unsigned(kvm, id, fld, op, limit))
15741574

1575-
#define kvm_has_feat(kvm, id, fld, limit) \
1575+
#define __kvm_has_feat(kvm, id, fld, limit) \
15761576
kvm_cmp_feat(kvm, id, fld, >=, limit)
15771577

1578-
#define kvm_has_feat_enum(kvm, id, fld, val) \
1578+
#define kvm_has_feat(kvm, ...) __kvm_has_feat(kvm, __VA_ARGS__)
1579+
1580+
#define __kvm_has_feat_enum(kvm, id, fld, val) \
15791581
kvm_cmp_feat_unsigned(kvm, id, fld, ==, val)
15801582

1583+
#define kvm_has_feat_enum(kvm, ...) __kvm_has_feat_enum(kvm, __VA_ARGS__)
1584+
15811585
#define kvm_has_feat_range(kvm, id, fld, min, max) \
15821586
(kvm_cmp_feat(kvm, id, fld, >=, min) && \
15831587
kvm_cmp_feat(kvm, id, fld, <=, max))

0 commit comments

Comments
 (0)