[PATCH v9 04/11] ACPI/IORT: Provide a generic helper to retrieve reserve regions
Lorenzo Pieralisi
lorenzo.pieralisi at arm.com
Wed Apr 6 08:54:10 PDT 2022
On Mon, Apr 04, 2022 at 01:42:02PM +0100, Shameer Kolothum wrote:
> Currently IORT provides a helper to retrieve HW MSI reserve regions.
> Change this to a generic helper to retrieve any IORT related reserve
> regions. This will be useful when we add support for RMR nodes in
> subsequent patches.
>
> Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi at huawei.com>
> ---
> drivers/acpi/arm64/iort.c | 23 +++++++++++++++--------
> drivers/iommu/dma-iommu.c | 2 +-
> include/linux/acpi_iort.h | 4 ++--
> 3 files changed, 18 insertions(+), 11 deletions(-)
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com> # for ACPI
IORT
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index c5ebb2be9a19..63acc3c5b275 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -830,16 +830,13 @@ static struct acpi_iort_node *iort_get_msi_resv_iommu(struct device *dev)
> return NULL;
> }
>
> -/**
> - * iort_iommu_msi_get_resv_regions - Reserved region driver helper
> - * for HW MSI regions.
> - * @dev: Device from iommu_get_resv_regions()
> - * @head: Reserved region list from iommu_get_resv_regions()
> - *
> +/*
> + * Retrieve platform specific HW MSI reserve regions.
> * The ITS interrupt translation spaces (ITS_base + SZ_64K, SZ_64K)
> * associated with the device are the HW MSI reserved regions.
> */
> -void iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
> +static void
> +iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
> {
> struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
> struct acpi_iort_its_group *its;
> @@ -888,6 +885,16 @@ void iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
> }
> }
>
> +/**
> + * iort_iommu_get_resv_regions - Generic helper to retrieve reserved regions.
> + * @dev: Device from iommu_get_resv_regions()
> + * @head: Reserved region list from iommu_get_resv_regions()
> + */
> +void iort_iommu_get_resv_regions(struct device *dev, struct list_head *head)
> +{
> + iort_iommu_msi_get_resv_regions(dev, head);
> +}
> +
> static inline bool iort_iommu_driver_enabled(u8 type)
> {
> switch (type) {
> @@ -1052,7 +1059,7 @@ int iort_iommu_configure_id(struct device *dev, const u32 *id_in)
> }
>
> #else
> -void iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
> +void iort_iommu_get_resv_regions(struct device *dev, struct list_head *head)
> { }
> int iort_iommu_configure_id(struct device *dev, const u32 *input_id)
> { return -ENODEV; }
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index 09f6e1c0f9c0..93d76b666888 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -384,7 +384,7 @@ void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list)
> {
>
> if (!is_of_node(dev_iommu_fwspec_get(dev)->iommu_fwnode))
> - iort_iommu_msi_get_resv_regions(dev, list);
> + iort_iommu_get_resv_regions(dev, list);
>
> }
> EXPORT_SYMBOL(iommu_dma_get_resv_regions);
> diff --git a/include/linux/acpi_iort.h b/include/linux/acpi_iort.h
> index a8198b83753d..e5d2de9caf7f 100644
> --- a/include/linux/acpi_iort.h
> +++ b/include/linux/acpi_iort.h
> @@ -36,7 +36,7 @@ int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
> /* IOMMU interface */
> int iort_dma_get_ranges(struct device *dev, u64 *size);
> int iort_iommu_configure_id(struct device *dev, const u32 *id_in);
> -void iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head);
> +void iort_iommu_get_resv_regions(struct device *dev, struct list_head *head);
> phys_addr_t acpi_iort_dma_get_max_cpu_address(void);
> #else
> static inline void acpi_iort_init(void) { }
> @@ -52,7 +52,7 @@ static inline int iort_dma_get_ranges(struct device *dev, u64 *size)
> static inline int iort_iommu_configure_id(struct device *dev, const u32 *id_in)
> { return -ENODEV; }
> static inline
> -void iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
> +void iort_iommu_get_resv_regions(struct device *dev, struct list_head *head)
> { }
>
> static inline phys_addr_t acpi_iort_dma_get_max_cpu_address(void)
> --
> 2.25.1
>
More information about the linux-arm-kernel
mailing list