Re: X will not start on a Thinkpad 240 using neomagic

2018-01-25 Thread Alex Bowden
Hi Michel,

Thank you very much for the insight on CONFIG_IO_STRICT_DEVMEM. I was able to 
use SystemTap to find where the error was occurring in the kernel. It turns out 
the vesafb takes the framebuffer and sets it IO_RESOURCE_BUSY using sysfb. When 
the framebuffer memory is set as busy and the strict devmem is enabled it will 
not allow the userspace to mmap this area. I changed my grub config to use 
GRUB_TERMINAL=console and that fixed the problem!!

-Alex
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

Re: X will not start on a Thinkpad 240 using neomagic

2018-01-25 Thread Alex Bowden
> Does mapping the whole BAR work? If so it'd be trivial to change the
> driver to just do that instead, and it should be harmless.

As far as I can tell, no:

[root@tpad ~]# ./testneo
neomagic nm2160 found
phys_base: 0xfd00 phys_len: 0x0100
attempt pci_device_map_range of 0x0100
pci_device_map_range: Invalid argument

00:09.0 VGA compatible controller: Neomagic Corporation NM2160 [MagicGraph 
128XD] (rev 01) (prog-if 00 [VGA controller])
Subsystem: IBM Device 0164
Flags: medium devsel, IRQ 255
Memory at fd00 (32-bit, prefetchable) [size=16M]
Memory at fea0 (32-bit, non-prefetchable) [size=2M]
Memory at fed0 (32-bit, non-prefetchable) [size=1M]
[virtual] Expansion ROM at 000c [disabled] [size=128K]

-- 
 <>

___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

Re: X will not start on a Thinkpad 240 using neomagic

2018-01-25 Thread Alex Bowden
I'll take a look into this. I'm not sure libpciaccess uses /dev/mem
anymore though?

Thanks!
Alex
-- 
 <>

___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

Re: X will not start on a Thinkpad 240 using neomagic

2018-01-24 Thread Michel Dänzer
On 2018-01-24 04:55 PM, Adam Jackson wrote:
> On Wed, 2018-01-24 at 01:12 +, Alex Bowden wrote:
>>
>> I have a Thinkpad 240 with a Neomagic NM2160 and I keep having an issue
>> with the neomagic driver. I think I have narrowed it down to the kernel
>> refusing to mmap the framebuffer. I created a program called testneo.c
>> to attempt to use pci_device_map_range to access the framebuffer but
>> it always returns 22 (Invalid argument).
> 
> I'm not sure why that would fail, but...

It could be related to the Linux kernel's CONFIG_IO_STRICT_DEVMEM,
excerpt from the corresponding help text:

  If this option is switched on, the /dev/mem file only allows
  userspace access to *idle* io-memory ranges (see /proc/iomem) This
  may break traditional users of /dev/mem (dosemu, legacy X, etc...)
  if the driver using a given range cannot be disabled.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

Re: X will not start on a Thinkpad 240 using neomagic

2018-01-24 Thread Adam Jackson
On Wed, 2018-01-24 at 01:12 +, Alex Bowden wrote:
> Hi all,
> 
> I have a Thinkpad 240 with a Neomagic NM2160 and I keep having an issue
> with the neomagic driver. I think I have narrowed it down to the kernel
> refusing to mmap the framebuffer. I created a program called testneo.c
> to attempt to use pci_device_map_range to access the framebuffer but
> it always returns 22 (Invalid argument).

I'm not sure why that would fail, but...

> [root@tpad ~]# ./testneo
> neomagic nm2160 found
>phys_base: 0xfd00 phys_len: 0x0100
> attempt pci_device_map_range of 2MB (0x20) // from neo_driver.c

Does mapping the whole BAR work? If so it'd be trivial to change the
driver to just do that instead, and it should be harmless.

- ajax
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

X will not start on a Thinkpad 240 using neomagic

2018-01-24 Thread Alex Bowden

Hi all,

I have a Thinkpad 240 with a Neomagic NM2160 and I keep having an issue
with the neomagic driver. I think I have narrowed it down to the kernel
refusing to mmap the framebuffer. I created a program called testneo.c
to attempt to use pci_device_map_range to access the framebuffer but
it always returns 22 (Invalid argument).

[root@tpad ~]# ./testneo
neomagic nm2160 found
phys_base: 0xfd00 phys_len: 0x0100
attempt pci_device_map_range of 2MB (0x20) // from neo_driver.c
pci_device_map_range: Invalid argument

I went through gdb and it does not seem to be previously mapped, so I
think the error is coming from the kernel (4.14.13).

Using the vesa driver does seem to work. I also tried 'nomodeset' on the
kernel command-line.

Is there something I am missing? KMS/DRI/vgaarb?

Any suggestions are appreciated!

Thanks,
Alex

testneo.c
Description: testneo.c
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s