Re: [PATCH 20/54] KVM: x86/mmu: Add struct and helpers to retrieve MMU role bits from regs

From: Paolo Bonzini
Date: Wed Jun 23 2021 - 13:18:59 EST


On 22/06/21 19:57, Sean Christopherson wrote:
+/*
+ * Yes, lot's of underscores. They're a hint that you probably shouldn't be
+ * reading from the role_regs. Once the mmu_role is constructed, it becomes
+ * the single source of truth for the MMU's state.
+ */
+#define BUILD_MMU_ROLE_REGS_ACCESSOR(reg, name, flag) \
+static inline bool ____is_##reg##_##name(struct kvm_mmu_role_regs *regs)\
+{ \
+ return !!(regs->reg & flag); \
+}

Ok, that's a decent reason to have these accessors in the first place. :)

Paolo