Skip to content

Commit

Permalink
AMD-vi: Mixed format IVHD block should replace fixed format IVHD block
Browse files Browse the repository at this point in the history
This fixes double IVHD_SETUP_INTR calls on the same IOMMU device.

Sponsored by:	The FreeBSD Foundation
MFC with:	74ada29
Reported by:	Oleg Ginzburg <[email protected]>
Reviewed by:	grehan
Approved by:	philip (mentor)
Differential Revision:	https://reviews.freebsd.org/D29521

(cherry picked from commit 03efa46)
  • Loading branch information
khng300 committed Apr 7, 2021
1 parent 1bbe044 commit 9d7eb55
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions sys/amd64/vmm/amd/ivrs_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,22 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE1 *ivhd, struct amdvi_softc *softc)
static bool
ivhd_is_newer(ACPI_IVRS_HEADER *old, ACPI_IVRS_HEADER *new)
{
/*
* Newer IVRS header type take precedence.
*/
if ((old->DeviceId == new->DeviceId) &&
(old->Type == IVRS_TYPE_HARDWARE_LEGACY) &&
((new->Type == IVRS_TYPE_HARDWARE_EFR) ||
(new->Type == IVRS_TYPE_HARDWARE_MIXED))) {
return (true);
if (old->DeviceId == new->DeviceId) {
/*
* Newer IVRS header type take precedence.
*/
if (old->Type == IVRS_TYPE_HARDWARE_LEGACY &&
((new->Type == IVRS_TYPE_HARDWARE_EFR) ||
(new->Type == IVRS_TYPE_HARDWARE_MIXED)))
return (true);

/*
* Mixed format IVHD header type take precedence
* over fixed format IVHD header types.
*/
if (old->Type == IVRS_TYPE_HARDWARE_EFR &&
new->Type == IVRS_TYPE_HARDWARE_MIXED)
return (true);
}

return (false);
Expand Down

0 comments on commit 9d7eb55

Please sign in to comment.