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: 644531 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rkCjr1yv4z9sRZ for ; Tue, 5 Jul 2016 15:53:36 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3rkCjq6nQfzDvdD for ; Tue, 5 Jul 2016 15:53:35 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rkByb1mLfzDrGk for ; Tue, 5 Jul 2016 15:19:35 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u655JWQQ005909 for ; Tue, 5 Jul 2016 01:19:32 -0400 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0a-001b2d01.pphosted.com with ESMTP id 23x9mdhvpd-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 05 Jul 2016 01:19:32 -0400 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Jul 2016 15:19:28 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 5 Jul 2016 15:19:27 +1000 X-IBM-Helo: d23dlp02.au.ibm.com X-IBM-MailFrom: sam.bobroff@au1.ibm.com X-IBM-RcptTo: linuxppc-dev@lists.ozlabs.org Received: from d23relay09.au.ibm.com (d23relay09.au.ibm.com [9.185.63.181]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 32FCB2BB005E for ; Tue, 5 Jul 2016 15:19:26 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u655JQQu22544538 for ; 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 u655JPA4025011 for ; 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 Subject: [PATCH 0/3] Rework spapr: Better handling of ibm, pa-features TM bit 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-0040-0000-0000-000001BD1ACD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070505-0041-0000-0000-00000A03C424 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-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mikey@neuling.org, aik@ozlabs.ru, anton@au1.ibm.com, agraf@suse.de, qemu-devel@nongnu.org, paulus@samba.org, qemu-ppc@nongnu.org, linuxppc-dev@lists.ozlabs.org MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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;