From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2418C636CE for ; Thu, 15 Jul 2021 19:02:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A75D861410 for ; Thu, 15 Jul 2021 19:02:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A75D861410 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EA9EB8D00F4; Thu, 15 Jul 2021 15:02:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E59258D00EC; Thu, 15 Jul 2021 15:02:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAC4D8D00F4; Thu, 15 Jul 2021 15:02:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 9EC9B8D00EC for ; Thu, 15 Jul 2021 15:02:51 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7F494253B0 for ; Thu, 15 Jul 2021 19:02:50 +0000 (UTC) X-FDA: 78365744100.28.539209D Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf11.hostedemail.com (Postfix) with ESMTP id 3519CF000209 for ; Thu, 15 Jul 2021 19:02:50 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id jx7-20020a17090b46c7b02901757deaf2c8so4876884pjb.0 for ; Thu, 15 Jul 2021 12:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=oe0BZYoHi++518OmcwQpv+uyHbR3qsM3BitMXqojLoA=; b=KkSoOuy20ieZTTXspwwIJZ/qwvEcmIUCW96k3EuDRkw1sCkqqKfcmfbO91AF6k1qhS 8qnpkDZ6aWj0wfJH/0hAVGRBjnP0q0JPwZg61NCU6R+M8HCzy6OVuMROhqb2IxlGGoCv h1+17kiQAK58iY2HB5gvPlpH+s2RiLYwdKFn4epefcWw4HfC7qk7/xXjY8aVibZ26rts AoJs2gHmC4xTh18jlPJvspNV3vIEX4rBUvYS8GYD11eUpQ7dqa57tcEImxEXNrBDBqn0 pwW57P75F9EH0EvkFeWxKfIN17JyRtO8gcNDpqmXT6o+6jdGBDLaigPBdnc8a1FhTSz1 yzZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oe0BZYoHi++518OmcwQpv+uyHbR3qsM3BitMXqojLoA=; b=GUlpQyPcBuqG2fsP7DtMi9jplXyT3qtVEwHI6KLzAtRYPliZUxAUJOj6YOlmObz5vl kmE2ETS+vUuzLFu7eJXxo33PmqXxTH6fgJwtewpSrR/89K7AAQDyGJ8rD4xTrQjek7eg y7ZoYHJ5iFyeAS5I95HgxQtEMvMAFYYeAYTV/594+3Nm9EJl/wwRl8iXkF+CAboTH+qu g6p7ip4hBOThrj6GOqqtHJ38hwYsNVJIGIahNLKnS2RfgMBjgGvDt0IvsNHWRiA2WIWI erxqvekFu5NB4Ks7HdmJcGe6KCEFEVzPl11ofigr4WmECCb9GvIWR2fHLv9w2ekx3SMr +vWA== X-Gm-Message-State: AOAM532KDQT58D+8u3ehhScciw+P6iTas/lM8K7xlI99KpQzPmjfOcbo sxGVPzbmqCw/GIk+5XQ79gkzdA== X-Google-Smtp-Source: ABdhPJw1dGPTVY/rw4APz9cGy+L54ppHFLemTQp3wX/mwVOXEld90LmZMJamyx8+JoKLrw9sxnMJtQ== X-Received: by 2002:a17:90a:738e:: with SMTP id j14mr11741420pjg.227.1626375768822; Thu, 15 Jul 2021 12:02:48 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id s20sm10639941pjn.23.2021.07.15.12.02.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 12:02:48 -0700 (PDT) Date: Thu, 15 Jul 2021 19:02:44 +0000 From: Sean Christopherson To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, 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 , 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 , tony.luck@intel.com, npmccallum@redhat.com, brijesh.ksingh@gmail.com Subject: Re: [PATCH Part2 RFC v4 08/40] x86/traps: Define RMP violation #PF error code Message-ID: References: <20210707183616.5620-1-brijesh.singh@amd.com> <20210707183616.5620-9-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210707183616.5620-9-brijesh.singh@amd.com> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 3519CF000209 X-Stat-Signature: o8hpcpk6xua385a818rfaci1jj3rcm44 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=KkSoOuy2; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of seanjc@google.com designates 209.85.216.52 as permitted sender) smtp.mailfrom=seanjc@google.com X-HE-Tag: 1626375770-655711 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: On Wed, Jul 07, 2021, Brijesh Singh wrote: > Bit 31 in the page fault-error bit will be set when processor encounters > an RMP violation. > > While at it, use the BIT() macro. > > Signed-off-by: Brijesh Singh > --- > arch/x86/include/asm/trap_pf.h | 18 +++++++++++------- > arch/x86/mm/fault.c | 1 + > 2 files changed, 12 insertions(+), 7 deletions(-) > > diff --git a/arch/x86/include/asm/trap_pf.h b/arch/x86/include/asm/trap_pf.h > index 10b1de500ab1..29f678701753 100644 > --- a/arch/x86/include/asm/trap_pf.h > +++ b/arch/x86/include/asm/trap_pf.h > @@ -2,6 +2,8 @@ > #ifndef _ASM_X86_TRAP_PF_H > #define _ASM_X86_TRAP_PF_H > > +#include /* BIT() macro */ What are people's thoughts on using linux/bits.h instead of vdso.bits.h, even though the vDSO version is technically sufficient? Seeing the "vdso" reference definitely made me blink slowly a few times. > + > /* > * Page fault error code bits: > * > @@ -12,15 +14,17 @@ > * bit 4 == 1: fault was an instruction fetch > * bit 5 == 1: protection keys block access > * bit 15 == 1: SGX MMU page-fault > + * bit 31 == 1: fault was an RMP violation > */ > enum x86_pf_error_code { > - X86_PF_PROT = 1 << 0, > - X86_PF_WRITE = 1 << 1, > - X86_PF_USER = 1 << 2, > - X86_PF_RSVD = 1 << 3, > - X86_PF_INSTR = 1 << 4, > - X86_PF_PK = 1 << 5, > - X86_PF_SGX = 1 << 15, > + X86_PF_PROT = BIT(0), > + X86_PF_WRITE = BIT(1), > + X86_PF_USER = BIT(2), > + X86_PF_RSVD = BIT(3), > + X86_PF_INSTR = BIT(4), > + X86_PF_PK = BIT(5), > + X86_PF_SGX = BIT(15), > + X86_PF_RMP = BIT(31), > }; > > #endif /* _ASM_X86_TRAP_PF_H */ > diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c > index 1c548ad00752..2715240c757e 100644 > --- a/arch/x86/mm/fault.c > +++ b/arch/x86/mm/fault.c > @@ -545,6 +545,7 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, unsigned long ad > !(error_code & X86_PF_PROT) ? "not-present page" : > (error_code & X86_PF_RSVD) ? "reserved bit violation" : > (error_code & X86_PF_PK) ? "protection keys violation" : > + (error_code & X86_PF_RMP) ? "rmp violation" : > "permissions violation"); > > if (!(error_code & X86_PF_USER) && user_mode(regs)) { > -- > 2.17.1 >