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] Fbdev graphics broken in xen/next dom0

To: Eamon Walsh <ewalsh@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Fbdev graphics broken in xen/next dom0
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Tue, 16 Mar 2010 18:19:52 -0400
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, George Coker <gscoker@xxxxxxxxxxxxx>
Delivery-date: Tue, 16 Mar 2010 15:47:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4B9FFD87.6010908@xxxxxxxxxxxxx>
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: <4B9AA301.6090303@xxxxxxxxxxxxx> <4B9AB559.1070709@xxxxxxxx> <4B9ADFDB.1070300@xxxxxxxxxxxxx> <4B9AE192.30104@xxxxxxxx> <20100316004630.GA7622@xxxxxxxxxxxxxxxxxxx> <4B9FFD87.6010908@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.19 (2009-01-05)
> 
> The serial output is attached.
> 
> The patch I used to instrument the fb_mmap function and the output it
> produced for a couple of runs are also attached.
> 
> And I tossed in my kernel .config for good measure.
> 
> What else is needed?

It looks that I confused your email with another person. You don't seem
to run the nvidia fb, but rather the radeon one.

.. snip ..
> Non-volatile memory driver v1.3
> Linux agpgart interface v0.103
> agpgart-intel 0000:00:00.0: Intel Q45/Q43 Chipset
> agpgart-intel 0000:00:00.0: detected 32764K stolen memory
> agpgart-intel 0000:00:00.0: AGP aperture is 256M @ 0xd0000000
> tpm_tis 00:08: 1.2 TPM (device-id 0x4A10, rev-id 78)
> [drm] Initialized drm 1.1.0 20060810
> [drm] radeon defaulting to kernel modesetting.
> [drm] radeon kernel modesetting enabled.
> xen_allocate_pirq: returning irq 16 for gsi 16
> Already setup the GSI :16
> i915 0000:00:02.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
> [drm] set up 31M of stolen space
> [drm] TMDS-8: set mode 1280x1024 17
> Console: switching to colour frame buffer device 160x64
> fb0: inteldrmfb frame buffer device
> registered panic notifier
> [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0

You look to have a i915 framebuffer on your box.

I *think* that the i915 is not using KMS and the TTM stuff, so the
patch that Arvind posted would probably not help you.
http://www.mail-archive.com/dri-devel@xxxxxxxxxxxxxxxxxxxxx/msg48668.html

So, lets boot your kernel with these command line parameters to get more
data: debug initcall_debug drm.debug=255

That should spew out some more details.

Next thing I would suggest is to instrument i915_gem_fault. Attached is
a patch that does it (thought it is not compile tested nor actually
booted so it might need some hand crafting - sorry).

And the other thing is to read through the steps that Arvind took in the
e-mail thread titled: "Nouveau on dom0". It covers the gamma of things
to troubleshoot this.

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index fba37e9..cfcaafd 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -33,6 +33,8 @@
 #include "intel_drv.h"
 #include <linux/swap.h>
 #include <linux/pci.h>
+#include <xen/xen.h>
+#include <asm/xen/page.h>
 
 #define I915_GEM_GPU_DOMAINS   (~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT))
 
@@ -1145,6 +1147,143 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
        return 0;
 }
 
