All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Le Tan <tamlokveer@gmail.com>
Cc: Jan Kiszka <jan.kiszka@web.de>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] About AddressSpace in intel-iommu emulation
Date: Thu, 26 Jun 2014 16:05:06 +0200	[thread overview]
Message-ID: <53AC2892.6030509@redhat.com> (raw)
In-Reply-To: <CACrq+iLndY7PG-tRf2H2V3s2YYVd9rHi_Tsz_5sgDUocQOSM8g@mail.gmail.com>

Il 26/06/2014 16:01, Le Tan ha scritto:
> Hi Paolo,
> I am adding intel-iommu emulation to q35 for the GSoC project. I am
> confused about AddressSpace and I believe that you can help me. :)
> 1. For intel-iommu emulation, I have to read the translation
> structures from guest memory, that is, the guest will prepare some
> tables in memory and write the physical address of them to a register
> of intel-iommu, and I need to access those structures. I use
> dma_memory_read(&address_space_memory,...) to do this. Is that right?
> I am not sure that whether accesses to address_space_memory will be
> translated through IOMMU. I think the answer is not, because I see
> that cpu_physical_memory_read() also use address_space_memory as
> AddressSpace.

Correct.

> 2. In my opinion, I have to init a AddressSpace and link it with my
> IOMMU MemoryRegion, then the bus uses this AddressSpace to translate
> the accesses. Is that right? For q35, how can I register my IOMMU
> MemoryRegion to the bus? I see that there is function
> pci_setup_iommu() that links a AddressSpace to the bus to translate
> accesses to PCI into system memory. Is that related? I think q35
> should maintain a bus AddressSpace, but I can't find it.
> What do you think?

Right now, the q35 PCI host does not define an iommu_fn, so the default 
DMA address space is used by pci_device_iommu_address_space.  This is 
just address_space_memory.

The iommu_fn is set with pci_setup_iommu.  Commit ae74bbe (apb: 
implement IOMMU translation for PCI host bridge, 2014-05-28) provides an 
example of how to prepare an IOMMU memory region, add it to an address 
space, and return that address space from an iommu_fn.

Thanks,

Paolo

> Thanks very much!
>
> Regards,
> Le Tan
>

  reply	other threads:[~2014-06-26 14:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 14:01 [Qemu-devel] About AddressSpace in intel-iommu emulation Le Tan
2014-06-26 14:05 ` Paolo Bonzini [this message]
2014-06-26 14:16   ` Le Tan
2014-06-27  2:08   ` Le Tan
2014-06-27  4:55     ` Paolo Bonzini
2014-06-27  5:46       ` Le Tan
2014-06-27  9:55         ` Jan Kiszka
2014-06-27 14:15           ` Le Tan

Reply instructions:

You may reply publicly 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=53AC2892.6030509@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=qemu-devel@nongnu.org \
    --cc=tamlokveer@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.