Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp745855pxb; Thu, 30 Sep 2021 16:42:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxprFaEQ3GmJB2MEayQfKEwH4fUaNOjPHJmh4PIVMJcPxR9B3q1oeeNiWQPma4auMBBCOTa X-Received: by 2002:a17:906:160a:: with SMTP id m10mr2493650ejd.259.1633045373241; Thu, 30 Sep 2021 16:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633045373; cv=none; d=google.com; s=arc-20160816; b=u7SVVv8TlOAu0NDYeCkNiMfmWF4g1yxDmy34PP+1WfA1rCRQ39c1gPETZCCp8SpXII XhDkFq3A33wpjY/qiF4Sx4Ta8ERppQDMnRqJIufLKwbroqPizSt7HoQmV+Mu8pyLX6ir sQ1HvLH2oz6WAre/QR/2tpySaurf7yKp3fT67dShj1fzfkk0p33k9UZFVzIn93TC3Bot tfJnFtrrXkagAlTn3/uBR1FgeCp2hRXFzmP75pS92IjZmQ88zwpOzyGWL1ew8PdiUMHV qjL+GL0G8WRDt5J8IBnLHL8I6QxPMtEf8JXw3VQtllaBGUZllNo+TXGiXBIz9v7YNySH Kkkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Gi00dUKbEnLBBRPaXgkT5o8maxEnkVJlIu1XQkEnZC0=; b=rWFtW8WkQ+9GvlaUj0+dovoGOX9rM5nMkGAErKtbzO2FV14yVeyyr6J/TCCjxViSHK 5ZPcVluEJSoT5jc/CpmXaPj5Zq6WmcMd/pVUyOnotzpTejfCma4RxJlTXUcYV6/QB7OO idC1rv3Kv4oKzPVs6vNf4mgRaqEz3eP7kHoIvpKTNeFf30zmsLjoWaBVNll8GeGz+seW YxdfwL5QRc+aWo0ulIo6xsN9HRK0qVBn79G4T418FM/yavDg3S7OXcxXkvHYa6/Njz34 Bi9fqRJrmrQY8S6O7l0ZRgn9Wh/0ZfwUOTPongsWDxRhy0q12IRIHWx6ZCcP/QQflGhW IsLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KbzcW1uC; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hd42si6879347ejc.627.2021.09.30.16.42.17; Thu, 30 Sep 2021 16:42:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KbzcW1uC; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350336AbhI3Xnt (ORCPT + 99 others); Thu, 30 Sep 2021 19:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350228AbhI3Xnt (ORCPT ); Thu, 30 Sep 2021 19:43:49 -0400 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31A86C06176D for ; Thu, 30 Sep 2021 16:42:06 -0700 (PDT) Received: by mail-oi1-x22b.google.com with SMTP id u22so9435092oie.5 for ; Thu, 30 Sep 2021 16:42:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Gi00dUKbEnLBBRPaXgkT5o8maxEnkVJlIu1XQkEnZC0=; b=KbzcW1uCfgaHX1R4cGCWYPX7UdNQyYMdI2TaNa0i7HP9MHoSkC/vqAaGCgbin6mB6T se+E7M7c8NwmnlvSAHX5Ie1kV2dQUGPSOdeqqEWF3Lwk2UCXrVLeLlgFqq84wDU9ZO/z y5JKi+oFRhFbmcrebDHwOlzmSssggAwIKOW79O97lnO4uguXxhrzpEcb4eFn8kFc3SBB WMQvnY7IFk8eR6WWepatQtY23RGz9Az/Xqjs9nqtdJONqku7bY6wav7l+I/4l/ILJI+W aMPQGheTvyHDLJc6QYsimS5BjEn4+6tQhaUZjCY5c7157mhO7h89Kblg9SE+vbVy4BwF IkJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Gi00dUKbEnLBBRPaXgkT5o8maxEnkVJlIu1XQkEnZC0=; b=utRXgHsDP2jQb+3I1xwOBVm7IE3B9VJXri0Ivd8Z2UOCR6on8RVRqspH5pf98Cmbx3 /hdOaDc5Vxs3hTOTnCRxiTov2QjpBYz2+/iGKKDaCtV2SOpXs2CzY0aPhRX/jloi6x98 nkX2fiZcB9rIu99P7X+rxInsw9RLijhICb3japy4Um1nno3qknvD/5yyggyzOjmt0/qK 7r6ESCxjaHn2c2tVuJkq26R3jEfS8HhqtnQiVWhMg6EJADYIwJ8vR3AqRyNp471YtYDE 4c6F8FIFjSGjhyf+uQeyGgfsSEuXs7UjQb0uiD4tMELszZCrL+5Uq8zTPXt6lD285+ZL qE7Q== X-Gm-Message-State: AOAM531j/v4s43FwXjUih7CRgbbvpwJ3OfeS46IOyBrxt9BfJi+QZDgt IIF+cj6tKxEtd3SbV5k+XvrIkLc/l49K9r5Y9e6Qfg== X-Received: by 2002:a05:6808:60f:: with SMTP id y15mr1599090oih.15.1633045325230; Thu, 30 Sep 2021 16:42:05 -0700 (PDT) MIME-Version: 1.0 References: <20210820155918.7518-1-brijesh.singh@amd.com> <20210820155918.7518-33-brijesh.singh@amd.com> In-Reply-To: <20210820155918.7518-33-brijesh.singh@amd.com> From: Marc Orr Date: Thu, 30 Sep 2021 16:41:54 -0700 Message-ID: Subject: Re: [PATCH Part2 v5 32/45] KVM: x86: Define RMP page fault error bits for #NPF To: Brijesh Singh Cc: x86 , LKML , kvm list , linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Borislav Petkov , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , tony.luck@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Aug 20, 2021 at 9:00 AM Brijesh Singh wrote: > > When SEV-SNP is enabled globally, the hardware places restrictions on all > memory accesses based on the RMP entry, whether the hypervisor or a VM, > performs the accesses. When hardware encounters an RMP access violation > during a guest access, it will cause a #VMEXIT(NPF). > > See APM2 section 16.36.10 for more details. nit: Section # should be 15.36.10 (rather than 16.36.10). Also, is it better to put section headings, rather than numbers in the commit logs and comments? Someone mentioned to me that the section numbering in APM and SDM can move around over time, but the section titles tend to be more stable. I'm not sure how true this is, so feel free to disregard this comment. > > Signed-off-by: Brijesh Singh > --- > arch/x86/include/asm/kvm_host.h | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 109e80167f11..a6e764458f3e 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -239,8 +239,12 @@ enum x86_intercept_stage; > #define PFERR_FETCH_BIT 4 > #define PFERR_PK_BIT 5 > #define PFERR_SGX_BIT 15 > +#define PFERR_GUEST_RMP_BIT 31 > #define PFERR_GUEST_FINAL_BIT 32 > #define PFERR_GUEST_PAGE_BIT 33 > +#define PFERR_GUEST_ENC_BIT 34 > +#define PFERR_GUEST_SIZEM_BIT 35 > +#define PFERR_GUEST_VMPL_BIT 36 > > #define PFERR_PRESENT_MASK (1U << PFERR_PRESENT_BIT) > #define PFERR_WRITE_MASK (1U << PFERR_WRITE_BIT) > @@ -251,6 +255,10 @@ enum x86_intercept_stage; > #define PFERR_SGX_MASK (1U << PFERR_SGX_BIT) > #define PFERR_GUEST_FINAL_MASK (1ULL << PFERR_GUEST_FINAL_BIT) > #define PFERR_GUEST_PAGE_MASK (1ULL << PFERR_GUEST_PAGE_BIT) > +#define PFERR_GUEST_RMP_MASK (1ULL << PFERR_GUEST_RMP_BIT) > +#define PFERR_GUEST_ENC_MASK (1ULL << PFERR_GUEST_ENC_BIT) > +#define PFERR_GUEST_SIZEM_MASK (1ULL << PFERR_GUEST_SIZEM_BIT) > +#define PFERR_GUEST_VMPL_MASK (1ULL << PFERR_GUEST_VMPL_BIT) > > #define PFERR_NESTED_GUEST_PAGE (PFERR_GUEST_PAGE_MASK | \ > PFERR_WRITE_MASK | \ > -- > 2.17.1 >