@@ -569,6 +569,31 @@ void iort_set_dma_mask(struct device *dev)
}
/**
+ * iort_get_memory_address_limit - If a named component node exists in the IORT
+ * for a device, get the number of address bits
+ * that the device can effectively use when
+ * accessing memory.
+ *
+ * @dev: The device
+ *
+ * Returns: ENOENT when no corresponding named component node found for dev
+ * Named component memory_address_limit field otherwise
+ */
+int iort_get_memory_address_limit(struct device *dev)
+{
+ struct acpi_iort_node *node;
+ struct acpi_iort_named_component *ncomp;
+
+ node = iort_scan_node(ACPI_IORT_NODE_NAMED_COMPONENT,
+ iort_match_node_callback, dev);
+ if (!node)
+ return -ENOENT;
+
+ ncomp = (struct acpi_iort_named_component *)node->node_data;
+ return ncomp->memory_address_limit;
+}
+
+/**
* iort_iommu_configure - Set-up IOMMU configuration for a device.
*
* @dev: device to configure
@@ -36,6 +36,7 @@
struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id);
/* IOMMU interface */
void iort_set_dma_mask(struct device *dev);
+int iort_get_memory_address_limit(struct device *dev);
const struct iommu_ops *iort_iommu_configure(struct device *dev);
#else
static inline void acpi_iort_init(void) { }
@@ -47,6 +48,8 @@ static inline struct irq_domain *iort_get_device_domain(struct device *dev,
{ return NULL; }
/* IOMMU interface */
static inline void iort_set_dma_mask(struct device *dev) { }
+static inline int iort_get_memory_address_limit(struct device *dev)
+{ return -ENOENT; }
static inline
const struct iommu_ops *iort_iommu_configure(struct device *dev)
{ return NULL; }
The memory_address_limit field present in IORT named component nodes describes the effective number of address bits that a device can use when accessing memory. Because this information has value when creating or validating device dma_masks, the aforementioned accessor function is introduced. Signed-off-by: Nate Watterson <nwatters@codeaurora.org> --- drivers/acpi/arm64/iort.c | 25 +++++++++++++++++++++++++ include/linux/acpi_iort.h | 3 +++ 2 files changed, 28 insertions(+)