* [PATCH] Allow small areas in io_block_mapping
@ 2001-11-16 15:21 Adrian Cox
2001-11-16 16:14 ` Dan Malek
0 siblings, 1 reply; 4+ messages in thread
From: Adrian Cox @ 2001-11-16 15:21 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 324 bytes --]
The attached patch stops io_block_mapping() from attempting to use BATs
for areas too small to fit in a BAT. (On the port I'm currently
developing, the board uses high-order address lines to distinguish
between register groups, and I'm trying to allocate a page for each group.)
--
Adrian Cox http://www.humboldt.co.uk/
[-- Attachment #2: pgtable.patch --]
[-- Type: text/plain, Size: 476 bytes --]
===== arch/ppc/mm/pgtable.c 1.7 vs edited =====
--- 1.7/arch/ppc/mm/pgtable.c Sun Nov 4 18:54:46 2001
+++ edited/arch/ppc/mm/pgtable.c Fri Nov 16 15:12:48 2001
@@ -242,7 +242,7 @@
/*
* Use a BAT for this if possible...
*/
- if (io_bat_index < 2 && is_power_of_2(size)
+ if (io_bat_index < 2 && is_power_of_2(size) && size >= 0x20000
&& (virt & (size - 1)) == 0 && (phys & (size - 1)) == 0) {
setbat(io_bat_index, virt, phys, size, flags);
++io_bat_index;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Allow small areas in io_block_mapping
2001-11-16 15:21 [PATCH] Allow small areas in io_block_mapping Adrian Cox
@ 2001-11-16 16:14 ` Dan Malek
2001-11-16 16:39 ` Adrian Cox
0 siblings, 1 reply; 4+ messages in thread
From: Dan Malek @ 2001-11-16 16:14 UTC (permalink / raw)
To: Adrian Cox; +Cc: linuxppc-dev
Adrian Cox wrote:
> The attached patch stops io_block_mapping() from attempting to use BATs
> for areas too small to fit in a BAT.
Hmmmm....Is io_block_mapping() supposed to be a replacement for ioremap()?
If so, it doesn't do anything I want. What you are asking for is already
done by ioremap. If someone has already wired BATs, you get them, and
if not then single PTEs will be allocated. In this case, just don't allocate
BATs for I/O in the space you want individual pages when you do the board
initialization, and call ioremap().
I think we still need to define a better set of functions here. I want to:
1.) Control the virt->phys mapping when necessary by forcing both
virtual and physical addresses (kind like io_block_mapping now)
2.) Cover a very large space with a single BAT or large page entry
3.) Have an ioremap()-like function that will use the physical address
to either match in 1 or 2 above, or allocate single PTEs if
no match.
The functions used to set up 1 and 2 above are performed very early during
memory management initialization and are not subject to change once we
start using these mapped spaces.
Thanks.
-- Dan
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Allow small areas in io_block_mapping
2001-11-16 16:14 ` Dan Malek
@ 2001-11-16 16:39 ` Adrian Cox
2001-11-16 16:57 ` Dan Malek
0 siblings, 1 reply; 4+ messages in thread
From: Adrian Cox @ 2001-11-16 16:39 UTC (permalink / raw)
To: Dan Malek; +Cc: linuxppc-dev
Dan Malek wrote:
> Hmmmm....Is io_block_mapping() supposed to be a replacement for ioremap()?
> If so, it doesn't do anything I want. What you are asking for is already
> done by ioremap. If someone has already wired BATs, you get them, and
> if not then single PTEs will be allocated. In this case, just don't
> allocate
> BATs for I/O in the space you want individual pages when you do the board
> initialization, and call ioremap().
I hadn't realised that ioremap could be used before vmalloc was working,
but on examining the code, it looks like it can. So I may just change my
code to use ioremap.
In defense of the patch I would like to say that the extra test is in
the spirit of the existing tests within io_block_mapping(), and if this
doesn't go in then a comment describing the intention and limits of the
interface would be a useful addition to <include/asm-ppc/io.h>.
> I think we still need to define a better set of functions here. I want to:
>
> 1.) Control the virt->phys mapping when necessary by forcing both
> virtual and physical addresses (kind like io_block_mapping now)
>
> 2.) Cover a very large space with a single BAT or large page entry
>
> 3.) Have an ioremap()-like function that will use the physical address
> to either match in 1 or 2 above, or allocate single PTEs if
> no match.
>
> The functions used to set up 1 and 2 above are performed very early during
> memory management initialization and are not subject to change once we
> start using these mapped spaces.
That's pretty well what I need here.
--
Adrian Cox http://www.humboldt.co.uk/
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Allow small areas in io_block_mapping
2001-11-16 16:39 ` Adrian Cox
@ 2001-11-16 16:57 ` Dan Malek
0 siblings, 0 replies; 4+ messages in thread
From: Dan Malek @ 2001-11-16 16:57 UTC (permalink / raw)
To: Adrian Cox; +Cc: linuxppc-dev
Adrian Cox wrote:
> I hadn't realised that ioremap could be used before vmalloc was working,
> but on examining the code, it looks like it can. So I may just change my
> code to use ioremap.
Yeah, but just remember it does 1:1 virt->phys mapping. I have a couple
of 4xx processors with hard-wired low physical addresses, and I have to
force them to map to a "friendly" virtual address :-). That's the
only reason I like io_block_mapping(), but I don't have BATs to deal with.
> In defense of the patch....
You are correct. The comments in the code are kind of funny.....ensure
you call it with the right parameters, but then it checks some anyway.
> That's pretty well what I need here.
Let's do it. I think io_block_mapping() was conceptually copied from
other architectures for consistency, but I don't think it's doing the
right thing for us in all cases.
Thanks.
-- Dan
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-11-16 16:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-16 15:21 [PATCH] Allow small areas in io_block_mapping Adrian Cox
2001-11-16 16:14 ` Dan Malek
2001-11-16 16:39 ` Adrian Cox
2001-11-16 16:57 ` Dan Malek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).