vmm: Make iommu ops tables const
While here, use designated initializers and rename some AMD iommu method implementations to match the corresponding op names. No functional change intended. Reviewed by: grehan MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31462
This commit is contained in:
parent
e54ae8258d
commit
41335c6b7f
@ -1181,7 +1181,7 @@ amdvi_create_mapping(void *arg, vm_paddr_t gpa, vm_paddr_t hpa,
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
amdvi_destroy_mapping(void *arg, vm_paddr_t gpa, uint64_t len)
|
||||
amdvi_remove_mapping(void *arg, vm_paddr_t gpa, uint64_t len)
|
||||
{
|
||||
struct amdvi_domain *domain;
|
||||
|
||||
@ -1360,7 +1360,7 @@ amdvi_disable(void)
|
||||
}
|
||||
|
||||
static void
|
||||
amdvi_inv_tlb(void *arg)
|
||||
amdvi_invalidate_tlb(void *arg)
|
||||
{
|
||||
struct amdvi_domain *domain;
|
||||
|
||||
@ -1369,16 +1369,16 @@ amdvi_inv_tlb(void *arg)
|
||||
amdvi_do_inv_domain(domain->id, false);
|
||||
}
|
||||
|
||||
struct iommu_ops iommu_ops_amd = {
|
||||
amdvi_init,
|
||||
amdvi_cleanup,
|
||||
amdvi_enable,
|
||||
amdvi_disable,
|
||||
amdvi_create_domain,
|
||||
amdvi_destroy_domain,
|
||||
amdvi_create_mapping,
|
||||
amdvi_destroy_mapping,
|
||||
amdvi_add_device,
|
||||
amdvi_remove_device,
|
||||
amdvi_inv_tlb
|
||||
const struct iommu_ops iommu_ops_amd = {
|
||||
.init = amdvi_init,
|
||||
.cleanup = amdvi_cleanup,
|
||||
.enable = amdvi_enable,
|
||||
.disable = amdvi_disable,
|
||||
.create_domain = amdvi_create_domain,
|
||||
.destroy_domain = amdvi_destroy_domain,
|
||||
.create_mapping = amdvi_create_mapping,
|
||||
.remove_mapping = amdvi_remove_mapping,
|
||||
.add_device = amdvi_add_device,
|
||||
.remove_device = amdvi_remove_device,
|
||||
.invalidate_tlb = amdvi_invalidate_tlb
|
||||
};
|
||||
|
@ -761,16 +761,16 @@ vtd_destroy_domain(void *arg)
|
||||
free(dom, M_VTD);
|
||||
}
|
||||
|
||||
struct iommu_ops iommu_ops_intel = {
|
||||
vtd_init,
|
||||
vtd_cleanup,
|
||||
vtd_enable,
|
||||
vtd_disable,
|
||||
vtd_create_domain,
|
||||
vtd_destroy_domain,
|
||||
vtd_create_mapping,
|
||||
vtd_remove_mapping,
|
||||
vtd_add_device,
|
||||
vtd_remove_device,
|
||||
vtd_invalidate_tlb,
|
||||
const struct iommu_ops iommu_ops_intel = {
|
||||
.init = vtd_init,
|
||||
.cleanup = vtd_cleanup,
|
||||
.enable = vtd_enable,
|
||||
.disable = vtd_disable,
|
||||
.create_domain = vtd_create_domain,
|
||||
.destroy_domain = vtd_destroy_domain,
|
||||
.create_mapping = vtd_create_mapping,
|
||||
.remove_mapping = vtd_remove_mapping,
|
||||
.add_device = vtd_add_device,
|
||||
.remove_device = vtd_remove_device,
|
||||
.invalidate_tlb = vtd_invalidate_tlb,
|
||||
};
|
||||
|
@ -59,7 +59,7 @@ static int iommu_enable = 1;
|
||||
SYSCTL_INT(_hw_vmm_iommu, OID_AUTO, enable, CTLFLAG_RDTUN, &iommu_enable, 0,
|
||||
"Enable use of I/O MMU (required for PCI passthrough).");
|
||||
|
||||
static struct iommu_ops *ops;
|
||||
static const struct iommu_ops *ops;
|
||||
static void *host_domain;
|
||||
static eventhandler_tag add_tag, delete_tag;
|
||||
|
||||
|
@ -60,8 +60,8 @@ struct iommu_ops {
|
||||
iommu_invalidate_tlb_t invalidate_tlb;
|
||||
};
|
||||
|
||||
extern struct iommu_ops iommu_ops_intel;
|
||||
extern struct iommu_ops iommu_ops_amd;
|
||||
extern const struct iommu_ops iommu_ops_intel;
|
||||
extern const struct iommu_ops iommu_ops_amd;
|
||||
|
||||
void iommu_cleanup(void);
|
||||
void *iommu_host_domain(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user