From: John Garry <john.garry@huawei.com>
To: Ethan Zhao <haifeng.zhao@linux.intel.com>,
Robin Murphy <robin.murphy@arm.com>, <joro@8bytes.org>,
<will@kernel.org>
Cc: <iommu@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<linuxarm@huawei.com>
Subject: Re: [PATCH v2 1/2] iova: Remove some magazine pointer NULL checks
Date: Wed, 7 Sep 2022 11:10:50 +0100 [thread overview]
Message-ID: <ba82816c-3d43-4256-17d7-bd3d358e942b@huawei.com> (raw)
In-Reply-To: <a9f959ed-b528-681d-f941-d615360c0be3@linux.intel.com>
On 07/09/2022 10:58, Ethan Zhao wrote:
Hi Ethan,
>> Or also add this:
>>
>> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
>> index 0d6d8edf782d..e8f0b8f47f45 100644
>> --- a/drivers/iommu/dma-iommu.c
>> +++ b/drivers/iommu/dma-iommu.c
>> @@ -578,6 +578,12 @@ static int iommu_dma_init_domain(struct
>> iommu_domain *domain, dma_addr_t base,
>> goto done_unlock;
>> }
>>
>> + if (!iovad->rcaches) {
>> + pr_warn("IOVA domain rcache not properly initialised\n");
>> + ret = -EFAULT;
>> + goto done_unlock;
>> + }
>> +
>> ret = 0;
>> goto done_unlock;
>>
> If the iovad->rcaches allocation failed, will skip iommu domain dma ops,
> so no need *any* iovad,->rcaches check, right ?
>
> and there is already warning about the fallback.
It's not as simple as that. We use the iovad->start_pfn member as a flag
for the IOVA domain being initialized. However that does not mean always
properly initialized. As above, the rcache init may fail, but in this
case we still set start_pfn.
This comes into play when we have multiple devices in the same IOMMU
group, for example, as I mentioned yesterday.
Thanks,
John
next prev parent reply other threads:[~2022-09-07 10:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 9:11 [PATCH v2 0/2] iova: Some misc changes John Garry
2022-09-05 9:11 ` [PATCH v2 1/2] iova: Remove some magazine pointer NULL checks John Garry
2022-09-05 15:06 ` Jerry Snitselaar
2022-09-06 9:28 ` Ethan Zhao
2022-09-06 10:50 ` John Garry
2022-09-06 13:37 ` Robin Murphy
2022-09-06 17:36 ` John Garry
2022-09-06 18:25 ` Robin Murphy
2022-09-07 8:46 ` John Garry
2022-09-07 9:05 ` Robin Murphy
2022-09-07 9:58 ` Ethan Zhao
2022-09-07 10:10 ` John Garry [this message]
2022-09-07 9:33 ` Ethan Zhao
2022-09-07 9:53 ` John Garry
2022-09-05 9:11 ` [PATCH v2 2/2] iova: Remove magazine BUG_ON() checks John Garry
2022-09-05 15:06 ` Jerry Snitselaar
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=ba82816c-3d43-4256-17d7-bd3d358e942b@huawei.com \
--to=john.garry@huawei.com \
--cc=haifeng.zhao@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®