Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp109920rwb; Tue, 6 Dec 2022 18:05:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ow9ggflhEVRQ7zmdvlTz+vo9ytqcoDLMgpU/24ywRAF7PnyeOXfhQExJP4bLSMy1jN/dw X-Received: by 2002:a17:90a:d681:b0:213:d08f:a455 with SMTP id x1-20020a17090ad68100b00213d08fa455mr104432716pju.130.1670378709656; Tue, 06 Dec 2022 18:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670378709; cv=none; d=google.com; s=arc-20160816; b=CLPxlHoQoKJscXgxiOZYWkH5erSwR0bcrkzJVdHOLYPs5d1s+c99OSdaDqH7vCzF4U SMGqExcP32/Zs7abTjcQW+iGKO7MPEQWwyPoSEgFIP1CY9d8ylh5Kf6G9ZNQnx5gnK3N uluTZ7OxLSohxNvnkN1wMO+hwAq/CVjSl0G2xv5PDDYEke5u4jUFL1rbee/YULtUuBSX aO7KzyQk9hwWxi4n0l1ocKKUmq3CgMMw5WR9tjcq+oo3ewVOpFvvhxFvML7174TrCGlJ K4tHmUVH3YWE1Xv2N12TkSYo1Ix280XDVnhEqYBB15KmlMY8zPUAK12DbC9DF/t2Zb3N PXOw== 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=8l9ZiSm/kaiuS9XyH4XFj4NlMRfh5ugtCJPZ6kCsnx0=; b=MQc+ufcLSBnQNqj0X2hwJYI3wzwvISkafxzUJDCUmBfE757TWWQldOHBwm21cboNwD 1/ZkI3Ak5Bc/DiKcmYynC5uwDtrJhleSePcWAWJb5rPlwwpXryyXOu9VylqyG6saerMv amJigIxaTHnUs96mqqADw3pYoNkcfs9z8NhlM6KEwWt0PV6PSQ6LO+aOvlLTRlG/mnZq yYyr6BA9+0zkBEGF0hdPqGxaBMuUNOb3ePW1x5g1czbu1l+EUF/bVBYojHdQ9VYsj6rz zs4KjcmAy6Y+6EZ5pCpvhiqh8N1E3q2ixdCzwjqGQ28mgXfgeG9HpAvCDTd4HGq7LUhc Mzog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="h+/TP1vQ"; 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 o12-20020a056a0015cc00b005726c063927si6817291pfu.161.2022.12.06.18.04.59; Tue, 06 Dec 2022 18:05:09 -0800 (PST) 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="h+/TP1vQ"; 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 S229944AbiLGBuD (ORCPT + 77 others); Tue, 6 Dec 2022 20:50:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiLGBty (ORCPT ); Tue, 6 Dec 2022 20:49:54 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A9D15289F; Tue, 6 Dec 2022 17:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670377793; x=1701913793; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wTnYWmM1Z8lnXpkf3CCIP9h4eff3UeEwYWr89BwyTuQ=; b=h+/TP1vQM72IKetOdmHNO7dLaaAB/ZfiTzIEWYJk64r18gktSYqvaotZ 8shMTYTWjEuz+yVV+Ar1Wb9/eJ4S4BFKWJR4NZ0lv8jonYmOvd7wlplf9 yxfR6ThOTOqlGHMeCJTD2idi3Q45N7pgWr5+XeEaAQgKnAdE41QdJB4ca GsvN3iOwewViuCfhCPFlNEXrDIiarPNQJiVwnNlvsqo6XZylHeDTCcKfO wo2YnV5DGCNvkWV8AnfFejtWlYEltRfgUqW7orOavzicpij6NOiId1Jtz kdc9X2hD2RZQSnfyWuySHY1j2DzIIIoAuTcGGAdGCG6jyHOMrQXAZ4kQu w==; X-IronPort-AV: E=McAfee;i="6500,9779,10553"; a="315494468" X-IronPort-AV: E=Sophos;i="5.96,223,1665471600"; d="scan'208";a="315494468" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2022 17:49:51 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10553"; a="646427602" X-IronPort-AV: E=Sophos;i="5.96,223,1665471600"; d="scan'208";a="646427602" Received: from puneets1-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.38.123]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2022 17:49:41 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 35405109C85; Wed, 7 Dec 2022 04:49:39 +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: [PATCHv8 01/14] x86/boot: Centralize __pa()/__va() definitions Date: Wed, 7 Dec 2022 04:49:20 +0300 Message-Id: <20221207014933.8435-2-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221207014933.8435-1-kirill.shutemov@linux.intel.com> References: <20221207014933.8435-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 d4a314cc50d6..56550f289118 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 62208ec04ca4..d37d612a6390 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 c93930d5ccbd..e4d3a2da2eb9 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.38.0