From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjmKf-0002Ze-B2 for qemu-devel@nongnu.org; Wed, 07 Oct 2015 06:52:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjmKc-0007Wy-2r for qemu-devel@nongnu.org; Wed, 07 Oct 2015 06:52:25 -0400 Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]:35599) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjmKb-0007Wp-Rr for qemu-devel@nongnu.org; Wed, 07 Oct 2015 06:52:22 -0400 Received: by wicge5 with SMTP id ge5so206923830wic.0 for ; Wed, 07 Oct 2015 03:52:21 -0700 (PDT) Sender: Paolo Bonzini References: <1444102257-17405-1-git-send-email-aik@ozlabs.ru> From: Paolo Bonzini Message-ID: <5614F960.9080703@redhat.com> Date: Wed, 7 Oct 2015 12:52:16 +0200 MIME-Version: 1.0 In-Reply-To: <1444102257-17405-1-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH qemu] kvm-all: Align to qemu_real_host_page_size in kvm_set_phys_mem List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy , qemu-devel@nongnu.org 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 > --- > > 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