From patchwork Thu Mar 10 11:15:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharata B Rao X-Patchwork-Id: 12776166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25BA9C433EF for ; Thu, 10 Mar 2022 11:16:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BBFAB8D0007; Thu, 10 Mar 2022 06:16:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B6F498D0001; Thu, 10 Mar 2022 06:16:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E98B8D0007; Thu, 10 Mar 2022 06:16:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id 8FBD88D0001 for ; Thu, 10 Mar 2022 06:16:31 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 35717181C9BAD for ; Thu, 10 Mar 2022 11:16:31 +0000 (UTC) X-FDA: 79228223382.19.69E3171 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2045.outbound.protection.outlook.com [40.107.243.45]) by imf20.hostedemail.com (Postfix) with ESMTP id 91DD81C001F for ; Thu, 10 Mar 2022 11:16:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O9nrffsGI//KGXb3Yd8TSuQB96lE6oTBRAjGUnelNyiNJJ19d0H9CRunGZA5eWpGmebjYJkc27+CZIWawId3U2apR0crtwvYB7O7dW3n5+V5U2/XCD3bEDRypot23HMzYwx9E/9/Zllgs1lOQYcFthnUuirGEeMZunDVrM81EvxrAUzXAcqXSTk6Zhs9sa7mqjOPZgTbShphjd7MUInGsfVMyymnaMF3dkYLEgvISR9NjN6nrrkDEE+ZrUaCH8yxX+oXIsHiKu4CIy2sg2icjKWCxejq4telHJv33Vzs/0zOFoc4KonGtk+gsVtO8/Z3GVyFo/XSd8pH7X3dGJj7KA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SudsVIi3obuN2snFXsZgYoY2KU/BgUvR8OGtpfgZI+I=; b=U8XGmIawe8vL8DufxXRJAhWKNOom25XnDMCmdTxc6uj+aw/MuJV9rqZOFUi66OSz/6+a0PM8AA753fQ1yRSo27DvQQZ0nnGz+kGK85Sh5JmDZsyM5Drm3u6Hd5BZ4k/YV3zctoSuD+ezpySB6GKEtIDlCYsq/DRRxAsAGwGOSxyGwMutYoq00JUNkniXPzM5i5vuKexFpjWV05zsOnNsbbslaKeWdvoJKbKSfBqd6laYsGu9W6V4VVwC4UBCCEFbCYcA3azyY0Esl6l3TKonKYjarWvv9A40jgCudMzn2pUiYriMOZg0RvOVhm9FWAJsqMlMT9z+2gQ2+hJC2/4Peg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=SudsVIi3obuN2snFXsZgYoY2KU/BgUvR8OGtpfgZI+I=; b=PQ2zmnzdsvSAZPRM57neB0W8wWBmJGITm+c/2SNz5BMDjQ6LlVp8KxM3YoVllrHkb5wpHnopozsLro7kf1YKiL8rDG0wZGVbsj/FY7kCbOBhlzufG2D9MiNnGNhdgAo4WKsvMg3gQR75qHixaoXX0HrHQvReG40QV1rF1zPgpWk= Received: from MW4PR04CA0066.namprd04.prod.outlook.com (2603:10b6:303:6b::11) by BL0PR12MB2820.namprd12.prod.outlook.com (2603:10b6:208:80::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.29; Thu, 10 Mar 2022 11:16:28 +0000 Received: from CO1NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:303:6b:cafe::d2) by MW4PR04CA0066.outlook.office365.com (2603:10b6:303:6b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22 via Frontend Transport; Thu, 10 Mar 2022 11:16:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT045.mail.protection.outlook.com (10.13.175.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5038.14 via Frontend Transport; Thu, 10 Mar 2022 11:16:26 +0000 Received: from BLR-5CG1133937.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 10 Mar 2022 05:16:20 -0600 From: Bharata B Rao To: CC: , , , , , , , , , , , , "Bharata B Rao" Subject: [RFC PATCH v0 3/6] x86: Enable Upper Address Ignore(UAI) feature Date: Thu, 10 Mar 2022 16:45:42 +0530 Message-ID: <20220310111545.10852-4-bharata@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220310111545.10852-1-bharata@amd.com> References: <20220310111545.10852-1-bharata@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f33297ab-f11a-4c4e-e3bf-08da02876b62 X-MS-TrafficTypeDiagnostic: BL0PR12MB2820:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pgTzMtLQLEqbV+ZNMgggJCsI2DhZf12KazrmuNnKVFM0bXSRshGxq9Mu6LtVQAuKAEmPDAo6FnZ2Acq/iuXwDzDSGNH90IuJJbdY6nJ4lu0daAaIBgZNWtfOx+XuUOFPCoJ8OoWfoioxlOG3zcwDiSQCt6EhJCIGAM7k9HzBhDuuzz0VY1GTCwE7pB6wqu6SkYz3q2PN+CCgcX6OFCu/9Q8lbSqnVccX7X3QGy1JUG4HiVH6SDtbcpsUsfIljQnQYFGaz0Vcg5iEZPl+ZuQU68aCFBcP8CFw561ivQSRDXxrRT930YrN3jG6kuf0pxiRngIzwpDOzjQitpbTAEKIIV3MQiL84u3bVsrnSGpmF5JtAPGoItZGT7H8iBv05hDDNksoKObTlFu6hFboeWlcIdjOW6YJGuIJ13S4CD5HAtUsQ0j6JQSle4b4UM2pmZ8z37XOJ9U4XlGhnJxCdmzsZ9YRcApJDKzQ43wuDHDi51KBu9OQ4m90/ZuO+o73fNgxJDh1cBpijgh70unaPPTNX1ajz/NwJNp6Sgtv9wX333FhsWoCGaQhY7JmJLLIDjx5HigXb5ExMSFgWyPzhF199k62KeBSQWePD+thT2OFoJ4sjb9jdICAlf4ZIa1iqL8MoGQWfnYk7Opjr/HFgVS+jdqk9ELsCKwHqbnTL96KVZZK+ADo+8YtB4kJlTvPFDR61zgAmhC2GJXyBYBhVVLhSA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(356005)(2616005)(6666004)(47076005)(81166007)(1076003)(8936002)(82310400004)(83380400001)(7416002)(5660300002)(8676002)(70206006)(70586007)(2906002)(316002)(4326008)(40460700003)(36860700001)(6916009)(7696005)(86362001)(36756003)(16526019)(26005)(54906003)(508600001)(426003)(336012)(186003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 11:16:26.9955 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f33297ab-f11a-4c4e-e3bf-08da02876b62 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2820 X-Rspamd-Queue-Id: 91DD81C001F X-Stat-Signature: yiyh7jmn1mkgud4hz3aby1a6un74ony1 X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=PQ2zmnzd; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf20.hostedemail.com: domain of bharata@amd.com designates 40.107.243.45 as permitted sender) smtp.mailfrom=bharata@amd.com X-Rspamd-Server: rspam03 X-HE-Tag: 1646910990-146126 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: UAI feature is enabled by setting bit 20 in EFER MSR. Signed-off-by: Bharata B Rao --- arch/x86/include/asm/msr-index.h | 2 ++ arch/x86/kernel/setup.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index a4a39c3e0f19..ce763952278f 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -30,6 +30,7 @@ #define _EFER_SVME 12 /* Enable virtualization */ #define _EFER_LMSLE 13 /* Long Mode Segment Limit Enable */ #define _EFER_FFXSR 14 /* Enable Fast FXSAVE/FXRSTOR */ +#define _EFER_UAI 20 /* Enable Upper Address Ignore */ #define EFER_SCE (1<<_EFER_SCE) #define EFER_LME (1<<_EFER_LME) @@ -38,6 +39,7 @@ #define EFER_SVME (1<<_EFER_SVME) #define EFER_LMSLE (1<<_EFER_LMSLE) #define EFER_FFXSR (1<<_EFER_FFXSR) +#define EFER_UAI (1<<_EFER_UAI) /* Intel MSRs. Some also available on other CPUs */ diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index f7a132eb794d..12615b1b4af5 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -740,6 +740,12 @@ dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p) return 0; } +static inline void __init uai_enable(void) +{ + if (boot_cpu_has(X86_FEATURE_UAI)) + msr_set_bit(MSR_EFER, _EFER_UAI); +} + /* * Determine if we were loaded by an EFI loader. If so, then we have also been * passed the efi memmap, systab, etc., so we should use these data structures @@ -1146,6 +1152,8 @@ void __init setup_arch(char **cmdline_p) x86_init.paging.pagetable_init(); + uai_enable(); + kasan_init(); /*