From patchwork Mon Mar 21 04:42:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 599968 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 3qT3Bj0P7Dz9s5l for ; Mon, 21 Mar 2016 15:44:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b=RzFquLFC; dkim-atps=neutral Received: from localhost ([::1]:55587 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahrhL-0002bM-8J for incoming@patchwork.ozlabs.org; Mon, 21 Mar 2016 00:44:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahrf1-0006uv-6r for qemu-devel@nongnu.org; Mon, 21 Mar 2016 00:41:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahrey-0007Ly-Gl for qemu-devel@nongnu.org; Mon, 21 Mar 2016 00:41:47 -0400 Received: from ozlabs.org ([103.22.144.67]:46067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahrey-0007LF-5z; Mon, 21 Mar 2016 00:41:44 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3qT37q0PPgz9srh; Mon, 21 Mar 2016 15:41:42 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1458535303; bh=jUPzkEeHVBCycoIniXtC8gcDbCsuIjYZMT1shN6yheA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RzFquLFCgX+g3pw7N1C8qPFu1TR25pqYAowGh17vcFGgGuID0yU9o5cSG/s1+8cDU xMlNd+mD16dBxd4uMe+jCyEG29wV5/q7WGcd5Jw0EHvjFQ8pQqqGqjyx73jWRzw9kX I+5NOA65FdGEIF3quK3+y1uDjmtT8kkSz4tddzFA= From: David Gibson To: paulus@samba.org, aik@ozlabs.ru Date: Mon, 21 Mar 2016 15:42:51 +1100 Message-Id: <1458535372-6757-6-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1458535372-6757-1-git-send-email-david@gibson.dropbear.id.au> References: <1458535372-6757-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Cc: agraf@suse.de, David Gibson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, bharata@linux.vnet.ibm.com Subject: [Qemu-devel] [RFC 5/6] pseries: Allow HPT resizing on PR KVM 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 The initial implementation of PAPR hash page table (HPT) resizing is based on TCG and will not work with KVM. Eventually, of course, we want to implement this in KVM as well. Long term that will require a new kernel capability flag to let qemu know if it's capable of handling HPT resizing. However, the "PR" KVM implementation already supports HPT resizing, since it has the HPT managed by QEMU - the TCG implementation will work for PR KVM as well. This patch adds code to detect PR KVM and permit HPT resizing in this case. Explicitly detecting PR KVM, rather than using a capability relevant to the feature at hand is frowned upon, but this should be adequate as a fallback until that flag is added to the kernel. Signed-off-by: David Gibson --- target-ppc/kvm.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 989e1d1..562e9fa 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -2208,6 +2208,7 @@ int kvmppc_reset_htab(int shift_hint) /* Full emulation, tell caller to allocate htab itself */ return 0; } + if (kvm_check_extension(kvm_state, KVM_CAP_PPC_ALLOC_HTAB)) { int ret; ret = kvm_vm_ioctl(kvm_state, KVM_PPC_ALLOCATE_HTAB, &shift); @@ -2579,8 +2580,12 @@ void kvmppc_check_papr_resize_hpt(Error **errp) return; } - /* KVM will need to advertise capability for HPT resizing once - * implemented, for now we assume that it's not possible with - * KVM */ - error_setg(errp, "Hash page table resizing not available with KVM"); + /* TODO: Check specific capabilities for HPT resize aware host kernels */ + + /* Fall back to checking if we have PR or HV KVM */ + if (!kvm_vm_check_extension(kvm_state, KVM_CAP_PPC_GET_PVINFO)) { + error_setg(errp, "Hash page table resizing not available with HV KVM"); + } + + /* PR KVM, we should be ok */ }