mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
ANDROID: KVM: arm64: Add vcpu flag copy primitive
Contrary to vanilla KVM, pKVM not only deals with flags in a vcpu, but also synchronises them across host and hypervisor views of the same vcpu. Most of the time, this is about copying flags from one vcpu structure to another, so let's offer a primitive that does this. Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Will Deacon <willdeacon@google.com> Bug: 233587962 Change-Id: Icd67b617c1cd69706ccd99739756458864b422bb
This commit is contained in:
committed by
Will Deacon
parent
0cd896e32e
commit
7019883a35
@@ -547,9 +547,25 @@ struct kvm_vcpu_arch {
|
||||
*fset &= ~(m); \
|
||||
} while (0)
|
||||
|
||||
#define __vcpu_copy_flag(vt, vs, flagset, f, m) \
|
||||
do { \
|
||||
typeof(vs->arch.flagset) tmp, val; \
|
||||
\
|
||||
__build_check_flag(vs, flagset, f, m); \
|
||||
\
|
||||
val = READ_ONCE(vs->arch.flagset); \
|
||||
val &= (m); \
|
||||
tmp = READ_ONCE(vt->arch.flagset); \
|
||||
tmp &= ~(m); \
|
||||
tmp |= val; \
|
||||
WRITE_ONCE(vt->arch.flagset, tmp); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define vcpu_get_flag(v, ...) __vcpu_get_flag((v), __VA_ARGS__)
|
||||
#define vcpu_set_flag(v, ...) __vcpu_set_flag((v), __VA_ARGS__)
|
||||
#define vcpu_clear_flag(v, ...) __vcpu_clear_flag((v), __VA_ARGS__)
|
||||
#define vcpu_copy_flag(vt, vs,...) __vcpu_copy_flag((vt), (vs), __VA_ARGS__)
|
||||
|
||||
/* SVE exposed to guest */
|
||||
#define GUEST_HAS_SVE __vcpu_single_flag(cflags, BIT(0))
|
||||
|
||||
Reference in New Issue
Block a user