All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: Konrad Rzeszutek Wilk <konrad@darnok.org>,
	Robin Murphy <robin.murphy@arm.com>,
	will@kernel.org,
	"open list:AMD IOMMU (AMD-VI)" <iommu@lists.linux-foundation.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iommu/amd: Enable swiotlb if any device supports iommu v2 and uses identity mapping
Date: Thu, 9 Sep 2021 14:32:55 +0800	[thread overview]
Message-ID: <CAAd53p4138BB_5-++0P9k91B1dCuKzuv1yGjiG77ewhd1MRSbQ@mail.gmail.com> (raw)
In-Reply-To: <YO67m/jaBvco+I36@8bytes.org>

On Wed, Jul 14, 2021 at 6:25 PM Joerg Roedel <joro@8bytes.org> wrote:
>
> On Tue, Jul 13, 2021 at 07:57:40PM -0400, Konrad Rzeszutek Wilk wrote:
> > The SWIOTLB does have support to do late initialization (xen-pcifront
> > does that for example - so if you add devices that can't do 64-bit it
> > will allocate something like 4MB).
>
> That sounds like a way to evaluate. I suggest to allocate the SWIOTLB
> memory at boot and when the IOMMUs are initialized we re-evaluate what
> we ended up with and free the SWIOTLB memory if its not needed.
>
> If that turns out to be wrong during runtime (e.g. because a device is
> switched to a passthrough default domain at runtime), we allocate a
> small aperture for this device like the above mentioned 4MB.

I am currently working on this but I found that 4MB is not enough,
16MB is the minimal size to make the device work.
How do I know the right SWIOTLB size for each device?

>
> (A boot option to always keep the aperture around might also be helpful
>  for some setups)

OK, will also implement this in next iteration.

Kai-Heng

>
> Regards,
>
>         Joerg

WARNING: multiple messages have this Message-ID (diff)
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: Konrad Rzeszutek Wilk <konrad@darnok.org>,
	"open list:AMD IOMMU \(AMD-VI\)"
	<iommu@lists.linux-foundation.org>,
	Robin Murphy <robin.murphy@arm.com>,
	open list <linux-kernel@vger.kernel.org>,
	will@kernel.org
Subject: Re: [PATCH] iommu/amd: Enable swiotlb if any device supports iommu v2 and uses identity mapping
Date: Thu, 9 Sep 2021 14:32:55 +0800	[thread overview]
Message-ID: <CAAd53p4138BB_5-++0P9k91B1dCuKzuv1yGjiG77ewhd1MRSbQ@mail.gmail.com> (raw)
In-Reply-To: <YO67m/jaBvco+I36@8bytes.org>

On Wed, Jul 14, 2021 at 6:25 PM Joerg Roedel <joro@8bytes.org> wrote:
>
> On Tue, Jul 13, 2021 at 07:57:40PM -0400, Konrad Rzeszutek Wilk wrote:
> > The SWIOTLB does have support to do late initialization (xen-pcifront
> > does that for example - so if you add devices that can't do 64-bit it
> > will allocate something like 4MB).
>
> That sounds like a way to evaluate. I suggest to allocate the SWIOTLB
> memory at boot and when the IOMMUs are initialized we re-evaluate what
> we ended up with and free the SWIOTLB memory if its not needed.
>
> If that turns out to be wrong during runtime (e.g. because a device is
> switched to a passthrough default domain at runtime), we allocate a
> small aperture for this device like the above mentioned 4MB.

I am currently working on this but I found that 4MB is not enough,
16MB is the minimal size to make the device work.
How do I know the right SWIOTLB size for each device?

>
> (A boot option to always keep the aperture around might also be helpful
>  for some setups)

OK, will also implement this in next iteration.

Kai-Heng

>
> Regards,
>
>         Joerg
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-09-09  6:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08  7:42 [PATCH] iommu/amd: Enable swiotlb if any device supports iommu v2 and uses identity mapping Kai-Heng Feng
2021-07-08  7:42 ` Kai-Heng Feng
2021-07-08  9:28 ` Joerg Roedel
2021-07-08  9:28   ` Joerg Roedel
2021-07-08 10:18   ` Robin Murphy
2021-07-08 10:18     ` Robin Murphy
2021-07-08 13:57     ` Kai-Heng Feng
2021-07-08 13:57       ` Kai-Heng Feng
2021-07-08 14:43       ` Robin Murphy
2021-07-08 14:43         ` Robin Murphy
2021-07-13 23:57         ` Konrad Rzeszutek Wilk
2021-07-13 23:57           ` Konrad Rzeszutek Wilk
2021-07-14  4:59           ` Kai-Heng Feng
2021-07-14  4:59             ` Kai-Heng Feng
2021-07-14 10:25           ` Joerg Roedel
2021-07-14 10:25             ` Joerg Roedel
2021-09-09  6:32             ` Kai-Heng Feng [this message]
2021-09-09  6:32               ` Kai-Heng Feng

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=CAAd53p4138BB_5-++0P9k91B1dCuKzuv1yGjiG77ewhd1MRSbQ@mail.gmail.com \
    --to=kai.heng.feng@canonical.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=konrad@darnok.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /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.