mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Tom Lendacky" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Tom Lendacky <thomas.lendacky@amd.com>,
	Borislav Petkov <bp@suse.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/cc] x86/ioremap: Selectively build arch override encryption functions
Date: Mon, 04 Oct 2021 11:41:30 -0000	[thread overview]
Message-ID: <163334769058.25758.12669979789529692829.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210928191009.32551-2-bp@alien8.de>

The following commit has been merged into the x86/cc branch of tip:

Commit-ID:     402fe0cb71032c4bc931ac70a6b024408e09f817
Gitweb:        https://git.kernel.org/tip/402fe0cb71032c4bc931ac70a6b024408e09f817
Author:        Tom Lendacky <thomas.lendacky@amd.com>
AuthorDate:    Wed, 08 Sep 2021 17:58:32 -05:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 04 Oct 2021 11:45:49 +02:00

x86/ioremap: Selectively build arch override encryption functions

In preparation for other uses of the cc_platform_has() function
besides AMD's memory encryption support, selectively build the
AMD memory encryption architecture override functions only when
CONFIG_AMD_MEM_ENCRYPT=y. These functions are:

- early_memremap_pgprot_adjust()
- arch_memremap_can_ram_remap()

Additionally, routines that are only invoked by these architecture
override functions can also be conditionally built. These functions are:

- memremap_should_map_decrypted()
- memremap_is_efi_data()
- memremap_is_setup_data()
- early_memremap_is_setup_data()

And finally, phys_mem_access_encrypted() is conditionally built as well,
but requires a static inline version of it when CONFIG_AMD_MEM_ENCRYPT is
not set.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210928191009.32551-2-bp@alien8.de
---
 arch/x86/include/asm/io.h | 8 ++++++++
 arch/x86/mm/ioremap.c     | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 841a5d1..5c6a4af 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -391,6 +391,7 @@ extern void arch_io_free_memtype_wc(resource_size_t start, resource_size_t size)
 #define arch_io_reserve_memtype_wc arch_io_reserve_memtype_wc
 #endif
 
+#ifdef CONFIG_AMD_MEM_ENCRYPT
 extern bool arch_memremap_can_ram_remap(resource_size_t offset,
 					unsigned long size,
 					unsigned long flags);
@@ -398,6 +399,13 @@ extern bool arch_memremap_can_ram_remap(resource_size_t offset,
 
 extern bool phys_mem_access_encrypted(unsigned long phys_addr,
 				      unsigned long size);
+#else
+static inline bool phys_mem_access_encrypted(unsigned long phys_addr,
+					     unsigned long size)
+{
+	return true;
+}
+#endif
 
 /**
  * iosubmit_cmds512 - copy data to single MMIO location, in 512-bit units
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 60ade7d..ccff76c 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -508,6 +508,7 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
 	memunmap((void *)((unsigned long)addr & PAGE_MASK));
 }
 
+#ifdef CONFIG_AMD_MEM_ENCRYPT
 /*
  * Examine the physical address to determine if it is an area of memory
  * that should be mapped decrypted.  If the memory is not part of the
@@ -746,7 +747,6 @@ bool phys_mem_access_encrypted(unsigned long phys_addr, unsigned long size)
 	return arch_memremap_can_ram_remap(phys_addr, size, 0);
 }
 
-#ifdef CONFIG_AMD_MEM_ENCRYPT
 /* Remap memory with encryption */
 void __init *early_memremap_encrypted(resource_size_t phys_addr,
 				      unsigned long size)

  reply	other threads:[~2021-10-04 11:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 19:10 [PATCH v4 0/8] Implement generic cc_platform_has() helper function Borislav Petkov
2021-09-28 19:10 ` [PATCH 1/8] x86/ioremap: Selectively build arch override encryption functions Borislav Petkov
2021-10-04 11:41   ` tip-bot2 for Tom Lendacky [this message]
2021-09-28 19:10 ` [PATCH 2/8] arch/cc: Introduce a function to check for confidential computing features Borislav Petkov
2021-10-04 11:41   ` [tip: x86/cc] " tip-bot2 for Tom Lendacky
2021-09-28 19:10 ` [PATCH 3/8] x86/sev: Add an x86 version of cc_platform_has() Borislav Petkov
2021-10-04 11:41   ` [tip: x86/cc] " tip-bot2 for Tom Lendacky
2021-09-28 19:10 ` [PATCH 4/8] powerpc/pseries/svm: Add a powerpc " Borislav Petkov
2021-10-04 11:41   ` [tip: x86/cc] " tip-bot2 for Tom Lendacky
2021-09-28 19:10 ` [PATCH 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has() Borislav Petkov
2021-10-04 11:41   ` [tip: x86/cc] " tip-bot2 for Tom Lendacky
2021-09-28 19:10 ` [PATCH 6/8] x86/sev: Replace occurrences of sev_active() " Borislav Petkov
2021-10-04 11:41   ` [tip: x86/cc] " tip-bot2 for Tom Lendacky
2021-09-28 19:10 ` [PATCH 7/8] x86/sev: Replace occurrences of sev_es_active() " Borislav Petkov
2021-10-04 11:41   ` [tip: x86/cc] " tip-bot2 for Tom Lendacky
2021-09-28 19:10 ` [PATCH 8/8] treewide: Replace the use of mem_encrypt_active() " Borislav Petkov
2021-10-04 11:41   ` [tip: x86/cc] " tip-bot2 for Tom Lendacky
2021-09-28 19:19 ` [PATCH v4 0/8] Implement generic cc_platform_has() helper function Kuppuswamy, Sathyanarayanan
2021-09-28 20:31   ` Borislav Petkov
2021-09-28 20:48     ` Kuppuswamy, Sathyanarayanan
2021-09-28 20:58       ` Borislav Petkov
2021-09-28 21:01         ` Kuppuswamy, Sathyanarayanan
2021-09-28 21:40           ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=163334769058.25758.12669979789529692829.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®