+void print_pte(struct vm_area_struct *vma, char *what, struct page *page, 
unsigned int pfn, unsigned long address)
+{
+       static const char * const level_name[] =
+         { "NONE", "4K", "2M", "1G", "NUM" };
+       unsigned long addr = 0;
+       pte_t *pte = NULL;
+       pteval_t val = (pteval_t)0;
+       unsigned int level = 0;
+       unsigned offset;
+       unsigned long phys;
+       pgprotval_t prot;
+       char buf[90];
+       char *str;
+
+       str = buf;
+       // Figure out if the address is pagetable.
+       if (address == 0 && !page && pfn>0) {
+               page = pfn_to_page(pfn);
+       }
+       if (address == 0 && page)
+               addr = (u64)page_address(page);
+
+       if (address && !page)
+               addr = address;
+
+       if (address && page) {
+               addr = (u64)page_address(page);
+               if (address != addr) {
+                       if (addr == 0) {
+                               str += sprintf(str, "addr(page)==0");
+                               addr = address;
+                       }
+               }
+       }
+
+       if (pfn != 0 && page) {
+               if (pfn != page_to_pfn(page)) // Gosh!?
+                       str += sprintf(str, "pfn!=pfn(page)");
+       }
+       if (pfn != 0 && addr != 0) {
+               if (pfn != virt_to_pfn(addr))
+                       str += sprintf(str,"pfn(addr)!=pfn");
+       }
+       pte = lookup_address(addr, &level);
+       if (!pte) {
+               str += sprintf(str,"!pte(addr)");
+               goto print;
+       }
+       offset = addr & ~PAGE_MASK;
+
+       if (xen_domain()) {
+               phys = (pte_mfn(*pte) << PAGE_SHIFT) + offset;          
+               val = pte_val_ma(*pte);
+
+               if (pfn > 0) {
+                       if (pte_mfn(*pte) == pfn) {
+                               if  (vma->vm_flags && VM_IO)
+                                       str += sprintf(str,"PHYS");
+                               else
+                                       str += sprintf(str,"BUG: VM_IO not 
set!");
+                       }
+                       /* It is a pseudo page ... and the VM_IO flag is set */
+                       if (pte_mfn(*pte) != pfn) {
+                               if (vma->vm_flags && VM_IO)
+                                       str += sprintf(str,"BUG: VM_IO flag 
set!");
+                               else
+                                       str += sprintf(str, "PSEUDO");
+                       }
+               } else {
+                       str += sprintf(str,"pfn==0");
+               }
+
+       } else {
+               phys = (pte_pfn(*pte) << PAGE_SHIFT) + offset;
+               val = pte_val(*pte);
+       }       
+       prot = pgprot_val(pte_pgprot(*pte));
+
+       if (!prot)
+               str += sprintf(str, "Not present.");
+       else  {
+               if (prot & _PAGE_USER)
+                       str += sprintf(str, "USR ");
+               else
+                       str += sprintf(str, "    ");
+               if (prot & _PAGE_RW)
+                       str += sprintf(str, "RW ");
+               else
+                       str += sprintf(str, "ro ");
+               if (prot & _PAGE_PWT)
+                       str += sprintf(str, "PWT ");
+               else
+                       str += sprintf(str, "    ");
+               if (prot & _PAGE_PCD)
+                       str += sprintf(str, "PCD ");
+               else
+                       str += sprintf(str, "    ");
+
+               /* Bit 9 has a different meaning on level 3 vs 4 */
+               if (level <= 3) {
+                       if (prot & _PAGE_PSE)
+                               str += sprintf(str, "PSE ");
+                       else
+                               str += sprintf(str, "    ");
+               } else {
+                       if (prot & _PAGE_PAT)
+                               str += sprintf(str, "pat ");
+                       else
+                               str += sprintf(str, "    ");
+               }
+               if (prot & _PAGE_GLOBAL)
+                       str += sprintf(str, "GLB ");
+               else
+                       str += sprintf(str, "    ");
+               if (prot & _PAGE_NX)
+                       str += sprintf(str, "NX ");
+               else
+                       str += sprintf(str, "x  ");
+#ifdef _PAGE_IOMEM
+               if (prot & _PAGE_IOMEM)
+                       str += sprintf(str, "IO ");
+               else
+                       str += sprintf(str, "   ");
+#endif
+               
+       }
+
+print:
+       printk(KERN_INFO "[%16s]PFN: 0x%lx PTE: 0x%lx (val:%lx): [%s] [%s]\n",
+                       what,
+                       (unsigned long)pfn,
+                       (pte) ? (unsigned long)(pte->pte) : 0,
+                       (unsigned long)val,
+                       buf,
+                       level_name[level]);
+}
+
 /**
  * i915_gem_fault - fault a page into the GTT
  * vma: VMA in question
@@ -1200,8 +1339,10 @@ int i915_gem_fault(struct vm_area_struct *vma, struct 
vm_fault *vmf)
        pfn = ((dev->agp->base + obj_priv->gtt_offset) >> PAGE_SHIFT) +
                page_offset;
 
+       print_pte(vma,"before",  NULL, pfn, 0);
        /* Finally, remap it using the new GTT offset */
        ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
+       print_pte(vma, "after",  NULL, pfn, (unsigned long) 
vmf->virtual_address);
 unlock:
        mutex_unlock(&dev->struct_mutex);
 

Attachment: debug-print-pte-i915.patch
Description: Text document

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