Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1589105pxb; Fri, 20 Aug 2021 09:02:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxf2zYtx9ZYme+/gzyCqx9BbiYqbRsDJckRPHH+xmYDZYkimWT7JK+bpL9pzlLBnGMNaNNs X-Received: by 2002:a17:906:558d:: with SMTP id y13mr21195117ejp.130.1629475348766; Fri, 20 Aug 2021 09:02:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1629475348; cv=pass; d=google.com; s=arc-20160816; b=dzdVAJWQlMexufUYz8ztQ5fi9avKqI+yqEde+qUrdSe52xblP29xs+wkXMBwDNY1Gq VK/uYBE9LdsZQWJFSTTJp3B0/AIJ5IMBoBrbgvFgPTNnCKrCtoQESOWO5XKk4bOQk0+Z 5sEERnoCCCZWY8iolxZP4ZbttkzHwKl2jiqb9MHoWPEJB/5jYTxJBAzhrLTYq6tLMt3F +o+wXc/L/kvRzfey/UY+hKVS9MkFDBcBPfDlFaZ4qMVz7EHSC+UcWzOotguSruy7M0em ssrSnlV7M9PIEnSS8pPrezr2tGUC1Q7RWqi0w/lEMk5t+yn7oeih1Fqe0u2iIlmfK+xP rKtA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=KJ91SxYunShGipyH8ojFfTywvFt1eW8pSHUNA9OcTyU=; b=rRuld/mClc3gM2162ih/EPWBl2USZp2J+vQFRZZbPdzd4W17tzqWoHXRv3MPv++Zqi DRQWeygzF4OPCY0yKaTxv+tKxSq+Jt3pdAOAAlqLbV0uAXN3V4RHwEnSgLbE0HUuC8gj JI/HZwXHivz82jIfZquI1T6hO61vdJKKvaNuEMejcP8kf74AZLpAWa9RcsGiW3oti5dh zHnPoYNr94+3sMZ27CCbtW92c0YJgUmuChDme1c0IJwgSeHa/6549gEEatKQCWptVJ1L 91Zn17FNpDo70mN3IebL9QxbKAaMdl0QJkApIygimmVgx7FdtmyN+sjQfxyLn+QGKugI QaSQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Xa6DfJHd; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si7305666ejd.416.2021.08.20.09.02.03; Fri, 20 Aug 2021 09:02:28 -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=@amd.com header.s=selector1 header.b=Xa6DfJHd; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229660AbhHTQBl (ORCPT + 99 others); Fri, 20 Aug 2021 12:01:41 -0400 Received: from mail-bn8nam08on2075.outbound.protection.outlook.com ([40.107.100.75]:31200 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238044AbhHTQBH (ORCPT ); Fri, 20 Aug 2021 12:01:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jLqHzP087BDQrtf9rWlI7LBp9MDH0w+7UkI2OUyuLaH39XCkXxc5C4rM2HKgOfPpi5OEtHWdy/wSpfkQmbfnWfiAa6w8KUjrmNUCNTJ+CDYj6PD1NVdYHfPKiEkxzwPxn4/0S9D+3FNm8OlfiCUqnjHhidqyBW/9kNL+PKZmHW0f7Qem33P8X6XB704/hgKT0OPm5f3Ovn5G4vw1HcvFNrd/we5pZkSTY4GFwMXX2ZgvQfujA7tdxVKWczoWcS+ilovLVJ9b7XwsMzSxY2Ub7UWFCOQVghB06G7O/h3Ep0XzxJf4byQeuzbA4iiEm1xPCwXYnnD/zKnt33+ZVVSfkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KJ91SxYunShGipyH8ojFfTywvFt1eW8pSHUNA9OcTyU=; b=g+kjTcJ8Cs3HPFWCVL/nyDMfrB4wfhXeKVlrrfQt4QDzScgNKCwPYGxiAUTfbkXl9Lhh8ds5EUrAr0AEu0fQr7b/oBVLPVUw3AhlXOMAVuw7BdoEXfnCDHE/dPu+vcOkJ9//meN6TlsDrEKrTGDn2ZUuq5tFBX6svWAdqJhWhxlbkLQoG5HoqDm0fT92LlfidF5W8A1XEcNgYdCXRf3rI1p4M47+X0nImtyVbLfDERKPrmHhbuRcwOh6XPoTvJjnkOBuHx3F/2SC98Cr85eTn10gsXRQYCfIAex2Q3jaw8lPulV/7lGybo4Jt6VrIW2MZTePiylMkKKZ35Yg2HWqBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KJ91SxYunShGipyH8ojFfTywvFt1eW8pSHUNA9OcTyU=; b=Xa6DfJHdc76qizNi/43ag2qCWvUphvg+AiQzZ3pC/Vv5wsVbnwfgdVZjfgeucnvq13nsMLSQMHkBQVEFywE8APrhDoemvwFHxd6eML2sWgupeq1jfgaIXzqpQXO+VO0U07UenMV3PrporyGaupRVNHcysF1OMFXvVl+zdQOpEq0= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SA0PR12MB4384.namprd12.prod.outlook.com (2603:10b6:806:9f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Fri, 20 Aug 2021 16:00:02 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3%6]) with mapi id 15.20.4436.019; Fri, 20 Aug 2021 16:00:02 +0000 From: Brijesh Singh To: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org Cc: 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, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, Brijesh Singh Subject: [PATCH Part2 v5 07/45] x86/traps: Define RMP violation #PF error code Date: Fri, 20 Aug 2021 10:58:40 -0500 Message-Id: <20210820155918.7518-8-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210820155918.7518-1-brijesh.singh@amd.com> References: <20210820155918.7518-1-brijesh.singh@amd.com> Content-Type: text/plain X-ClientProxiedBy: SN7P222CA0013.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:124::11) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sbrijesh-desktop.amd.com (165.204.77.1) by SN7P222CA0013.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:124::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.18 via Frontend Transport; Fri, 20 Aug 2021 16:00:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e272240-cc77-4113-46e1-08d963f391d9 X-MS-TrafficTypeDiagnostic: SA0PR12MB4384: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0ZO5oeXtsEpQofUD3aS2P+0doDZLxIPBufyh1IvPihnXHFCttNriHiFFM/4kE2sS9J3W/AzHOv87K6Fd06TbNWAi4BFIsaRY+6o5OeE3Q3fM01jc/p2HpR5w2QxefaMtphd599c2IZ9zUv47OkYjAFQZfKXIutUzJtx7D8Q+fplaVz+HYMBh+RCYIvaev8gcEv7WmEw7M+NCJXQRvpCR/SvWqTcgcaEvcCjLwez3Wqo7U4/WHfXdALta3+8uI7XF6CHfnlru2aV3KxwA93D9ycOaWXlfsWy3PHzeb3HAdSubOY7FOJmKg+QY0YY0y6F5ITuoYnEwEMox+nKNJVk4E1fDv7ULu3epZp59mQhEtu2fyrElvs8VlUxtlsZG/t5oghyXr4Q2Ntc9oDalfDMLR2dp1p64cwk97vLL4AfPTVAWHKFRw/1QBMmTPd6UQ+8XcNssOV3Kd01YJtfB6f7YjQvezi1qsvlb/V/pBaX7WAv9CTUWen76RIN7x3teBh6PvLbJLpIb6XVVdxS3+2vjXdQKu4ibpnVw4rZEfjyZqZ9gtjK/TilYQGQno+Q0lWR8PpApIUmpAzsKIhNj3FKUGvffHGbwAst/Ajsyq6Y2dYtDxw6CXsrzVd5Y+AEqCFsIxpiiCfnTzEcG8AcO7AGXPInhVlBO6c8EjLzJYt4a08TJUjDDdqeKg7KgFF7C5ccl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2718.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(39860400002)(396003)(366004)(346002)(136003)(5660300002)(6666004)(52116002)(66946007)(44832011)(36756003)(7416002)(66476007)(7406005)(6486002)(956004)(8936002)(316002)(2906002)(186003)(4326008)(478600001)(86362001)(26005)(54906003)(38100700002)(38350700002)(7696005)(1076003)(8676002)(83380400001)(2616005)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4MhuWrLcLHwqpklrgBxNx9uSU+xdYVIX9JN3/xKBsQAQlNr3t3PsnwEyqa2h?= =?us-ascii?Q?ALQR8Lohn/VrSC3VNiLZkzf2vhYQuL8ddPvidtRWrJllqMcz0BNinHCIkQM/?= =?us-ascii?Q?boWHLOmDekCXDrWJOvmEnLy7Ro3JSAYWzC402SRWtUnyMapS5+Ifn7Y6dWfD?= =?us-ascii?Q?Ug/0m50twoB/BghhfvOQSwtmiNOjnhEI8fFCMXyMX1gx1eiXMJvDYe0NPA2E?= =?us-ascii?Q?YRtVXchhd6Z+mJkfGjs1hHqB7rX+Ucwz9ng10voJTtmVN8aQAABedKCH4sWF?= =?us-ascii?Q?kbz1ELEZv+e4YPoLjKd9rrgm3FsM8nohIyWLefBLbqBa+14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ae4FSUL3fkWpqjaqesOZRdQiXz0mt3UOXFjNCDY0GdS8RHS6zsyMbC/sL?= =?us-ascii?Q?j5UF5gT3fE6DjpWGAamb+aRjsJ3H7imD9hiR+coOfQyhLPtINl4lW8LQ+OWf?= =?us-ascii?Q?5ZnsEO6FC9Jbty+xHDFMSsZh?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e272240-cc77-4113-46e1-08d963f391d9 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2021 16:00:02.6573 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XjqvCw5B5RvKKLBZQd1NRnFasipj21dMaujDTyb7v8PuwFD+rc6KyGsz1YygJffOfx3g5TCG9f2BUTo8h/pj8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4384 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Bit 31 in the page fault-error bit will be set when processor encounters an RMP violation. While at it, use the BIT_ULL() 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..89b705114b3f 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 */ + /* * 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 due to 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_ULL(0), + X86_PF_WRITE = BIT_ULL(1), + X86_PF_USER = BIT_ULL(2), + X86_PF_RSVD = BIT_ULL(3), + X86_PF_INSTR = BIT_ULL(4), + X86_PF_PK = BIT_ULL(5), + X86_PF_SGX = BIT_ULL(15), + X86_PF_RMP = BIT_ULL(31), }; #endif /* _ASM_X86_TRAP_PF_H */ diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index b2eefdefc108..8b7a5757440e 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