public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, Robin Murphy <robin.murphy@arm.com>
Cc: baolu.lu@linux.intel.com,
	Jean-Philippe Brucker <jean-philippe@linaro.org>,
	Niklas Schnelle <schnelle@linux.ibm.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	virtualization@lists.linux-foundation.org, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map
Date: Mon, 25 Sep 2023 10:48:21 +0800	[thread overview]
Message-ID: <42860c87-cf4d-0413-c3ae-b74ee9e7e5e6@linux.intel.com> (raw)
In-Reply-To: <20230922233309.GI13795@ziepe.ca>

On 9/23/23 7:33 AM, Jason Gunthorpe wrote:
> On Fri, Sep 22, 2023 at 07:07:40PM +0100, Robin Murphy wrote:
> 
>> virtio isn't setting ops->pgsize_bitmap for the sake of direct mappings
>> either; it sets it once it's discovered any instance, since apparently it's
>> assuming that all instances must support identical page sizes, and thus once
>> it's seen one it can work "normally" per the core code's assumptions. It's
>> also I think the only driver which has a "finalise" bodge but*can*  still
>> properly support map-before-attach, by virtue of having to replay mappings
>> to every new endpoint anyway.
> Well it can't quite do that since it doesn't know the geometry - it
> all is sort of guessing and hoping it doesn't explode on replay. If it
> knows the geometry it wouldn't need finalize...

The ultimate solution to this problem seems to be to add device pointer
to the parameter of ops->domain_alloc. So once the domain is allocated,
it is fully initialized. Attaching this domain to a device that is not
compatible will return -EINVAL, then the caller has to allocate a new
domain for this device.

I feel that this is not an AMD specific problem, other iommu drivers
will also encounter the similar problem sooner or later.

Best regards,
baolu

  reply	other threads:[~2023-09-25  2:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 11:51 [PATCH v2 0/2] iommu/virtio: Enable IOMMU_CAP_DERRED_FLUSH Niklas Schnelle
2023-09-18 11:51 ` [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map Niklas Schnelle
2023-09-18 15:58   ` Jean-Philippe Brucker
2023-09-18 16:37   ` Robin Murphy
2023-09-19  8:00     ` Niklas Schnelle
2023-09-19  8:15     ` Jean-Philippe Brucker
2023-09-19  8:28       ` Robin Murphy
2023-09-22  7:52         ` Jean-Philippe Brucker
2023-09-19 14:46       ` Jason Gunthorpe
2023-09-22  7:57         ` Jean-Philippe Brucker
2023-09-22 12:41           ` Jason Gunthorpe
2023-09-22 13:13             ` Robin Murphy
2023-09-22 16:27               ` Jason Gunthorpe
2023-09-22 18:07                 ` Robin Murphy
2023-09-22 23:33                   ` Jason Gunthorpe
2023-09-25  2:48                     ` Baolu Lu [this message]
2023-09-25 12:40                       ` Jason Gunthorpe
2023-09-25 13:07                     ` Robin Murphy
2023-09-25 13:29                       ` Jason Gunthorpe
2023-09-25 17:23                         ` Robin Murphy
2023-09-18 11:51 ` [PATCH v2 2/2] iommu/virtio: Add ops->flush_iotlb_all and enable deferred flush Niklas Schnelle
2023-09-18 15:59   ` Jean-Philippe Brucker

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=42860c87-cf4d-0413-c3ae-b74ee9e7e5e6@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jean-philippe@linaro.org \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=schnelle@linux.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox