From patchwork Thu Sep 29 10:48:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 676597 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 3slBCW4WLcz9ryZ for ; Thu, 29 Sep 2016 20:49:27 +1000 (AEST) Received: from localhost ([::1]:36334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpYu4-00089Z-AG for incoming@patchwork.ozlabs.org; Thu, 29 Sep 2016 06:49:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpYsy-0007NR-V1 for qemu-devel@nongnu.org; Thu, 29 Sep 2016 06:48:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpYsw-0002sL-TH for qemu-devel@nongnu.org; Thu, 29 Sep 2016 06:48:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpYsw-0002s9-Mh; Thu, 29 Sep 2016 06:48:14 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2752F4DD4B; Thu, 29 Sep 2016 10:48:14 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8TAm8Wj017989; Thu, 29 Sep 2016 06:48:12 -0400 From: Thomas Huth To: David Gibson , qemu-ppc@nongnu.org Date: Thu, 29 Sep 2016 12:48:07 +0200 Message-Id: <1475146087-19865-3-git-send-email-thuth@redhat.com> In-Reply-To: <1475146087-19865-1-git-send-email-thuth@redhat.com> References: <1475146087-19865-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 29 Sep 2016 10:48:14 +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 2/2] target-ppc/kvm: Enable transactional memory on POWER8 with KVM-HV, too 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: Alexander Graf , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Transactional memory is also supported on POWER8 KVM-HV if the KVM_CAP_PPC_HTM is not available in the kernel yet, so add a hack to allow TM here, too. Signed-off-by: Thomas Huth --- hw/ppc/spapr.c | 2 +- target-ppc/kvm.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index fc37145..2f4e818 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -584,7 +584,7 @@ static void spapr_populate_pa_features(CPUPPCState *env, void *fdt, int offset) */ pa_features[3] |= 0x20; } - if (kvmppc_has_cap_htm()) { + if (kvmppc_has_cap_htm() && pa_size > 24) { pa_features[24] |= 0x80; /* Transactional memory support */ } diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index dca50bc..e990cb7 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -567,11 +567,18 @@ int kvm_arch_init_vcpu(CPUState *cs) idle_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, kvm_kick_cpu, cpu); - /* Some targets support access to KVM's guest TLB. */ switch (cenv->mmu_model) { case POWERPC_MMU_BOOKE206: + /* This target supports access to KVM's guest TLB */ ret = kvm_booke206_tlb_init(cpu); break; + case POWERPC_MMU_2_07: + if (!cap_htm && !kvmppc_is_pr(cs->kvm_state)) { + /* KVM-HV has transactional memory on POWER8 also without the + * KVM_CAP_PPC_HTM extension, so enable it here instead. */ + cap_htm = true; + } + break; default: break; }