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-ia64-devel

[Xen-ia64-devel] [Patch] cleanup warning of UC|WB attribute page

To: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-ia64-devel] [Patch] cleanup warning of UC|WB attribute page
From: Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>
Date: Sun, 06 May 2007 11:32:55 +0900
Delivery-date: Sat, 05 May 2007 19:29:59 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi,

This patch for cleanup the following warnings.

(XEN) mm.c:497:d0 Warning: UC to WB for mpaddr=xxxxxxxx

Currently UC|WB atrribute page is mapped as WB page.
So, if dom0 accsess UC|WB page as UC page, then we get the warnings.

I don't know why there are UC|WB attribute pages,
but actually there seems to be them in efi memmap.

(XEN) dom mem: type=13, attr=0x8000000000000008, 
range=[0x0000000000000000-0x0000000000001000) (4KB)
(XEN) dom mem: type=10, attr=0x8000000000000008, 
range=[0x0000000000001000-0x0000000000002000) (4KB)
(XEN) dom mem: type= 6, attr=0x8000000000000008, 
range=[0x0000000000002000-0x0000000000003000) (4KB)
(XEN) dom mem: type= 7, attr=0x0000000000000008, 
range=[0x0000000000003000-0x00000000000a0000) (628KB)
(XEN) dom mem: type= 6, attr=0x8000000000000009, 
range=[0x00000000000c0000-0x0000000000100000) (256KB)
(XEN) dom mem: type= 7, attr=0x0000000000000008, 
range=[0x0000000000100000-0x0000000004000000) (63MB)
[snip...]
(XEN) dom mem: type= 7, attr=0x0000000000000008, 
range=[0x000000006d3fc000-0x000000006d456000) (360KB)
(XEN) dom mem: type= 5, attr=0x8000000000000009, 
range=[0x000000006d456000-0x000000006d4fc000) (664KB)
(XEN) dom mem: type= 7, attr=0x0000000000000008, 
range=[0x000000006d4fc000-0x000000006d774000) (2MB)
(XEN) dom mem: type= 6, attr=0x8000000000000009, 
range=[0x000000006d774000-0x000000006d800000) (560KB)
(XEN) dom mem: type= 5, attr=0x8000000000000009, 
range=[0x000000007f884000-0x000000007fc7c000) (3MB)
(XEN) dom mem: type= 6, attr=0x8000000000000009, 
range=[0x000000007fc7c000-0x000000007fd00000) (528KB)
(XEN) dom mem: type= 8, attr=0x0000000000000008, 
range=[0x000000007fd00000-0x000000007fd42000) (264KB)
(XEN) dom mem: type= 5, attr=0x8000000000000009, 
range=[0x000000007fd64000-0x0000000080000000) (2MB)
(XEN) dom mem: type=11, attr=0x8000000000000001, 
range=[0x00000000fe000000-0x00000000fec00000) (12MB)
(XEN) dom mem: type=11, attr=0x0000000000000001, 
range=[0x00000000fec00000-0x00000000fef00000) (3MB)
(XEN) dom mem: type= 6, attr=0x8000000000000001, 
range=[0x00000000ff000000-0x0000000100000000) (16MB)
(XEN) dom mem: type= 7, attr=0x0000000000000008, 
range=[0x0000000100000000-0x0000000800000000) (28672MB)
(XEN) dom mem: type= 7, attr=0x0000000000000008, 
range=[0x0000004080000000-0x0000004091695000) (278MB)
(XEN) dom mem: type=11, attr=0x8000000000000001, 
range=[0x00000ffc00000000-0x00000ffc80000000) (2048MB)
(XEN) dom mem: type=12, attr=0x8000000000000001, 
range=[0x0003fffffc000000-0x0004000000000000) (64MB)

Signed-off-by: Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>


Best Regards,

Akio Takebe

---
diff -r 63263d715d43 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Thu May 03 14:38:26 2007 -0600
+++ b/xen/arch/ia64/xen/mm.c    Sun May 06 12:55:52 2007 +0900
@@ -493,6 +493,8 @@ u64 translate_domain_pte(u64 pteval, u64
                           port space.  Also prevents possible address
                           aliasing issues.  */
                        if (!(mpaddr - IO_PORTS_PADDR < IO_PORTS_SIZE))
+                       /* and also except UC|WB page */
+                       if (!efi_ucwb(mpaddr, PAGE_SIZE)) 
                                gdprintk(XENLOG_WARNING, "Warning: UC to WB "
                                         "for mpaddr=%lx\n", mpaddr);
                        pteval = (pteval & ~_PAGE_MA_MASK) | _PAGE_MA_WB;
@@ -956,6 +958,52 @@ assign_domain_same_page(struct domain *d
         (void)__assign_domain_page(d, mpaddr, mpaddr, flags);
     }
 }
+
+int
+efi_ucwb(unsigned long physaddr, unsigned long size)
+{
+    void *efi_map_start, *efi_map_end;
+    u64 efi_desc_size;
+    void* p;
+
+    efi_map_start = __va(ia64_boot_param->efi_memmap);
+    efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
+    efi_desc_size = ia64_boot_param->efi_memdesc_size;
+
+    for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
+        efi_memory_desc_t* md = (efi_memory_desc_t *)p;
+        unsigned long start = md->phys_addr;
+        unsigned long end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
+
+        if (start <= physaddr && physaddr < end) {
+            if ((physaddr + size) > end) {
+                gdprintk(XENLOG_INFO, "%s: physaddr 0x%lx size = 0x%lx\n",
+                        __func__, physaddr, size);
+                return 0;
+            }
+
+            // for UC space
+            if (md->type == EFI_RUNTIME_SERVICES_CODE ||
+                md->type == EFI_RUNTIME_SERVICES_DATA ||
+                md->type == EFI_ACPI_RECLAIM_MEMORY   ||
+                md->type == EFI_ACPI_MEMORY_NVS       ||
+                md->type == EFI_RESERVED_TYPE){
+                if( md->attribute & EFI_MEMORY_WB &&
+                    md->attribute & EFI_MEMORY_UC )
+                        return 1;
+            }
+
+            return 0;
+        }
+
+        if (physaddr < start) {
+            break;
+        }
+    }
+
+    return 1;
+}
+
 
 int
 efi_mmio(unsigned long physaddr, unsigned long size)
diff -r 63263d715d43 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Thu May 03 14:38:26 2007 -0600
+++ b/xen/include/asm-ia64/mm.h Sun May 06 12:55:52 2007 +0900
@@ -431,6 +431,7 @@ extern unsigned long assign_domain_mmio_
 extern unsigned long assign_domain_mmio_page(struct domain *d, unsigned long 
mpaddr, unsigned long phys_addr, unsigned long size, unsigned long flags);
 extern unsigned long assign_domain_mach_page(struct domain *d, unsigned long 
mpaddr, unsigned long size, unsigned long flags);
 int domain_page_mapped(struct domain *d, unsigned long mpaddr);
+int efi_ucwb(unsigned long physaddr, unsigned long size);
 int efi_mmio(unsigned long physaddr, unsigned long size);
 extern unsigned long ____lookup_domain_mpa(struct domain *d, unsigned long 
mpaddr);
 extern unsigned long do_dom0vp_op(unsigned long cmd, unsigned long arg0, 
unsigned long arg1, unsigned long arg2, unsigned long arg3);


_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel