From patchwork Tue Jun 14 12:02:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 12880958 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 9265CC43334 for ; Tue, 14 Jun 2022 12:02:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BBF9D8D023E; Tue, 14 Jun 2022 08:02:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B47258D023D; Tue, 14 Jun 2022 08:02:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E9078D023E; Tue, 14 Jun 2022 08:02:40 -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 8BBE38D023C for ; Tue, 14 Jun 2022 08:02:40 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 57FE26191D for ; Tue, 14 Jun 2022 12:02:40 +0000 (UTC) X-FDA: 79576704480.10.9918F53 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf22.hostedemail.com (Postfix) with ESMTP id E5949C00B4 for ; Tue, 14 Jun 2022 12:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655208159; x=1686744159; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Gepnq+G3FqhcuUO0CXCxB2ziSQE4OecO4NsW7OsOcao=; b=nR+wanYqZhv5VIsI4gLeKrheYEDhChB+cn7CnrUzsPtM+nBDVBWljVaa jy21cHiVylNDymxXIAHYMZwO9dOMHL6wpS3sRVEsQQAbqBQZkpvRImhEi SfFhPtsHzJEFtRrSwOSQo7iOXs6pEogcUeG3VnvglDho9i9uu5DkrzUTG xtJolo9v6e9kAVQyYp70SQB6FBaHZXqAR/QGt6VlTAKlH+2+SCFr5iTpI hdfyJZKcqnrpOp8QN0y4E16A1VQFnboM1CTL5S5ObAl152QK4HVbIROtC MtfC9qYo/d+LhIA5UoNDDUkFEiekJcES1nH/QC+gc6J2xdAcxTHyJRm4J Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10377"; a="267281644" X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="267281644" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2022 05:02:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="712440884" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 14 Jun 2022 05:02:28 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 825B118F; Tue, 14 Jun 2022 15:02:32 +0300 (EEST) 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 , Varad Gautam , Dario Faggioli , Dave Hansen , Mike Rapoport , David Hildenbrand , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.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 Subject: [PATCHv7 01/14] x86/boot: Centralize __pa()/__va() definitions Date: Tue, 14 Jun 2022 15:02:18 +0300 Message-Id: <20220614120231.48165-2-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> References: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655208159; a=rsa-sha256; cv=none; b=s51K9/cz+04twDxpABYjl1CC1AQw/rmHu374BYvn+ymiQfF7NN5aUjBHc0UXikwVZkfKSM OzlifXhDtUS81M8iGAOvvT8QbjXVGTX6qj9tVuT1/A3aOI1q4vu/ygSXna5HZzAfFeq20o kD+jZK6pMHl25KYos3/aWBRhUWnPaKg= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=nR+wanYq; spf=none (imf22.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.20) 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=1655208159; 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=pvd0q95uJCSzrUcSPspBy/3xWQeyzSLMNTzhkSvL6Qo=; b=x7GT/GzO7IszJk1/CguRCGVhvZ7EaCvJCfhudFc6OabnubJpEqCiR0JZLatzs53f5+u0OL 0RCHV/W2PMeZfNlMp09ZKsZcGvUAEf9CQr5F2hmaG0lqMxCZP8fNvZ0QHOYOqAY0+E6RwT aIcRmA5kgmdM9mOmR8YwUGTwN2H5e2E= X-Stat-Signature: d3n84fnbwqo88g6rweorrzmycbbomact X-Rspamd-Queue-Id: E5949C00B4 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=nR+wanYq; spf=none (imf22.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.20) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1655208158-619740 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 44c350d627c7..66a2e992c5f5 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 4910bf230d7b..245cf8f2a0bd 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 52f989f6acc2..730c4677e9db 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