WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] RE: [PATCH][VTD] pci mmcfg patch for x86-64 - version 2

To: Jan Beulich <jbeulich@xxxxxxxxxx>
Subject: [Xen-devel] RE: [PATCH][VTD] pci mmcfg patch for x86-64 - version 2
From: "Kay, Allen M" <allen.m.kay@xxxxxxxxx>
Date: Tue, 9 Dec 2008 14:37:29 -0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: Espen Skoglund <espen.skoglund@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "Han, Weidong" <weidong.han@xxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Tue, 09 Dec 2008 14:38:06 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <493E5B7D.76E4.0078.0@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <57C9024A16AD2D4C97DC78E552063EA35C77DA3B@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <493E5B7D.76E4.0078.0@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AclZ6+r2DhOq0ByGSZKZ+MM8Fh09AQAYrvfg
Thread-topic: [PATCH][VTD] pci mmcfg patch for x86-64 - version 2
Fixed.  Will include in the next revision.  Thanks!

Allen 

>-----Original Message-----
>From: Jan Beulich [mailto:jbeulich@xxxxxxxxxx] 
>Sent: Tuesday, December 09, 2008 2:50 AM
>To: Kay, Allen M
>Cc: Keir Fraser; Han, Weidong; xen-devel@xxxxxxxxxxxxxxxxxxx; 
>Espen Skoglund
>Subject: Re: [PATCH][VTD] pci mmcfg patch for x86-64 - version 2
>
>>>> "Kay, Allen M" <allen.m.kay@xxxxxxxxx> 08.12.08 23:33 >>>
>>+#define PCI_MCFG_VIRT_START     (PML4_ADDR(257))
>>+#define PCI_MCFG_VIRT_END       (RDWR_MPT_VIRT_START + 
>PML4_ENTRY_BYTES)
>
>The latter line is certainly wrong.
>
>>+static void __iomem * __init mcfg_ioremap(struct 
>acpi_mcfg_allocation *cfg)
>>+{
>>+     void __iomem *addr;
>>+     unsigned long virt;
>>+     unsigned long mfn;
>>+     unsigned long size, nr_mfn;
>>+
>>+        /* see asm-x86/config.h, only 2048 PCI segments are 
>supported) */
>>+        BUG_ON(cfg->pci_segment >= 2048);
>
>This seems an inappropriate use of BUG_ON() - should either return NULL
>here or map just the first 2048 segments (and check in other places
>accordingly). Also, I'd say you shouldn't have a literal 2048 
>here, but rather
>calculate the number from PCI_MCFG_VIRT_END.
>
>>+     virt = PCI_MCFG_VIRT_START + (cfg->pci_segment * (1 << 22)) +
>>+               (cfg->start_bus_number * (1 << 20));
>
>Isn't the first (segment) shift value supposed to be 28? Also, 
>you have to
>use 1UL there, otherwise the multiplication will get truncated 
>to 32 bits.
>
>>+     mfn = cfg->address >> PAGE_SHIFT;
>>+        size = (cfg->end_bus_number - cfg->start_bus_number) << 20;
>
>Since end_bus_number is the last valid number, you need to add 1 here
>I would think.
>
>Jan
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel