Received: by 10.223.176.5 with SMTP id f5csp534031wra; Tue, 30 Jan 2018 15:35:55 -0800 (PST) X-Google-Smtp-Source: AH8x22635HvlZXyUATQq4DtAR/s+pL0ikT3knIstVNH1t6G/Bgr5FJ8ju5rlzlXqYHe5/QGL6ki7 X-Received: by 10.99.115.24 with SMTP id o24mr9844588pgc.415.1517355355730; Tue, 30 Jan 2018 15:35:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517355355; cv=none; d=google.com; s=arc-20160816; b=TvP93W+VOS9AUprlxVFYC9+K9ME5in2rcRCLdsJOVk5MwVNyoZvzCOba80zFPOZdSJ J9FL4f2UPnyD4i8E0C1FE/a0/z398lMXd95XSS2dAlZgOEWE9LwMFyZ6BEGrifG2zKbR Yj2oIB8pc601t78WHswOSwh3N12B8oUR8m2ljLv1WhWRRQALn7AF79ZGa8NNYoD21T1h er8LNwi048DnkZZJpYs5slduB/afP3aOE8Y96NssFH7E2DV+wY4teduVYPjl4oWcsR0C Jfp848a/z9iiyU14ljHvbHjfsvs0Leo3cv6N05DaALJXzxWXltlBuwXp27Dmcebzxxoj 5JWg== 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:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=JQcGtHwYYTFr4EliMyOb0j8u+2oWMZlV4lRJS7K/52Y=; b=OoK6xBxBRVfOxLVHMfB7M+GX94CnMU+Ru+x7KGxPkRWprRYB3fe8+SBNtSlBTppliw y4LgF70DTCllx+LfiOFBXEwXhyXT56RNvCYId0wf9ZNS9h+is5YBtZSvCi47WMQOlFUT YsTdf4z/WPxtP56A79ZhkemukJxKmU8iZm3VQHdCJoZKlDrRSJQX4GAHgoxuqKHtPWr/ QIheuBuwoudoQJhpik0cYokn/GDDF06H97pgBxfkOQrNUGaIHJyZLj4ZMAghR0ZB9jK2 aMkt37iX6IrkVT8RDk1ANYA0v9uU6s5C67fZdyMRRQ9Vvd3n7/mlYrUvghazN6djnW8T dyLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=AKhyG7/8; 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 d8si356259pfh.120.2018.01.30.15.35.40; Tue, 30 Jan 2018 15:35:55 -0800 (PST) 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=AKhyG7/8; 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 S1752768AbeA3W0M (ORCPT + 99 others); Tue, 30 Jan 2018 17:26:12 -0500 Received: from mail-by2nam01on0082.outbound.protection.outlook.com ([104.47.34.82]:51949 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752529AbeA3W0K (ORCPT ); Tue, 30 Jan 2018 17:26:10 -0500 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; bh=JQcGtHwYYTFr4EliMyOb0j8u+2oWMZlV4lRJS7K/52Y=; b=AKhyG7/8CAcckSgbYdKBikMgpuomKl/h+lKH7DFyWCucPaLN/z/uldLB1W460oQjHCVWeXP3sVh5cOtllCO8ORMyM8ishxSZRSYEaVX/Qc9Yq0yrMMZTa+fCzluiaRUHKvLXC+u0xihX+UjSNDMwHViiGupx2/PXsaeAHrJr9Uk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from [10.236.65.116] (165.204.78.1) by DM5PR12MB1147.namprd12.prod.outlook.com (10.168.236.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Tue, 30 Jan 2018 22:26:07 +0000 Subject: Re: [PATCHv3 1/3] x86/mm/encrypt: Move page table helpers into separate translation unit To: "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" Cc: Linus Torvalds , Borislav Petkov , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20180124163623.61765-1-kirill.shutemov@linux.intel.com> <20180124163623.61765-2-kirill.shutemov@linux.intel.com> From: Tom Lendacky Message-ID: Date: Tue, 30 Jan 2018 16:26:03 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180124163623.61765-2-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: MWHPR1601CA0012.namprd16.prod.outlook.com (10.172.93.22) To DM5PR12MB1147.namprd12.prod.outlook.com (10.168.236.142) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 439e8bf0-665f-469f-dc68-08d5683075e6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:DM5PR12MB1147; X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1147;3:4ii5Xw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lDOvn/I4dsWKq1GC0o1gVyTNy66WQ+5myk8s6cDNlciqlCDZ++Sp7x7VapRzq7l/gifpXYZIQAidxn7WsdJPj6xL27+/shFAVvXv+K8o5LH32caf6hJIwUNqiQ9PKJtfO5rEFCXgwZFRU1C6efYeAs17qzC1B25pnBBpc6J7jZndEQM8nLKjXNxXGUFOl0pDVuLoiKPvSaCVeVYwewjVyzTd9NLFQ462qLqH0K92f/TvquBZ8o36g5ulFjUPbFp1QwxdicwUupHV/PqcfOoFtNWqmg6OCLGtajNfSuDHHDcsjL+K5RiXsy8/Ym1o/Kg+3ACfGC+UwD1VmLRxOIXCPRtD;4:TAriFrvHLDBWarr75OdlFnXlHhLvDH7PbNT/SdMDre5lr1wi4MccYdPxz2zbsXVpQxUj+b1T8TVeV0d/R6EGR3cYoRQMbHKycGMh5s/2lHcHwXGN/p+seAwrnuxInYpA+vTgE0hJUvzc5T8VKP/A1J+vJr9zaLPykQWoYxoI2nadS3qjoEfWKQVYgeAa8irVQE9oVKF8z4oMFJClHs33T1GQ366xwmmD0N8Vl0whbKbkSKRtVuqri4vYR/0J05zgtyFq61FrYWMkSKD3TxSL8v1Vx99ahUH9tDanqT5ESX3HiBjejEQma18JJtLhbV0jaqRe690Wf3tQur/dpo2+Kg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231101)(944501161)(10201501046)(3002001)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR12MB1147;BCL:0;PCL:0;RULEID:;SRVR:DM5PR12MB1147; X-Forefront-PRVS: 0568F32D91 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(376002)(39860400002)(346002)(396003)(39380400002)(366004)(189003)(199004)(3846002)(229853002)(53936002)(8676002)(81156014)(53546011)(97736004)(8936002)(66066001)(386003)(65956001)(6116002)(81166006)(2906002)(47776003)(105586002)(6666003)(50466002)(230700001)(2950100002)(31686004)(5660300001)(305945005)(65806001)(65826007)(86362001)(478600001)(4326008)(68736007)(7736002)(36756003)(16526019)(26005)(52146003)(72206003)(6486002)(106356001)(16576012)(31696002)(23676004)(6246003)(186003)(316002)(3260700006)(83506002)(59450400001)(64126003)(90366009)(2486003)(54906003)(77096007)(52116002)(25786009)(76176011)(110136005)(58126008);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR12MB1147;H:[10.236.65.116];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyTUIxMTQ3OzIzOjJIbTZlbkh6V1FnR2hTb2NPTzRxZGd1KzVW?= =?utf-8?B?RFlRRURINTNyNEFUZUhwWk9NK3dMSzE2YnFETnptNnBCN2loMXNzYUlMSjBx?= =?utf-8?B?MDA3QjZ2RXYzQXhMSkJQanR1b0V5RDk4LzA1MS9mYzlkbU9MUGJxSVY1b0xH?= =?utf-8?B?Q1pHZk84K1JBL3N3N01aTzQ2UWNkS0RMbHF4YXpOWmV6K1FCOC8veU81SFlB?= =?utf-8?B?UTlVZmo0d1JvT1diK2wxRlZlMzh4akhyeUlTSlVPMVNjUWRhL3huS0dvKzJM?= =?utf-8?B?WGZKbTFxcnE3ZmxNYkNkUFd4ZVQ1VFFZbEt1U3FiczdIaUN3VjhhUXpYTkVF?= =?utf-8?B?RWNhQlhMelAwNnJFOGRvUzl6d0pLL21aYVF5MkVxOU5PZXQ5M1NQWUF1eDBB?= =?utf-8?B?YUYzc011MGFYU2JadEZ3Qkl1NGQ1MmRKdFVGbkxuZVZDdXArakZkeERSWnhM?= =?utf-8?B?LzBZbnhLWTVPcTFoNkF6L2ZXVjJEcEIzbV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Flfw2p7AsBi0v6mRJFGueVcmxQQn2TDpaR/w1FXvg=;5:AW/63gGojyZO/hwmXXl2raorkTlhrtAkO3IdTIvxFN+aBE3CR9BhdgjhuG5XUeNfioYGFBQkxG7EPMiNYc/RQVwIgw/hXNPoxjXu7+Ux/1yjJmMWHhftKEl95cZYhREylye6NklS7x7UndQG+8fKND8BfrI/aY09sUPf8G+RzTs=;24:9NQfMZSQ9bexgyJo4UDp21Sg789dGoId3v2F/fxUgKAhm/mMgCok78NMZ9r7UUHtjWOpTEFUNG3hCqMt2cwDXG/eIYNVRf4sYEwXpyfqAB8=;7:8WrVqmeYZj7HCUkrybKCyu7iOaHtiBM78sTU2ywPiD4Is3/WzVuSV0VpMP757W7kuqbNvjPsP2eoC7ZoH0cPiN/Yrq9YuuD436i2ApGP8mUM4CZEKvP9NABz0Zn8IBNSHJJEpK6BS6fDW7YG9guwwx1DWd6B/DHxoPJHUqLdSqUS3oywIQc7VaSGTTj43SoB4NEgkLOJ6adO1o+TQ0JqcNqBmDJ0chgjCB/5S7s4lq2YpIXVh7kyJjboOzoFJGmq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1147;20:PLNpYz2dnQLYzPeVN7EXw0KRTBW/yS32gVR2IYXocyiYfnJ5SSCHWt0vPAd7b/ct2fYCoT3Rl3/wRZ4rYlKCJ6HE5n/qyeI59pZ/417Brj4kyiEmvRY1hs2QiV9z509PoEcaiCDWJukKN24J4wVnB2+tNQViqTB4kA6f3sOsLL7R1s6AuhbS8fFEe5oLpJzt7BlwsWEE3qWBvCUT9sTli3JQXekHsrTZFHBvPsOX1MzUdTC3H5KQtOCUAYAVf3fc X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2018 22:26:07.6076 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 439e8bf0-665f-469f-dc68-08d5683075e6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1147 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/24/2018 10:36 AM, Kirill A. Shutemov wrote: > There are bunch of functions in mem_encrypt.c that operate on the > identity mapping, which means they want virtual addresses to be equal to > physical one, without PAGE_OFFSET shift. > > We also need to avoid paravirtualizaion call there. > > Getting this done is tricky. We cannot use usual page table helpers. > It forces us to open-code a lot of things. It makes code ugly and hard > to modify. > > We can get it work with the page table helpers, but it requires few > preprocessor tricks. These tricks may have side effects for the rest of > the file. > > Let's isolate such functions into own translation unit. > > Signed-off-by: Kirill A. Shutemov Just one minor comment at the end. With that change: Reviewed-by: Tom Lendacky > --- > arch/x86/mm/Makefile | 14 +- > arch/x86/mm/mem_encrypt.c | 578 +---------------------------------- > arch/x86/mm/mem_encrypt_identity.c | 596 +++++++++++++++++++++++++++++++++++++ > arch/x86/mm/mm_internal.h | 1 + > 4 files changed, 607 insertions(+), 582 deletions(-) > create mode 100644 arch/x86/mm/mem_encrypt_identity.c > ... > diff --git a/arch/x86/mm/mm_internal.h b/arch/x86/mm/mm_internal.h > index 4e1f6e1b8159..7b4fc4386d90 100644 > --- a/arch/x86/mm/mm_internal.h > +++ b/arch/x86/mm/mm_internal.h > @@ -19,4 +19,5 @@ extern int after_bootmem; > > void update_cache_mode_entry(unsigned entry, enum page_cache_mode cache); > > +extern bool sev_enabled __section(.data); Lets move this into arch/x86/include/asm/mem_encrypt.h and then add #include to mem_encrypt_identity.c. Thanks, Tom > #endif /* __X86_MM_INTERNAL_H */ >