Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2004928rwl; Thu, 30 Mar 2023 04:52:44 -0700 (PDT) X-Google-Smtp-Source: AKy350a4p27VoHNnVuvOAvtHiZUpOoEMBHXXqyJtIcPmtK5WPn4/Ozx+MGRPG22NtMlk23sqEYse X-Received: by 2002:a05:6a00:2e9d:b0:626:fe8b:48a6 with SMTP id fd29-20020a056a002e9d00b00626fe8b48a6mr21010417pfb.3.1680177164227; Thu, 30 Mar 2023 04:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680177164; cv=none; d=google.com; s=arc-20160816; b=kvkcFx9xe3RUOjxZeIHeYjAE+yeE1vsqIn2rpg1A3QxZ0bqDL7w5bhLzEdyX7zRGdH +kkdrrZ7SuYSl5rSCCASovv1upZeR/XnDXNgvkUVwyW1XoMHyYx/zUdMKdubT6lcWxWB jpQWRQugJd9aLjC61/FecOgGUdOJKO3p0XC1MI+CgBi5QjtY5Gd5YX4oR4HB3no1jL4A 3sJ4QI4wumM5u6eh8j1oZJxUcXKOmRTmZArcnEj/9I9f4CU8hNv3ZFhDJ0ctLDN4y5qo QkeWBf4RJRoI6b2Viz7V995/CrPzJxga4Fblwtmw2loCXCSuthID7vu8G8wCyQMc68ob bmgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fY9Gq1C+euQfN8HX4Dp9v5W//o61MTHQI2rmCiyIkTM=; b=MSb1FNsFNBM2mJDrAXgpsYfO/tPOeoy4jP+R0F41AjSwuy4I31bVcPMPFGObqz9Ypa dhPxom7w6T+Pjkd3gT21A0mdnZr4uId9tH/GRJS0xDhjg2r2booYhRsxgjKPR1+5M+9M 00BwYhn1+clVa5lfeRzvgjQPucx+Ls6K80vA92nP13WP1XpAB4hi0Ny92OIFpgS46egK sETdrLs6b/zrkS+1uPQ6VYgHf9N5Jr2UMGCBR9HToHuoOf1Qzb39Py0hnc7VwTKh/yJh dS4HLcWorGOVtFkCj+BkopZSV5yYlnQeVKgG3OJ4gGO+OJB/aLOmy+UO0BLObe2gRZyv p03Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PwZNdpyn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a056a001a4e00b00627fbc1cb02si27864117pfv.338.2023.03.30.04.52.32; Thu, 30 Mar 2023 04:52:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PwZNdpyn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231609AbjC3LuZ (ORCPT + 99 others); Thu, 30 Mar 2023 07:50:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbjC3LuU (ORCPT ); Thu, 30 Mar 2023 07:50:20 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A515597; Thu, 30 Mar 2023 04:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680177015; x=1711713015; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bJTThgoaEyMmVXYNTmAj3X3A0F/zyVZqqh7eNmMOpAY=; b=PwZNdpynz1oHJnipIue42EO8/xdm+LpP0AuQT5t0/y6PXPgTGVy2Vzal qQhzW7b/r2+WbjNOUvBPWuDCM3boCQ3Z10my3hMvnbbOphyeHtos6qrvz wEDAF2N5k5e5uHN6AlZhK6W1Bh4CuBO5rOrfPnr8wH+XuEZ4V2FUjMWf/ Ib0iSOqDg3WedrxF8Fg7bpKnEoJ97GLAXxRDDoJgEj82ZMoUREveGCzQx fCMHKnZ8J2QD0njcC90cZzcoewVhX+s+REWOG2OIN+gMIuRnNa70zfZod kJwhT3rUt7XCAY/CG9k+KnLNUx3hYlFg3IZp0+LUrKCmnaf22y2/gt2+q A==; X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="339868390" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="339868390" 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.39.2