From patchwork Thu Mar 30 11:49:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 13194073 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 A03FEC761A6 for ; Thu, 30 Mar 2023 11:50:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 880786B0080; Thu, 30 Mar 2023 07:50:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 855C86B0081; Thu, 30 Mar 2023 07:50:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CEA56B0082; Thu, 30 Mar 2023 07:50:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 605D86B0080 for ; Thu, 30 Mar 2023 07:50:38 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 37C46AC605 for ; Thu, 30 Mar 2023 11:50:38 +0000 (UTC) X-FDA: 80625397356.14.1727B34 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf28.hostedemail.com (Postfix) with ESMTP id 10291C000B for ; Thu, 30 Mar 2023 11:50:35 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=MpqYtae1; spf=none (imf28.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680177036; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fY9Gq1C+euQfN8HX4Dp9v5W//o61MTHQI2rmCiyIkTM=; b=Dn06wBKkTaWT68u9rReAVN9Q4rmV9iqEJIAFa2noanpjvzyj0BpAoERM/EyqLLrZQobFvq 2qteYo5L4vuWv42BX4bExoWKrwX7C+GIc3uJOh/NwtUQgkG3KJX6dRxnoktzOcJaR9Zaje 0nlfTOXu5o3Q/oZTZPMDlYRSFypsM/Y= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=MpqYtae1; spf=none (imf28.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680177036; a=rsa-sha256; cv=none; b=MlaW/TmQZPI/dUj2eJQx2SpGwk4NA6xZyhKmU1FcnUUWIx1hKVo1df/hL6vOct9ALbjhUa NKSWCl+4Vrs+hs9rsVSQ3XeSK298PdZU+K3uQREUT+vcsL/z8DB65U+GZQcfd7sy2CpWdu UY6d3KUw09ssA68UYVRdSp2Yyf2a5Wc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680177036; x=1711713036; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bJTThgoaEyMmVXYNTmAj3X3A0F/zyVZqqh7eNmMOpAY=; b=MpqYtae12WeuogpfYULR9zDBfs0hufs1U2z3awV3Ns+dP/C8MAuElNaq f2Zca/aTQQMYamHIWWpVm9CmtHTJGQyGhMrlWUfG7eMJ66avJUHtTQmQY 2aZNOxH2pV2B1SO5nSNBFtFRyHs8evDjcZ7qhDGbflx33gyyPIQKfIcTS RyRm7MMbcU81+JWTil9QdhAoBchs/TmVUMNXkmME9lyCnAq9D7kyJIfCy kpxLn1pq9XgRedGzJgS4U+KwuLYA7EZrbVWA12IeBT1kJaxA6T0PHcfmP +M5LSOCFCJ9KKr/Ate1deYcnI9RNv6xaY3DCJtXnVrLIz9Exfq7WNQCYO w==; X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="339868387" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="339868387" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 04:50:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="1014401427" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="1014401427" Received: from ngreburx-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.251.209.91]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 04:50:02 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id E46BE10438C; Thu, 30 Mar 2023 14:49:59 +0300 (+03) From: "Kirill A. Shutemov" To: Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Dario Faggioli , Dave Hansen , Mike Rapoport , David Hildenbrand , Mel Gorman , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, aarcange@redhat.com, peterx@redhat.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Mike Rapoport , Dave Hansen Subject: [PATCHv9 01/14] x86/boot: Centralize __pa()/__va() definitions Date: Thu, 30 Mar 2023 14:49:43 +0300 Message-Id: <20230330114956.20342-2-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230330114956.20342-1-kirill.shutemov@linux.intel.com> References: <20230330114956.20342-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 56mu41rms656pnqbkihjneimqom8ui8z X-Rspamd-Queue-Id: 10291C000B X-HE-Tag: 1680177035-550443 X-HE-Meta: U2FsdGVkX18zryyZuPDEattVr5K4e3xH8SjipOqo78zz7+PT9kt1NEkQRObJ09I0jLOIhNjEGQeb28XDVSNNDyOfy6CwBlFliPR2yisiqXsZfDLqCA5J6eyUGjsEaTnooJjbPDxmFyVgtfLv84bWPvZ8XQcLWUkGqk8m4G6smsYxHJ73zcYj+KzzM5zdAH96lLKbc25dnh9S4OvsgJeGnmDAd9+XA/u2zkPKBqDNZ0Jwx1F7W9rxQLw2uuwiq4jlvVqn4mhRKgP88p3DUKNx2V2FsHCU1Jo31M7YDzruTBd+m+M8JCV22BCgevZe+MctetNHjKHwE6x1gzjeKGuMOGihGX1c+TLWwNnvTJhsBlUElSv6SLML1Sn65HPWB5vBXAkR24MZIP3hlU28oXIc3EN/G3IrJ351AXmkxQbO+52lWZ75Q21s/SkyH4elzfPauOWgQWWo8d12R5hSA94U8KJkZWNLBm9N6ZLPnkrAqflzXygz0GQ88gD9+Jy9bIJZ1xXgezCcTfcVyTEw1QsPDIy7GPsmcR8VKlAxMyA8IytXGo4DfKtKWJDzJcTWBatyL84EKC66+CeWxHKfwLalY2r3k70GxYkm0EAu9sfp/j84qNmhQC3Ok/XEhhjGxu9kBI4q0TVFLlUleUA4nSPEh6IUYkp1mGwAPyOSq2ApAT2qqB626JImACjEyDIaLJ3kbfn4+vOFAl6KQ8Gx0ShbjRgOoP5Su3JVZxnFguU5ak0gZVNfAYY7qoJ8EmvtV0zA1vzf58DuH1p5znJ6o2qMqU7Q/sPz+zIb+v+D41zoEDjwCRQctsRO9peS0GGD/IwzilLSNaCgn8zJTbS2W9DMEjIRX4CTvDvDPlXF96lapaYZudC3eBJG5Q97025nrNSpmUZ+tPTlpddimAyJaRTrdlcHwiLoWtdl1ryiFu3nkQp72v0xWrpDj79po1j7UYXi+KI5jZ6xlxEMRZqB31h 8/R6+nDw 9FxYRZIEMx6cAqn74qywlUe/AH70z8yofzl+GwqqR6tFDFTP8LAVamPpzD8J3sgQ3SO+2nr0cBV8m7hqmsfwQ07sQ1xRh27xfE3EPcrn5ChjI2OtZr5pjvqTgoWZJJtvcEzgqe4kzg0p3ne0KW61mJmbazrG1HYcbwnL2/iQzB2E0QFg1Ok5Das31DAzlSjJ4p9Vz6qo5wpKB/Qh9aQuP595RGzE/icDRqw7bcUrBDmygALS44716BSXnwKejbKo3gp65 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: Replace multiple __pa()/__va() definitions with a single one in misc.h. Signed-off-by: Kirill A. Shutemov Reviewed-by: David Hildenbrand Reviewed-by: Mike Rapoport Reviewed-by: Dave Hansen --- arch/x86/boot/compressed/ident_map_64.c | 8 -------- arch/x86/boot/compressed/misc.h | 9 +++++++++ arch/x86/boot/compressed/sev.c | 2 -- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compressed/ident_map_64.c index 321a5011042d..bcc956c17872 100644 --- a/arch/x86/boot/compressed/ident_map_64.c +++ b/arch/x86/boot/compressed/ident_map_64.c @@ -8,14 +8,6 @@ * Copyright (C) 2016 Kees Cook */ -/* - * Since we're dealing with identity mappings, physical and virtual - * addresses are the same, so override these defines which are ultimately - * used by the headers in misc.h. - */ -#define __pa(x) ((unsigned long)(x)) -#define __va(x) ((void *)((unsigned long)(x))) - /* No PAGE_TABLE_ISOLATION support needed either: */ #undef CONFIG_PAGE_TABLE_ISOLATION diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h index 20118fb7c53b..2f155a0e3041 100644 --- a/arch/x86/boot/compressed/misc.h +++ b/arch/x86/boot/compressed/misc.h @@ -19,6 +19,15 @@ /* cpu_feature_enabled() cannot be used this early */ #define USE_EARLY_PGTABLE_L5 +/* + * Boot stub deals with identity mappings, physical and virtual addresses are + * the same, so override these defines. + * + * will not define them if they are already defined. + */ +#define __pa(x) ((unsigned long)(x)) +#define __va(x) ((void *)((unsigned long)(x))) + #include #include #include diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c index d63ad8f99f83..014b89c89088 100644 --- a/arch/x86/boot/compressed/sev.c +++ b/arch/x86/boot/compressed/sev.c @@ -104,9 +104,7 @@ static enum es_result vc_read_mem(struct es_em_ctxt *ctxt, } #undef __init -#undef __pa #define __init -#define __pa(x) ((unsigned long)(x)) #define __BOOT_COMPRESSED