Skip to content

Commit 654ecf3

Browse files
author
Vineeth Pillai (Google)
committed
SQUASHME: pKVM: x86: VMX: Move vCPU register macros to header
These macros will be used by reprivilege code as well and hence, move it to a common header file. Fixes: 321aa36 (pKVM: VMX: Setup the RSP and RIP fields for the pKVM hypervisor) Signed-off-by: Vineeth Pillai (Google) <vineeth@bitbyteword.org>
1 parent 804b431 commit 654ecf3

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

arch/x86/kvm/pkvm/vmx/host_vmentry.S

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,11 @@
33
#include <asm/kvm_vcpu_regs.h>
44
#include <asm/frame.h>
55
#include <asm/asm.h>
6-
#include <asm/bitsperlong.h>
76
#include <asm/unwind_hints.h>
87
#include <asm/nospec-branch.h>
98
#include "kvm-asm-offsets.h"
109
#include "run_flags.h"
11-
12-
#define WORD_SIZE (BITS_PER_LONG / 8)
13-
14-
#define VCPU_RAX (__VCPU_REGS_RAX * WORD_SIZE)
15-
#define VCPU_RCX (__VCPU_REGS_RCX * WORD_SIZE)
16-
#define VCPU_RDX (__VCPU_REGS_RDX * WORD_SIZE)
17-
#define VCPU_RBX (__VCPU_REGS_RBX * WORD_SIZE)
18-
#define VCPU_RBP (__VCPU_REGS_RBP * WORD_SIZE)
19-
#define VCPU_RSI (__VCPU_REGS_RSI * WORD_SIZE)
20-
#define VCPU_RDI (__VCPU_REGS_RDI * WORD_SIZE)
21-
22-
#define VCPU_R8 (__VCPU_REGS_R8 * WORD_SIZE)
23-
#define VCPU_R9 (__VCPU_REGS_R9 * WORD_SIZE)
24-
#define VCPU_R10 (__VCPU_REGS_R10 * WORD_SIZE)
25-
#define VCPU_R11 (__VCPU_REGS_R11 * WORD_SIZE)
26-
#define VCPU_R12 (__VCPU_REGS_R12 * WORD_SIZE)
27-
#define VCPU_R13 (__VCPU_REGS_R13 * WORD_SIZE)
28-
#define VCPU_R14 (__VCPU_REGS_R14 * WORD_SIZE)
29-
#define VCPU_R15 (__VCPU_REGS_R15 * WORD_SIZE)
10+
#include "vcpu_regs.h"
3011

3112
/*
3213
* pkvm_host_vmexit_entry - Handle a VM-Exit event from the deprivileged

arch/x86/kvm/pkvm/vmx/vcpu_regs.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef __PKVM_VMX_VCPU_REGS_H
3+
#define __PKVM_VMX_VCPU_REGS_H
4+
5+
#include <asm/bitsperlong.h>
6+
7+
#define WORD_SIZE (BITS_PER_LONG / 8)
8+
9+
#define VCPU_RAX (__VCPU_REGS_RAX * WORD_SIZE)
10+
#define VCPU_RCX (__VCPU_REGS_RCX * WORD_SIZE)
11+
#define VCPU_RDX (__VCPU_REGS_RDX * WORD_SIZE)
12+
#define VCPU_RBX (__VCPU_REGS_RBX * WORD_SIZE)
13+
#define VCPU_RBP (__VCPU_REGS_RBP * WORD_SIZE)
14+
#define VCPU_RSI (__VCPU_REGS_RSI * WORD_SIZE)
15+
#define VCPU_RDI (__VCPU_REGS_RDI * WORD_SIZE)
16+
17+
#define VCPU_R8 (__VCPU_REGS_R8 * WORD_SIZE)
18+
#define VCPU_R9 (__VCPU_REGS_R9 * WORD_SIZE)
19+
#define VCPU_R10 (__VCPU_REGS_R10 * WORD_SIZE)
20+
#define VCPU_R11 (__VCPU_REGS_R11 * WORD_SIZE)
21+
#define VCPU_R12 (__VCPU_REGS_R12 * WORD_SIZE)
22+
#define VCPU_R13 (__VCPU_REGS_R13 * WORD_SIZE)
23+
#define VCPU_R14 (__VCPU_REGS_R14 * WORD_SIZE)
24+
#define VCPU_R15 (__VCPU_REGS_R15 * WORD_SIZE)
25+
26+
#endif /* __PKVM_VMX_VCPU_REGS_H */
27+

0 commit comments

Comments
 (0)