xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Michael D Labriola <mlabriol@gdeb.com>
Cc: Arvind R <arvino55@gmail.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	xen-devel@lists.xensource.com,
	Joanna Rutkowska <joanna@invisiblethingslab.com>,
	xen-devel-bounces@lists.xensource.com
Subject: Re: Re: [Patch RFC] ttm: nouveau accelerated on Xen pv-ops kernel
Date: Wed, 9 Jun 2010 13:43:42 -0400	[thread overview]
Message-ID: <20100609174342.GA13712@phenom.dumpdata.com> (raw)
In-Reply-To: <OF5A3547F1.A198374F-ON852576E7.004EC871-852576E7.005101FB@gdeb.com>

> > >>>         vma->vm_private_data = bo;
> > >>> -       vma->vm_flags |= VM_RESERVED | VM_IO | VM_MIXEDMAP |
> > >>> VM_DONTEXPAND;
> > >>> +       vma->vm_flags |= VM_RESERVED | VM_MIXEDMAP |
> > >>> VM_DONTEXPAND;
> > >>> +       if (!((bo->mem.placement & TTM_PL_MASK_MEM) &
> > >>> TTM_PL_FLAG_TT))
> > >>> +               vma->vm_flags |= VM_IO;
> > >>> +       vma->vm_page_prot = vma_get_vm_prot(vma->vm_flags);
> > >>>         return 0;
> > >>>  out_unref:
> > >>>         ttm_bo_unref(&bo);
> > >>>
.. snip.
> > >>> nVidia GeForce 9400 GT.

