Message ID | 20221214194056.161492-23-michael.roth@amd.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 5B9B8C4332F for <linux-mm@archiver.kernel.org>; Wed, 14 Dec 2022 19:52:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ECB168E0005; Wed, 14 Dec 2022 14:52:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E7B348E0002; Wed, 14 Dec 2022 14:52:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1BF48E0005; Wed, 14 Dec 2022 14:52:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C0B788E0002 for <linux-mm@kvack.org>; Wed, 14 Dec 2022 14:52:12 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 95EEBA0F9C for <linux-mm@kvack.org>; Wed, 14 Dec 2022 19:52:12 +0000 (UTC) X-FDA: 80241958104.17.1F436FF Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2069.outbound.protection.outlook.com [40.107.244.69]) by imf28.hostedemail.com (Postfix) with ESMTP id BDB0DC001A for <linux-mm@kvack.org>; Wed, 14 Dec 2022 19:52:09 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=bfc2JPN9; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf28.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.244.69 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671047529; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ehh3zB8AkT3HR+8GiQG3Qs2aejsevicxPUxFJxZv7mk=; b=3cSrPnnNeAiyss7FCbcUQK39okvZz5ChlgeRS7uPIS3zp1MTbrKRIFa7L2sJU3KzNIl4kR Iyzk1tmJTmJkML+x5c3Dquwh5taqwTmhDIqWFyjIP7vMDVR2QOSsajeWHOUgYLSML/gCmZ 4Z4QZY7m+MpUXWjWSzKgAGEeFswwvjk= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=bfc2JPN9; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf28.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.244.69 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1671047529; a=rsa-sha256; cv=pass; b=d4pW/CmLW7IcgVfRZ25bKsGdL75NPYzvbInrcZsfOZ4mBuMU0ZE5gW8g0zxa4gsGeMhd/F NwbBBFVKHbUsyqM0RWV8dLb8fD97wmcLTZqFxWT10Q9Jzg6XKDisZFzWya2oooAyvzr5E6 qAPjPUX1bZJGL3xUAJhStDmBZ28A0Jw= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LSoX6i0K+8TvDyeDCIU+eauBLa3w5W7GITVE+MH1cOcG8TQkVT1G/sTjyFxHkvn+7DQKbfZjQVmo39kiIBZV8Kw2KowIN2DmT2DKGOt9aCf7vMJsU4mAf0i4Y18lsbcoyQzs3ce7ZJ2sBcZTT5j3/KhqyPBsCY/Ofd0v19SirzyjXYbaS1YFBuSUoojFK6VGrmn/xY+p5SYL9geikWiVIuuPz2ymEmemXyX+HZVkJhiNGgvLMyMyDCT6nWcXmY5d+Pc39uKGERnIrgVOCun9VhtAk5rod/PqBBSEQDBdnEdoyiCQNEggQI6PFIkdWyYl5qqKRkEC217FDTFeJ5CZuw== 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=ehh3zB8AkT3HR+8GiQG3Qs2aejsevicxPUxFJxZv7mk=; b=WxTUCK05snWn5ISW+9YqecRp/3xoMJQrZMSrxlZNmbSkne4eSYDDEsOvmDyrbl2PeI+spy5vpTpIXKbjKwV5DCH/bo+faFwGJw6SFMZywEhhfXLrg7XKQcVKyLYjTm3EFY+R42gi4F0Kaj0OX3TlZy6AS37zUEdqj+IyT1XqRDfo9sgkeV38V8KND6FEZ6ZChcTEJjZtm0udqlugzy6tyava2mUCcC6lWJw3P/N+uNGdawWGsNDOMsT2+jhHuCUNIONndFqdtPS6hU3L7T4EcBB+eRtGX1wVhysd61miNsmUjJkDZEV06fXPyd+wQVYpAes5TGitB/4Ndw8Kg+t1RA== 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=ehh3zB8AkT3HR+8GiQG3Qs2aejsevicxPUxFJxZv7mk=; b=bfc2JPN9gP3mSTzNqzMYj4ip9rOxntwTL+pmj+X9MFLIn6DFx7HvGP4wJ1LWclh1h5fjg002rxdIyXqwHVPVrBW9n8UocRGIJdKsSWDwxQ0vYjOeQIDHWi/CtlEfTIIy0IlwY2purrm/UeWCJTbQt+ub3mpWetTdSc3W2wyl5Ng= Received: from CY5PR18CA0041.namprd18.prod.outlook.com (2603:10b6:930:13::19) by PH0PR12MB7864.namprd12.prod.outlook.com (2603:10b6:510:26c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.11; Wed, 14 Dec 2022 19:52:00 +0000 Received: from CY4PEPF0000C979.namprd02.prod.outlook.com (2603:10b6:930:13:cafe::85) by CY5PR18CA0041.outlook.office365.com (2603:10b6:930:13::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.11 via Frontend Transport; Wed, 14 Dec 2022 19:51:59 +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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000C979.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5924.10 via Frontend Transport; Wed, 14 Dec 2022 19:51:59 +0000 Received: from localhost (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.34; Wed, 14 Dec 2022 13:51:58 -0600 From: Michael Roth <michael.roth@amd.com> To: <kvm@vger.kernel.org> CC: <linux-coco@lists.linux.dev>, <linux-mm@kvack.org>, <linux-crypto@vger.kernel.org>, <x86@kernel.org>, <linux-kernel@vger.kernel.org>, <tglx@linutronix.de>, <mingo@redhat.com>, <jroedel@suse.de>, <thomas.lendacky@amd.com>, <hpa@zytor.com>, <ardb@kernel.org>, <pbonzini@redhat.com>, <seanjc@google.com>, <vkuznets@redhat.com>, <wanpengli@tencent.com>, <jmattson@google.com>, <luto@kernel.org>, <dave.hansen@linux.intel.com>, <slp@redhat.com>, <pgonda@google.com>, <peterz@infradead.org>, <srinivas.pandruvada@linux.intel.com>, <rientjes@google.com>, <dovmurik@linux.ibm.com>, <tobin@ibm.com>, <bp@alien8.de>, <vbabka@suse.cz>, <kirill@shutemov.name>, <ak@linux.intel.com>, <tony.luck@intel.com>, <marcorr@google.com>, <sathyanarayanan.kuppuswamy@linux.intel.com>, <alpergun@google.com>, <dgilbert@redhat.com>, <jarkko@kernel.org>, <ashish.kalra@amd.com>, <harald@profian.com> Subject: [PATCH RFC v7 22/64] x86/fault: Return pfn from dump_pagetable() for SEV-specific fault handling. Date: Wed, 14 Dec 2022 13:40:14 -0600 Message-ID: <20221214194056.161492-23-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221214194056.161492-1-michael.roth@amd.com> References: <20221214194056.161492-1-michael.roth@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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-TrafficTypeDiagnostic: CY4PEPF0000C979:EE_|PH0PR12MB7864:EE_ X-MS-Office365-Filtering-Correlation-Id: c4c126d3-a80a-4373-8dde-08dade0ca9db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KVjYk4w/HnfWbVhfEPsdQS8zDAZhPUCkgVLygV6jjgjm22Qb1ZMH4LPC03cNp0YMQ8acCe+1vrZ6K/QOgFAWsDLWO3G1V7mDV+Ais7OoiJt2urNLPJrHNMVafJllpcDHVoimWqEduOO9DAb1dJ1ksziCRFG3l86KEydDBnv9PCDt8a3uhpC0iKvqva8mSgEhaXL8zzaGnRg41iHa7JqNrSuBAaHY9FZW3yQrhnBoT191UCFxXyXiJ2bt6OahQEl2arCj3aYFIw/sUj4RLOOe10pXSBviNwK13MhhakDQWDBRpu8OHDkOYtQQpdZt/I44mv+ReI1Ftlie85A1S0plJ24ly2QxZpI/uLxoSJJ8Lz6EHOZBSlvN4dG+2gbcXySTfhQeMCBbzKwmwZ9ZfiJ8kgksLVknuXXCo4cojqcoGPQHQ5KOOwW74kYk0YK1PSzscGg3pgw1xL8OXtDBH5lkSyTDjXVX5UlJ6PxN2dx6N3MyAKMMiKxT+fMdoYMBW/B1UXdUqqqQ4SyvEhIVETQ/xJm+y0uodq9wvn7rQhtbZw/qkKV01DEa+j1RZlywAoY4YyzqYWsPQvE+dhBfXYqolmrKnepkc0s32fkR5YNAHDRinSJAVJvpUzV/YJqPe7O13eRZnqdGtM49CiNauw4ynGjH18kMtnjDYuvUdQlYnILfEWzmVkAAb/fS387b605DYwcWFHe7SQi/GmsXgX6/IrxW/8s1dUR6PN+N/HDSRg0= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:CA;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(376002)(136003)(346002)(451199015)(40470700004)(36840700001)(46966006)(82310400005)(478600001)(6666004)(86362001)(16526019)(356005)(81166007)(82740400003)(26005)(186003)(8936002)(1076003)(336012)(41300700001)(2906002)(54906003)(6916009)(83380400001)(36756003)(44832011)(40460700003)(426003)(47076005)(316002)(7416002)(7406005)(2616005)(70206006)(8676002)(70586007)(4326008)(40480700001)(5660300002)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 19:51:59.6120 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4c126d3-a80a-4373-8dde-08dade0ca9db 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: CY4PEPF0000C979.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7864 X-Rspamd-Queue-Id: BDB0DC001A X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: u63946ridydwrgndgzw4y8u6ctcs7waa X-HE-Tag: 1671047529-642145 X-HE-Meta: U2FsdGVkX18NF2zj/gNwIbVdRbvanl5Hc7Zsrv1YwOXmKQITgjUz07P6xHlKXgn4WhTRyddfiCBLSRxEjMsp/ycNZ240aZf6s1oOiQ14GJJFglauM+Pk+AcL8Lb5UTLmgt7S4Q5kz9YTIxPUwBALt1uZFoIDSrIN29q7Z6636bD/0p+xZbX6+030M+osWR4M6syTfVR6CIsRYb4VAOKOzsGLI764LqiBVTyyOROS/5wfSbIb12p1vbmQl8Ok6Y0vvk1loaXxolpRk9C8uVMkNqDo0Kg44DU2Gu1orXqoiHO9kUrl8SvcQ7FkvdUlLKMONfOfg5RU+Hi4P9W88wdX6AaaXbpMd/1arK7ytzv4hhJiN+Pllgv23lzkpdhHVu4+DBdANPJyodduUMGWZYpezMeaK+uRlnoaRLWTQbEAGUoGXsSscAkcLeLZVzD2Sp60ywtSMNQOsRQI/R6FSj7BbOkZN5mxTnHHekCBIZHfuR+uAKbA5LTGvxn+MGmKL1HOflMDGtoNbhxeIL2RHuIp9gEYI7WpOnttUtAbVTsM3wdlW1PiEUV0ExR7zEaBW2cVGM9Tg8FVzMRECtJT40s3dyrwCuWRvgbuxeeZ02ZQFBVM0cHmqsI4lnbVcts5XLE7C0AvpShgAC7TU9UHWSt6AZVVAjRdA7j1nvPl6iTKGexh6j7rcHGY0aFtNGC+DSd/UQQe8nmeYiWfQBnQBjihuIZWYr5LYh5aOPiEldDwBGS8ESVlbRA5I8zA1NtrS/8IcFGODBytuk7jxPFiEKLQCb7pEVJMA18J6WZORGLq7Qf4jVgJcMevSpGHit9S6aakEbP0Bej1kplBwbvDQ9FS3tcZ08aH3u8fG4rMFqI0sE8SKkheLBewRJr4AYFivm+VWiBJEdXDzdP97sWwGNhQVuZ9z8t6znJfi5UBIS9S7fKy67tRSKKagx/RK+r2InmSKkuLKpu38nO0XmDBknx MYDmmWFo ultHbSZD7cPUh4aLenhAjp6dcxuCEfr6+O1Km+rU9aQjZ1KS66um7MBbjqQ== 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: <linux-mm.kvack.org> |
Series |
Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support
|
expand
|
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index d611051dcf1e..ded53879f98d 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -311,7 +311,7 @@ static bool low_pfn(unsigned long pfn) return pfn < max_low_pfn; } -static void dump_pagetable(unsigned long address) +static unsigned long dump_pagetable(unsigned long address) { pgd_t *base = __va(read_cr3_pa()); pgd_t *pgd = &base[pgd_index(address)]; @@ -345,8 +345,10 @@ static void dump_pagetable(unsigned long address) pte = pte_offset_kernel(pmd, address); pr_cont("*pte = %0*Lx ", sizeof(*pte) * 2, (u64)pte_val(*pte)); + return 0; out: pr_cont("\n"); + return 0; } #else /* CONFIG_X86_64: */ @@ -367,10 +369,11 @@ static int bad_address(void *p) return get_kernel_nofault(dummy, (unsigned long *)p); } -static void dump_pagetable(unsigned long address) +static unsigned long dump_pagetable(unsigned long address) { pgd_t *base = __va(read_cr3_pa()); pgd_t *pgd = base + pgd_index(address); + unsigned long pfn; p4d_t *p4d; pud_t *pud; pmd_t *pmd; @@ -388,6 +391,7 @@ static void dump_pagetable(unsigned long address) if (bad_address(p4d)) goto bad; + pfn = p4d_pfn(*p4d); pr_cont("P4D %lx ", p4d_val(*p4d)); if (!p4d_present(*p4d) || p4d_large(*p4d)) goto out; @@ -396,6 +400,7 @@ static void dump_pagetable(unsigned long address) if (bad_address(pud)) goto bad; + pfn = pud_pfn(*pud); pr_cont("PUD %lx ", pud_val(*pud)); if (!pud_present(*pud) || pud_large(*pud)) goto out; @@ -404,6 +409,7 @@ static void dump_pagetable(unsigned long address) if (bad_address(pmd)) goto bad; + pfn = pmd_pfn(*pmd); pr_cont("PMD %lx ", pmd_val(*pmd)); if (!pmd_present(*pmd) || pmd_large(*pmd)) goto out; @@ -412,13 +418,14 @@ static void dump_pagetable(unsigned long address) if (bad_address(pte)) goto bad; + pfn = pte_pfn(*pte); pr_cont("PTE %lx", pte_val(*pte)); out: pr_cont("\n"); - - return; + return pfn; bad: pr_info("BAD\n"); + return -1; } #endif /* CONFIG_X86_64 */