<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/iommu, branch v4.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.4</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-01-07T12:36:41Z</updated>
<entry>
<title>iommu/dma: Use correct offset in map_sg</title>
<updated>2016-01-07T12:36:41Z</updated>
<author>
<name>Robin Murphy</name>
<email>robin.murphy@arm.com</email>
</author>
<published>2016-01-04T16:19:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=164afb1d85b872907cfac048b46c094db596d529'/>
<id>urn:sha1:164afb1d85b872907cfac048b46c094db596d529</id>
<content type='text'>
When mapping a non-page-aligned scatterlist entry, we copy the original
offset to the output DMA address before aligning it to hand off to
iommu_map_sg(), then later adding the IOVA page address portion to get
the final mapped address. However, when the IOVA page size is smaller
than the CPU page size, it is the offset within the IOVA page we want,
not that within the CPU page, which can easily be larger than an IOVA
page and thus result in an incorrect final address.

Fix the bug by taking only the IOVA-aligned part of the offset as the
basis of the DMA address, not the whole thing.

Signed-off-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
</content>
</entry>
<entry>
<title>iommu/ipmmu-vmsa: Don't truncate ttbr if LPAE is not enabled</title>
<updated>2015-12-28T16:10:52Z</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert+renesas@glider.be</email>
</author>
<published>2015-12-22T19:01:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f64232eee61906f22942224af2a9fd40e26e592e'/>
<id>urn:sha1:f64232eee61906f22942224af2a9fd40e26e592e</id>
<content type='text'>
If CONFIG_PHYS_ADDR_T_64BIT=n:

    drivers/iommu/ipmmu-vmsa.c: In function 'ipmmu_domain_init_context':
    drivers/iommu/ipmmu-vmsa.c:434:2: warning: right shift count &gt;= width of type
      ipmmu_ctx_write(domain, IMTTUBR0, ttbr &gt;&gt; 32);
      ^

As io_pgtable_cfg.arm_lpae_s1_cfg.ttbr[] is an array of u64s, assigning
it to a phys_addr_t may truncates it.  Make ttbr u64 to fix this.

Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
</content>
</entry>
<entry>
<title>iommu/dma: Avoid unlikely high-order allocations</title>
<updated>2015-12-28T16:06:26Z</updated>
<author>
<name>Robin Murphy</name>
<email>robin.murphy@arm.com</email>
</author>
<published>2015-12-18T17:01:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0a9afeda8057bcedc997278db193914d32c4003b'/>
<id>urn:sha1:0a9afeda8057bcedc997278db193914d32c4003b</id>
<content type='text'>
Doug reports that the equivalent page allocator on 32-bit ARM exhibits
particularly pathalogical behaviour under memory pressure when
fragmentation is high, where allocating a 4MB buffer takes tens of
seconds and the number of calls to alloc_pages() is over 9000![1]

We can drastically improve that situation without losing the other
benefits of high-order allocations when they would succeed, by assuming
memory pressure is relatively constant over the course of an allocation,
and not retrying allocations at orders we know to have failed before.
This way, the best-case behaviour remains unchanged, and in the worst
case we should see at most a dozen or so (MAX_ORDER - 1) failed attempts
before falling back to single pages for the remainder of the buffer.

[1]:http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/394660.html

