From patchwork Tue Jul 31 09:09:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 10550507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B677213BF for ; Tue, 31 Jul 2018 09:12:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A72B42A8BD for ; Tue, 31 Jul 2018 09:12:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99F0F2AAD5; Tue, 31 Jul 2018 09:12:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4AF572A8BD for ; Tue, 31 Jul 2018 09:12:17 +0000 (UTC) Received: from localhost ([::1]:57752 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkQhU-00018l-56 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 31 Jul 2018 05:12:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42864) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkQed-00072b-J9 for qemu-devel@nongnu.org; Tue, 31 Jul 2018 05:09:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fkQeY-0000ee-KX for qemu-devel@nongnu.org; Tue, 31 Jul 2018 05:09:19 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42482 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fkQeY-0000eR-EA for qemu-devel@nongnu.org; Tue, 31 Jul 2018 05:09:14 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6V94iAr120719 for ; Tue, 31 Jul 2018 05:09:14 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2kjm679r75-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 31 Jul 2018 05:09:13 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 31 Jul 2018 10:09:12 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 31 Jul 2018 10:09:10 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6V99Aq844237050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 31 Jul 2018 09:09:10 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28DB842059; Tue, 31 Jul 2018 12:09:22 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DF2F42056; Tue, 31 Jul 2018 12:09:21 +0100 (BST) Received: from s38lp20.boeblingen.de.ibm.com (unknown [9.145.168.142]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 31 Jul 2018 12:09:21 +0100 (BST) From: Janosch Frank To: qemu-devel@nongnu.org Date: Tue, 31 Jul 2018 10:09:00 +0100 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180731090900.187430-1-frankja@linux.ibm.com> References: <20180731090900.187430-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18073109-0008-0000-0000-0000025A61FE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18073109-0009-0000-0000-000021C0F649 Message-Id: <20180731090900.187430-3-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-07-31_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=938 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807310099 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v2 2/2] s390x: Enable KVM huge page backing support 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: borntraeger@de.ibm.com, cohuck@redhat.com, david@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP QEMU has had huge page support for a longer time already, but KVM memory management under s390x needed some changes to work with huge backings. Now that we have support, let's enable it if requested and available. Otherwise we now properly tell the user if there is no support and back out instead of failing to run the VM later on. Signed-off-by: Janosch Frank --- target/s390x/kvm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index d923cf4240..26e6937498 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -285,6 +285,12 @@ int kvm_arch_init(MachineState *ms, KVMState *s) { MachineClass *mc = MACHINE_GET_CLASS(ms); + if (mem_path && kvm_vm_enable_cap(s, KVM_CAP_S390_HPAGE, 0)) { + error_report("Huge page backing was specified, " + "but this KVM does not support huge pages"); + return -EINVAL; + } + mc->default_cpu_type = S390_CPU_TYPE_NAME("host"); cap_sync_regs = kvm_check_extension(s, KVM_CAP_SYNC_REGS); cap_async_pf = kvm_check_extension(s, KVM_CAP_ASYNC_PF);