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

Re: [Xen-devel] Frame buffer mmap not working in pvops dom0

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: Re: [Xen-devel] Frame buffer mmap not working in pvops dom0
From: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Date: Wed, 21 Jul 2010 15:22:49 -0400
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 21 Jul 2010 12:23:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20100721190056.GA9756@xxxxxxxxxxxxxxxxxxx>
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>
Organization: National Security Agency
References: <4C46FA8D.6040809@xxxxxxxxxxxxx> <20100721141613.GG17817@xxxxxxxxxxx> <20100721144209.GA5031@xxxxxxxxxxxxxxxxxxx> <4C4711BB.5090905@xxxxxxxxxxxxx> <20100721190056.GA9756@xxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Thunderbird/3.0.5
On 07/21/2010 03:00 PM, Konrad Rzeszutek Wilk wrote:
>> I have been dumping the page tables (using the attached pt-dump script,
>> as qemu's "info tlb" only works on i386) from a paused qemu instance
>> that is running a simple mmap-and-spin program (also attached). All 100
>> pages map to physical memory address 39a4c000.
> 
> The qemu output then isn't going to a VNC window but something else. I
> presume the something else is the SDL piece? Were there any special flags
> to enable this on QEMU?

The exact command line I'm using is:

qemu-kvm -daemonize -usbdevice tablet -m 1024 \
        -monitor unix:fc13-mon,server,nowait \
        -net nic -net tap /dev/lvm0/FC13-64

This uses SDL graphics, which is qemu's default. Within qemu, I use
vga=ask on the xen command line in grub.

>> >From a bit more debugging, I've been able to trace the correct address
>> (0xf0000000) being lost when it is passed by xen_make_pte to
>> pte_pfn_to_mfn and eventually to get_phys_to_machine(0xf0000) which
>> returns -1. Still not sure where the final physical address is coming
>> from, but I'm guessing this is part of the problem.
> 
> That looks like the VM_IO flag (_PAGE_IOMAP on the PTE) is not set somewhere.
> Do you have an idea what piece of kernel code gets triggered when QEMU does
> 'mmap' on the /dev/fb0?
> 
> On my machine where I use KMS/DRM it ends up calling 'ttm_fb_mmap'. But
> for your system, where it looks that you are using the "old" framebuffer
> code it might be something entirely different.
> 

The code path is fb_mmap with a NULL fbops->fb_mmap, so it just
delegates to the default code. Specifically, io_remap_pfn_range is where
the bad mapping is requested.

I have a patch that fixes the issue, but I'm not sure under what
conditions the _PAGE_IOMAP bit needs to be set.

--- a/arch/x86/include/asm/fb.h
+++ b/arch/x86/include/asm/fb.h
@@ -10,6 +10,7 @@ static inline void fb_pgprotect
 {
        if (boot_cpu_data.x86 > 3)
                pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
+       pgprot_val(vma->vm_page_prot) |= _PAGE_IOMAP;
 }

 #ifdef CONFIG_X86_32

-- 

Daniel De Graaf
National Security Agency

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