Skip to content

Commit 915d2f0

Browse files
committed
KVM: Move KVM_REG_SIZE() definition to common uAPI header
Define KVM_REG_SIZE() in the common kvm.h header, and delete the arm64 and RISC-V versions. As evidenced by the surrounding definitions, all aspects of the register size encoding are generic, i.e. RISC-V should have moved arm64's definition to common code instead of copy+pasting. Acked-by: Anup Patel <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Reviewed-by: Muhammad Usama Anjum <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 3522c41 commit 915d2f0

File tree

3 files changed

+4
-6
lines changed
  • arch
    • arm64/include/uapi/asm
    • riscv/include/uapi/asm
  • include/uapi/linux

3 files changed

+4
-6
lines changed

arch/arm64/include/uapi/asm/kvm.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
4444
#define KVM_DIRTY_LOG_PAGE_OFFSET 64
4545

46-
#define KVM_REG_SIZE(id) \
47-
(1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
48-
4946
struct kvm_regs {
5047
struct user_pt_regs regs; /* sp = sp_el0 */
5148

arch/riscv/include/uapi/asm/kvm.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,6 @@ struct kvm_riscv_sbi_sta {
211211
#define KVM_RISCV_TIMER_STATE_OFF 0
212212
#define KVM_RISCV_TIMER_STATE_ON 1
213213

214-
#define KVM_REG_SIZE(id) \
215-
(1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
216-
217214
/* If you need to interpret the index values, here is the key: */
218215
#define KVM_REG_RISCV_TYPE_MASK 0x00000000FF000000
219216
#define KVM_REG_RISCV_TYPE_SHIFT 24

include/uapi/linux/kvm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,10 @@ struct kvm_dirty_tlb {
10701070

10711071
#define KVM_REG_SIZE_SHIFT 52
10721072
#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL
1073+
1074+
#define KVM_REG_SIZE(id) \
1075+
(1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
1076+
10731077
#define KVM_REG_SIZE_U8 0x0000000000000000ULL
10741078
#define KVM_REG_SIZE_U16 0x0010000000000000ULL
10751079
#define KVM_REG_SIZE_U32 0x0020000000000000ULL

0 commit comments

Comments
 (0)