lkml.org 
[lkml]   [2019]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[RFC PATCH 0/3] fix dma_mask for CCW devices
Date
Commit 37db8985b211 ("s390/cio: add basic protected virtualization
support") breaks virtio-ccw devices with VIRTIO_F_IOMMU_PLATFORM for non
Protected Virtualization (PV) guests. The problem is that the dma_mask
of the CCW device, which is used by virtio core, gets changed from 64 to
31 bit. This is done because some of the DMA allocations do require 31
bit addressable memory, but it has unfavorable side effects.

For PV the only drawback is that some of the virtio structures must end
up in ZONE_DMA (with PV we have the bounce the buffers mapped via DMA
API anyway).

But for non PV guests we have a problem: because of the 31 bit mask
guests bigger than 2G are likely to try bouncing buffers. The swiotlb
however is only initialized for PV guests (because we don't want to
bounce anything for non PV guests). The first map of a buffer with
an address beyond 0x7fffffff kills the guest.

This series sets out to fix this problem by first making the GPF_DMA
flag count for DMA API allocations -- on s390 at least. Then we set
dma_mask to 64 bit and do the allocations for the memory that needs to
be 31 bit addressable with the GPF_DMA flag.

For CCW devices we could probably just not clear any GFP flags at
all but, I decided to be conservative and change only what really needs
to be changed.

I'm not perfectly satisfied with this solution, but I believe it is good
enough, and I can't think of anything better at the moment. Ideas
welcome.

Halil Pasic (3):
dma-mapping: make overriding GFP_* flags arch customizable
s390/virtio: fix virtio-ccw DMA without PV
dma-mapping: warn on harmful GFP_* flags

arch/s390/Kconfig | 1 +
arch/s390/include/asm/cio.h | 5 +++--
arch/s390/mm/init.c | 20 ++++++++++++++++++++
drivers/s390/cio/css.c | 16 +++++++++-------
drivers/s390/cio/device.c | 5 +++--
drivers/s390/cio/device_ops.c | 3 ++-
include/linux/dma-mapping.h | 13 +++++++++++++
kernel/dma/Kconfig | 6 ++++++
kernel/dma/mapping.c | 4 +---
9 files changed, 58 insertions(+), 15 deletions(-)

--
2.17.1

\
 
 \ /
  Last update: 2019-09-23 14:36    [W:0.184 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site