From patchwork Mon Jul 6 18:34:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 491812 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E4E1B140325 for ; Tue, 7 Jul 2015 05:38:36 +1000 (AEST) Received: from localhost ([::1]:52697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCCDq-0008Vx-PW for incoming@patchwork.ozlabs.org; Mon, 06 Jul 2015 15:38:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCCC3-0005Tw-S8 for qemu-devel@nongnu.org; Mon, 06 Jul 2015 15:36:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCCBy-0001yk-Sa for qemu-devel@nongnu.org; Mon, 06 Jul 2015 15:36:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCCBy-0001y5-NR for qemu-devel@nongnu.org; Mon, 06 Jul 2015 15:36:38 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id DE7689158F for ; Mon, 6 Jul 2015 19:36:37 +0000 (UTC) Received: from gimli.home (ovpn-113-190.phx2.redhat.com [10.3.113.190]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t66IYsnT011869; Mon, 6 Jul 2015 14:34:55 -0400 From: Alex Williamson To: qemu-devel@nongnu.org Date: Mon, 06 Jul 2015 12:34:54 -0600 Message-ID: <20150706183454.15635.2149.stgit@gimli.home> In-Reply-To: <20150706183311.15635.76314.stgit@gimli.home> References: <20150706183311.15635.76314.stgit@gimli.home> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/11] vfio: cpu: Use "real" page size API X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Peter Crosthwaite This is system level code, and should only depend on the host page size, not the target page size. Note that HOST_PAGE_SIZE is misleadingly lead and is really aligning to both host and target page size. Hence it's replacement with REAL_HOST_PAGE_SIZE. Signed-off-by: Peter Crosthwaite Tested-by: Alexey Kardashevskiy Acked-by: Paolo Bonzini Signed-off-by: Alex Williamson --- hw/vfio/pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index b8fa4ac..66d4223 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2388,7 +2388,7 @@ static void vfio_map_bar(VFIOPCIDevice *vdev, int nr) * potentially insert a direct-mapped subregion before and after it. */ if (vdev->msix && vdev->msix->table_bar == nr) { - size = vdev->msix->table_offset & qemu_host_page_mask; + size = vdev->msix->table_offset & qemu_real_host_page_mask; } strncat(name, " mmap", sizeof(name) - strlen(name) - 1); @@ -2401,8 +2401,9 @@ static void vfio_map_bar(VFIOPCIDevice *vdev, int nr) if (vdev->msix && vdev->msix->table_bar == nr) { uint64_t start; - start = HOST_PAGE_ALIGN((uint64_t)vdev->msix->table_offset + - (vdev->msix->entries * PCI_MSIX_ENTRY_SIZE)); + start = REAL_HOST_PAGE_ALIGN((uint64_t)vdev->msix->table_offset + + (vdev->msix->entries * + PCI_MSIX_ENTRY_SIZE)); size = start < bar->region.size ? bar->region.size - start : 0; strncat(name, " msix-hi", sizeof(name) - strlen(name) - 1);