* [Qemu-devel] [PATCH qemu] kvm-all: Align to qemu_real_host_page_size in kvm_set_phys_mem
@ 2015-10-06 3:30 Alexey Kardashevskiy
2015-10-07 10:52 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Kardashevskiy @ 2015-10-06 3:30 UTC (permalink / raw)
To: qemu-devel
Cc: Alexey Kardashevskiy, Paolo Bonzini, Alex Williamson,
Alexander Graf
As the comment in kvm_set_phys_mem() says, KVM works in page size chunks.
However it uses hardcoded TARGET_PAGE_SIZE which is 4K on most platforms
while actual host may use different page size, for example, PPC64 hosts
use 64K system pages.
This replaces static TARGET_PAGE_SIZE with run-time calculated
qemu_real_host_page_size.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
This is the result of debugging VFIO quirks not working under PPC64 KVM.
---
kvm-all.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 0be4615..6f04fbb 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -642,15 +642,15 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml,
/* kvm works in page size chunks, but the function may be called
with sub-page size and unaligned start address. Pad the start
address to next and truncate size to previous page boundary. */
- delta = (TARGET_PAGE_SIZE - (start_addr & ~TARGET_PAGE_MASK));
- delta &= ~TARGET_PAGE_MASK;
+ delta = qemu_real_host_page_size - (start_addr & ~qemu_real_host_page_mask);
+ delta &= ~qemu_real_host_page_mask;
if (delta > size) {
return;
}
start_addr += delta;
size -= delta;
- size &= TARGET_PAGE_MASK;
- if (!size || (start_addr & ~TARGET_PAGE_MASK)) {
+ size &= qemu_real_host_page_mask;
+ if (!size || (start_addr & ~qemu_real_host_page_mask)) {
return;
}
--
2.5.0.rc3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH qemu] kvm-all: Align to qemu_real_host_page_size in kvm_set_phys_mem
2015-10-06 3:30 [Qemu-devel] [PATCH qemu] kvm-all: Align to qemu_real_host_page_size in kvm_set_phys_mem Alexey Kardashevskiy
@ 2015-10-07 10:52 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2015-10-07 10:52 UTC (permalink / raw)
To: Alexey Kardashevskiy, qemu-devel; +Cc: Alex Williamson, Alexander Graf
On 06/10/2015 05:30, Alexey Kardashevskiy wrote:
> As the comment in kvm_set_phys_mem() says, KVM works in page size chunks.
> However it uses hardcoded TARGET_PAGE_SIZE which is 4K on most platforms
> while actual host may use different page size, for example, PPC64 hosts
> use 64K system pages.
>
> This replaces static TARGET_PAGE_SIZE with run-time calculated
> qemu_real_host_page_size.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>
> This is the result of debugging VFIO quirks not working under PPC64 KVM.
> ---
> kvm-all.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 0be4615..6f04fbb 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -642,15 +642,15 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml,
> /* kvm works in page size chunks, but the function may be called
> with sub-page size and unaligned start address. Pad the start
> address to next and truncate size to previous page boundary. */
> - delta = (TARGET_PAGE_SIZE - (start_addr & ~TARGET_PAGE_MASK));
> - delta &= ~TARGET_PAGE_MASK;
> + delta = qemu_real_host_page_size - (start_addr & ~qemu_real_host_page_mask);
> + delta &= ~qemu_real_host_page_mask;
> if (delta > size) {
> return;
> }
> start_addr += delta;
> size -= delta;
> - size &= TARGET_PAGE_MASK;
> - if (!size || (start_addr & ~TARGET_PAGE_MASK)) {
> + size &= qemu_real_host_page_mask;
> + if (!size || (start_addr & ~qemu_real_host_page_mask)) {
> return;
> }
>
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-07 10:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06 3:30 [Qemu-devel] [PATCH qemu] kvm-all: Align to qemu_real_host_page_size in kvm_set_phys_mem Alexey Kardashevskiy
2015-10-07 10:52 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).