Reported-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Signed-off-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
</content>
</entry>
<entry>
<title>iommu/dma: Add some missing #includes</title>
<updated>2015-12-28T16:03:34Z</updated>
<author>
<name>Robin Murphy</name>
<email>robin.murphy@arm.com</email>
</author>
<published>2015-12-18T17:01:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5b11e9cd42d08e76b86eacf103b1fa7794e21bff'/>
<id>urn:sha1:5b11e9cd42d08e76b86eacf103b1fa7794e21bff</id>
<content type='text'>
dma-iommu.c was naughtily relying on an implicit transitive #include of
linux/vmalloc.h, which is apparently not present on some architectures.
Add that, plus a couple more headers for other functions which are used
similarly.

Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Signed-off-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
</content>
</entry>
<entry>
<title>Merge tag 'iommu-fixes-v4.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu</title>
<updated>2015-12-18T20:38:35Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2015-12-18T20:38:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ccdd96be43a2e27fc69152df8fcfd30f2902b255'/>
<id>urn:sha1:ccdd96be43a2e27fc69152df8fcfd30f2902b255</id>
<content type='text'>
Pull IOMMU fixes from Joerg Roedel:
 "Two similar fixes for the Intel and AMD IOMMU drivers to add proper
  access checks before calling handle_mm_fault"

* tag 'iommu-fixes-v4.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu/vt-d: Do access checks before calling handle_mm_fault()
  iommu/amd: Do proper access checking before calling handle_mm_fault()
</content>
</entry>
<entry>
<title>Revert "scatterlist: use sg_phys()"</title>
<updated>2015-12-15T20:54:06Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2015-12-15T20:54:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3e6110fd5480f5f86ff31381f4dea14218284bff'/>
<id>urn:sha1:3e6110fd5480f5f86ff31381f4dea14218284bff</id>
<content type='text'>
commit db0fa0cb0157 "scatterlist: use sg_phys()" did replacements of
the form:

    phys_addr_t phys = page_to_phys(sg_page(s));
    phys_addr_t phys = sg_phys(s) &amp; PAGE_MASK;

However, this breaks platforms where sizeof(phys_addr_t) &gt;
sizeof(unsigned long).  Revert for 4.3 and 4.4 to make room for a
combined helper in 4.5.

Cc: &lt;stable@vger.kernel.org&gt;
Cc: Jens Axboe &lt;axboe@fb.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Russell King &lt;linux@arm.linux.org.uk&gt;
Cc: David Woodhouse &lt;dwmw2@infradead.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Fixes: db0fa0cb0157 ("scatterlist: use sg_phys()")
Suggested-by: Joerg Roedel &lt;joro@8bytes.org&gt;
Reported-by: Vitaly Lavrov &lt;vel21ripn@gmail.com&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
</content>
</entry>
<entry>
<title>iommu/vt-d: Do access checks before calling handle_mm_fault()</title>
<updated>2015-12-14T14:37:55Z</updated>
<author>
<name>Joerg Roedel</name>
<email>jroedel@suse.de</email>
</author>
<published>2015-11-17T15:11:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7f8312a3b31de5676144d9e75f2f2647c8b4b769'/>
<id>urn:sha1:7f8312a3b31de5676144d9e75f2f2647c8b4b769</id>
<content type='text'>
Not doing so is a bug and might trigger a BUG_ON in
handle_mm_fault(). So add the proper permission checks
before calling into mm code.

Reviewed-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
Acked-By: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
</content>
</entry>
<entry>
<title>iommu/amd: Do proper access checking before calling handle_mm_fault()</title>
<updated>2015-12-14T14:37:47Z</updated>
<author>
<name>Joerg Roedel</name>
<email>jroedel@suse.de</email>
</author>
<published>2015-11-17T15:11:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7b5cc1a9c9f4096555345c365508d727149553fe'/>
<id>urn:sha1:7b5cc1a9c9f4096555345c365508d727149553fe</id>
<content type='text'>
The handle_mm_fault function expects the caller to do the
access checks. Not doing so and calling the function with
wrong permissions is a bug (catched by a BUG_ON).
So fix this bug by adding proper access checking to the io
page-fault code in the AMD IOMMUv2 driver.

