ACPI: VIOT: Fix ACS setup
authorEric Auger <eric.auger@redhat.com>
Thu, 30 Jun 2022 09:40:59 +0000 (11:40 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 5 Jul 2022 18:25:39 +0000 (20:25 +0200)
commit3dcb861dbc6ab101838a1548b1efddd00ca3c3ec
tree206893bed229a01f88b40ae49984ec31688c1b2d
parent88084a3df1672e131ddc1b4e39eeacfd39864acf
ACPI: VIOT: Fix ACS setup

Currently acpi_viot_init() gets called after the pci
device has been scanned and pci_enable_acs() has been called.
So pci_request_acs() fails to be taken into account leading
to wrong single iommu group topologies when dealing with
multi-function root ports for instance.

We cannot simply move the acpi_viot_init() earlier, similarly
as the IORT init because the VIOT parsing relies on the pci
scan. However we can detect VIOT is present earlier and in
such a case, request ACS. Introduce a new acpi_viot_early_init()
routine that allows to call pci_request_acs() before the scan.

While at it, guard the call to pci_request_acs() with #ifdef
CONFIG_PCI.

Fixes: 3cf485540e7b ("ACPI: Add driver for the VIOT table")
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reported-by: Jin Liu <jinl@redhat.com>
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/bus.c
drivers/acpi/viot.c
include/linux/acpi_viot.h