From patchwork Mon Oct 22 05:18:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharata B Rao X-Patchwork-Id: 10651687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9948A921 for ; Mon, 22 Oct 2018 05:18:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C7B728382 for ; Mon, 22 Oct 2018 05:18:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FF54287A4; Mon, 22 Oct 2018 05:18:59 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BC6228382 for ; Mon, 22 Oct 2018 05:18:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 06A906B0006; Mon, 22 Oct 2018 01:18:57 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 018C46B0007; Mon, 22 Oct 2018 01:18:56 -0400 (EDT) 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 E235A6B0008; Mon, 22 Oct 2018 01:18:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 88C5A6B0006 for ; Mon, 22 Oct 2018 01:18:56 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id x10-v6so24235848edx.9 for ; Sun, 21 Oct 2018 22:18:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=GwXZqgNnN0cza7zF/sJfQOM5IOg0fhpq0V1mvcGHjAE=; b=AmxgdIJajdS1MQEGegRNv9eCiztuWUKB/xl0+sKCs7E+2M/DQOMXHSiQDPe2jxEE35 3hX6OjGPiFKjT7XPbgjRCAM/kjmNBIvpxzAiBpr7FVkoPFxpR63Vm+2s3SqbQuoLQr6W Z1x9qJYryKe0V19QJ2prNvFj1LKHALREN0E3WMZRyw1mECxW/PSZZwMMbHgOC0jwUBO9 DT677juCiu0E7beoKlPe0OLn6VjbKpU745gQ0bhvSIx4ctUFK5Fvtl+7RLtR+/RXv+Pr 4oJt4KRwgRtXk3XQx++d6tMuiqd/J/7GEOSHj8oQDZDwu+QUJ9CYcmfqNLaIg4HIXI8V CT/A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of bharata@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=bharata@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: ABuFfoh4rIJFbNfV9xSWD3CqszWLHNdFl+OPal6aiEDUHNUC1ZDJqAQt RgQAulS2xtoO8WcM3sL7PQ2VR6sHgGaQP9h+2hwyUPjcJQAucIvQknGfZimz5P9RkC4IzSB9aKW cmJFwjqYPT8E7a4ZsLRv022xG98rSSju18hzhllvuS2QwoIvT5Hv9MSegBNmGjSyWyg== X-Received: by 2002:a50:dacf:: with SMTP id s15-v6mr12151301edj.241.1540185536001; Sun, 21 Oct 2018 22:18:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Y0WJOY2bfYC8DEeP00jjowcTMlzvagiBAT8ty0+oINL2hLgDFp5A62uxWy5BVco3R1WE8 X-Received: by 2002:a50:dacf:: with SMTP id s15-v6mr12151267edj.241.1540185534989; Sun, 21 Oct 2018 22:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540185534; cv=none; d=google.com; s=arc-20160816; b=otO/4l78IiIP7/0QthLnykbzB5kLVmcUawcvEOmg4uDbR4LgXDuB3YF5RupD+tvJxQ RksFt4pI7ls5BoK2Dajd0nz1s7HcY5JyNvzIGG5BJ2lSQJsicYKsIFnXWOActHJEC6Ou 78wGq+QzzohrSlenQlB44o+y+3WJCvg6mCjLvJhZqjle4rZx70Q8dhnOUCwflsdLMsQ+ uODsGo4pLcaovOYRmrE9udoUwJ+XUvqyR7srWotkdhayytF4d4gadCcNwAYb+FjuWMmd VzCMQv/RnjV5ycv2nSXSD87pfPA/OszFMWjT4TT9U3KoYoxsVmwfzom3nb9eQjOiv3TQ R9Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=GwXZqgNnN0cza7zF/sJfQOM5IOg0fhpq0V1mvcGHjAE=; b=N++YEgDCrUvonAKiP3xzO0fq45DHHwvk4hdOj0o3+88dt9hhVfWKLKv1BXLHGhf21l RVEvgJb6ywNnfOZuBot2G+hh2mx8BsOuJcStiAVvOD35Gqf/7D9tyh7uAMuFlKadrPey nFYO+ZPot04knHsm96lX9WtwEZDhpdQAsl+6knvh3tZEzgSDGe/JKCJILonJFL2t6BNH AcU2BJPxp1pLEVqJBJ0es6Yr+7tAxH+UQ9v8cp7NDdLXDffcRPbhZUZosautVDn5lSUf 3IPR2ucg9kNHqefTNX8MYNz1z6MBgbIzB2ar89QbnUf52bc18qlZ5nfRnYjPuXKED880 TJNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of bharata@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=bharata@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id k10-v6si1484433ejh.140.2018.10.21.22.18.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Oct 2018 22:18:54 -0700 (PDT) Received-SPF: pass (google.com: domain of bharata@linux.ibm.com designates 148.163.158.5 as permitted sender) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of bharata@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=bharata@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9M59YH8133458 for ; Mon, 22 Oct 2018 01:18:53 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n9315rvue-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Oct 2018 01:18:53 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 22 Oct 2018 06:18:51 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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, 22 Oct 2018 06:18:48 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9M5IlpN5505512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 22 Oct 2018 05:18:47 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D944AE057; Mon, 22 Oct 2018 05:18:47 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A8CDAE056; Mon, 22 Oct 2018 05:18:45 +0000 (GMT) Received: from bharata.in.ibm.com (unknown [9.124.35.126]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 22 Oct 2018 05:18:45 +0000 (GMT) From: Bharata B Rao To: linuxppc-dev@lists.ozlabs.org Cc: kvm-ppc@vger.kernel.org, linux-mm@kvack.org, paulus@au1.ibm.com, benh@linux.ibm.com, aneesh.kumar@linux.vnet.ibm.com, jglisse@redhat.com, linuxram@us.ibm.com, Bharata B Rao Subject: [RFC PATCH v1 0/4] kvmppc: HMM backend driver to manage pages of secure guest Date: Mon, 22 Oct 2018 10:48:33 +0530 X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 x-cbid: 18102205-0020-0000-0000-000002D8147A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18102205-0021-0000-0000-000021272E0C Message-Id: <20181022051837.1165-1-bharata@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-21_14:,, 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=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=969 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810220049 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: X-Virus-Scanned: ClamAV using ClamSMTP Hi, A pseries guest can be run as a secure guest on Ultravisor-enabled POWER platforms. On such platforms, this driver will be used to manage the movement of guest pages between the normal memory managed by hypervisor (HV) and secure memory managed by Ultravisor (UV). This is an early post of HMM driver patches that manage page migration between normal and secure memory. Private ZONE_DEVICE memory equal to the amount of secure memory available in the platform for running secure guests is created via a HMM device. The movement of pages between normal and secure memory is done by ->alloc_and_copy() callback routine of migrate_vma(). The page-in or page-out requests from UV will come to HV as hcalls and HV will call back into UV via uvcalls to satisfy these page requests. The implementation of uvcall themselves are not present in this post and will be posted separately. Changes in v1 ============= - Moved from global HMM pages hash table to per guest hash - Added support for shared pages (non-secure/normal pages of a secure guest) - Misc cleanups and fixes v0: https://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg138742.html Bharata B Rao (4): kvmppc: HMM backend driver to manage pages of secure guest kvmppc: Add support for shared pages in HMM driver kvmppc: H_SVM_INIT_START and H_SVM_INIT_DONE hcalls kvmppc: Handle memory plug/unplug to secure VM arch/powerpc/include/asm/hvcall.h | 9 +- arch/powerpc/include/asm/kvm_host.h | 16 + arch/powerpc/include/asm/kvm_ppc.h | 34 +- arch/powerpc/include/asm/ucall-api.h | 31 ++ arch/powerpc/kvm/Makefile | 3 + arch/powerpc/kvm/book3s.c | 5 +- arch/powerpc/kvm/book3s_hv.c | 115 +++++- arch/powerpc/kvm/book3s_hv_hmm.c | 575 +++++++++++++++++++++++++++ arch/powerpc/kvm/book3s_pr.c | 3 +- arch/powerpc/kvm/powerpc.c | 2 +- 10 files changed, 785 insertions(+), 8 deletions(-) create mode 100644 arch/powerpc/include/asm/ucall-api.h create mode 100644 arch/powerpc/kvm/book3s_hv_hmm.c