This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] swiotlb and Xen query?

To: "Petersson, Mats" <Mats.Petersson@xxxxxxx>
Subject: Re: [Xen-devel] swiotlb and Xen query?
From: "pradeep singh rautela" <rautelap@xxxxxxxxx>
Date: Wed, 2 May 2007 18:47:53 +0530
Cc: xenkernelnewbies@xxxxxxxxxxxxxxxx, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 02 May 2007 06:16:23 -0700
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=UAORy6DnZ5uPLwl/0GI6SbOqHmI7GnfHmgikT++obzPNQnQJhkpQvYBw+/WRYNXBUMYxlHKyL7Zy7tRu6Sr7Qz82bx4V5qla+VOOU27wLwZJ8Nq5PWSGrVRz88Ly06U0Rq8x5yROKFe1tYJJtc1aG7PSnfyn38dsNCmDlAB8rSY=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=mp+PXds0kAC8t/rZSx/HE8A6PPaCFrAal8NzUSDu55LxiVRvQ2SXVi4H0YCreEi4JM4EoVlcFOk9glyXVJTYquVdRlDeap1TNXeVVr4aCLn9RsjoOFgONwetuobXZ6rFLKRk7eqU/wxONLBGPQZ/38l/qz5OcCQyTCcm8FDmfwM=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <907625E08839C4409CE5768403633E0B018E1C9F@xxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <6bc632150705020549l63456f8dkcf40750cb6fdc9d6@xxxxxxxxxxxxxx> <907625E08839C4409CE5768403633E0B018E1C9F@xxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Mats,
sorry again for complete newbie questions.
Please find my further queries inline.
On 5/2/07, Petersson, Mats < Mats.Petersson@xxxxxxx> wrote:

> dom0 and domU uses swiotlb mechanism to emulate hardware
> IOMMU, right?
> And that so because the whole memory is visible to hypervisor
> only and not to other domains, am i right?

Not so. It uses swiotlb to allow 32-bit devices to access memory above

Ok, perhaps i messed up the question.sorry for that.
What i mean is, since a device has no idea of the mappings between domU memory and the machine memory, does this means the swiotlb is used to make sure that memory to which a device has DMAed can be actually mapped to the correct domain?
Because device can DMA on to any 32 bit memory as you have correctly stated, Mats and that is till 4GB of machine memory. This memory to which the 32bit device can DMA need to be given to the correct domU isn't it?Who makes sure this? swiotlb or hypervisor only using grant tables? If not how is zero copying ensured, if it is at all in this case?

> My doubt is once the translation table between virtual and
> physical addresses is set by the swiotlb.How does device
> becomes aware of this table which is emulated in hardware as
> a matter of fact using swiotlb.the device does not knows
> about this table when accessing physical memory, isnt it?

It works because swiotlb isn't at all a translation. Instead, it copies
the buffer of the requesting driver to a specifically allocated memory
region below 4GB.

So does this means it copies the buffer from dom0 on to domU using swiotlb whenever there is a DMA transfer? Isn't that an overhead? copying ?

This new (low) memory location is what's being given
to the hardware device, so it never knew anything about the buffer
originally having been elsewhere.

> Another question is -
> dom0 and domU they both have their swiotlb mappings.This
> means Xen also keeps record of a mapping between these two
> tables in dom0 and domU? Am i right? Doesnt this means
> wasting a lot of memory in allocating bounce buffers for
> swiotlb during booting of dom0 and then during booting of domUs?

There are no mappings of memory within swiotlb.

And by the way, both Dom0 and DomU (in the para-virtual case) knows
exactly where the actual physical address is in the machine - the
hypervisor checks when the guest writes to its page-tables that the
memory is within that guest.

Thanks a lot Mats but i  mean when the device writes to the memory.

Thank you once again.


> Please bear as i am just starting with the Xen code .
> Any pointers or links will be really helpful.
> Thank you
> ~psr
> --
> ---
> pradeep singh rautela
> "Genius is 1% inspiration, and 99% perspiration" - not me :)

pradeep singh rautela

"Genius is 1% inspiration, and 99% perspiration" - not me :)
Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>