..snip..
> 
> Hmm... I just verified that this patch fixes KMS/Nouveau issues in Xen on 
> my two primary test boxes (GeForce 6200, GeForce 7300).  However, on my 
> really old machines (AGP GeForce2 MX200), this causes a new crash.  These 
> old boxes were actually working fine in Xen prior to this patch, just 
> w/out 3d acceleration.  Now I get the following messages in dmesg:
> 
> [  129.637319] [drm] nouveau 0000:01:00.0: Allocating FIFO number 1
> [  129.638853] [drm] nouveau 0000:01:00.0: nouveau_channel_alloc: 
> initialised FIFO 1
> [  129.643791] X: Corrupted page table at address 40412000
> [  129.643815] *pdpt = 0000000015216001 *pde = 0000000000000000 
> [  129.643856] Bad pagetable: 000f [#1] SMP 
.. snip..
> [  129.652216] [drm] nouveau 0000:01:00.0: nouveau_channel_free: freeing 
> fifo 1
> 
> 
> And my X log ends abruptly after this line:
> (II) NOUVEAU(0): Opened GPU Channel 1


So, I've spent the last two weeks trying to get this to work.

What I found out was that the majority of the problems were with the Linux AGP code
(drivers/char/agp/*). Now I can get Kernel Modesetting 
working under Radeon HD3200 (PCI-e), NVidia GeForce FX5200 (AGP), and I think
other ones too (hadn't tested yet). However, I am still failing at the same
spot as Michael: the dreaded Opened GPU Channel 1...

Anyhow.. if you want the patches:

git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git devel/kms-fixes

(and the "devel/drm.backport" which is a drop of drm/* from 2.6.34-rc7 in
2.6.32 universe).

The explanation:

1). Newer boxes with PCI-e cards with more than 4GB allocated to dom0.
Those cards have their own IOMMU built in on the cards and use the PCI
DMA. The problem is that some of those cards set the DMA mask to 32-bit,
meaning they are only comfortable allocating pages under the 4GB mark.
The Xen-SWIOTLB kicks in and happily gives a bounce buffer for pages
that are above the 32-bit mark, which are then programmed to the IOMMU.
Except that the graphic drivers do not sync the bounce buffer so the
result ends up stored in the bounce buffer and not in the buffer the
graphic drivers expect (oops).  That however should not have happend
as any pages allocated from the TTM library use the 'alloc_page' with
 _GFP_DMA32 flag, which means that all of those pages WILL be under
4GB under baremetal. However under Xen that flag is useless and the page
can be very well allocated above the 4GB mark (and is if you are using
the debug Xen hypervisor). The patch titled
 "ttm: When TTM_PAGE_FLAG_DMA32 allocate pages under" fixes that by
replacing the PFNs with ones under the 4GB.

It makes my Radeon HD3200 work, and I believe other PCI-e cards too.

2). i915 cards:
The earlier cards (before PCI-e) depend on the AGP to the virtual to
physical address translations.  The old AGP code is safe for specific 
controllers: say i915 - and only if you have CONFIG_DMAR enabled. So
there is a patch if you don't have that enabled:

      intel-agp: Warn when !USE_PCI_DMA_API and inserting bogus bus addresses.

3) i915 and before.
For older ones, such as the ICH5 (which has an i860 chipset), the Linux
code blindly uses the virt_to_phys and page_to_phys which are not
Xen-safe. For this fancy NV30 card (which is AGP) I've gotten to the
point of the framebuffer displaying properly. The patches that fix this
are:
  intel-agp: Use Xen back-door to get page's physical address for i8[1,3]0
      agp-backend: Use Xen back-door to get bus address for scratch page.
      agp: If _GFP_DMA_32 flag is set enforce pages to be under 4GB under Xen.
      agp: Program the GART with the real physical address under Xen.
      agp: Use Xen back-door to get bus address for legacy code.


4). I did check out the AGP code for the other chipsets, so added
experimental support for AMD64 chipset. Haven't tested it at all.

Summary:
Most of those patches are not upstream materials. Right now I am
just trying to get those bugs fixed and then later on revisit them with
a more comprehensive patch.

  parent reply	other threads:[~2010-06-09 17:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 13:21 [Patch RFC] nouveau accelerated on Xen pv-ops kernel Arvind R
     [not found] ` <d799c4761003100521h663c82eepda85f3f0309828c2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-11 11:02   ` [Patch RFC] ttm: " Pekka Paalanen
2010-03-12  5:27     ` Arvind R
2010-03-28 10:20       ` Joanna Rutkowska
2010-03-30  5:50         ` Arvind R
2010-03-12 12:45     ` Arvind R
2010-03-12 13:20       ` Michael D Labriola
2010-03-13 22:03       ` Joanna Rutkowska
2010-03-15 14:44         ` Michael D Labriola
2010-03-15 23:13           ` Jeremy Fitzhardinge
2010-03-16  7:18             ` Arvind R
2010-03-16 16:48               ` Michael D Labriola
2010-03-16 16:40             ` Michael D Labriola
2010-03-16 17:21               ` Konrad Rzeszutek Wilk
2010-03-16 19:39                 ` Michael D Labriola
2010-03-16 19:41                   ` Konrad Rzeszutek Wilk
2010-03-17  1:01                     ` Konrad Rzeszutek Wilk
2010-03-18  6:09                   ` Arvind R
2010-03-19 15:29                     ` Michael D Labriola
2010-03-20  6:01                       ` Arvind R
2010-03-22 21:14                         ` Michael D Labriola
2010-03-23  6:21                           ` Arvind R
2010-03-23 12:45                             ` Michael D Labriola
2010-03-23 13:27                             ` Michael D Labriola
2010-03-25  7:05                               ` Arvind R
2010-03-25  7:18           ` Jeremy Fitzhardinge
2010-03-29 14:42             ` Michael D Labriola
2010-06-09 17:43           ` Konrad Rzeszutek Wilk [this message]
2010-06-09 18:39             ` Pasi Kärkkäinen
2010-06-09 19:31               ` Konrad Rzeszutek Wilk
2010-06-17 17:51             ` Konrad Rzeszutek Wilk
2010-06-22 22:32               ` Joanna Rutkowska
2010-06-23 12:54                 ` Konrad Rzeszutek Wilk
2010-06-23 13:21                   ` Joanna Rutkowska
2010-06-23 14:38                     ` Konrad Rzeszutek Wilk
2010-06-23 15:08                       ` Konrad Rzeszutek Wilk
2010-06-24 19:55                   ` Pasi Kärkkäinen
2010-06-24 21:00                     ` Konrad Rzeszutek Wilk
     [not found]       ` <d799c4761003120445h57ab1373m31eb0add242ef74c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-16 13:25         ` Thomas Hellstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100609174342.GA13712@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=arvino55@gmail.com \
    --cc=jeremy@goop.org \
    --cc=joanna@invisiblethingslab.com \
    --cc=mlabriol@gdeb.com \
    --cc=xen-devel-bounces@lists.xensource.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).