<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/dev/iommu, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>iommu_gas: Fix assertion.</title>
<updated>2026-02-19T14:00:12+00:00</updated>
<author>
<name>Ruslan Bukin</name>
<email>br@FreeBSD.org</email>
</author>
<published>2026-02-19T13:56:36+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7e8284c6ad95bb7a0fc84d4d945ee98737efdd36'/>
<id>7e8284c6ad95bb7a0fc84d4d945ee98737efdd36</id>
<content type='text'>
placeholder entry end changed to 0 in f591287756368
("iommu_gas: make placeholder entry at the start of the GAS zero size")

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D55326
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
placeholder entry end changed to 0 in f591287756368
("iommu_gas: make placeholder entry at the start of the GAS zero size")

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D55326
</pre>
</div>
</content>
</entry>
<entry>
<title>AMD IOMMU: fix per-device IOMMU bypass when IR is enabled</title>
<updated>2025-10-20T21:06:47+00:00</updated>
<author>
<name>Jason A. Harmening</name>
<email>jah@FreeBSD.org</email>
</author>
<published>2025-10-20T01:53:08+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=35170408a7b86a879d7e2ffb5ddb70fe75951d89'/>
<id>35170408a7b86a879d7e2ffb5ddb70fe75951d89</id>
<content type='text'>
When interrupt remapping (IR) is enabled, the device table entry
(DTE) for a given device will likely be initialized by
amdiommu_ir_find() during MSI configuration.  This function directly
calls amdiommu_get_ctx_for_dev() with id_mapped=false, which means that
any attempt to disable DMA remapping for the device (e.g. by setting
hw.busdma.pciD.B.S.F='bounce' in the loader tunables) will effectively
be ignored as the paging mode field in the DTE will not be set to
0 as required for identity mapping.  This will ultimately produce
an unusable device, because busdma will later observe the bounce
configuration through iommu_instantiate_ctx() and will employ the
non-translated 'bounce' busdma methods for the device, while the DTE
remains configured to enable translation.

Fix this by tweaking iommu_instantiate_ctx() to always return the
relevant per-device context object even if translation is disabled,
and adopt it in amdiommu_ir_find() instead of directly calling
amdiommu_get_ctx_for_dev().

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53209
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When interrupt remapping (IR) is enabled, the device table entry
(DTE) for a given device will likely be initialized by
amdiommu_ir_find() during MSI configuration.  This function directly
calls amdiommu_get_ctx_for_dev() with id_mapped=false, which means that
any attempt to disable DMA remapping for the device (e.g. by setting
hw.busdma.pciD.B.S.F='bounce' in the loader tunables) will effectively
be ignored as the paging mode field in the DTE will not be set to
0 as required for identity mapping.  This will ultimately produce
an unusable device, because busdma will later observe the bounce
configuration through iommu_instantiate_ctx() and will employ the
non-translated 'bounce' busdma methods for the device, while the DTE
remains configured to enable translation.

Fix this by tweaking iommu_instantiate_ctx() to always return the
relevant per-device context object even if translation is disabled,
and adopt it in amdiommu_ir_find() instead of directly calling
amdiommu_get_ctx_for_dev().

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53209
</pre>
</div>
</content>
</entry>
<entry>
<title>iommu_gas: Use proper prototype for SYSINIT functions</title>
<updated>2025-10-13T10:12:29+00:00</updated>
<author>
<name>Zhenlei Huang</name>
<email>zlei@FreeBSD.org</email>
</author>
<published>2025-10-13T10:12:29+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=05c313cd2cbcc6c0a6ffa97363b70232d02542f3'/>
<id>05c313cd2cbcc6c0a6ffa97363b70232d02542f3</id>
<content type='text'>
MFC after:	1 week
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
MFC after:	1 week
</pre>
</div>
</content>
</entry>
<entry>
<title>iommu_get_requester(): make it more resilient against arbitrary dev arg</title>
<updated>2025-09-09T02:51:08+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2025-09-05T23:06:18+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c745a6818bcbf33cf7f59641c925d19b3f98cea8'/>
<id>c745a6818bcbf33cf7f59641c925d19b3f98cea8</id>
<content type='text'>
If passed the parent of a device instead of the device, the loop might
end up with the host bridge in the pci local variable.  If the passed
device is not from the pci hierarchy, any of the calculated parents
might be NULL.

