Skip to content

Commit

Permalink
KVM: s390: a utility function for migration
Browse files Browse the repository at this point in the history
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 <imbrenda@linux.vnet.ibm.com>
Message-Id: <1525106005-13931-2-git-send-email-imbrenda@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
  • Loading branch information
Claudio Imbrenda authored and Christian Borntraeger committed Jul 13, 2018
1 parent 0230cae commit 0313334
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions include/linux/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memsl
return ALIGN(memslot->npages, BITS_PER_LONG) / 8;
}

static inline unsigned long *kvm_second_dirty_bitmap(struct kvm_memory_slot *memslot)
{
unsigned long len = kvm_dirty_bitmap_bytes(memslot);

return memslot->dirty_bitmap + len / sizeof(*memslot->dirty_bitmap);
}

struct kvm_s390_adapter_int {
u64 ind_addr;
u64 summary_addr;
Expand Down
2 changes: 1 addition & 1 deletion virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ int kvm_get_dirty_log_protect(struct kvm *kvm,

n = kvm_dirty_bitmap_bytes(memslot);

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

spin_lock(&kvm->mmu_lock);
Expand Down

0 comments on commit 0313334

Please sign in to comment.