{"id":814041,"url":"http://patchwork.ozlabs.org/api/1.2/patches/814041/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170915035130.8354-12-david@gibson.dropbear.id.au/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.2/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170915035130.8354-12-david@gibson.dropbear.id.au>","list_archive_url":null,"date":"2017-09-15T03:51:23","name":"[PULL,11/18] vfio, spapr: Fix levels calculation","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"fb01d3c84e4aa090c4c360c00e2964c9a0a49a6e","submitter":{"id":47,"url":"http://patchwork.ozlabs.org/api/1.2/people/47/?format=json","name":"David Gibson","email":"david@gibson.dropbear.id.au"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170915035130.8354-12-david@gibson.dropbear.id.au/mbox/","series":[{"id":3203,"url":"http://patchwork.ozlabs.org/api/1.2/series/3203/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3203","date":"2017-09-15T03:51:23","name":null,"version":1,"mbox":"http://patchwork.ozlabs.org/series/3203/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814041/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814041/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=gibson.dropbear.id.au\n\theader.i=@gibson.dropbear.id.au header.b=\"m046rzrs\"; \n\tdkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xthLY0pggz9t2h\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 13:52:37 +1000 (AEST)","from localhost ([::1]:50989 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dshgB-0006rS-42\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 23:52:35 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:54142)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <dgibson@ozlabs.org>) id 1dshfL-0006f4-2z\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 23:51:45 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <dgibson@ozlabs.org>) id 1dshfJ-0003N1-Ll\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 23:51:43 -0400","from ozlabs.org ([2401:3900:2:1::2]:60843)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <dgibson@ozlabs.org>)\n\tid 1dshfJ-0003Ku-Aw; Thu, 14 Sep 2017 23:51:41 -0400","by ozlabs.org (Postfix, from userid 1007)\n\tid 3xthKM53jRz9t3H; Fri, 15 Sep 2017 13:51:34 +1000 (AEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n\td=gibson.dropbear.id.au; s=201602; t=1505447495;\n\tbh=8huNxMjTWbOTRiWHZDDGF2iYzBRTTFHp320BoOQir4U=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=m046rzrslaVpGS/bqVTy3PMUurP0ZYtq/Bv22Cub5W2MeS7KY7Iof0nu3a+chLper\n\t8rNFWUEl/HJu3uQGIwBD22CwpavfOQwR+DdcPSBXgxwIA+hVWkZOb4PmBSK0IB1XfU\n\tj5HoAS5InODqjjrN2gxltqkwOMXjXal88HF7ViXw=","From":"David Gibson <david@gibson.dropbear.id.au>","To":"peter.maydell@linaro.org","Date":"Fri, 15 Sep 2017 13:51:23 +1000","Message-Id":"<20170915035130.8354-12-david@gibson.dropbear.id.au>","X-Mailer":"git-send-email 2.13.5","In-Reply-To":"<20170915035130.8354-1-david@gibson.dropbear.id.au>","References":"<20170915035130.8354-1-david@gibson.dropbear.id.au>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2401:3900:2:1::2","Subject":"[Qemu-devel] [PULL 11/18] vfio, spapr: Fix levels calculation","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"aik@ozlabs.ru, gkurz@kaod.org, agraf@suse.de, qemu-devel@nongnu.org,\n\tqemu-ppc@nongnu.org, David Gibson <david@gibson.dropbear.id.au>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"From: Alexey Kardashevskiy <aik@ozlabs.ru>\n\nThe existing tries to round up the number of pages but @pages is always\ncalculated as the rounded up value minus one  which makes ctz64() always\nreturn 0 and have create.levels always set 1.\n\nThis removes wrong \"-1\" and allows having more than 1 levels. This becomes\nhandy for >128GB guests with standard 64K pages as this requires blocks\nwith zone order 9 and the popular limit of CONFIG_FORCE_MAX_ZONEORDER=9\nmeans that only blocks up to order 8 are allowed.\n\nSigned-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>\nSigned-off-by: David Gibson <david@gibson.dropbear.id.au>\n---\n hw/vfio/spapr.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c\nindex 32fd6a9b54..259397c002 100644\n--- a/hw/vfio/spapr.c\n+++ b/hw/vfio/spapr.c\n@@ -163,7 +163,7 @@ int vfio_spapr_create_window(VFIOContainer *container,\n      */\n     entries = create.window_size >> create.page_shift;\n     pages = MAX((entries * sizeof(uint64_t)) / getpagesize(), 1);\n-    pages = MAX(pow2ceil(pages) - 1, 1); /* Round up */\n+    pages = MAX(pow2ceil(pages), 1); /* Round up */\n     create.levels = ctz64(pages) / 6 + 1;\n \n     ret = ioctl(container->fd, VFIO_IOMMU_SPAPR_TCE_CREATE, &create);\n","prefixes":["PULL","11/18"]}