Reviewed-by: Jesse Barnes &lt;jbarnes@virtuousgeek.org&gt;
Acked-By: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
</content>
</entry>
<entry>
<title>s390/pci_dma: handle dma table failures</title>
<updated>2015-11-09T08:10:49Z</updated>
<author>
<name>Sebastian Ott</name>
<email>sebott@linux.vnet.ibm.com</email>
</author>
<published>2015-10-26T10:19:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=66728eeea6d80060e4b9df55c7845c838ff2799f'/>
<id>urn:sha1:66728eeea6d80060e4b9df55c7845c838ff2799f</id>
<content type='text'>
We use lazy allocation for translation table entries but don't handle
allocation (and other) failures during translation table updates.

Handle these failures and undo translation table updates when it's
meaningful.

Signed-off-by: Sebastian Ott &lt;sebott@linux.vnet.ibm.com&gt;
Reviewed-by: Gerald Schaefer &lt;gerald.schaefer@de.ibm.com&gt;
Signed-off-by: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
</content>
</entry>
<entry>
<title>mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd</title>
<updated>2015-11-07T01:50:42Z</updated>
<author>
<name>Mel Gorman</name>
<email>mgorman@techsingularity.net</email>
</author>
<published>2015-11-07T00:28:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d0164adc89f6bb374d304ffcc375c6d2652fe67d'/>
<id>urn:sha1:d0164adc89f6bb374d304ffcc375c6d2652fe67d</id>
<content type='text'>
__GFP_WAIT has been used to identify atomic context in callers that hold
spinlocks or are in interrupts.  They are expected to be high priority and
have access one of two watermarks lower than "min" which can be referred
to as the "atomic reserve".  __GFP_HIGH users get access to the first
lower watermark and can be called the "high priority reserve".

Over time, callers had a requirement to not block when fallback options
were available.  Some have abused __GFP_WAIT leading to a situation where
an optimisitic allocation with a fallback option can access atomic
reserves.

This patch uses __GFP_ATOMIC to identify callers that are truely atomic,
cannot sleep and have no alternative.  High priority users continue to use
__GFP_HIGH.  __GFP_DIRECT_RECLAIM identifies callers that can sleep and
are willing to enter direct reclaim.  __GFP_KSWAPD_RECLAIM to identify
callers that want to wake kswapd for background reclaim.  __GFP_WAIT is
redefined as a caller that is willing to enter direct reclaim and wake
kswapd for background reclaim.

This patch then converts a number of sites

o __GFP_ATOMIC is used by callers that are high priority and have memory
  pools for those requests. GFP_ATOMIC uses this flag.

o Callers that have a limited mempool to guarantee forward progress clear
  __GFP_DIRECT_RECLAIM but keep __GFP_KSWAPD_RECLAIM. bio allocations fall
  into this category where kswapd will still be woken but atomic reserves
  are not used as there is a one-entry mempool to guarantee progress.

o Callers that are checking if they are non-blocking should use the
  helper gfpflags_allow_blocking() where possible. This is because
  checking for __GFP_WAIT as was done historically now can trigger false
  positives. Some exceptions like dm-crypt.c exist where the code intent
  is clearer if __GFP_DIRECT_RECLAIM is used instead of the helper due to
  flag manipulations.

o Callers that built their own GFP flags instead of starting with GFP_KERNEL
  and friends now also need to specify __GFP_KSWAPD_RECLAIM.

The first key hazard to watch out for is callers that removed __GFP_WAIT
and was depending on access to atomic reserves for inconspicuous reasons.
In some cases it may be appropriate for them to use __GFP_HIGH.

The second key hazard is callers that assembled their own combination of
GFP flags instead of starting with something like GFP_KERNEL.  They may
now wish to specify __GFP_KSWAPD_RECLAIM.  It's almost certainly harmless
if it's missed in most cases as other activity will wake kswapd.

Signed-off-by: Mel Gorman &lt;mgorman@techsingularity.net&gt;
Acked-by: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Acked-by: Michal Hocko &lt;mhocko@suse.com&gt;
Acked-by: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Cc: Christoph Lameter &lt;cl@linux.com&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Cc: Vitaly Wool &lt;vitalywool@gmail.com&gt;
Cc: Rik van Riel &lt;riel@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
