LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
From: Ram Pai <linuxram@us.ibm.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: andmike@us.ibm.com, "Michael S. Tsirkin" <mst@redhat.com>,
	Alexey Kardashevskiy <aik@ozlabs.ru>,
	linux-kernel@vger.kernel.org, ram.n.pai@gmail.com, cai@lca.pw,
	tglx@linutronix.de, sukadev@linux.vnet.ibm.com,
	linuxppc-dev@lists.ozlabs.org, hch@lst.de,
	bauerman@linux.ibm.com, david@gibson.dropbear.id.au
Subject: RE: [RFC v1 0/2] Enable IOMMU support for pseries Secure VMs
Date: Wed, 6 Nov 2019 14:22:37 -0800
Message-ID: <20191106222237.GE5201@oc0525413822.ibm.com> (raw)
In-Reply-To: <157306632211.17570.17567742230498149897@sif>

On Wed, Nov 06, 2019 at 12:52:02PM -0600, Michael Roth wrote:
> 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@71000000
>   Populating /vdevice/nvram@71000001
>   Populating /vdevice/l-lan@71000002
>   Populating /vdevice/v-scsi@71000003
>          SCSI: Looking for devices
>             8200000000000000 CD-ROM   : "QEMU     QEMU CD-ROM      2.5+"
>   Populating /pci@800000020000000
>                        00 0000 (D) : 1af4 1042    virtio [ block ]
>   No NVRAM common partition, re-initializing...
>   Scanning USB
>   Using default console: /vdevice/vty@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
>     https://urldefense.proofpoint.com/v2/url?u=http-3A__www.opensource.org_licenses_bsd-2Dlicense.php&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=m-UrKChQVkZtnPpjbF6YY99NbT8FBByQ-E-ygV8luxw&m=-xG4gaWE7BANKGOFx0wmF5ZgZVd8A1r-tsN44n4JUW4&s=QcpPgRqeZAk1pICsA-kk2gNKKiMJLASiPVi-hPinur0&e= 
>   
>   
>   Trying to load:  from: /pci@800000020000000/scsi@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.

you are right. In my case, I was providing the kernel image
on the qemu command line. So there was no need for SLOF to read the
virtio disk. Hence it continued without hanging. SLOF needs to be enhanced
to support IOMMU.


RP


  reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04 21:28 Ram Pai
2019-11-04 21:28 ` [RFC v1 1/2] powerpc/pseries/iommu: Share the per-cpu TCE page with the hypervisor Ram Pai
2019-11-04 21:28   ` [RFC v1 2/2] powerpc/pseries/iommu: Use dma_iommu_ops for Secure VMs aswell Ram Pai
2019-11-07 10:26     ` Michael Ellerman
2019-11-08  5:49       ` Ram Pai
2019-11-06  1:58   ` [RFC v1 1/2] powerpc/pseries/iommu: Share the per-cpu TCE page with the hypervisor Alexey Kardashevskiy
2019-11-06 17:01     ` Ram Pai
2019-11-07  5:58       ` Alexey Kardashevskiy
2019-11-07 10:29   ` Michael Ellerman
2019-11-08  6:05     ` Ram Pai
2019-11-06  1:59 ` [RFC v1 0/2] Enable IOMMU support for pseries Secure VMs Alexey Kardashevskiy
2019-11-06 16:46   ` Ram Pai
2019-11-06 18:06   ` Michael S. Tsirkin
2019-11-06 18:52     ` Michael Roth
2019-11-06 22:22       ` Ram Pai [this message]
2019-11-07  6:01     ` Alexey Kardashevskiy

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=20191106222237.GE5201@oc0525413822.ibm.com \
    --to=linuxram@us.ibm.com \
    --cc=aik@ozlabs.ru \
    --cc=andmike@us.ibm.com \
    --cc=bauerman@linux.ibm.com \
    --cc=cai@lca.pw \
    --cc=david@gibson.dropbear.id.au \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mst@redhat.com \
    --cc=ram.n.pai@gmail.com \
    --cc=sukadev@linux.vnet.ibm.com \
    --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

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/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 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


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