From nobody Wed May 14 06:27:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1527092558572586.9354099672738; Wed, 23 May 2018 09:22:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2D7E1E9E28; Wed, 23 May 2018 16:22:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F3CE22010CB0; Wed, 23 May 2018 16:22:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AC7314CA81; Wed, 23 May 2018 16:22:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4NGIEWI015929 for ; Wed, 23 May 2018 12:18:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id D60152026E0E; Wed, 23 May 2018 16:18:14 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-119.brq.redhat.com [10.40.204.119]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4FA252026DFD for ; Wed, 23 May 2018 16:18:14 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 23 May 2018 18:18:02 +0200 Message-Id: <20180523161802.23266-7-abologna@redhat.com> In-Reply-To: <20180523161802.23266-1-abologna@redhat.com> References: <20180523161802.23266-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 6/6] qemu: Format pseries.cap-hpt-mps on the command line X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 23 May 2018 16:22:37 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This makes the feature fully functional. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1571078 Signed-off-by: Andrea Bolognani --- src/qemu/qemu_command.c | 26 ++++++++++++++++++++ tests/qemuxml2argvdata/pseries-features.args | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b446a08613..983839e81c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7193,6 +7193,32 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, =20 virBufferAsprintf(&buf, ",resize-hpt=3D%s", str); } + + if (def->hpt_maxpagesize > 0) { + unsigned long long tmp =3D def->hpt_maxpagesize; + unsigned int shifts =3D 0; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_HP= T_MPS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Limiting the page size for HPT guest is " + "not supported by this QEMU binary")); + goto cleanup; + } + + /* QEMU expects the argument to be a number of left shifts: + * for example, if you wanted to limit the guest to 4 KiB page= s, + * since 4096 =3D=3D 1 << 12, you would need to add cap-hpt-mp= s=3D12 + * to the command line. + * + * Convert from our internal representation, which is bytes, + * to the one QEMU expects */ + while (tmp > 1) { + tmp =3D tmp >> 1; + shifts++; + } + + virBufferAsprintf(&buf, ",cap-hpt-mps=3D%u", shifts); + } } =20 if (cpu && cpu->model && diff --git a/tests/qemuxml2argvdata/pseries-features.args b/tests/qemuxml2a= rgvdata/pseries-features.args index f5c1959cca..4e581a69a1 100644 --- a/tests/qemuxml2argvdata/pseries-features.args +++ b/tests/qemuxml2argvdata/pseries-features.args @@ -7,7 +7,8 @@ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-ppc64 \ -name guest \ -S \ --machine pseries,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,resize-hpt=3D= required \ +-machine pseries,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,resize-hpt=3D= required,\ +cap-hpt-mps=3D30 \ -m 512 \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ -uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list