Common KVM changes for 6.6:
- Wrap kvm_{gfn,hva}_range.pte in a union to allow mmu_notifier events to pass
action specific data without needing to constantly update the main handlers.
- Drop unused function declarations
-----BEGIN PGP SIGNATURE-----
iQJGBAABCgAwFiEEMHr+pfEFOIzK+KY1YJEiAU0MEvkFAmTudpYSHHNlYW5qY0Bn
b29nbGUuY29tAAoJEGCRIgFNDBL5xJUQAKnMVEV+7gRtfV5KCJFRTNAMxo4zSIt/
K6QX+x/SwUriXj4nTAlvAtju1xz4nwTYBABKj3bXEaLpVjIUIbnEzEGuTKKK6XY9
UyJKVgafwLuKLWPYN/5Zv5SCO7DmVC9W3lVMtchgt7gFcRxtZhmEn53boHhrhan0
/2L5XD6N9rd81Zmd/rQkJNRND7XY3HkvDSnfmsRI/rfFUglCUHBDp4c2Wkmz+Dnb
ux7N37si5OTbRVp18VzbLg1jalstDEm36ZQ7tLkvIbNbZV6pV93/ZmcTmsOruTeN
gHVr6/RXmKKwgO3wtZ9DKL6oMcoh20yoT+vqhbaihVssLPGPusk7S2cCQ7529u8/
Oda+w67MMdbE46N9CmB56fkpwNvn9nLCoQFhMhXBWhPJVNmorpiR6drHKqLy5zCq
lrsWGqXU/DXA2PwdsztfIIMVeALawzExHu9ayppcKwb4S8TLJhLma7dT+EvwUxuV
hoswaIT7Tq2ptZ34Fo5/vEz+90u2wi7LynHrNdTs7NLsW+WI/jab7KxKc+mf5WYh
KuMzqmmPXmWRFupFeDa61YY5PCvMddDeac/jCYL/2cr73RA8bUItivwt5mEg5nOW
9NEU+cLbl1s8g2KfxwhvodVkbhiNGf8MkVpE5skHHh9OX8HYzZUa/s6uUZO1O0eh
XOk+fa9KWabt
=n819
-----END PGP SIGNATURE-----
Merge tag 'kvm-x86-generic-6.6' of https://github.com/kvm-x86/linux into HEAD
Common KVM changes for 6.6:
- Wrap kvm_{gfn,hva}_range.pte in a union to allow mmu_notifier events to pass
action specific data without needing to constantly update the main handlers.
- Drop unused function declarations
This commit is contained in:
commit
0d15bf966d
7 changed files with 22 additions and 21 deletions
|
|
@ -551,7 +551,7 @@ typedef void (*on_unlock_fn_t)(struct kvm *kvm);
|
|||
struct kvm_hva_range {
|
||||
unsigned long start;
|
||||
unsigned long end;
|
||||
pte_t pte;
|
||||
union kvm_mmu_notifier_arg arg;
|
||||
hva_handler_t handler;
|
||||
on_lock_fn_t on_lock;
|
||||
on_unlock_fn_t on_unlock;
|
||||
|
|
@ -572,6 +572,8 @@ static void kvm_null_fn(void)
|
|||
}
|
||||
#define IS_KVM_NULL_FN(fn) ((fn) == (void *)kvm_null_fn)
|
||||
|
||||
static const union kvm_mmu_notifier_arg KVM_MMU_NOTIFIER_NO_ARG;
|
||||
|
||||
/* Iterate over each memslot intersecting [start, last] (inclusive) range */
|
||||
#define kvm_for_each_memslot_in_hva_range(node, slots, start, last) \
|
||||
for (node = interval_tree_iter_first(&slots->hva_tree, start, last); \
|
||||
|
|
@ -616,7 +618,7 @@ static __always_inline int __kvm_handle_hva_range(struct kvm *kvm,
|
|||
* bother making these conditional (to avoid writes on
|
||||
* the second or later invocation of the handler).
|
||||
*/
|
||||
gfn_range.pte = range->pte;
|
||||
gfn_range.arg = range->arg;
|
||||
gfn_range.may_block = range->may_block;
|
||||
|
||||
/*
|
||||
|
|
@ -657,14 +659,14 @@ static __always_inline int __kvm_handle_hva_range(struct kvm *kvm,
|
|||
static __always_inline int kvm_handle_hva_range(struct mmu_notifier *mn,
|
||||
unsigned long start,
|
||||
unsigned long end,
|
||||
pte_t pte,
|
||||
union kvm_mmu_notifier_arg arg,
|
||||
hva_handler_t handler)
|
||||
{
|
||||
struct kvm *kvm = mmu_notifier_to_kvm(mn);
|
||||
const struct kvm_hva_range range = {
|
||||
.start = start,
|
||||
.end = end,
|
||||
.pte = pte,
|
||||
.arg = arg,
|
||||
.handler = handler,
|
||||
.on_lock = (void *)kvm_null_fn,
|
||||
.on_unlock = (void *)kvm_null_fn,
|
||||
|
|
@ -684,7 +686,6 @@ static __always_inline int kvm_handle_hva_range_no_flush(struct mmu_notifier *mn
|
|||
const struct kvm_hva_range range = {
|
||||
.start = start,
|
||||
.end = end,
|
||||
.pte = __pte(0),
|
||||
.handler = handler,
|
||||
.on_lock = (void *)kvm_null_fn,
|
||||
.on_unlock = (void *)kvm_null_fn,
|
||||
|
|
@ -718,6 +719,7 @@ static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn,
|
|||
pte_t pte)
|
||||
{
|
||||
struct kvm *kvm = mmu_notifier_to_kvm(mn);
|
||||
const union kvm_mmu_notifier_arg arg = { .pte = pte };
|
||||
|
||||
trace_kvm_set_spte_hva(address);
|
||||
|
||||
|
|
@ -733,7 +735,7 @@ static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn,
|
|||
if (!READ_ONCE(kvm->mmu_invalidate_in_progress))
|
||||
return;
|
||||
|
||||
kvm_handle_hva_range(mn, address, address + 1, pte, kvm_change_spte_gfn);
|
||||
kvm_handle_hva_range(mn, address, address + 1, arg, kvm_change_spte_gfn);
|
||||
}
|
||||
|
||||
void kvm_mmu_invalidate_begin(struct kvm *kvm, unsigned long start,
|
||||
|
|
@ -772,7 +774,6 @@ static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
|
|||
const struct kvm_hva_range hva_range = {
|
||||
.start = range->start,
|
||||
.end = range->end,
|
||||
.pte = __pte(0),
|
||||
.handler = kvm_unmap_gfn_range,
|
||||
.on_lock = kvm_mmu_invalidate_begin,
|
||||
.on_unlock = kvm_arch_guest_memory_reclaimed,
|
||||
|
|
@ -837,7 +838,6 @@ static void kvm_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn,
|
|||
const struct kvm_hva_range hva_range = {
|
||||
.start = range->start,
|
||||
.end = range->end,
|
||||
.pte = __pte(0),
|
||||
.handler = (void *)kvm_null_fn,
|
||||
.on_lock = kvm_mmu_invalidate_end,
|
||||
.on_unlock = (void *)kvm_null_fn,
|
||||
|
|
@ -870,7 +870,8 @@ static int kvm_mmu_notifier_clear_flush_young(struct mmu_notifier *mn,
|
|||
{
|
||||
trace_kvm_age_hva(start, end);
|
||||
|
||||
return kvm_handle_hva_range(mn, start, end, __pte(0), kvm_age_gfn);
|
||||
return kvm_handle_hva_range(mn, start, end, KVM_MMU_NOTIFIER_NO_ARG,
|
||||
kvm_age_gfn);
|
||||
}
|
||||
|
||||
static int kvm_mmu_notifier_clear_young(struct mmu_notifier *mn,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue