Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2663619ybl; Thu, 29 Aug 2019 11:09:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAMB2cN1+2KtnOJhDCjNfzuMLAoJJ96LdosG1NYRZ7VNKHwHgC6k1zd8xX1Xkas5WrEgC8 X-Received: by 2002:a17:90b:f12:: with SMTP id br18mr10736509pjb.127.1567102148622; Thu, 29 Aug 2019 11:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567102148; cv=none; d=google.com; s=arc-20160816; b=mvEX5Svdw4K695x3yCEJqumumFYnM0XJZY3wksyqyOG4DPwTCRf2OXHUu3E5iYJQby zSiwYGU7v8wLzcW0IFsjsY9AZENBKHJo3Ew6K8Xoy5mzPsvuI0bZvQYPLSNpQUEB5NtK QcKYA77nbtBsnWPmlMFb1Dx8Nj3Z9J1/M9J321X0bglN57GCHd/nJjEx3VJrgD3l8Sq6 TaFo5+q0Hk4o9z5wu4NF8ljCamQC/fVk/xHZ7aAcaMvcamIduB2uyuDz7dLmN0VWWvzi PyJdKxJFVUU3p40N7/svLvB9Vpnw0oGBQ75rfWOaKSlC/clZv35ba+G0cFvPnvofuy+0 AE+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=z53znbRjWuBpAUn8vV8ZIAe1QUqIkcH1JiZP3M6nJEA=; b=qRsDyOHC5xW+ubk4mQ2dfNvI8mdJxi9shqPVyqh6sxlphWsmLOxjAJbUs1dhqd1rEN L6hs2n9b4klG6NlmwITV7iVp7fLtHbka7IifEjnRSFYMYivnSoxZ+SN/0fu23cIQGoRk CdhB0GYopIFP8gAtRZu7oTByIQq+7fJfZPmNhCaZ9V1MXOVoJZ82IjeMgQir0/DtnR1B Sd94tGbMX5kyTiIMnliXulJNaFta7EYu2r0s1JARPVrr3uZd9nJQ/9wIeRTnPA6SYWoY HSS/1XrqjbUoXNeobnBW6arIdCa+iAUD6Xam+2rsmOTyTXNGoXBqHCfnJZSt0SZC6+HA CejA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w9si2394419pll.241.2019.08.29.11.08.52; Thu, 29 Aug 2019 11:09:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727746AbfH2SHZ (ORCPT + 99 others); Thu, 29 Aug 2019 14:07:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:36698 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726518AbfH2SHZ (ORCPT ); Thu, 29 Aug 2019 14:07:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B0342B67A; Thu, 29 Aug 2019 18:07:23 +0000 (UTC) Date: Thu, 29 Aug 2019 20:07:17 +0200 From: Borislav Petkov To: "Singh, Brijesh" Cc: "kvm@vger.kernel.org" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Joerg Roedel , "Lendacky, Thomas" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 10/11] mm: x86: Invoke hypercall when page encryption status is changed Message-ID: <20190829180717.GF2132@zn.tnic> References: <20190710201244.25195-1-brijesh.singh@amd.com> <20190710201244.25195-11-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190710201244.25195-11-brijesh.singh@amd.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 10, 2019 at 08:13:11PM +0000, Singh, Brijesh wrote: > @@ -2060,6 +2067,14 @@ static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc) > */ > cpa_flush(&cpa, 0); > > + /* > + * When SEV is active, notify hypervisor that a given memory range is mapped > + * encrypted or decrypted. Hypervisor will use this information during > + * the VM migration. > + */ > + if (sev_active()) > + set_memory_enc_dec_hypercall(addr, numpages << PAGE_SHIFT, enc); Btw, tglx has a another valid design concern here: why isn't this a pv_ops thing? So that it is active only when the hypervisor is actually present? I know, I know, this will run on SEV guests only because it is all (hopefully) behind "if (sev_active())" checks but the clean and accepted design is a paravirt call, I'd say. Especially if some day other hypervisors should want to run SEV guests too... Thx. -- Regards/Gruss, Boris. SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 247165, AG München