The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=53adc0b898a4d263cad0bdfb687d9f008e5768f3

commit 53adc0b898a4d263cad0bdfb687d9f008e5768f3
Author:     Konstantin Belousov <k...@freebsd.org>
AuthorDate: 2024-12-06 08:06:42 +0000
Commit:     Konstantin Belousov <k...@freebsd.org>
CommitDate: 2024-12-07 01:54:01 +0000

    amdiommu: correctly initialize iommu.unit
    
    The field is mostly used for display, and should match device unit, not
    BIOS IVHD device id, which is deprecated and is practically zero.
    
    Sponsored by:   Advanced Micro Devices (AMD)
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/x86/iommu/amd_drv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/x86/iommu/amd_drv.c b/sys/x86/iommu/amd_drv.c
index 4d7db52a4acd..0712a2a2225f 100644
--- a/sys/x86/iommu/amd_drv.c
+++ b/sys/x86/iommu/amd_drv.c
@@ -176,7 +176,6 @@ ivrs_lookup_ivhd_0x40(ACPI_IVRS_HARDWARE2 *h2, void *arg)
                return (false);
 
        ildp->sc->unit_dom = h2->PciSegmentGroup;
-       ildp->sc->iommu.unit = ivrs_info_to_unit_id(h2->Info);
        ildp->sc->efr = h2->EfrRegisterImage;
        return (true);
 }
@@ -194,7 +193,6 @@ ivrs_lookup_ivhd_0x10(ACPI_IVRS_HARDWARE1 *h1, void *arg)
                return (false);
 
        ildp->sc->unit_dom = h1->PciSegmentGroup;
-       ildp->sc->iommu.unit = ivrs_info_to_unit_id(h1->Info);
        return (true);
 }
 
@@ -456,6 +454,7 @@ amdiommu_attach(device_t dev)
        bool res;
 
        sc = device_get_softc(dev);
+       sc->iommu.unit = device_get_unit(dev);
        sc->iommu.dev = dev;
 
        error = pci_find_cap(dev, PCIY_SECDEV, &sc->seccap_reg);

Reply via email to