[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrVKSF2GYaRCf2xSDEYjYbfjKNd9LKwzEmtz4xKpCgSqDg@mail.gmail.com>
Date: Fri, 28 Oct 2016 14:26:06 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Stas Sergeev <stsp@...t.ru>
Cc: Linux kernel <linux-kernel@...r.kernel.org>
Subject: Re: /dev/mem and PCI memory = EFAULT?
On Fri, Oct 28, 2016 at 2:18 PM, Stas Sergeev <stsp@...t.ru> wrote:
> 29.10.2016 00:05, Andy Lutomirski пишет:
>
>> On Fri, Oct 28, 2016 at 2:03 PM, Stas Sergeev <stsp@...t.ru> wrote:
>>>
>>> Hello.
>>>
>>> For the long time dosemu used /dev/mem for vga pass-through.
>>> Now it appears /dev/mem has this check:
>>> http://lxr.free-electrons.com/source/drivers/char/mem.c#L51
>>> which prevents an accesses to PCI memory regions if the
>>> "high_memory" points low enough. It seems "high_memory"
>>> just points to the end of the physical ram, so depending on
>>> the ram size you either can access PCI devices or you get
>>> EFAULT.
>>> Was it wrong to use /dev/mem for accessing the PCI devices?
>>> How should I do that now?
>>>
>> What is DOSEMU trying to do here? Access the framebuffer?
>>
>> ISTM it would be better to use the DRM or FB layer directly (just map
>> the framebuffer itself) or, if necessary, use VFIO.
>
> Yes, framebuffer.
> Mapping fb directly is not really an option because dosemu does
> its own modesetting when you do vga pass-through. So it is
> usually started that way with "nomodeset=1" and w/o fb.
> Yes, some crazy people try the pass-through even out of fb
> console, but that's weird (the problem is most SDL2 builds do
> not have directfb backend compiled in, otherwise we could
> just use SDL rendering on top of fb).
>
> The thing is, I needed (for testing purposes, unrelated to dosemu)
> some quick way to access the PCI memory space, and to my surprise I
> couldn't do that with /dev/mem. Was this really disallowed intentionally?
I believe so.
Try the /sys/devices/.../resource? and resource?_wc files.
--Andy
--
Andy Lutomirski
AMA Capital Management, LLC
Powered by blists - more mailing lists