Skip to content

Commit 0313334

Browse files
Claudio Imbrendaborntraeger
authored andcommitted
KVM: s390: a utility function for migration
Introduce a utility function that will be used later on for storage attributes migration, and use it in kvm_main.c to replace existing code that does the same thing. Signed-off-by: Claudio Imbrenda <[email protected]> Message-Id: <[email protected]> Signed-off-by: Christian Borntraeger <[email protected]>
1 parent 0230cae commit 0313334

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

include/linux/kvm_host.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,13 @@ static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memsl
309309
return ALIGN(memslot->npages, BITS_PER_LONG) / 8;
310310
}
311311

312+
static inline unsigned long *kvm_second_dirty_bitmap(struct kvm_memory_slot *memslot)
313+
{
314+
unsigned long len = kvm_dirty_bitmap_bytes(memslot);
315+
316+
return memslot->dirty_bitmap + len / sizeof(*memslot->dirty_bitmap);
317+
}
318+
312319
struct kvm_s390_adapter_int {
313320
u64 ind_addr;
314321
u64 summary_addr;

virt/kvm/kvm_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ int kvm_get_dirty_log_protect(struct kvm *kvm,
11691169

11701170
n = kvm_dirty_bitmap_bytes(memslot);
11711171

1172-
dirty_bitmap_buffer = dirty_bitmap + n / sizeof(long);
1172+
dirty_bitmap_buffer = kvm_second_dirty_bitmap(memslot);
11731173
memset(dirty_bitmap_buffer, 0, n);
11741174

11751175
spin_lock(&kvm->mmu_lock);

0 commit comments

Comments
 (0)