From a9b0c34507eba2b386be61fe49ab2fe0db121674 Mon Sep 17 00:00:00 2001 From: Bibo Mao Date: Tue, 27 Oct 2026 22:51:12 +0800 Subject: ACPI: LoongArch: Add acpi_arch_[late]_init() LoongArch IOMMU scanning flow is similar with virtio-iommu, there is an early init phase and a late init phase. In the early init function, PCI ACS is enabled if there is IOMMU table, and the late init function is called after PCI device scanning, where IOVT table scanning function is executed. Here add acpi_arch_init() and acpi_arch_late_init() API for LoongArch: the acpi_iovt_init() function is to enable PCI ACS function if the IOMMU device exists in IOVT table; while the acpi_iovt_late_init() function is to scan IOVT table and add IOMMU devices. Signed-off-by: Bibo Mao Signed-off-by: Huacai Chen --- include/linux/acpi.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d7f1f3d05390..9d3f039ebd94 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1637,6 +1637,7 @@ static inline int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id, #endif void acpi_arch_init(void); +void acpi_arch_late_init(void); #ifdef CONFIG_ACPI_PCC void acpi_init_pcc(void); -- cgit v1.2.3 From 33e340160884ca61e414c237bbaef10553639457 Mon Sep 17 00:00:00 2001 From: Bibo Mao Date: Tue, 27 Oct 2026 22:51:12 +0800 Subject: ACPI: LoongArch: Add support for acpi_iommu_configure_id() acpi_iommu_configure_id() currently only supports IORT and VIOT. Add support for LoongArch's IOVT as well. Acked-by: Rafael J. Wysocki (Intel) Signed-off-by: Bibo Mao Signed-off-by: Huacai Chen --- include/linux/acpi_iovt.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 include/linux/acpi_iovt.h (limited to 'include/linux') diff --git a/include/linux/acpi_iovt.h b/include/linux/acpi_iovt.h new file mode 100644 index 000000000000..663b4c679bc5 --- /dev/null +++ b/include/linux/acpi_iovt.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ACPI_IOVT_H__ +#define __ACPI_IOVT_H__ + +#ifdef CONFIG_ACPI_IOVT +int iovt_iommu_configure_id(struct device *dev, const u32 *id_in); +#else +static inline int iovt_iommu_configure_id(struct device *dev, const u32 *id_in) +{ return -ENODEV; } +#endif + +#endif /* __ACPI_IOVT_H__ */ -- cgit v1.2.3