From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Thorsten Glaser <tg@mirbsd.de>
Cc: linux-m68k@vger.kernel.org, aranym@lists.bobek.cz
Subject: Re: [PATCH] make NatFeat drivers bool, not tristate
Date: Wed, 24 Jul 2013 16:56:30 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1307241645500.8930@ayla.of.borg> (raw)
In-Reply-To: <loom.20130724T152350-539@post.gmane.org>
On Wed, 24 Jul 2013, Thorsten Glaser wrote:
> Thorsten Glaser <tg <at> mirbsd.de> writes:
> > Andreas Schwab dixit:
> > >The problem is that aranym expects the parameters of the natfeat calls
> > >to be physical addresses. The nf_get_id calls use literal strings as
> > >parameters which only works when the drivers are builtin because phys ==
> > >virt then.
And fixing the conversion is non-trivial, as module memory is allocated using
vmalloc(), which may be non-contiguous in physical memory space, right?
> > Ah, right, there was that issue… so this patch should probably go in?
>
> At first, anyway.
I prefer a fix to go in instead :-)
> Maybe if CONFIG_NATFEAT is selected (it’s bool), some bounce buffer could
> be allocated and memlocked, which the other NF* drivers can then use.
> (If NatFeat is not found during boot, no memory should be allocated.)
>
> Especially if we had more NF* drivers in the future (hostfs could be made
> into something, maybe with something like umsdos on top for Unix file
> permissions? And I’m hoping for a bidirectional “virtio/serial” console…)
> this could be useful sharing, and not needing to have everything else
> in the kernel statically.
>
> Well, if someone has time and wants to write this.
It doesn't have to be that complex...
The patch below adds a wrapper that copies the (supposedly short) name to
the kernel stack before calling into ARAnyM.
Does this make modular NatFeat drivers work for you?
It doesn't break the built-in drivers for me.
ARAnyM hackers: What's the maximum size of ID names?
diff --git a/arch/m68k/emu/natfeat.c b/arch/m68k/emu/natfeat.c
index cb574ae..98655ef 100644
--- a/arch/m68k/emu/natfeat.c
+++ b/arch/m68k/emu/natfeat.c
@@ -19,9 +19,11 @@
#include <asm/machdep.h>
#include <asm/natfeat.h>
+extern long nf_get_id2(const char *feature_name);
+
asm("\n"
-" .global nf_get_id,nf_call\n"
-"nf_get_id:\n"
+" .global nf_get_id2,nf_call\n"
+"nf_get_id2:\n"
" .short 0x7300\n"
" rts\n"
"nf_call:\n"
@@ -30,12 +32,24 @@ asm("\n"
"1: moveq.l #0,%d0\n"
" rts\n"
" .section __ex_table,\"a\"\n"
-" .long nf_get_id,1b\n"
+" .long nf_get_id2,1b\n"
" .long nf_call,1b\n"
" .previous");
-EXPORT_SYMBOL_GPL(nf_get_id);
EXPORT_SYMBOL_GPL(nf_call);
+long nf_get_id(const char *feature_name)
+{
+ char name_copy[32]; // FIXME maximum size of ID names?
+ size_t n;
+
+ n = strlcpy(name_copy, feature_name, sizeof(name_copy));
+ if (n >= sizeof(name_copy))
+ return 0;
+
+ return nf_get_id2(name_copy);
+}
+EXPORT_SYMBOL_GPL(nf_get_id);
+
void nfprint(const char *fmt, ...)
{
static char buf[256];
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2013-07-24 14:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-23 22:51 [PATCH] make NatFeat drivers bool, not tristate Thorsten Glaser
2013-07-24 8:57 ` Andreas Schwab
2013-07-24 12:42 ` Thorsten Glaser
2013-07-24 13:26 ` Thorsten Glaser
2013-07-24 14:56 ` Geert Uytterhoeven [this message]
2013-07-24 15:02 ` Petr Stehlik
2013-07-24 16:19 ` Geert Uytterhoeven
2013-07-24 20:04 ` Petr Stehlik
2013-07-24 17:23 ` Thorsten Glaser
2013-07-24 17:40 ` Geert Uytterhoeven
2013-07-29 21:52 ` Geert Uytterhoeven
2013-07-30 8:50 ` Thorsten Glaser
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=alpine.DEB.2.02.1307241645500.8930@ayla.of.borg \
--to=geert@linux-m68k.org \
--cc=aranym@lists.bobek.cz \
--cc=linux-m68k@vger.kernel.org \
--cc=tg@mirbsd.de \
/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