From nobody Fri Nov 7 14:25:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548350316857554.1350582339013; Thu, 24 Jan 2019 09:18:36 -0800 (PST) Received: from localhost ([127.0.0.1]:57295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmie7-0001Vm-0l for importer@patchew.org; Thu, 24 Jan 2019 12:18:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmicQ-0000pQ-Fp for qemu-devel@nongnu.org; Thu, 24 Jan 2019 12:16:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmicP-0004Hs-MQ for qemu-devel@nongnu.org; Thu, 24 Jan 2019 12:16:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54842) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmicN-00042q-Jp; Thu, 24 Jan 2019 12:16:45 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D4A7C40F13; Thu, 24 Jan 2019 17:10:10 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27DBE71D44; Thu, 24 Jan 2019 17:10:06 +0000 (UTC) From: Igor Mammedov To: qemu-devel@nongnu.org Date: Thu, 24 Jan 2019 17:57:56 +0100 Message-Id: <1548349076-350255-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 24 Jan 2019 17:10:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] s390x: remove direct reference to mem_path global form s90x code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: david@redhat.com, cohuck@redhat.com, pasic@linux.ibm.com, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" I plan to deprecate -mem-path option and replace it with memory-backend, for that it's necessary to get rid of mem_path global variable. Do it for s390x case, replacing it with alternative way to enable 1Mb hugepages capability. Signed-off-by: Igor Mammedov --- PS: Original code nor the new one probably is not entirely correct when huge pages are enabled in case where mixed initial RAM and memory backends are used, backend's page size might not match initial RAM's so I'm not sure if enabling 1MB cap is correct in this case on s390 (should it be the same for all RAM???). With new approach 1Mb cap is not enabled if the smallest page size is not 1Mb. --- target/s390x/kvm.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 2ebf26a..22e868a 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -285,33 +285,28 @@ void kvm_s390_crypto_reset(void) } } =20 -static int kvm_s390_configure_mempath_backing(KVMState *s) +static int kvm_s390_configure_hugepage_backing(KVMState *s) { - size_t path_psize =3D qemu_mempath_getpagesize(mem_path); + size_t psize =3D qemu_getrampagesize(); =20 - if (path_psize =3D=3D 4 * KiB) { - return 0; - } - - if (!hpage_1m_allowed()) { - error_report("This QEMU machine does not support huge page " - "mappings"); - return -EINVAL; - } + if (psize =3D=3D 1 * MiB) { + if (!hpage_1m_allowed()) { + error_report("This QEMU machine does not support huge page " + "mappings"); + return -EINVAL; + } =20 - if (path_psize !=3D 1 * MiB) { + if (kvm_vm_enable_cap(s, KVM_CAP_S390_HPAGE_1M, 0)) { + error_report("Memory backing with 1M pages was specified, " + "but KVM does not support this memory backing"); + return -EINVAL; + } + cap_hpage_1m =3D 1; + } else if (psize =3D=3D 2 * GiB) { error_report("Memory backing with 2G pages was specified, " "but KVM does not support this memory backing"); return -EINVAL; } - - if (kvm_vm_enable_cap(s, KVM_CAP_S390_HPAGE_1M, 0)) { - error_report("Memory backing with 1M pages was specified, " - "but KVM does not support this memory backing"); - return -EINVAL; - } - - cap_hpage_1m =3D 1; return 0; } =20 @@ -319,7 +314,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) { MachineClass *mc =3D MACHINE_GET_CLASS(ms); =20 - if (mem_path && kvm_s390_configure_mempath_backing(s)) { + if (kvm_s390_configure_hugepage_backing(s)) { return -EINVAL; } =20 --=20 2.7.4