mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@list.ru>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Linux kernel <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	dosemu-devel <dosemu-devel@lists.sourceforge.net>,
	Bart Oldeman <bartoldeman@users.sourceforge.net>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: /dev/mem and PCI memory = EFAULT (regression?)
Date: Sat, 29 Oct 2016 00:36:49 +0300	[thread overview]
Message-ID: <89281ddd-ea21-6de8-b4dd-57ff4b0d2040@list.ru> (raw)
In-Reply-To: <CALCETrVKSF2GYaRCf2xSDEYjYbfjKNd9LKwzEmtz4xKpCgSqDg@mail.gmail.com>

OK, thanks for the prompt reply, Andy!
I'll try your sysfs suggestion.

Let me just add a bit of CCs to get more people involved.
I believe the ram size involvement makes this smell like a bug,
plus it looks like a regression. Not that I am going to suffer
much (this pass-through stuff always breaks in a million of
different ways, I'll probably just remove it), but its still a very
questionable change IMO.

29.10.2016 00:26, Andy Lutomirski пишет:
> On Fri, Oct 28, 2016 at 2:18 PM, Stas Sergeev <stsp@list.ru> wrote:
>> 29.10.2016 00:05, Andy Lutomirski пишет:
>>
>>> On Fri, Oct 28, 2016 at 2:03 PM, Stas Sergeev <stsp@list.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
>

  reply	other threads:[~2016-10-28 22:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28 21:03 /dev/mem and PCI memory = EFAULT? Stas Sergeev
2016-10-28 21:05 ` Andy Lutomirski
2016-10-28 21:18   ` Stas Sergeev
2016-10-28 21:26     ` Andy Lutomirski
2016-10-28 21:36       ` Stas Sergeev [this message]
2016-10-28 23:26         ` /dev/mem and PCI memory = EFAULT (regression?) Linus Torvalds
2016-10-28 23:47           ` Stas Sergeev

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=89281ddd-ea21-6de8-b4dd-57ff4b0d2040@list.ru \
    --to=stsp@list.ru \
    --cc=bartoldeman@users.sourceforge.net \
    --cc=dosemu-devel@lists.sourceforge.net \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=torvalds@linux-foundation.org \
    /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

all inboxes | Powered by JetHome®