KVM Archive on lore.kernel.org
 help / color / Atom feed
From: Halil Pasic <pasic@linux.ibm.com>
To: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Thiago Jung Bauermann <bauerman@linux.ibm.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
	"Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>
Subject: [PATCH 1/1] s390/protvirt: restore force_dma_unencrypted()
Date: Mon, 15 Jul 2019 15:17:19 +0200
Message-ID: <20190715131719.100650-1-pasic@linux.ibm.com> (raw)

Since commit e67a5ed1f86f ("dma-direct: Force unencrypted DMA under SME
for certain DMA masks"), force_dma_unencrypted() is broken on s390
(under protvirt). Before used to return sev_active(), after it became
practically architecture specific, with the default implementation
always returning false.

Let's restore the old behavior of force_dma_unencrypted().

Note: we still need sev_active() defined because of the reference
in fs/core/vmcore, but this one is likely to go away soon along
with the need for an s390 sev_active().

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Fixes: e67a5ed1f86f ("dma-direct: Force unencrypted DMA under SME for
certain DMA masks")

--

Thiago has a path that gets rid of the fs/core/vmcore reference. Link:
https://patchwork.ozlabs.org/patch/1131571/

Prior discussion:
https://www.spinics.net/lists/kernel/msg3189113.html
---
 arch/s390/Kconfig                   | 1 +
 arch/s390/include/asm/mem_encrypt.h | 2 +-
 arch/s390/mm/init.c                 | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 5d8570ed6cab..a4ad2733eedf 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -189,6 +189,7 @@ config S390
 	select VIRT_CPU_ACCOUNTING
 	select ARCH_HAS_SCALED_CPUTIME
 	select HAVE_NMI
+	select ARCH_HAS_FORCE_DMA_UNENCRYPTED
 	select SWIOTLB
 	select GENERIC_ALLOCATOR
 
diff --git a/arch/s390/include/asm/mem_encrypt.h b/arch/s390/include/asm/mem_encrypt.h
index 3eb018508190..f8453f8cc191 100644
--- a/arch/s390/include/asm/mem_encrypt.h
+++ b/arch/s390/include/asm/mem_encrypt.h
@@ -7,7 +7,7 @@
 #define sme_me_mask	0ULL
 
 static inline bool sme_active(void) { return false; }
-extern bool sev_active(void);
+static inline bool sev_active(void) { return false; }
 
 int set_memory_encrypted(unsigned long addr, int numpages);
 int set_memory_decrypted(unsigned long addr, int numpages);
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index f0bee6af3960..023ab4221687 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -156,7 +156,7 @@ int set_memory_decrypted(unsigned long addr, int numpages)
 }
 
 /* are we a protected virtualization guest? */
-bool sev_active(void)
+bool force_dma_unencrypted(struct device *dev)
 {
 	return is_prot_virt_guest();
 }
-- 
2.17.1


             reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 13:17 Halil Pasic [this message]
2019-07-15 13:20 ` Christoph Hellwig
2019-07-15 13:28   ` Lendacky, Thomas
2019-07-15 13:29     ` Christoph Hellwig
2019-07-15 14:20     ` Christoph Hellwig
2019-07-15 14:25       ` Halil Pasic
2019-07-15 15:25       ` Lendacky, Thomas
2019-07-15 14:21   ` Halil Pasic

Reply instructions:

You may reply publically 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=20190715131719.100650-1-pasic@linux.ibm.com \
    --to=pasic@linux.ibm.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=bauerman@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hch@infradead.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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

KVM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvm/0 kvm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvm kvm/ https://lore.kernel.org/kvm \
		kvm@vger.kernel.org kvm@archiver.kernel.org
	public-inbox-index kvm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.kvm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox