* [PATCH] [IOMMU] enlarge intr remapping table
@ 2009-09-25 7:11 Zhai, Edwin
2009-09-25 8:04 ` Jan Beulich
0 siblings, 1 reply; 5+ messages in thread
From: Zhai, Edwin @ 2009-09-25 7:11 UTC (permalink / raw)
To: Keir Fraser; +Cc: Xen Developers, Zhai, Edwin
[-- Attachment #1: Type: text/plain, Size: 205 bytes --]
This patch enlarges interrupt remapping table to fix the out-of range
table access when using many multiple-function PCI devices.
Signed-Off-By: Zhai Edwin <edwin.zhai@intel.com>
--
best rgds,
edwin
[-- Attachment #2: intremap_cleanup.patch --]
[-- Type: text/plain, Size: 2655 bytes --]
Index: hv/xen/drivers/passthrough/vtd/intremap.c
===================================================================
--- hv.orig/xen/drivers/passthrough/vtd/intremap.c
+++ hv/xen/drivers/passthrough/vtd/intremap.c
@@ -208,7 +208,7 @@ static int ioapic_rte_to_remap_entry(str
{
dprintk(XENLOG_ERR VTDPREFIX,
"%s: intremap index (%d) is larger than"
- " the maximum index (%ld)!\n",
+ " the maximum index (%d)!\n",
__func__, index, IREMAP_ENTRY_NR - 1);
spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags);
return -EFAULT;
@@ -502,7 +502,7 @@ static int msi_msg_to_remap_entry(
{
dprintk(XENLOG_ERR VTDPREFIX,
"%s: intremap index (%d) is larger than"
- " the maximum index (%ld)!\n",
+ " the maximum index (%d)!\n",
__func__, index, IREMAP_ENTRY_NR - 1);
msi_desc->remap_index = -1;
spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags);
@@ -617,7 +617,7 @@ int enable_intremap(struct iommu *iommu)
if ( ir_ctrl->iremap_maddr == 0 )
{
drhd = iommu_to_drhd(iommu);
- ir_ctrl->iremap_maddr = alloc_pgtable_maddr(drhd, 1);
+ ir_ctrl->iremap_maddr = alloc_pgtable_maddr(drhd, IREMAP_PAGE_NR );
if ( ir_ctrl->iremap_maddr == 0 )
{
dprintk(XENLOG_WARNING VTDPREFIX,
Index: hv/xen/drivers/passthrough/vtd/iommu.h
===================================================================
--- hv.orig/xen/drivers/passthrough/vtd/iommu.h
+++ hv/xen/drivers/passthrough/vtd/iommu.h
@@ -302,7 +302,14 @@ struct iremap_entry {
}hi;
};
};
-#define IREMAP_ENTRY_NR (PAGE_SIZE_4K/sizeof(struct iremap_entry))
+
+/* Max intr remapping table page order is 8, as max number of IRTEs is 64K */
+#define IREMAP_PAGE_ORDER 8
+#define IREMAP_PAGE_NR ( 1 << IREMAP_PAGE_ORDER )
+
+/* Each entry is 16 byte */
+#define IREMAP_ENTRY_NR ( 1 << ( IREMAP_PAGE_ORDER + 8 ) )
+
#define iremap_present(v) ((v).lo & 1)
#define iremap_fault_disable(v) (((v).lo >> 1) & 1)
@@ -429,9 +436,9 @@ struct qinval_entry {
#define IEC_GLOBAL_INVL 0
#define IEC_INDEX_INVL 1
#define IRTA_REG_EIME_SHIFT 11
-#define IRTA_REG_TABLE_SIZE 7 // 4k page = 256 * 16 byte entries
- // 2^^(IRTA_REG_TABLE_SIZE + 1) = 256
- // IRTA_REG_TABLE_SIZE = 7
+
+/* 2^(IRTA_REG_TABLE_SIZE + 1) = IREMAP_ENTRY_NR */
+#define IRTA_REG_TABLE_SIZE ( IREMAP_PAGE_ORDER + 7 )
#define VTD_PAGE_TABLE_LEVEL_3 3
#define VTD_PAGE_TABLE_LEVEL_4 4
[-- 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] 5+ messages in thread* Re: [PATCH] [IOMMU] enlarge intr remapping table
2009-09-25 7:11 [PATCH] [IOMMU] enlarge intr remapping table Zhai, Edwin
@ 2009-09-25 8:04 ` Jan Beulich
2009-09-25 8:36 ` Zhai, Edwin
0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2009-09-25 8:04 UTC (permalink / raw)
To: Keir Fraser, Edwin Zhai; +Cc: Xen Developers
>>> "Zhai, Edwin" <edwin.zhai@intel.com> 25.09.09 09:11 >>>
>This patch enlarges interrupt remapping table to fix the out-of range
>table access when using many multiple-function PCI devices.
>
>Signed-Off-By: Zhai Edwin <edwin.zhai@intel.com>
This can't be working: Wherever iremap_maddr gets mapped, only a single
page is being mapped.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] [IOMMU] enlarge intr remapping table
2009-09-25 8:04 ` Jan Beulich
@ 2009-09-25 8:36 ` Zhai, Edwin
2009-09-25 8:43 ` Jan Beulich
0 siblings, 1 reply; 5+ messages in thread
From: Zhai, Edwin @ 2009-09-25 8:36 UTC (permalink / raw)
To: Jan Beulich; +Cc: Xen Developers, Keir Fraser
Jan Beulich wrote:
>>>> "Zhai, Edwin" <edwin.zhai@intel.com> 25.09.09 09:11 >>>
>>>>
>> This patch enlarges interrupt remapping table to fix the out-of range
>> table access when using many multiple-function PCI devices.
>>
>> Signed-Off-By: Zhai Edwin <edwin.zhai@intel.com>
>>
>
> This can't be working: Wherever iremap_maddr gets mapped, only a single
> page is being mapped.
>
Is there any API can be used to map a series of continuous pages?
> Jan
>
>
--
best rgds,
edwin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] [IOMMU] enlarge intr remapping table
2009-09-25 8:36 ` Zhai, Edwin
@ 2009-09-25 8:43 ` Jan Beulich
2009-09-25 8:52 ` Zhai, Edwin
0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2009-09-25 8:43 UTC (permalink / raw)
To: Edwin Zhai; +Cc: Xen Developers, Keir Fraser
>>> "Zhai, Edwin" <edwin.zhai@intel.com> 25.09.09 10:36 >>>
>Is there any API can be used to map a series of continuous pages?
No, you'll have to figure which one you really need. And even if there
was, you surely wouldn't want to map all 256 at one time.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] [IOMMU] enlarge intr remapping table
2009-09-25 8:43 ` Jan Beulich
@ 2009-09-25 8:52 ` Zhai, Edwin
0 siblings, 0 replies; 5+ messages in thread
From: Zhai, Edwin @ 2009-09-25 8:52 UTC (permalink / raw)
To: Jan Beulich; +Cc: Xen Developers, Keir Fraser
Thanks,
I'll modify my patch.
Jan Beulich wrote:
>>>> "Zhai, Edwin" <edwin.zhai@intel.com> 25.09.09 10:36 >>>
>>>>
>> Is there any API can be used to map a series of continuous pages?
>>
>
> No, you'll have to figure which one you really need. And even if there
> was, you surely wouldn't want to map all 256 at one time.
>
> Jan
>
>
--
best rgds,
edwin
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-09-25 8:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-25 7:11 [PATCH] [IOMMU] enlarge intr remapping table Zhai, Edwin
2009-09-25 8:04 ` Jan Beulich
2009-09-25 8:36 ` Zhai, Edwin
2009-09-25 8:43 ` Jan Beulich
2009-09-25 8:52 ` Zhai, Edwin
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.