From patchwork Mon Nov 4 04:17:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharata B Rao X-Patchwork-Id: 11224911 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF99A16B1 for ; Mon, 4 Nov 2019 04:18:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 838FA21929 for ; Mon, 4 Nov 2019 04:18:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 838FA21929 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AA8796B0005; Sun, 3 Nov 2019 23:18:14 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A57DD6B0008; Sun, 3 Nov 2019 23:18:14 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 96EB16B000A; Sun, 3 Nov 2019 23:18:14 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 813076B0005 for ; Sun, 3 Nov 2019 23:18:14 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 1F0C3181AEF0B for ; Mon, 4 Nov 2019 04:18:14 +0000 (UTC) X-FDA: 76117287708.09.walk12_d9f80261e915 X-Spam-Summary: 2,0,0,1831fabe7053de1e,d41d8cd98f00b204,bharata@linux.ibm.com,:linuxppc-dev@lists.ozlabs.org:kvm-ppc@vger.kernel.org::paulus@au1.ibm.com:aneesh.kumar@linux.vnet.ibm.com:jglisse@redhat.com:cclaudio@linux.ibm.com:linuxram@us.ibm.com:sukadev@linux.vnet.ibm.com:hch@lst.de:bharata@linux.ibm.com,RULES_HIT:41:355:379:541:968:973:988:989:1260:1261:1311:1314:1345:1437:1515:1535:1543:1711:1730:1747:1777:1792:1801:1963:2393:2559:2562:2903:3138:3139:3140:3141:3142:3355:3865:3866:3867:3868:3870:3871:3872:3874:4117:4184:4250:4605:5007:6117:6119:6261:7875:7903:7904:8568:8784:9010:10004:11026:11232:11473:11658:11914:12043:12291:12296:12297:12438:12555:12663:12679:12895:13141:13149:13161:13229:13230:13894:14096:14180:14181:14394:14721:21060:21080:21220:21451:21627:21740:21966:30012:30034:30054:30070:30089,0,RBL:148.163.158.5:@linux.ibm.com:.lbl8.mailshell.net-62.14.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNS BL:neutr X-HE-Tag: walk12_d9f80261e915 X-Filterd-Recvd-Size: 6365 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 Nov 2019 04:18:13 +0000 (UTC) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xA44CqEQ079630 for ; Sun, 3 Nov 2019 23:18:12 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2w27r5g24n-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 03 Nov 2019 23:18:12 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Nov 2019 04:18:10 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 4 Nov 2019 04:18:08 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xA44I7Kt196956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 Nov 2019 04:18:07 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3968A5204F; Mon, 4 Nov 2019 04:18:07 +0000 (GMT) Received: from bharata.in.ibm.com (unknown [9.124.35.185]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 617765204E; Mon, 4 Nov 2019 04:18:05 +0000 (GMT) From: Bharata B Rao To: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, linux-mm@kvack.org Cc: paulus@au1.ibm.com, aneesh.kumar@linux.vnet.ibm.com, jglisse@redhat.com, cclaudio@linux.ibm.com, linuxram@us.ibm.com, sukadev@linux.vnet.ibm.com, hch@lst.de, Bharata B Rao Subject: [PATCH v10 0/8] KVM: PPC: Driver to manage pages of secure guest Date: Mon, 4 Nov 2019 09:47:52 +0530 X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19110404-0020-0000-0000-000003823B12 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19110404-0021-0000-0000-000021D85C51 Message-Id: <20191104041800.24527-1-bharata@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-11-04_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=937 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911040039 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi, This is the next version of the patchset that adds required support in the KVM hypervisor to run secure guests on PEF-enabled POWER platforms. The major change in this version is about not using kvm.arch->rmap[] array to store device PFNs, thus not depending on the memslot availability to reach to the device PFN from the fault path. Instead of rmap[], we now have a different array which gets created and destroyed along with memslot creation and deletion. These arrays hang off from kvm.arch and are arragned in a simple linked list for now. We could move to some other data structure in future if walking of linked list becomes an overhead due to large number of memslots. Other changes include: - Rearranged/Merged/Cleaned up patches, removed all Acks/Reviewed-by since all the patches have changed. - Added a new patch to support H_SVM_INIT_ABORT hcall (From Suka) - Added KSM unmerge support so that VMAs that have device PFNs don't participate in KSM merging and eventually crash in KSM code. - Release device pages during unplug (Paul) and ensure that memory hotplug and unplug works correctly. - Let kvm-hv module to load on PEF-disabled platforms (Ram) when CONFIG_PPC_UV is enabled allowing regular non-secure guests to still run. - Support guest reset when swithing to secure is in progress. - Check if page is already secure in kvmppc_send_page_to_uv() before sending it to UV. - Fixed sentinal for header file kvm_book3s_uvmem.h (Jason) Now, all the dependencies required by this patchset are in powerpc/next on which this patchset is based upon. Outside of PowerPC code, this needs a change in KSM code as this patchset uses ksm_madvise() which is not exported. Anshuman Khandual (1): KVM: PPC: Ultravisor: Add PPC_UV config option Bharata B Rao (6): mm: ksm: Export ksm_madvise() KVM: PPC: Support for running secure guests KVM: PPC: Shared pages support for secure guests KVM: PPC: Radix changes for secure guest KVM: PPC: Handle memory plug/unplug to secure VM KVM: PPC: Support reset of secure guest Sukadev Bhattiprolu (1): KVM: PPC: Implement H_SVM_INIT_ABORT hcall Documentation/powerpc/ultravisor.rst | 39 + Documentation/virt/kvm/api.txt | 19 + arch/powerpc/Kconfig | 17 + arch/powerpc/include/asm/hvcall.h | 10 + arch/powerpc/include/asm/kvm_book3s_uvmem.h | 80 ++ arch/powerpc/include/asm/kvm_host.h | 7 + arch/powerpc/include/asm/kvm_ppc.h | 2 + arch/powerpc/include/asm/ultravisor-api.h | 6 + arch/powerpc/include/asm/ultravisor.h | 36 + arch/powerpc/kvm/Makefile | 3 + arch/powerpc/kvm/book3s_64_mmu_radix.c | 25 + arch/powerpc/kvm/book3s_hv.c | 144 ++++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 23 +- arch/powerpc/kvm/book3s_hv_uvmem.c | 794 ++++++++++++++++++++ arch/powerpc/kvm/powerpc.c | 12 + include/uapi/linux/kvm.h | 1 + mm/ksm.c | 1 + 17 files changed, 1217 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/include/asm/kvm_book3s_uvmem.h create mode 100644 arch/powerpc/kvm/book3s_hv_uvmem.c