From: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
To: Adam Morrison <mad-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org>
Cc: Benjamin Serebrin
<serebrin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Dan Tsafrir
<dan-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org>,
David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
Omer Peleg
<omer-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org>
Subject: Re: [PATCH 6/7] iommu: change intel-iommu to use IOVA frame numbers
Date: Tue, 12 Apr 2016 17:10:24 +0100 [thread overview]
Message-ID: <570D1DF0.6050309@arm.com> (raw)
In-Reply-To: <CAHMfzJkqrtPT3QvG-myZchp8jUZ3E5X_CDa3yaYPpAQ+BR4LNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On 12/04/16 16:12, Adam Morrison wrote:
> On Tue, Apr 12, 2016 at 1:55 PM, Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org> wrote:
>
>>> Make intel-iommu map/unmap/invalidate work with IOVA pfns instead of
>>> pointers to "struct iova". This avoids using the iova struct from the IOVA
>>> red-black tree and the resulting explicit find_iova() on unmap.
>
> [...]
>
>>> diff --git a/include/linux/iova.h b/include/linux/iova.h
>>> index 92f7177..efecee0 100644
>>> --- a/include/linux/iova.h
>>> +++ b/include/linux/iova.h
>>> @@ -75,7 +75,7 @@ struct iova *alloc_iova_mem(void);
>>> void free_iova_mem(struct iova *iova);
>>> void free_iova(struct iova_domain *iovad, unsigned long pfn);
>>> void __free_iova(struct iova_domain *iovad, struct iova *iova);
>>> -struct iova *alloc_iova(struct iova_domain *iovad, unsigned long size,
>>> +unsigned long alloc_iova(struct iova_domain *iovad, unsigned long size,
>>> unsigned long limit_pfn,
>>> bool size_aligned);
>>> struct iova *reserve_iova(struct iova_domain *iovad, unsigned long
>>> pfn_lo,
>>
>>
>> Making the internals more efficient is no bad thing, but changing the
>> external interface to the IOVA library like this breaks at least
>> dma-iommu.c, thus stops arm64 from building.
>
> Good point. I will add new versions of alloc_iova() and free_iova()
> for this functionality and make intel-iommu uses them, so as to not
> break other users.
I wonder if it might be worth going for the intermediate compromise of
splitting up the structure thus:
struct iova {
unsigned long pfn_hi;
unsigned long pfn_lo;
};
/* internal to iova.c */
struct iova_private {
struct rb_node node;
struct iova iova;
};
then externally passing the pfn-only struct iovas by value everywhere we
currently pass a struct iova *. AFAICS, that ought to require minimal
changes in the users, and they shouldn't need to know or care whether
any given iova is backed by the tree or the rcache, because they're
simple to fake up:
unsigned long iova_pfn =
iova_rcache_get(&iovad->rcaches[log_size]);
if (iova_pfn)
return { iova_pfn + log_size, iova_pfn };
What do you reckon?
Robin.
next prev parent reply other threads:[~2016-04-12 16:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-28 16:17 [PATCH 6/7] iommu: change intel-iommu to use IOVA frame numbers Adam Morrison
[not found] ` <20151228161724.GA27916-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org>
2016-04-11 20:16 ` Benjamin Serebrin via iommu
2016-04-12 10:55 ` Robin Murphy
[not found] ` <570CD405.7010403-5wv7dgnIgG8@public.gmane.org>
2016-04-12 15:12 ` Adam Morrison
[not found] ` <CAHMfzJkqrtPT3QvG-myZchp8jUZ3E5X_CDa3yaYPpAQ+BR4LNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-12 16:10 ` Robin Murphy [this message]
[not found] ` <570D1DF0.6050309-5wv7dgnIgG8@public.gmane.org>
2016-04-12 20:13 ` Adam Morrison
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=570D1DF0.6050309@arm.com \
--to=robin.murphy-5wv7dgnigg8@public.gmane.org \
--cc=dan-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org \
--cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=mad-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org \
--cc=omer-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org \
--cc=serebrin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.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.