diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 5cf4bfa0f4b4232118f00a35e88277c6eff44475..a789147d4a046156cd81d1f2545bca7203966f5a 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -1030,6 +1030,7 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size) dev_dbg(dev, "dma_pfn_offset(%#08llx)\n", offset); } +#ifdef CONFIG_IOMMU_SVA static bool iort_pci_rc_supports_ats(struct acpi_iort_node *node) { struct acpi_iort_root_complex *pci_rc; @@ -1037,6 +1038,7 @@ static bool iort_pci_rc_supports_ats(struct acpi_iort_node *node) pci_rc = (struct acpi_iort_root_complex *)node->node_data; return pci_rc->ats_attribute & ACPI_IORT_ATS_SUPPORTED; } +#endif /** * iort_iommu_configure - Set-up IOMMU configuration for a device. @@ -1073,9 +1075,10 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) info.node = node; err = pci_for_each_dma_alias(to_pci_dev(dev), iort_pci_iommu_init, &info); - +#ifdef CONFIG_IOMMU_SVA if (!err && !iort_pci_rc_supports_ats(node)) dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_NO_ATS; +#endif } else { int i = 0; @@ -1085,7 +1088,9 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) return NULL; do { +#ifdef CONFIG_IOMMU_SVA u32 sid; +#endif parent = iort_node_map_platform_id(node, &streamid, IORT_IOMMU_TYPE, i++); @@ -1093,6 +1098,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) if (parent) err = iort_iommu_xlate(dev, parent, streamid); +#ifdef CONFIG_IOMMU_SVA if (!acpi_dev_prop_read_single(ACPI_COMPANION(dev), "streamid", DEV_PROP_U32, &sid)) { err = iommu_fwspec_add_ids(dev, &sid, 1); @@ -1101,6 +1107,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) dev->iommu_fwspec->can_stall = true; dev->iommu_fwspec->num_pasid_bits = 0x10; } +#endif } while (parent && !err); } diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 1ca5bd542d829351412a3c0b2ce40b75dcec5327..7edde72f1f09b5312ecb56de225b75f5f53f0165 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -184,8 +184,6 @@ struct iommu_resv_region { enum iommu_resv_type type; }; -#ifdef CONFIG_IOMMU_API - /** * enum page_response_code - Return status of fault handlers, telling the IOMMU * driver how to proceed with the fault. @@ -203,19 +201,6 @@ enum page_response_code { IOMMU_PAGE_RESP_FAILURE, }; -/** - * enum page_request_handle_t - Return page request/response handler status - * - * @IOMMU_FAULT_STATUS_HANDLED: Stop processing the fault, and do not send a - * reply to the device. - * @IOMMU_FAULT_STATUS_CONTINUE: Fault was not handled. Call the next handler, - * or terminate. - */ -enum page_request_handle_t { - IOMMU_PAGE_RESP_HANDLED = 0, - IOMMU_PAGE_RESP_CONTINUE, -}; - /** * Generic page response information based on PCI ATS and PASID spec. * @addr: servicing page address @@ -235,6 +220,29 @@ struct page_response_msg { u64 private_data; }; +/** + * iopf_queue_flush_t - Flush low-level page fault queue + * + * Report all faults currently pending in the low-level page fault queue + */ +struct iopf_queue; +typedef int (*iopf_queue_flush_t)(void *cookie, struct device *dev); + +#ifdef CONFIG_IOMMU_API + +/** + * enum page_request_handle_t - Return page request/response handler status + * + * @IOMMU_FAULT_STATUS_HANDLED: Stop processing the fault, and do not send a + * reply to the device. + * @IOMMU_FAULT_STATUS_CONTINUE: Fault was not handled. Call the next handler, + * or terminate. + */ +enum page_request_handle_t { + IOMMU_PAGE_RESP_HANDLED = 0, + IOMMU_PAGE_RESP_CONTINUE, +}; + struct iommu_sva_param { unsigned long features; unsigned int min_pasid; @@ -459,14 +467,6 @@ struct iommu_fault_param { void *data; }; -/** - * iopf_queue_flush_t - Flush low-level page fault queue - * - * Report all faults currently pending in the low-level page fault queue - */ -struct iopf_queue; -typedef int (*iopf_queue_flush_t)(void *cookie, struct device *dev); - /** * struct iommu_param - collection of per-device IOMMU data *