From patchwork Tue Jul 5 05:19:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Bobroff X-Patchwork-Id: 9213609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D8856048F for ; Tue, 5 Jul 2016 05:24:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F1B5288A9 for ; Tue, 5 Jul 2016 05:24:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53A3B288AB; Tue, 5 Jul 2016 05:24:09 +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=-6.9 required=2.0 tests=BAYES_00,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 C3C48288A9 for ; Tue, 5 Jul 2016 05:24:08 +0000 (UTC) Received: from localhost ([::1]:52069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKIq7-0001lw-Bj for patchwork-qemu-devel@patchwork.kernel.org; Tue, 05 Jul 2016 01:24:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKIll-0006Vs-FG for qemu-devel@nongnu.org; Tue, 05 Jul 2016 01:19:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKIlh-00034m-G3 for qemu-devel@nongnu.org; Tue, 05 Jul 2016 01:19:36 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48026 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKIlh-00034Q-Bj for qemu-devel@nongnu.org; Tue, 05 Jul 2016 01:19:33 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u655JWrZ095679 for ; Tue, 5 Jul 2016 01:19:32 -0400 Received: from e23smtp09.au.ibm.com (e23smtp09.au.ibm.com [202.81.31.142]) by mx0b-001b2d01.pphosted.com with ESMTP id 23x9t11nxy-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 05 Jul 2016 01:19:32 -0400 Received: from localhost by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Jul 2016 15:19:29 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 5 Jul 2016 15:19:27 +1000 X-IBM-Helo: d23dlp01.au.ibm.com X-IBM-MailFrom: sam.bobroff@au1.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org;qemu-ppc@nongnu.org Received: from d23relay06.au.ibm.com (d23relay06.au.ibm.com [9.185.63.219]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 755362CE8056; Tue, 5 Jul 2016 15:19:26 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u655JQbX10158384; Tue, 5 Jul 2016 15:19:26 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u655JPA8025011; Tue, 5 Jul 2016 15:19:26 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u655JPan025003; Tue, 5 Jul 2016 15:19:25 +1000 Received: from tungsten.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id E8EC7A0094; Tue, 5 Jul 2016 15:19:24 +1000 (AEST) From: Sam Bobroff To: david@gibson.dropbear.id.au Date: Tue, 5 Jul 2016 15:19:21 +1000 X-Mailer: git-send-email 2.1.4 In-Reply-To: <20160608022602.GU9226@voom.fritz.box> References: <20160608022602.GU9226@voom.fritz.box> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16070505-0052-0000-0000-000001AAA111 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070505-0053-0000-0000-00000650CC82 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-07-05_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607050049 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 0/3] Rework spapr: Better handling of ibm, pa-features TM bit 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: mikey@neuling.org, aik@ozlabs.ru, mpe@ellerman.id.au, anton@au1.ibm.com, agraf@suse.de, qemu-devel@nongnu.org, paulus@samba.org, qemu-ppc@nongnu.org, linuxppc-dev@lists.ozlabs.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi David, Anton asked me to have a look at this, so here is an attempt at a re-implementation of his: "spapr: Better handling of ibm, pa-features TM bit" addressing your comments and those from Paul Mackerras. I've broken the patch into one to unconditionally disable the HTM bit in pa-features and a second one to set it conditionally based on a (new) KVM capability. It requires a small patch to KVM to support the capability, presumably something like this: Adding a new capability requires changing linux/kvm.h but I believe we can avoid incrementing KVM_API_VERSION at this stage since kernels that don't yet support it will simply return false. However, due to the ambiguity of that result I've included Anton's initial fallback approach to be used in that case. Once the API version is incremented (and support for the capability is guaranteed) the ambiguity would be gone and we should be able to remove the fallback. As long as that happens before KVM PR supports HTM, this should address Paul's concern about using the PVINFO capability to discover KVM-HV. Note: I'm not sure how to handle the change to linux/kvm.h, I've included the patch here because it's needed to compile, but I suspect it needs to go via the kernel. Let's see if this part looks good first. Note also: I've changed TM to HTM where possible in an attempt to be consistent. Sam Bobroff (3): spapr: Disable ibm, pa-features HTM bit Add KVM_CAP_PPC_HTM to linux/kvm.h spapr: Set ibm, pa-features HTM from KVM_CAP_PPC_HTM hw/ppc/spapr.c | 3 ++- linux-headers/linux/kvm.h | 1 + target-ppc/kvm.c | 27 +++++++++++++++++++++++++++ target-ppc/kvm_ppc.h | 6 ++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 02416fe..4a8ddab 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -588,6 +588,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) r = 1; break; #endif + case KVM_CAP_PPC_HTM: + r = cpu_has_feature(CPU_FTR_TM); + break; default: r = 0; break;