<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/modules/vmm, branch release/12.4.0</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>AMD-vi: Fix IOMMU device interrupts being overridden</title>
<updated>2021-09-03T18:46:40+00:00</updated>
<author>
<name>Ka Ho Ng</name>
<email>khng@FreeBSD.org</email>
</author>
<published>2021-03-22T09:33:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=5ba7dc4c21767288f44b5a31c49b65663ae7eb25'/>
<id>5ba7dc4c21767288f44b5a31c49b65663ae7eb25</id>
<content type='text'>
Currently, AMD-vi PCI-e passthrough will lead to the following lines in
dmesg:
"kernel: CPU0: local APIC error 0x40
ivhd0: Error: completion failed tail:0x720, head:0x0."

After some tracing, the problem is due to the interaction with
amdvi_alloc_intr_resources() and pci_driver_added(). In ivrs_drv, the
identification of AMD-vi IVHD is done by walking over the ACPI IVRS
table and ivhdX device_ts are added under the acpi bus, while there are
no driver handling the corresponding IOMMU PCI function. In
amdvi_alloc_intr_resources(), the MSI intr are allocated with the ivhdX
device_t instead of the IOMMU PCI function device_t. bus_setup_intr() is
called on ivhdX. the IOMMU pci function device_t is only used for
pci_enable_msi(). Since bus_setup_intr() is not called on IOMMU pci
function, the IOMMU PCI function device_t's dinfo-&gt;cfg.msi is never
updated to reflect the supposed msi_data and msi_addr. So the msi_data
and msi_addr stay in the value 0. When pci_driver_added() tried to loop
over the children of a pci bus, and do pci_cfg_restore() on each of
them, msi_addr and msi_data with value 0 will be written to the MSI
capability of the IOMMU pci function, thus explaining the errors in
dmesg.

This change includes an amdiommu driver which currently does attaching,
detaching and providing DEVMETHODs for setting up and tearing down
interrupt. The purpose of the driver is to prevent pci_driver_added()
from calling pci_cfg_restore() on the IOMMU PCI function device_t.
The introduction of the amdiommu driver handles allocation of an IRQ
resource within the IOMMU PCI function, so that the dinfo-&gt;cfg.msi is
populated.

