* [PATCH 2/3] iommu: exports set_entry
@ 2010-11-15 18:00 Jean Guyader
2010-11-18 11:54 ` Tim Deegan
0 siblings, 1 reply; 2+ messages in thread
From: Jean Guyader @ 2010-11-15 18:00 UTC (permalink / raw)
To: xen-devel; +Cc: Kay, Allen M
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: iommu_export_set_entry --]
[-- Type: text/plain, Size: 2422 bytes --]
Exports iommu_set_entry to the rest of xen.
Signed-off-by: Jean Guyader <jean.guyader@citrix.com>
---
diff -r 93ae9939b4a5 xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c Mon Nov 15 11:52:14 2010 +0000
+++ b/xen/drivers/passthrough/iommu.c Mon Nov 15 11:53:59 2010 +0000
@@ -418,6 +418,23 @@
ops->suspend();
}
+int iommu_set_entry(struct domain *d, unsigned long gfn, unsigned long mfn,
+ unsigned int flags, int map)
+{
+ const struct iommu_ops *ops = iommu_get_ops();
+ if ( iommu_enabled )
+ return ops->set_entry(d, gfn, mfn, flags, map);
+ return -1;
+}
+
+int iommu_flush_iotlb(struct domain *d, unsigned long gfn, unsigned int nr)
+{
+ const struct iommu_ops *ops = iommu_get_ops();
+ if ( iommu_enabled )
+ return ops->flush_iotlb(d, gfn, nr);
+ return -1;
+}
+
/*
* Local variables:
* mode: C
diff -r 93ae9939b4a5 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c Mon Nov 15 11:52:14 2010 +0000
+++ b/xen/drivers/passthrough/vtd/iommu.c Mon Nov 15 11:53:59 2010 +0000
@@ -2197,6 +2197,8 @@
.read_msi_from_ire = msi_msg_read_remap_rte,
.suspend = vtd_suspend,
.resume = vtd_resume,
+ .set_entry = intel_iommu_set_entry,
+ .flush_iotlb = intel_iommu_flush_iotlb
};
/*
diff -r 93ae9939b4a5 xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h Mon Nov 15 11:52:14 2010 +0000
+++ b/xen/include/xen/iommu.h Mon Nov 15 11:53:59 2010 +0000
@@ -84,6 +84,10 @@
unsigned int flags);
int iommu_unmap_page(struct domain *d, unsigned long gfn);
+int iommu_set_entry(struct domain *d, unsigned long gfn, unsigned long mfn,
+ unsigned int flags, int map);
+int iommu_flush_iotlb(struct domain *d, unsigned long gfn, unsigned int nr);
+
void iommu_domain_teardown(struct domain *d);
int hvm_do_IRQ_dpci(struct domain *d, unsigned int irq);
int dpci_ioport_intercept(ioreq_t *p);
@@ -130,6 +134,9 @@
unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
void (*suspend)(void);
void (*resume)(void);
+ int (*set_entry)(struct domain *d, unsigned long gfn, unsigned long mfn,
+ unsigned int flags, int map);
+ int (*flush_iotlb)(struct domain *d, unsigned long gfn, unsigned int nr);
};
void iommu_update_ire_from_apic(unsigned int apic, unsigned int reg, unsigned int value);
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2/3] iommu: exports set_entry
2010-11-15 18:00 [PATCH 2/3] iommu: exports set_entry Jean Guyader
@ 2010-11-18 11:54 ` Tim Deegan
0 siblings, 0 replies; 2+ messages in thread
From: Tim Deegan @ 2010-11-18 11:54 UTC (permalink / raw)
To: Jean Guyader; +Cc: xen-devel, Kay, Allen M
At 18:00 +0000 on 15 Nov (1289844015), Jean Guyader wrote:
> diff -r 93ae9939b4a5 xen/drivers/passthrough/iommu.c
> --- a/xen/drivers/passthrough/iommu.c Mon Nov 15 11:52:14 2010 +0000
> +++ b/xen/drivers/passthrough/iommu.c Mon Nov 15 11:53:59 2010 +0000
> @@ -418,6 +418,23 @@
> ops->suspend();
> }
>
> +int iommu_set_entry(struct domain *d, unsigned long gfn, unsigned long mfn,
> + unsigned int flags, int map)
> +{
> + const struct iommu_ops *ops = iommu_get_ops();
> + if ( iommu_enabled )
> + return ops->set_entry(d, gfn, mfn, flags, map);
Needs a check that set_entry() isn't NULL or it'll crash on AMD IOMMUs.
> + return -1;
> +}
> +
> +int iommu_flush_iotlb(struct domain *d, unsigned long gfn, unsigned int nr)
> +{
> + const struct iommu_ops *ops = iommu_get_ops();
> + if ( iommu_enabled )
> + return ops->flush_iotlb(d, gfn, nr);
Likewise.
> + return -1;
> +}
> +
> /*
> * Local variables:
> * mode: C
> diff -r 93ae9939b4a5 xen/drivers/passthrough/vtd/iommu.c
> --- a/xen/drivers/passthrough/vtd/iommu.c Mon Nov 15 11:52:14 2010 +0000
> +++ b/xen/drivers/passthrough/vtd/iommu.c Mon Nov 15 11:53:59 2010 +0000
> @@ -2197,6 +2197,8 @@
> .read_msi_from_ire = msi_msg_read_remap_rte,
> .suspend = vtd_suspend,
> .resume = vtd_resume,
> + .set_entry = intel_iommu_set_entry,
> + .flush_iotlb = intel_iommu_flush_iotlb
> };
>
> /*
> diff -r 93ae9939b4a5 xen/include/xen/iommu.h
> --- a/xen/include/xen/iommu.h Mon Nov 15 11:52:14 2010 +0000
> +++ b/xen/include/xen/iommu.h Mon Nov 15 11:53:59 2010 +0000
> @@ -84,6 +84,10 @@
> unsigned int flags);
> int iommu_unmap_page(struct domain *d, unsigned long gfn);
>
> +int iommu_set_entry(struct domain *d, unsigned long gfn, unsigned long mfn,
> + unsigned int flags, int map);
> +int iommu_flush_iotlb(struct domain *d, unsigned long gfn, unsigned int nr);
> +
> void iommu_domain_teardown(struct domain *d);
> int hvm_do_IRQ_dpci(struct domain *d, unsigned int irq);
> int dpci_ioport_intercept(ioreq_t *p);
> @@ -130,6 +134,9 @@
> unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
> void (*suspend)(void);
> void (*resume)(void);
> + int (*set_entry)(struct domain *d, unsigned long gfn, unsigned long mfn,
> + unsigned int flags, int map);
> + int (*flush_iotlb)(struct domain *d, unsigned long gfn, unsigned int nr);
> };
>
> void iommu_update_ire_from_apic(unsigned int apic, unsigned int reg, unsigned int value);
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
--
Tim Deegan <Tim.Deegan@citrix.com>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-18 11:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-15 18:00 [PATCH 2/3] iommu: exports set_entry Jean Guyader
2010-11-18 11:54 ` Tim Deegan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.