提交 587bab28 编写于 作者: Z Zhou Guanghui 提交者: Xie XiuQi

iort: Clean up compiling errors/warnings for sva

hulk inclusion
category: bugfix
bugzilla: 16081
CVE: NA
-------------------

1. use CONFIG_IOMMU_SVA macro to isolate iommu-sva related code in iort.
2. move struct page_response_msg,enum page_response_code and
iopf_queue_flush_t out of macro CONFIG_IOMMU_API, since these are always
used by iommu api.

Fixes: 676917d8930e ("iommu/sva: Track mm changes with an MMU notifier")
Fixes: 615753b31ae4 ("ACPI/IORT: Check ATS capability in root complex nodes")
Fixes: e741c308b09f ("iort: Read ACPI configure to get streamid.")
Signed-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 3b8ecccd
...@@ -1030,6 +1030,7 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size) ...@@ -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); 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) static bool iort_pci_rc_supports_ats(struct acpi_iort_node *node)
{ {
struct acpi_iort_root_complex *pci_rc; struct acpi_iort_root_complex *pci_rc;
...@@ -1037,6 +1038,7 @@ static bool iort_pci_rc_supports_ats(struct acpi_iort_node *node) ...@@ -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; pci_rc = (struct acpi_iort_root_complex *)node->node_data;
return pci_rc->ats_attribute & ACPI_IORT_ATS_SUPPORTED; return pci_rc->ats_attribute & ACPI_IORT_ATS_SUPPORTED;
} }
#endif
/** /**
* iort_iommu_configure - Set-up IOMMU configuration for a device. * iort_iommu_configure - Set-up IOMMU configuration for a device.
...@@ -1073,9 +1075,10 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) ...@@ -1073,9 +1075,10 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
info.node = node; info.node = node;
err = pci_for_each_dma_alias(to_pci_dev(dev), err = pci_for_each_dma_alias(to_pci_dev(dev),
iort_pci_iommu_init, &info); iort_pci_iommu_init, &info);
#ifdef CONFIG_IOMMU_SVA
if (!err && !iort_pci_rc_supports_ats(node)) if (!err && !iort_pci_rc_supports_ats(node))
dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_NO_ATS; dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_NO_ATS;
#endif
} else { } else {
int i = 0; int i = 0;
...@@ -1085,7 +1088,9 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) ...@@ -1085,7 +1088,9 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
return NULL; return NULL;
do { do {
#ifdef CONFIG_IOMMU_SVA
u32 sid; u32 sid;
#endif
parent = iort_node_map_platform_id(node, &streamid, parent = iort_node_map_platform_id(node, &streamid,
IORT_IOMMU_TYPE, IORT_IOMMU_TYPE,
i++); i++);
...@@ -1093,6 +1098,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) ...@@ -1093,6 +1098,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
if (parent) if (parent)
err = iort_iommu_xlate(dev, parent, streamid); err = iort_iommu_xlate(dev, parent, streamid);
#ifdef CONFIG_IOMMU_SVA
if (!acpi_dev_prop_read_single(ACPI_COMPANION(dev), if (!acpi_dev_prop_read_single(ACPI_COMPANION(dev),
"streamid", DEV_PROP_U32, &sid)) { "streamid", DEV_PROP_U32, &sid)) {
err = iommu_fwspec_add_ids(dev, &sid, 1); err = iommu_fwspec_add_ids(dev, &sid, 1);
...@@ -1101,6 +1107,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) ...@@ -1101,6 +1107,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
dev->iommu_fwspec->can_stall = true; dev->iommu_fwspec->can_stall = true;
dev->iommu_fwspec->num_pasid_bits = 0x10; dev->iommu_fwspec->num_pasid_bits = 0x10;
} }
#endif
} while (parent && !err); } while (parent && !err);
} }
......
...@@ -184,8 +184,6 @@ struct iommu_resv_region { ...@@ -184,8 +184,6 @@ struct iommu_resv_region {
enum iommu_resv_type type; enum iommu_resv_type type;
}; };
#ifdef CONFIG_IOMMU_API
/** /**
* enum page_response_code - Return status of fault handlers, telling the IOMMU * enum page_response_code - Return status of fault handlers, telling the IOMMU
* driver how to proceed with the fault. * driver how to proceed with the fault.
...@@ -203,19 +201,6 @@ enum page_response_code { ...@@ -203,19 +201,6 @@ enum page_response_code {
IOMMU_PAGE_RESP_FAILURE, 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. * Generic page response information based on PCI ATS and PASID spec.
* @addr: servicing page address * @addr: servicing page address
...@@ -235,6 +220,29 @@ struct page_response_msg { ...@@ -235,6 +220,29 @@ struct page_response_msg {
u64 private_data; 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 { struct iommu_sva_param {
unsigned long features; unsigned long features;
unsigned int min_pasid; unsigned int min_pasid;
...@@ -459,14 +467,6 @@ struct iommu_fault_param { ...@@ -459,14 +467,6 @@ struct iommu_fault_param {
void *data; 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 * struct iommu_param - collection of per-device IOMMU data
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册