[RFC v1 0/2] Enable IOMMU support for pseries Secure VMs

Michael Roth mdroth at linux.vnet.ibm.com
Thu Nov 7 05:52:02 AEDT 2019


Quoting Michael S. Tsirkin (2019-11-06 12:06:37)
> On Wed, Nov 06, 2019 at 12:59:50PM +1100, Alexey Kardashevskiy wrote:
> > 
> > 
> > On 05/11/2019 08:28, Ram Pai wrote:
> > > This patch series enables IOMMU support for pseries Secure VMs.
> > > 
> > > 
> > > Tested using QEMU command line option:
> > > 
> > >  "-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4,
> > >     iommu_platform=on,disable-modern=off,disable-legacy=on"
> > >  and 
> > > 
> > >  "-device virtio-blk-pci,scsi=off,bus=pci.0,
> > >     addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,
> > >     iommu_platform=on,disable-modern=off,disable-legacy=on"
> > 
> > 
> > Worth mentioning that SLOF won't boot with such devices as SLOF does not know about iommu_platform=on.
> 
> Shouldn't be hard to support: set up the iommu to allow everything
> and ack the feature. Right?

It's not a static/linear mapping in this case so we need calls to map DMA
buffers as-needed. I've gotten it to boot with virtio-blk, but the patches
have some hacks and need cleanup, hoping to post them soon.

I'm a bit perplexed how we would manage to boot a guest without those
changes though, this is what I get with qemu 4.1.0:

  qemu-system-ppc64 -M pseries,ic-mode=xics -m 512M -bios /home/mdroth/w/build/qemu-4.1.0-build/pc-bios/slof.bin -device virtio-blk-pci,drive=drive0,id=blk0,disable-modern=off,disable-legacy=on,iommu_platform=on -drive file=/home/mdroth/vm/bionic-server-cloudimg-ppc64el.img,if=none,id=drive0 -trace enable=spapr_iommu\*,file=trace.out -monitor unix:/tmp/mon.sock,server,nowait -vga none -nographic
  qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-cfpc=workaround
  qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-sbbc=workaround
  qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-ibs=workaround
  
  
  SLOF **********************************************************************
  QEMU Starting
   Build Date = Jul  3 2019 12:26:14
   FW Version = git-ba1ab360eebe6338
   Press "s" to enter Open Firmware.
  
  Populating /vdevice methods
  Populating /vdevice/vty at 71000000
  Populating /vdevice/nvram at 71000001
  Populating /vdevice/l-lan at 71000002
  Populating /vdevice/v-scsi at 71000003
         SCSI: Looking for devices
            8200000000000000 CD-ROM   : "QEMU     QEMU CD-ROM      2.5+"
  Populating /pci at 800000020000000
                       00 0000 (D) : 1af4 1042    virtio [ block ]
  No NVRAM common partition, re-initializing...
  Scanning USB
  Using default console: /vdevice/vty at 71000000
  
    Welcome to Open Firmware
  
    Copyright (c) 2004, 2017 IBM Corporation All rights reserved.
    This program and the accompanying materials are made available
    under the terms of the BSD License available at
    http://www.opensource.org/licenses/bsd-license.php
  
  
  Trying to load:  from: /pci at 800000020000000/scsi at 0 ... virtioblk_init: failed
  virtioblk_transfer: Access beyond end of device!

And then it hangs. This is with TCG so maybe it behaves differently with
KVM, but that's the result I would expect with the current SLOF code.

> 
> > > 
> > > Ram Pai (2):
> > >   powerpc/pseries/iommu: Share the per-cpu TCE page with the hypervisor.
> > >   powerpc/pseries/iommu: Use dma_iommu_ops for Secure VMs aswell.
> > > 
> > >  arch/powerpc/platforms/pseries/iommu.c | 30 ++++++++++++++++++------------
> > >  1 file changed, 18 insertions(+), 12 deletions(-)
> > > 
> > 
> > -- 
> > Alexey
> 


More information about the Linuxppc-dev mailing list