Change the interface to allow the caller to receive error.
Instead of asserting, just issue a message and return ENXIO,
allowing the caller to select appropriate action.

PR:	289318
Reviewed by:	jah
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D52406
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If passed the parent of a device instead of the device, the loop might
end up with the host bridge in the pci local variable.  If the passed
device is not from the pci hierarchy, any of the calculated parents
might be NULL.

Change the interface to allow the caller to receive error.
Instead of asserting, just issue a message and return ENXIO,
allowing the caller to select appropriate action.

PR:	289318
Reviewed by:	jah
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D52406
</pre>
</div>
</content>
</entry>
<entry>
<title>iommu_gas_map_region(): add comment explaining the ma array shift</title>
<updated>2025-04-01T22:23:17+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2025-01-25T09:37:50+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=45f70f98fc55b753b1e7a7374b4a061aa1f27392'/>
<id>45f70f98fc55b753b1e7a7374b4a061aa1f27392</id>
<content type='text'>
and the difference between start and entry-&gt;start values at this point.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
and the difference between start and entry-&gt;start values at this point.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
</pre>
</div>
</content>
</entry>
<entry>
<title>iommu: eliminate iommu_free_ctx()</title>
<updated>2024-11-03T19:38:19+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2024-11-03T14:50:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d97838b7c2a605932b6edf36f87abe7ccce74314'/>
<id>d97838b7c2a605932b6edf36f87abe7ccce74314</id>
<content type='text'>
iommu_free_ctx_locked() alone is enough

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
iommu_free_ctx_locked() alone is enough

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</pre>
</div>
</content>
</entry>
<entry>
<title>iommu: move context link and ref count into device-independent parts</title>
<updated>2024-10-13T22:30:26+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2024-10-12T19:56:14+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e9d948cfe0d21780d2e94137e322ecfe89f75d6a'/>
<id>e9d948cfe0d21780d2e94137e322ecfe89f75d6a</id>
<content type='text'>
This also allows to move some bits of ddb print routines into
iommu_utils.c common for x86 iommu drivers.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This also allows to move some bits of ddb print routines into
iommu_utils.c common for x86 iommu drivers.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</pre>
</div>
</content>
</entry>
<entry>
<title>iommu_get_requester(): do not panic if asked about non-pci device</title>
<updated>2024-10-13T22:30:26+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2024-10-13T10:04:32+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7896b03fff4d9c2e9c35ecf1dce2e0d672467a5a'/>
<id>7896b03fff4d9c2e9c35ecf1dce2e0d672467a5a</id>
<content type='text'>
For now, return zero rid and the device itself.  Add a comment noting
that eventually ACPI HID can be used to calculate rid for some more
devices.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For now, return zero rid and the device itself.  Add a comment noting
that eventually ACPI HID can be used to calculate rid for some more
devices.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</pre>
</div>
</content>
</entry>
<entry>
<title>iommu.h: improve header self-sufficiency</title>
<updated>2024-10-13T22:30:25+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2024-10-13T09:45:41+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=26ff9d2050a11449211644c6cb83cda7d94a785a'/>
<id>26ff9d2050a11449211644c6cb83cda7d94a785a</id>
<content type='text'>
The header embeds struct task into defined structures.  Also it needs
the PCI_BUSMAX constant.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The header embeds struct task into defined structures.  Also it needs
the PCI_BUSMAX constant.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</pre>
</div>
</content>
</entry>
<entry>
<title>iommu: extend iommu_map_entry to store the list of associated freed page table pages</title>
<updated>2024-09-27T17:34:23+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2024-09-25T01:50:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f713ed6694d949ec37365533afbb47c04f919572'/>
<id>f713ed6694d949ec37365533afbb47c04f919572</id>
<content type='text'>
The pages are inserted into the added slist if the entry parameter is
passed to iommu_pgfree().  For now it is nop.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The pages are inserted into the added slist if the entry parameter is
passed to iommu_pgfree().  For now it is nop.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</pre>
</div>
</content>
</entry>
</feed>
