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] [Solved] Nouveau on dom0

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: Re: [Xen-devel] [Solved] Nouveau on dom0
From: Arvind R <arvino55@xxxxxxxxx>
Date: Fri, 12 Mar 2010 11:42:05 +0530
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 11 Mar 2010 22:13:04 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=EeYVXoPvDT0BJhsMBRrPh8Cg73HIxNM7AuWjtUlpp+Y=; b=UQpeAJxYXp5cXktmz3il8cVyb1ajRfXRbw1CtECCSX6YPnte96WrZJNe1iIjIfw2qk 9bTFNuxxBsv6Bb7Djd6kBeWhF8VuHRYwbth8rjFOew7kr+0mO/jmLzZQbeSAozSxx11m 3IF0og8c4kRR/5Ucv1do4/BRpk1gseAd0D5ZU=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=rk0QdTpxw8EtIpjrPlyN8DWmwiGLi/9tJZIYAuMKop25gZTgjTmdfhcoP5UWXrqSSY AFpY/o/7eObWIyfWYFGuqWfiU68bSki/nhekwVug4htLTmyj9MVtZHEQDhHn3R8X6dLf XecCsp6os28BA8l/kHdrdPZNvtuTyoXausVpI=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20100311201536.GA22182@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>
References: <20100303181303.GA21078@xxxxxxxxxxxxxxxxxxx> <20100304182518.GB20263@xxxxxxxxxxxxxxxxxxx> <d799c4761003042346k1bc2477mb7711927ea54fb7a@xxxxxxxxxxxxxx> <20100305202309.GA15454@xxxxxxxxxxxxxxxxxxx> <d799c4761003060016o292a5874s91d729893db465c6@xxxxxxxxxxxxxx> <d799c4761003061259u1c8986e9j4ef1e84e1ee8e7df@xxxxxxxxxxxxxx> <d799c4761003061556k795b674do622e0a7d038e0b9@xxxxxxxxxxxxxx> <20100308175127.GF4568@xxxxxxxxxxxxxxxxxxx> <d799c4761003100450v650d2cfbq5e6a8764cc5b189f@xxxxxxxxxxxxxx> <20100311201536.GA22182@xxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, Mar 12, 2010 at 1:45 AM, Konrad Rzeszutek Wilk
<konrad.wilk@xxxxxxxxxx> wrote:
>> >> THAT SOLVED THE FAULTING; OUT_RING now completes under Xen.
>
> :-)
>
>> >
>> > That is great! Thanks for doing all the hard-work in digging through the
>> > code.
>> >
>> >
>> > So this means you got graphics on the screen? Or at least that Kernel
>> > Mode Setting and the DRM parts show fancy graphics during boot?
>>
>> AT LAST, yes! Patch: (after aboout 600 reboots!)
>>
>> diff -Naur nouveau-kernel.orig/drivers/gpu/drm/ttm/ttm_bo_vm.c
>> nouveau-kernel.new/drivers/gpu/drm/ttm/ttm_bo_vm.c
>> --- nouveau-kernel.orig/drivers/gpu/drm/ttm/ttm_bo_vm.c 2010-01-27
>> 10:19:28.000000000 +0530
>> +++ nouveau-kernel.new/drivers/gpu/drm/ttm/ttm_bo_vm.c  2010-03-10
>> 17:28:59.000000000 +0530
>> @@ -271,7 +271,10 @@
>>          */
>>
>>         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);
>>
Sorry for the typo:
vma_get_vm_prot in last added line should be vm_get_page_prot

>> The previous patch worked for memory-space exported to user via
>> mmap. That worked for the pushbuf, but not for mode-setting (I guess).
>> The ensuing crashes were hard - no logs, nothing. So had to devise
>> ways of forcing log-writing before crashing (and praying). The located
>> iomem problem and had search code for appropriate condition.
>
> Aaah.
>> And setting the vm_page_prot IS important!
>>
>> Nouveau does kernel-modesetting only. The framebuffer device uses
>> channel 1 and is as regular a framebuffer as any other. 2D graphics
>> operations use channel 2 (xf86-video-nouveau). 3D graphics (gallium)
>> use a channel for every 3D window. There are 128 channels, 0 and 127
>> being reserved. Every channel has a dma-engine which is user triggered
>
> What happens if you use only one channel? Does it grow to accomodate
> more of the writes to the ring?
One channel for one compostion. So channel 1 for the consolefb device. So
if X is set to omit acceleration, it works thro the consolefb. Channel 2 is set
up for 2D graphics which alone xf86-video-nouveau (the DDX component)
supports. Channel 3 is set up for 3D acceleration provided by gallium (Mesa)
- sort of tunneling thro the DDX layer. If you run glxgears in a
window, Channel 4
will be set up the application.

Each 'Channe' is self-contained with pushbufs, dma, bo, gpuobject ....
>
>> thro' pushbuffer rings. Every DMA has a 1MiB VRAM space which forms one
>> of the targets of DMA ops - the other being in the opaque GPU-space. The
>
> So 1MiB per channel? Is this how the textures get loaded via this 1MiB
> VRAM?
Yes.

>> BO encapsualtes the virtual-address space of the user VM. and the GPU-DMA
>> is provided a constructed PageTable that is consistent with the kernel view 
>> of
>> that space. The GEM_NEW ioctl sets up the whole space-management machinery,
>> the user-space is mmaped out, and the operations triggered thro the pushbuf.
>
> So when the write to the RING is done, the GPU accesses the System RAM memory.
> What is then the deal with the 512MB or so video cards? Is that only
> used for putting textures on it?
Half the memory is used as the viewport to the system CPU and the other
half is the GPU system. The system/user transfer to the viewport (and
controls via the iomem space). The DMA is NOT programmed in the conventional
way - it has the lowest-level pagetable created for the instances 1MiB space
(to which it is bound) and the other end is managed by the GPU intelligence.

>> YAHOO! (just a simple shout)
>
> <grins> Thank you for solving this problem! If you ever are in the
> Boston area give me a ring and the beers (or your favorite liquid) is on
> me!
>
vice-versa if you are around Chennai, India.

Actually, I'm neither an expert on the deep internals of the kernel (though
I'm getting to know more about it) nor the new generation of graphics.
Just reading about the graphics devices of today got me
frustrated because I could not get it it up on Xen, and the debates on
TTM, GEM made me think that either something was drastically wrong
or something stupid was missed. So this mission.

Video-cards have loads of specialised processors - dozens of them often.
CUDA is an environment/architecure that allows normal C programs to
use these cores - someday graphics cards will also do graphics!
So somebody will have to ensure that Xen in the future is enabled for it
- it doesn't stop with Direct-Rendering - which also needs enhancements.
Having X accelerated brought down dom0 CPU usage from 15-30% on
my system to 1-5% when running a sample WinXP (with meadowcourt
PVops drivers) domU!

PS. I sent a mail to your personal address with all the patches I used in
the workout - am attaching it here too - in case it is of interest to somebody.
You should look a the correct_section_mismatch.patch for what it is worth.

Attachment: xen-2.6.31.6.patches.tar.gz
Description: GNU Zip compressed data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>