This has been tested on EPYC Rome 7282 with Radeon 5700XT GPU.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	jhb
Approved by:	philip (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28984

(cherry picked from commit 74ada297e8978b8efda3dffdd1bb24aee7c5faa4)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, AMD-vi PCI-e passthrough will lead to the following lines in
dmesg:
"kernel: CPU0: local APIC error 0x40
ivhd0: Error: completion failed tail:0x720, head:0x0."

After some tracing, the problem is due to the interaction with
amdvi_alloc_intr_resources() and pci_driver_added(). In ivrs_drv, the
identification of AMD-vi IVHD is done by walking over the ACPI IVRS
table and ivhdX device_ts are added under the acpi bus, while there are
no driver handling the corresponding IOMMU PCI function. In
amdvi_alloc_intr_resources(), the MSI intr are allocated with the ivhdX
device_t instead of the IOMMU PCI function device_t. bus_setup_intr() is
called on ivhdX. the IOMMU pci function device_t is only used for
pci_enable_msi(). Since bus_setup_intr() is not called on IOMMU pci
function, the IOMMU PCI function device_t's dinfo-&gt;cfg.msi is never
updated to reflect the supposed msi_data and msi_addr. So the msi_data
and msi_addr stay in the value 0. When pci_driver_added() tried to loop
over the children of a pci bus, and do pci_cfg_restore() on each of
them, msi_addr and msi_data with value 0 will be written to the MSI
capability of the IOMMU pci function, thus explaining the errors in
dmesg.

This change includes an amdiommu driver which currently does attaching,
detaching and providing DEVMETHODs for setting up and tearing down
interrupt. The purpose of the driver is to prevent pci_driver_added()
from calling pci_cfg_restore() on the IOMMU PCI function device_t.
The introduction of the amdiommu driver handles allocation of an IRQ
resource within the IOMMU PCI function, so that the dinfo-&gt;cfg.msi is
populated.

This has been tested on EPYC Rome 7282 with Radeon 5700XT GPU.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	jhb
Approved by:	philip (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28984

(cherry picked from commit 74ada297e8978b8efda3dffdd1bb24aee7c5faa4)
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC r360071-r360072: force -fcommon in kernel/modules where needed</title>
<updated>2020-04-30T14:51:31+00:00</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2020-04-30T14:51:31+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=27a8b12be898569a3e5084de6f6158bb2c54944a'/>
<id>27a8b12be898569a3e5084de6f6158bb2c54944a</id>
<content type='text'>
This contains some extra bits over the original commits, as things are
slightly different in earlier branches.

r360071:
Allow kernel modules to build with a compiler that defaults to -fno-common

This uses the same approach as r359691.

r360072:
More fixes to build the kernel with a compiler that defaults to -fno-common

Using the same approach as the last commit for the files used by genassym.sh.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This contains some extra bits over the original commits, as things are
slightly different in earlier branches.

r360071:
Allow kernel modules to build with a compiler that defaults to -fno-common

This uses the same approach as r359691.

r360072:
More fixes to build the kernel with a compiler that defaults to -fno-common

Using the same approach as the last commit for the files used by genassym.sh.
</pre>
</div>
</content>
</entry>
<entry>
<title>All genassym.sh usage need offset.inc</title>
<updated>2018-07-03T21:02:25+00:00</updated>
<author>
<name>Bryan Drewery</name>
<email>bdrewery@FreeBSD.org</email>
</author>
<published>2018-07-03T21:02:25+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ccca101f7049ae5aefa5c37577abf4129658a055'/>
<id>ccca101f7049ae5aefa5c37577abf4129658a055</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix cyclic dependency after r326552.</title>
<updated>2017-12-05T17:23:33+00:00</updated>
<author>
<name>Bryan Drewery</name>
<email>bdrewery@FreeBSD.org</email>
</author>
<published>2017-12-05T17:23:33+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=488adf43d40fbe074527cd24a4bcb81e4ea6d9a4'/>
<id>488adf43d40fbe074527cd24a4bcb81e4ea6d9a4</id>
<content type='text'>
The OBJS_DEPEND_GUESS mechanism was making vmx_genassym.o depend
on all headers along with vmx_assym.h, though vmx_assym.h depends
on having vmx_genassym.o present to generate.  Moving the headers
to DPSRCS is enough to resolve the issue as they will no longer
be implicit dependencies for all objects.  Because of this we
need explicit OBJS_DEPEND_GUESS entries to ensure the headers
are generated when needed for the *_support.o files that need
them.

X-MFC-With:	r326552
MFC after:	2 weeks
Sponsored by:	Dell EMC
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The OBJS_DEPEND_GUESS mechanism was making vmx_genassym.o depend
on all headers along with vmx_assym.h, though vmx_assym.h depends
on having vmx_genassym.o present to generate.  Moving the headers
to DPSRCS is enough to resolve the issue as they will no longer
be implicit dependencies for all objects.  Because of this we
need explicit OBJS_DEPEND_GUESS entries to ensure the headers
are generated when needed for the *_support.o files that need
them.

X-MFC-With:	r326552
MFC after:	2 weeks
Sponsored by:	Dell EMC
</pre>
</div>
</content>
</entry>
<entry>
<title>Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct assignment to VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=1.</title>
<updated>2017-04-30T02:08:46+00:00</updated>
<author>
<name>Anish Gupta</name>
<email>anish@FreeBSD.org</email>
</author>
<published>2017-04-30T02:08:46+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=07ff474a68f545ae5e560394f12c9ec29e349c0b'/>
<id>07ff474a68f545ae5e560394f12c9ec29e349c0b</id>
<content type='text'>
Reviewed by:bcr
Approved by:grehan
Tested by:rgrimes
Differential Revision:https://reviews.freebsd.org/D10049
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed by:bcr
Approved by:grehan
Tested by:rgrimes
Differential Revision:https://reviews.freebsd.org/D10049
</pre>
</div>
</content>
</entry>
<entry>
<title>sys/modules: normalize .CURDIR-relative paths to SRCTOP</title>
<updated>2017-03-04T10:10:17+00:00</updated>
<author>
<name>Enji Cooper</name>
<email>ngie@FreeBSD.org</email>
</author>
<published>2017-03-04T10:10:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=193d9e768ba63fcfb187cfd17f461f7d41345048'/>
<id>193d9e768ba63fcfb187cfd17f461f7d41345048</id>
<content type='text'>
This simplifies make output/logic

Tested with:	`cd sys/modules; make ALL_MODULES=` on amd64
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This simplifies make output/logic

Tested with:	`cd sys/modules; make ALL_MODULES=` on amd64
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
</pre>
</div>
</content>
</entry>
<entry>
<title>Exclude -flto when building *genassym.o</title>
<updated>2017-02-21T18:59:17+00:00</updated>
<author>
<name>Ed Maste</name>
<email>emaste@FreeBSD.org</email>
</author>
<published>2017-02-21T18:59:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=0e8b3ab34883efedeeb5e0d3baa90ea98de1e692'/>
<id>0e8b3ab34883efedeeb5e0d3baa90ea98de1e692</id>
<content type='text'>
The build process generates *assym.h using nm from *genassym.o (which is
in turn created from *genassym.c).

When compiling with link-time optimization (LTO) using -flto, .o files
are LLVM bitcode, not ELF objects. This is not usable by genassym.sh,
so remove -flto from those ${CC} invocations.

Submitted by:	George Rimar
Reviewed by:	dim
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D9659
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The build process generates *assym.h using nm from *genassym.o (which is
in turn created from *genassym.c).

When compiling with link-time optimization (LTO) using -flto, .o files
are LLVM bitcode, not ELF objects. This is not usable by genassym.sh,
so remove -flto from those ${CC} invocations.

Submitted by:	George Rimar
Reviewed by:	dim
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D9659
</pre>
</div>
</content>
</entry>
<entry>
<title>Use lapic_ipi_alloc() to dynamically allocate IPI slots needed by bhyve when</title>
<updated>2015-03-14T02:32:08+00:00</updated>
<author>
<name>Neel Natu</name>
<email>neel@FreeBSD.org</email>
</author>
<published>2015-03-14T02:32:08+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=18a2b08e65278fc88d171baa7bb1728cf53a11ae'/>
<id>18a2b08e65278fc88d171baa7bb1728cf53a11ae</id>
<content type='text'>
vmm.ko is loaded.

Also relocate the 'justreturn' IPI handler to be alongside all other handlers.

Requested by:	kib
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
vmm.ko is loaded.

Also relocate the 'justreturn' IPI handler to be alongside all other handlers.

Requested by:	kib
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace bhyve's minimal RTC emulation with a fully featured one in vmm.ko.</title>
<updated>2014-12-30T22:19:34+00:00</updated>
<author>
<name>Neel Natu</name>
<email>neel@FreeBSD.org</email>
</author>
<published>2014-12-30T22:19:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=0dafa5cd4baeba5cd83594af440a3e250e5ddc22'/>
<id>0dafa5cd4baeba5cd83594af440a3e250e5ddc22</id>
<content type='text'>
The new RTC emulation supports all interrupt modes: periodic, update ended
and alarm. It is also capable of maintaining the date/time and NVRAM contents
across virtual machine reset. Also, the date/time fields can now be modified
by the guest.

Since bhyve now emulates both the PIT and the RTC there is no need for
"Legacy Replacement Routing" in the HPET so get rid of it.

The RTC device state can be inspected via bhyvectl as follows:
bhyvectl --vm=vm --get-rtc-time
bhyvectl --vm=vm --set-rtc-time=&lt;unix_time_secs&gt;
bhyvectl --vm=vm --rtc-nvram-offset=&lt;offset&gt; --get-rtc-nvram
bhyvectl --vm=vm --rtc-nvram-offset=&lt;offset&gt; --set-rtc-nvram=&lt;value&gt;

Reviewed by:	tychon
Discussed with:	grehan
Differential Revision:	https://reviews.freebsd.org/D1385
MFC after:	2 weeks
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The new RTC emulation supports all interrupt modes: periodic, update ended
and alarm. It is also capable of maintaining the date/time and NVRAM contents
across virtual machine reset. Also, the date/time fields can now be modified
by the guest.

Since bhyve now emulates both the PIT and the RTC there is no need for
"Legacy Replacement Routing" in the HPET so get rid of it.

The RTC device state can be inspected via bhyvectl as follows:
bhyvectl --vm=vm --get-rtc-time
bhyvectl --vm=vm --set-rtc-time=&lt;unix_time_secs&gt;
bhyvectl --vm=vm --rtc-nvram-offset=&lt;offset&gt; --get-rtc-nvram
bhyvectl --vm=vm --rtc-nvram-offset=&lt;offset&gt; --set-rtc-nvram=&lt;value&gt;

Reviewed by:	tychon
Discussed with:	grehan
Differential Revision:	https://reviews.freebsd.org/D1385
MFC after:	2 weeks
</pre>
</div>
</content>
</entry>
<entry>
<title>Retire the '@' symlink. It isn't really needed and causes more</title>
<updated>2014-11-06T16:48:37+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2014-11-06T16:48:37+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=528013d5a8b067fc384c91bdfd106e0d773959b7'/>
<id>528013d5a8b067fc384c91bdfd106e0d773959b7</id>
<content type='text'>
problems than it solves. SYSDIR is already defined almost always and
can be used instead. Working around the one case where it isn't is
much easier than working around the fact that @ may not exist in 18
other places.

Differential Revision: https://reviews.freebsd.org/D1100
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
problems than it solves. SYSDIR is already defined almost always and
can be used instead. Working around the one case where it isn't is
much easier than working around the fact that @ may not exist in 18
other places.

Differential Revision: https://reviews.freebsd.org/D1100
</pre>
</div>
</content>
</entry>
</feed>
