Skip to content

Commit 4ce1cf7

Browse files
Pierre Morelmstsirkin
authored andcommitted
s390: virtio: PV needs VIRTIO I/O device protection
If protected virtualization is active on s390, VIRTIO has only retricted access to the guest memory. Define CONFIG_ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS and export arch_has_restricted_virtio_memory_access to advertize VIRTIO if that's the case. Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Halil Pasic <pasic@linux.ibm.com> Link: https://lore.kernel.org/r/1599728030-17085-3-git-send-email-pmorel@linux.ibm.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
1 parent 0afa15e commit 4ce1cf7

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

arch/s390/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,7 @@ menu "Virtualization"
820820
config PROTECTED_VIRTUALIZATION_GUEST
821821
def_bool n
822822
prompt "Protected virtualization guest support"
823+
select ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS
823824
help
824825
Select this option, if you want to be able to run this
825826
kernel as a protected virtualization KVM guest.

arch/s390/mm/init.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <asm/kasan.h>
4646
#include <asm/dma-mapping.h>
4747
#include <asm/uv.h>
48+
#include <linux/virtio_config.h>
4849

4950
pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(.bss..swapper_pg_dir);
5051

@@ -160,6 +161,16 @@ bool force_dma_unencrypted(struct device *dev)
160161
return is_prot_virt_guest();
161162
}
162163

164+
#ifdef CONFIG_ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS
165+
166+
int arch_has_restricted_virtio_memory_access(void)
167+
{
168+
return is_prot_virt_guest();
169+
}
170+
EXPORT_SYMBOL(arch_has_restricted_virtio_memory_access);
171+
172+
#endif
173+
163174
/* protected virtualization */
164175
static void pv_init(void)
165176
{

0 commit comments

Comments
 (0)