Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5788505imm; Mon, 27 Aug 2018 04:26:33 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb9zl3pMZKoM1OeUsBksrHjH5KtC9mSZdhfO4rSwaKD7FNY0HL1CJckcpYfwEsn1LrWmZ9H X-Received: by 2002:a17:902:187:: with SMTP id b7-v6mr12876794plb.269.1535369193633; Mon, 27 Aug 2018 04:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535369193; cv=none; d=google.com; s=arc-20160816; b=Ce6fLcZsRQoXPg20IRMr19L881PNxQDB5BWVwNmxxWZ3rgfeSl+dgATrp7OofN7Ykk ckLitebVmmJrXHFkrUX6foHPCJY1d4OO/00yJ9BZr3FYvq03vJX5DJpdbxT2dbKLZGAx NU1zlptu5dpoi8UfbserdJOmsYXQU0pJjISIcmIHWrXJoY39BBkkP1Zlv19pvzi9dOMD 02jmeNzyyUE6FsEd576YrFjKSVCUzWESpOAPLRg+46MSeg++nQFsS57bZ8ujkdPszv4o NzKhqLlVkar+4PyN527BtzyueSXPBqYe4I5Y7eFzhayqgP6b0Y03LvXxuF8F6TrDNSys b36w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=NWk/vNA/LIZ2N41H4n7tTsNT4PBBOFLfImtws51zSdg=; b=TUG3uqOwEf2uV85sPzmNGzzBjeG3dU+kIbA9ePaVWDHH/6IAcxSWbdU44lH/sY7cwn I/pt8tPx1WkElsCwu0Vp8O05tMHTapMXUeHnLDyEw1Tt6E4NKYbHc5XIRmbRLGdg3weH QF3TxWRizAh8dWS2oLTfAbFhnAtF0IRrfTZFOEy9GJH+6jKuVARqujPnLr9MnGazsoLI f6w9TYKfrc+C/x7W8WvDhhDLSSC2yPQd13Pe3pQT3b5PgvJLrMCrWohzUprf09TGMEwt 9Rjhl94V/wq1l37CY8xcAwSMoUnrmPP1UqikQC3UTcazil1g7Hr/H+oyPH1b4hRLI07r k9pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=lzCbJMrz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6-v6si15162929pfc.298.2018.08.27.04.26.15; Mon, 27 Aug 2018 04:26:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=lzCbJMrz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726972AbeH0PLQ (ORCPT + 99 others); Mon, 27 Aug 2018 11:11:16 -0400 Received: from mail-sn1nam02on0085.outbound.protection.outlook.com ([104.47.36.85]:53246 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726825AbeH0PLQ (ORCPT ); Mon, 27 Aug 2018 11:11:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NWk/vNA/LIZ2N41H4n7tTsNT4PBBOFLfImtws51zSdg=; b=lzCbJMrzq2uH3xWTxFcnTFHeOM6bLa54CQrYteJj8+kJ7/jwFxenMDcLHbG5m9xEn8Uwb+4Y+6t2Cw/McxDTrsxG+ix571wvoBGnvl0PXaxa8mSTMlUBbBYlPrbcZ8q4bm7MYCj9HdOJZLJU/E2u29U+s8gZwDAeXc9oekBghk8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from sbrijesh-desktop.amd.com (165.204.77.1) by BYAPR12MB2679.namprd12.prod.outlook.com (2603:10b6:a03:69::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Mon, 27 Aug 2018 11:24:56 +0000 From: Brijesh Singh To: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Brijesh Singh , Tom Lendacky , Thomas Gleixner , Borislav Petkov , Paolo Bonzini , Sean Christopherson , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PATCH 0/2] x86: Fix SEV guest regression Date: Mon, 27 Aug 2018 06:24:38 -0500 Message-Id: <1535369080-20290-1-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR21CA0011.namprd21.prod.outlook.com (2603:10b6:3:ac::21) To BYAPR12MB2679.namprd12.prod.outlook.com (2603:10b6:a03:69::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c96cf28-1807-4268-cadc-08d60c0fb807 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:BYAPR12MB2679; X-Microsoft-Exchange-Diagnostics: 1;BYAPR12MB2679;3:QLvXCBgHWdh6Eybtdu4SxbPcp1B8WH5nALMavBayuIFs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e8BpXWofotJzNFki3mlx2vBVrNg6ZPWSjDONX9gigP9BGYeyjykJyVJm+DYE+mC+yu1Iq5zlv6G5ojODezkRG3mOfHjLsGOkPV5Dl6Oyp+0C9/nXeK+sLycw/vNzyOyxilH9bf4a/RHbu0xZgInIbh0si7ogAx1b9En2Zt34RmbQO5/AFcdBl2kL1enFTlgAShQhhAVRCl7lblafeYxCvG8pcq1/hloEZSohoMtxH/D3Rcq08v/SKa92YWfbk96ElIWCbg7M7Kp2t6XHVGkoj4vmUl/P0Fdf5NE+Vq9H+0yYL;4:Z9rrUlh+8Vqoi9Q/rNm1f+rKMF268iT/0/gAhXlljmFOl3MMkA//KAk1AtGt0Iu8jKBp6gqEOzwTCxpRIApF/4p2mFtFHZ7o65t60OGfbYriID7q3LTg7CJtevBrohJlP4/sxoNzX06GiC8D91KOo9Na0FQTE/vMK+s80Fo5WdpRQGc7FJb7B0dV5hT7JfNq3dI+I9fd8Xq+3I6gmb4Umj78ShaU5EtumDNCF3iuGSrt52IwB3HWP3cxmJdrHqpc0az2FZyskf1AOVx34hWCkscn3C/ettR8teRaVUAI6gQPXowyPiG1mYHVyIBWEBayM7xYVETOvRk88pntkf8fGYUwcVeF85KbTMBsumagqXUTIeeJRPau6OUsdzRAe6LZ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(84791874153150)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201708071742011)(7699016);SRVR:BYAPR12MB2679;BCL:0;PCL:0;RULEID:;SRVR:BYAPR12MB2679; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(346002)(39860400002)(376002)(366004)(136003)(396003)(189003)(199004)(5660300001)(8676002)(81166006)(81156014)(25786009)(6116002)(4326008)(23676004)(47776003)(316002)(54906003)(6306002)(86362001)(97736004)(53936002)(44832011)(7696005)(52116002)(305945005)(3846002)(7736002)(50226002)(2906002)(8936002)(16526019)(186003)(6486002)(105586002)(53416004)(26005)(106356001)(36756003)(68736007)(476003)(50466002)(966005)(2616005)(956004)(478600001)(2870700001)(66066001)(486006)(6666003)(386003);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR12MB2679;H:sbrijesh-desktop.amd.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWUFQUjEyTUIyNjc5OzIzOjg3Mk5BTzM3YWlqR01JeUV0TkJBdFBYeXF2?= =?utf-8?B?UHJEWWhTbm9PWDJVNFloMU4wT1BiNmxEY0VsVXRUcUY3cW9NeUxGbVhoNWIw?= =?utf-8?B?WmZKMWZOdlpiSUFIaGFTVUZkdlczZGhaQW9waE9uWGc2Snh6VWU3VFgwSnFH?= =?utf-8?B?WnJBa1FGdHBIUGlYZjZpalFiaGFiTm9MUCtUeCt2cm9SOHRibnppYjkxMUhr?= =?utf-8?B?MDlseXp0VDJQaElDVkF5RWRISnRndXhwNFhkUjRsUXN4UGVXSmFhWmZMQ0Fn?= =?utf-8?B?cVRmLy9jeTRGa0tTQ25MYWk3Vm1ZUzYzRThSS1Bqd2dTem1ueml3WFQ3RVRX?= =?utf-8?B?Q05VdEFGVTA2OHpUcGYrRDlXVGRtOUsxRElRQTVpd3FLbENXbFIrT1dpenNy?= =?utf-8?B?bU1ZNndKQWxlNXQ5TjBBbGpNYkRlVEhIK3dzUlZ1Mk54M0JnTU5Tb1hQNmFu?= =?utf-8?B?VDhrc0RrdDFWTWkxcnRXZ29Nb1pqZ1ZIZXJKdzBhcVhBdE1Na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CroBPQVFxnodbrVM9rVfD/4NpArtUf0Q==;5:9S6v76ZVp2mrutBqk8OlslQyrVY9qoFCaAU5W+TeNvqth+0XE6L4ruOmhQdOuw9G4JlrzNILo1N6Ug3G9TkMzk3hEL71lcXmgrl/8fYnCaZ+FlypccdGJUkmpKdMnir+P1TEDQ/09iTsAy+wh1QCeOB5uefYNtogfMfGZECrBMQ=;7:63HoUVvmWtcFJ3mWkE+FaHjAImUPZcQwFRiKjdmvAhJlBtZ4C0LWlnJjjfVPPiReOH6loOzUC/LkciSssbPrETMxChx6Zib4fmSSzngsrFwuaP0hBXR6ofUJdMjbwuanbbBdSbaCSxnSOJ0FFo38rn3zwPIOBaBiNj1on91usLQcxi0GdOmTZKM9VrNwywXtVc1OYFUepkXjzhMNM7beouXPAxBcAXfTMn+MJ0fT/7elYnxfptLl9OK4T9FugatR SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BYAPR12MB2679;20:o+AbBdx3E20NRa1/GbC/hVqqSLNwnDq9wS7LISB+4+Op/O4pwbqRTj/D/oUOPxDy1dcRlhpKoWyOEYF1cEKYErKURj80fqYSNz8W6CKtpGjHLcuGokoLb/dNpjHvpJlmtC6gxheSzzf90KivwQ2HdJDRckYr3FiEiuZ6n99rzVC0Btt5dnjHaSx9nGisIOsY9vHxp+V7M31hZdo2hW1SD1ANgcjoXP0PCLFqkmQPORu2GRVqWg8cPkZom3EQfPxt X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 11:24:56.3049 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c96cf28-1807-4268-cadc-08d60c0fb807 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2679 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit " x86/kvmclock: Remove memblock dependency https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=368a540e0232ad446931f5a4e8a5e06f69f21343 " introduced SEV guest regression. The guest physical address holding the wall_clock and hv_clock_boot are shared with the hypervisor must be mapped with C=0 when SEV is active. To clear the C-bit we use kernel_physical_mapping_init() to split the large pages. The above commit moved the kvmclock initialization very early and kernel_physical_mapping_init() fails to allocate memory while spliting the large page. To solve it, we add a special .data..decrypted section, this section can be used to hold the shared variables. Early boot code maps this section with C=0. The section is pmd aligned and sized to avoid the need to split the pages. Caller can use __decrypted attribute to add the variables in .data..decrypted section. Cc: Tom Lendacky Cc: Thomas Gleixner Cc: Borislav Petkov Cc: Paolo Bonzini Cc: Sean Christopherson Cc: "Radim Krčmář" Brijesh Singh (2): x86/mm: add .data..decrypted section to hold shared variables x86/kvm: use __decrypted attribute when declaring shared variables arch/x86/include/asm/mem_encrypt.h | 4 + arch/x86/kernel/head64.c | 12 ++ arch/x86/kernel/kvmclock.c | 26 ++++- arch/x86/kernel/vmlinux.lds.S | 18 +++ arch/x86/mm/mem_encrypt_identity.c | 220 +++++++++++++++++++++++++++---------- 5 files changed, 218 insertions(+), 62 deletions(-) -- 2.7.4