Atari kernel-in-FastRAM patches, take three
Subsystems (5)
Michael Schmitz
maintainercover Atari kernel-in-FastRAM patches, take three
Geert,
see the following patch series for the hopefully final word on the 'make ST-RAM pool accessible for kernels running from FastRAM' story.
ST-RAM pool is allocated from an arch initcall if the kernel runs in FastRAM, at which time memory mapping support is up and running and ioremap works as it should.
This should make current kernels run again on TTs with insufficent ST-RAM but enough TT-RAM to hold the kernel and user data. It does speed up kernel operations a great deal on Falcon hardware with FastRAM on accelerators.
Side effects: rebooting from a kernel in FastRAM will go through a hard reboot -no idea why. SCSI operations seem to fail sooner than otherwise on my system (the SCSI patches are not in my atafb-stram branch). Need to investigate on both accounts.
Please review and apply.
Cheers,
Michael
Michael Schmitz
maintainerPATCH 1/4 m68k/atari - stram: alloc ST-RAM pool even if kernel not in ST-RAM
With the kernel loaded to FastRAM (TT-RAM), none of the ST-RAM address range is mapped by init_mem, and ST-RAM is not accessible through the normal allocation pathways as a result.
Implement ST-RAM pool allocation to be based on physical addresses always (it already was when the kernel was loaded in ST-RAM). Return kernel virtual addresses as per normal.
The current test for the kernel residing in ST-RAM always returns true. Use the bootinfo memory chunk order instead - with the kernel in FastRAM, ST-RAM (phys. 0x0) is not the first chunk.
In case the kernel is running from FastRAM, delay mapping of ST-RAM pool until after mem_init.
Provide helper functions for those users of ST-RAM that need to be aware of the backing physical addresses.
Kudos to Geert for his hints on getting this started.
--- arch/m68k/atari/stram.c | 75 +++++++++++++++++++++++++++-------- arch/m68k/include/asm/atari_stram.h | 2 + 2 files changed, 60 insertions(+), 17 deletions(-)
arch/m68k/atari/stram.c +58 -17
@@ -47,6 +47,7 @@ static struct resource stram_pool = {static unsigned long pool_size =1024 *1024 ; +static unsigned long stram_virt_offset;static int __init atari_stram_setup (char *arg) {
@@ -67,14 +68,12 @@ early_param("stram_pool", atari_stram_setup);void __init atari_stram_init (void ) {int i; -void *stram_start;/* * determine whether kernel code resides in ST-RAM * (then ST-RAM is the first memory block at virtual 0x0) */ - stram_start =phys_to_virt (0 ); - kernel_in_stram = (stram_start ==0 ); + kernel_in_stram = (m68k_memory[0 ].addr ==0 );for (i =0 ; i < m68k_num_memory; ++i) {if (m68k_memory[i].addr ==0 ) {
@@ -89,24 +88,66 @@ void __init atari_stram_init(void)/* * This function is called from setup_arch() to reserve the pages needed for -* ST-RAM management. +* ST-RAM management, if the kernel resides in ST-RAM. */ void __init atari_stram_reserve_pages (void *start_mem) { -/* -* always reserve first page of ST-RAM, the first 2 KiB are -* supervisor-only! -*/ -if (!kernel_in_stram) -reserve_bootmem (0 ,PAGE_SIZE ,BOOTMEM_DEFAULT ); +if (kernel_in_stram) { +pr_debug ("atari_stram pool: kernel in ST-RAM, using alloc_bootmem!\n" ); + stram_pool.start = (resource_size_t )alloc_bootmem_low_pages (pool_size); + stram_pool.end = stram_pool.start + pool_size -1 ; +request_resource (&iomem_resource, &stram_pool); + stram_virt_offset =0 ; +pr_debug ("atari_stram pool: size = %lu bytes, resource = %pR\n" , + pool_size, &stram_pool); +pr_debug ("atari_stram pool: start = %p, end = %p\n" , + (void *) stram_pool.start, (void *) stram_pool.end); +pr_debug ("atari_stram pool: stram_virt_offset = %p\n" , + (void *) stram_virt_offset); + } +} - stram_pool.start = (resource_size_t )alloc_bootmem_low_pages (pool_size); - stram_pool.end = stram_pool.start + pool_size -1 ; -request_resource (&iomem_resource, &stram_pool); -pr_debug ("atari_stram pool: size = %lu bytes, resource = %pR\n" , - pool_size, &stram_pool); +/* +* This function is called as arch initcall to reserve the pages needed for +* ST-RAM management, if the kernel does not reside in ST-RAM. +*/ +int __init atari_stram_map_pages (void ) +{ +if (!kernel_in_stram) { +/* +* Skip page 0, as the fhe first 2 KiB are supervisor-only! +*/ +pr_debug ("atari_stram pool: kernel not in ST-RAM, using ioremap!\n" ); + stram_pool.start =PAGE_SIZE ; + stram_pool.end = stram_pool.start + pool_size -1 ; +request_resource (&iomem_resource, &stram_pool); + stram_virt_offset = (unsigned long )ioremap (stram_pool.start, +resource_size (&stram_pool)) - stram_pool.start; +pr_debug ("atari_stram pool: size = %lu bytes, resource = %pR\n" , + pool_size, &stram_pool); +pr_debug ("atari_stram pool: start = %p, end = %p\n" , + (void *) stram_pool.start, (void *) stram_pool.end); +pr_debug ("atari_stram pool: stram_virt_offset = %p\n" , + (void *) stram_virt_offset); + } +return 0 ; +} +arch_initcall (atari_stram_map_pages); + + +void *atari_stram_to_virt (unsigned long phys) +{ +return (void *)(phys + stram_virt_offset); +} +EXPORT_SYMBOL (atari_stram_to_virt); + + +unsigned long atari_stram_to_phys (void *virt) +{ +return (unsigned long )(virt - stram_virt_offset); } +EXPORT_SYMBOL (atari_stram_to_phys);void *atari_stram_alloc (unsigned long size,const char *owner)
@@ -134,14 +175,14 @@ void *atari_stram_alloc(unsigned long size, const char *owner) }pr_debug ("atari_stram_alloc: returning %pR\n" , res); -return (void *)res->start; +return atari_stram_to_virt (res->start); }EXPORT_SYMBOL (atari_stram_alloc);void atari_stram_free (void *addr) { -unsigned long start = (unsigned long )addr; +unsigned long start =atari_stram_to_phys (addr);struct resource *res;unsigned long size;
arch/m68k/include/asm/atari_stram.h +2 -0
@@ -8,6 +8,8 @@/* public interface */ void *atari_stram_alloc (unsigned long size,const char *owner);void atari_stram_free (void *); +void *atari_stram_to_virt (unsigned long phys); +unsigned long atari_stram_to_phys (void *);/* functions called internally by other parts of the kernel */ void atari_stram_init (void );
Signature · 1 line
1.7.0.4
Michael Schmitz
maintainerPATCH 3/4 m68k/atari - ataflop: use correct virt/phys translation for DMA buffer
In reply to Michael SchmitzWith new ST-RAM allocation to work also when the kernel is running from FastRAM, use dedicated virt/phys translation for this case.
--- drivers/block/ataflop.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/ataflop.c +1 -1
@@ -1952,7 +1952,7 @@ static int __init atari_floppy_init (void) goto Enomem; } TrackBuffer = DMABuffer +512 ; - PhysDMABuffer =virt_to_phys (DMABuffer); + PhysDMABuffer =atari_stram_to_phys (DMABuffer); PhysTrackBuffer =virt_to_phys (TrackBuffer); BufferDrive = BufferSide = BufferTrack =-1 ;
Signature · 1 line
1.7.0.4
Michael Schmitz
maintainerPATCH 2/4 m68k/atari - atafb: convert allocation of fb ram to new interface
In reply to Michael SchmitzThe new atari_stram_alloc interface returns kernel virtual addresses even if the kernel runs in FastRAM. These addresses are not guaranteed to be identical with the physical addresses. Since ST-RAM mappings have not been set up by mem_init, virt_to_phys() and its cousin do not work and the atari_stram_to_phys() etc. helpers must be used to determine physical addresses.
fb.fix->smem_start needs physical addresses, fb.par->screen_base needs virtual addresses. Take care of the virt-to-phys conversion both on fb init and par changes.
--- drivers/video/atafb.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-)
drivers/video/atafb.c +9 -8
@@ -790,7 +790,7 @@ static void tt_get_par(struct atafb_par *par) addr = ((shifter.bas_hi &0xff ) <<16 ) | ((shifter.bas_md &0xff ) <<8 ) | ((shifter.bas_lo &0xff )); - par->screen_base =phys_to_virt (addr); + par->screen_base =atari_stram_to_virt (addr); }static void tt_set_par (struct atafb_par *par)
@@ -1584,7 +1584,7 @@ static void falcon_get_par(struct atafb_par *par) addr = (shifter.bas_hi &0xff ) <<16 | (shifter.bas_md &0xff ) <<8 | (shifter.bas_lo &0xff ); - par->screen_base =phys_to_virt (addr); + par->screen_base =atari_stram_to_virt (addr);/* derived parameters */ hw->ste_mode = (hw->f_shift &0x510 ) ==0 && hw->st_shift ==0x100 ;
@@ -1980,7 +1980,7 @@ static void stste_get_par(struct atafb_par *par) ((shifter.bas_md &0xff ) <<8 );if (ATARIHW_PRESENT (EXTD_SHIFTER )) addr |= (shifter.bas_lo &0xff ); - par->screen_base =phys_to_virt (addr); + par->screen_base =atari_stram_to_virt (addr); }static void stste_set_par (struct atafb_par *par)
@@ -2039,7 +2039,7 @@ static int stste_detect(void)static void stste_set_screen_base (void *s_base) {unsigned long addr; - addr =virt_to_phys (s_base); + addr =atari_stram_to_phys (s_base);/* Setup Screen Memory */ shifter.bas_hi = (unsigned char )((addr &0xff0000 ) >>16 ); shifter.bas_md = (unsigned char )((addr &0x00ff00 ) >>8 );
@@ -2286,7 +2286,7 @@ static void set_screen_base(void *s_base) {unsigned long addr; - addr =virt_to_phys (s_base); + addr =atari_stram_to_phys (s_base);/* Setup Screen Memory */ shifter.bas_hi = (unsigned char )((addr &0xff0000 ) >>16 ); shifter.bas_md = (unsigned char )((addr &0x00ff00 ) >>8 );
@@ -2433,7 +2433,8 @@ static void atafb_set_disp(struct fb_info *info)atafb_get_var (&info->var, info);atafb_get_fix (&info->fix, info); - info->screen_base = (void *)info->fix.smem_start; +/* Note: smem_start derives from real_screen_base, not screen_base! */ + info->screen_base =atari_stram_to_virt (info->fix.smem_start); } static int atafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
@@ -3166,13 +3167,13 @@ int __init atafb_init(void)memset (screen_base,0 , mem_req); pad = -(unsigned long )screen_base & (PAGE_SIZE -1 ); screen_base += pad; - real_screen_base = screen_base + ovsc_offset; + real_screen_base = (void *)atari_stram_to_phys (screen_base + ovsc_offset); screen_len = (mem_req - pad - ovsc_offset) &PAGE_MASK ;st_ovsc_switch ();if (CPU_IS_040_OR_060 ) {/* On a '040+, the cache mode of video RAM must be set to * write-through also for internal video hardware! */ -cache_push (virt_to_phys (screen_base), screen_len); +cache_push (atari_stram_to_phys (screen_base), screen_len);kernel_set_cachemode (screen_base, screen_len,IOMAP_WRITETHROUGH ); }
Signature · 1 line
1.7.0.4
Michael Schmitz
maintainerPATCH 4/4 m68k/atari - atari_scsi: use correct virt/phys translation for DMA buffer
In reply to Michael SchmitzWith new ST-RAM allocation to work also when the kernel is running from FastRAM, use dedicated virt/phys translation for this case.
--- drivers/scsi/atari_scsi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/atari_scsi.c +1 -1
@@ -639,7 +639,7 @@ static int __init atari_scsi_detect(struct scsi_host_template *host) "double buffer\n"); return 0; } - atari_dma_phys_buffer =virt_to_phys (atari_dma_buffer); + atari_dma_phys_buffer =atari_stram_to_phys (atari_dma_buffer); atari_dma_orig_addr =0 ; }#endif
Signature · 1 line
1.7.0.4
Geert Uytterhoeven
maintainerRe: [PATCH 1/4] m68k/atari - stram: alloc ST-RAM pool even if kernel not in ST-RAM
In reply to Michael SchmitzHi Michael,
arch/m68k/atari/stram.c void __init atari_stram_init(void) · line 104
Quoted 4 lines · Michael Schmitz
arch/m68k/atari/stram.c +4
-0+pr_debug ("atari_stram pool: size = %lu bytes, resource = %pR\n" , + pool_size, &stram_pool); +pr_debug ("atari_stram pool: start = %p, end = %p\n" , + (void *) stram_pool.start, (void *) stram_pool.end);
Please drop this line, as it prints more or less the same as the %pR in the line above. Also in the other block.
Review
Quoted 2 lines
(quoted diff) +2
-0+ pr_debug("atari_stram pool: stram_virt_offset = %p\n", + (void *) stram_virt_offset);
Please use "%lx", and drop the cast to "void *". Also in the other block.
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Geert Uytterhoeven
maintainerRe: [PATCH 2/4] m68k/atari - atafb: convert allocation of fb ram to new interface
In reply to Michael SchmitzHi Michael,
drivers/video/atafb.c int __init atafb_init(void) · line 3170
Quoted 6 lines · Michael Schmitz
drivers/video/atafb.c +1
-1@@ -3166,13 +3167,13 @@ int __init atafb_init(void)memset (screen_base,0 , mem_req); pad = -(unsigned long )screen_base & (PAGE_SIZE -1 ); screen_base += pad; - real_screen_base = screen_base + ovsc_offset; + real_screen_base = (void *)atari_stram_to_phys (screen_base + ovsc_offset);
I think real_screen_base should be renamed to e.g. "phys_screen_base", and changed to "unsigned long", so you can drop the above cast (and a few more while assigning it to fix->smem_start).
This will also expose that ATAFB_EXT is broken, and what needs to be done to fix it (follow the chain of casts, phys addresses are unsigned long, virt addresses are void *).
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Quoted 3 lines · Michael Schmitz
see the following patch series for the hopefully final word on the 'make ST-RAM pool accessible for kernels running from FastRAM' story.
Would you mind sharing your config? I'm always getting a panic very early, even before nfcon is ready, which makes it almost impossible to debug.
Andreas.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Michael Schmitz
maintainerAndreas,
see attached. I may have disabled nfcon entirely - usually I use parallel debug with ARAnyM.
Cheers,
Michael
Quoted 16 lines · Andreas Schwab
Quoted 3 lines · Michael Schmitz
see the following patch series for the hopefully final word on the 'make ST-RAM pool accessible for kernels running from FastRAM' story.
Would you mind sharing your config? I'm always getting a panic very early, even before nfcon is ready, which makes it almost impossible to debug.
Andreas.
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Michael Schmitz
maintainerRe: [PATCH 1/4] m68k/atari - stram: alloc ST-RAM pool even if kernel not in ST-RAM
In reply to Geert UytterhoevenHi Geert,
will do. Likewise for the external framebuffer case.
I'm still hung up on the SCSI behaviour with current kernels - may have managed to trash the SCSI disk filesystems or partitions with an earlier version of these patches.
Cheers,
Michael
Quoted 28 lines · Geert Uytterhoeven
Hi Michael,
arch/m68k/atari/stram.c void __init atari_stram_init(void) · line 104
Quoted 4 lines · Michael Schmitz
arch/m68k/atari/stram.c +4
-0+pr_debug ("atari_stram pool: size = %lu bytes, resource = %pR\n" , + pool_size, &stram_pool); +pr_debug ("atari_stram pool: start = %p, end = %p\n" , + (void *) stram_pool.start, (void *) stram_pool.end);Please drop this line, as it prints more or less the same as the %pR in the line above. Also in the other block.
Review
Quoted 2 lines
(quoted diff) +2
-0+ pr_debug("atari_stram pool: stram_virt_offset = %p\n", + (void *) stram_virt_offset);Please use "%lx", and drop the cast to "void *". Also in the other block.
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]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
Geert Uytterhoeven
maintainerHi Michael,
Quoted 3 lines · Michael Schmitz
see the following patch series for the hopefully final word on the 'make ST-RAM pool accessible for kernels running from FastRAM' story.
When submitting a "take three", please annotate the individual patches with "[PATCH v3 x/y]".
It would also have been nice to CC the block resp. SCSI maintainers to get their acks for patches 3 and 4, but I'm gonna take them through the m68k tree anyway.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Geert Uytterhoeven
maintainerRe: [PATCH 3/4] m68k/atari - ataflop: use correct virt/phys translation for DMA buffer
In reply to Michael SchmitzHi Jens,
If you don't object, I'd like to take this one through the m68k tree, as it depends on a new m68k platform function.
Quoted 22 lines · Michael Schmitz
With new ST-RAM allocation to work also when the kernel is running from FastRAM, use dedicated
virt/phystranslation for this case.Signed-off-by Michael Schmitz <[email protected]>--- drivers/block/ataflop.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/block/ataflop.c +1
-2@@ -1952,7 +1952,7 @@ static int __init atari_floppy_init (void) goto Enomem; } TrackBuffer = DMABuffer +512 ; - PhysDMABuffer =virt_to_phys (DMABuffer); + PhysDMABuffer =atari_stram_to_phys (DMABuffer); PhysTrackBuffer =virt_to_phys (TrackBuffer); BufferDrive = BufferSide = BufferTrack =-1 ; --
Quoted 1 line
1.7.0.4
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Geert Uytterhoeven
maintainerRe: [PATCH 4/4] m68k/atari - atari_scsi: use correct virt/phys translation for DMA buffer
In reply to Michael SchmitzHi James,
If you don't object, I'd like to take this one through the m68k tree, as it depends on a new m68k platform function.
Quoted 22 lines · Michael Schmitz
With new ST-RAM allocation to work also when the kernel is running from FastRAM, use dedicated
virt/phystranslation for this case.Signed-off-by Michael Schmitz <[email protected]>--- drivers/scsi/atari_scsi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/scsi/atari_scsi.c +1
-2@@ -639,7 +639,7 @@ static int __init atari_scsi_detect(struct scsi_host_template *host) "double buffer\n"); return 0; } - atari_dma_phys_buffer =virt_to_phys (atari_dma_buffer); + atari_dma_phys_buffer =atari_stram_to_phys (atari_dma_buffer); atari_dma_orig_addr =0 ; }#endif --
Quoted 1 line
1.7.0.4
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Michael Schmitz
maintainerHi Geert,
Quoted 8 lines
Hi Michael,
Quoted 3 lines · Michael Schmitz
see the following patch series for the hopefully final word on the 'make ST-RAM pool accessible for kernels running from FastRAM' story.
When submitting a "take three", please annotate the individual patches with "[PATCH v3 x/y]".
Will follow shortly.
Quoted 3 lines
It would also have been nice to CC the block resp. SCSI maintainers to get their acks for patches 3 and 4, but I'm gonna take them through the m68k tree anyway.
I'll do that anyway - not that I've got much hope to elicit a response from either. Still waiting for feedback from the last SCSI patches sent there.
(Not that I'm any better - still haven't given Finn's patches a try...)
Cheers,
Michael
Quoted 11 lines
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]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
Re: [PATCH 3/4] m68k/atari - ataflop: use correct virt/phys translation for DMA buffer
In reply to Geert UytterhoevenQuoted 4 lines · Geert Uytterhoeven
Hi Jens,
If you don't object, I'd like to take this one through the m68k tree, as it depends on a new m68k platform function.
Sure, that's fine.
Signature · 1 line
Jens Axboe
Quoted 2 lines · Michael Schmitz
see attached. I may have disabled nfcon entirely - usually I use parallel debug with ARAnyM.
Thanks, with debug=par early printk is working. So the problem is that kernel-in-FastRAM does not solve the kernel-too-big/FastRAM-too-big problem, since the page tables for the first node (== FastRAM) memory must still fit in INIT_MAPPED_SIZE (== 4Mb) - kernel-size.
Andreas.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Michael Schmitz
maintainerAndreas,
do we know the size of the first memory chunk early enough in head.S? Maybe it's time to increase INIT_MAPPED_SIZE at least in cases where we know that there's more than 4 MB in the first memchunk ...
Cheers,
Michael
Quoted 16 lines · Andreas Schwab
Quoted 2 lines · Michael Schmitz
see attached. I may have disabled nfcon entirely - usually I use parallel debug with ARAnyM.
Thanks, with debug=par early printk is working. So the problem is that kernel-in-FastRAM does not solve the kernel-too-big/FastRAM-too-big problem, since the page tables for the first node (== FastRAM) memory must still fit in
INIT_MAPPED_SIZE(== 4Mb) - kernel-size.Andreas.
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Don't top post!
Quoted 3 lines · Michael Schmitz
do we know the size of the first memory chunk early enough in
head.S? Maybe it's time to increaseINIT_MAPPED_SIZEat least in cases where we know that there's more than 4 MB in the first memchunk ...
How do you know? You would have to reimplement the check paging_init does.
Andreas.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Andreas,
Quoted 1 line
Don't top post!
Sorry - gurgle made me do it :')
Quoted 9 lines
Quoted 3 lines · Michael Schmitz
do we know the size of the first memory chunk early enough in
head.S? Maybe it's time to increaseINIT_MAPPED_SIZEat least in cases where we know that there's more than 4 MB in the first memchunk ...How do you know? You would have to reimplement the check
paging_initdoes.
I see - as a heuristic, we can probably assume that the first memchunk is the relevant one, and especially in the case of FastRAM, also the larger one.
Does this hold for Amiga/Mac/VME as well?
Cheers,
Michael
Quoted 13 lines
Andreas.
Signature · 9 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: https://lists.debian.org/[email protected]
Geert Uytterhoeven
maintainerHi Michael,
Quoted 3 lines · Michael Schmitz
do we know the size of the first memory chunk early enough in
head.S? Maybe it's time to increaseINIT_MAPPED_SIZEat least in cases where we know that there's more than 4 MB in the first memchunk ...
"get_bi_record BI_MEMCHUNK" will return a pointer to the first mem_info struct.
If the first chunk is at least 8 MiB it should be not that intrusive. If it isn't, and you have to use multiple chunks, it becomes more complicated.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Geert Uytterhoeven
maintainerHi Michael,
Quoted 5 lines · Michael Schmitz
Quoted 5 lines
Quoted 3 lines · Michael Schmitz
do we know the size of the first memory chunk early enough in
head.S? Maybe it's time to increaseINIT_MAPPED_SIZEat least in cases where we know that there's more than 4 MB in the first memchunk ...
Quoted 7 lines
Quoted 2 lines
How do you know? You would have to reimplement the check
paging_initdoes.I see - as a heuristic, we can probably assume that the first memchunk is the relevant one, and especially in the case of FastRAM, also the larger one.
Does this hold for Amiga/Mac/VME as well?
People want to run the kernel in the fastest memory chunk, which is typically also the largest (slow Amiga mainboard memory may be 2 - 16 MiB for Linux-capable machines, accelerator memory may be larger).
Don't know about Mac, but I have some memories of interleaved banks and such...
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Hi Geert
Quoted 4 lines
Hi Michael,
On Mon, Mar 31, 2014 at 11:24 PM, Michael Schmitz <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
do we know the size of the first memory chunk early enough in
head.S? Maybe it's time to increaseINIT_MAPPED_SIZEat least in cases where we know that there's more than 4 MB in the first memchunk ..."
get_bi_recordBI_MEMCHUNK" will return a pointer to the firstmem_infostruct.
Yep, that's as far as I got - if I read bootinfo.h right, this will need to have an offset of 12 bytes added to get to the size member, correct?
Quoted 3 lines
If the first chunk is at least 8 MiB it should be not that intrusive. If it isn't, and you have to use multiple chunks, it becomes more complicated.
My reasoning exactly - if the first chunk is the smaller one, the page tables shouldn't get too big anyway. If it's the larger one, multiple chunks are not possible anyway (at least on Atari) due to the discontigmem constraint. Either way, 8 MB should be safe if present.
What size FastRAM did precipitate that bug for you, Andreas?
Cheers,
Michael
Hi Geert,
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
do we know the size of the first memory chunk early enough in
head.S? Maybe it's time to increaseINIT_MAPPED_SIZEat least in cases where we know that there's more than 4 MB in the first memchunk ...Quoted 8 lines
Quoted 3 lines
How do you know? You would have to reimplement the check
paging_initdoes.I see - as a heuristic, we can probably assume that the first memchunk is the relevant one, and especially in the case of FastRAM, also the larger one.
Does this hold for Amiga/Mac/VME as well?
Quoted 4 lines
People want to run the kernel in the fastest memory chunk, which is typically also the largest (slow Amiga mainboard memory may be 2 - 16 MiB for Linux-capable machines, accelerator memory may be larger).
And the chunk the kernel runs from would always be the first chunk listed in bootinfo, since that's the one mapped at virtual address zero?
Quoted 3 lines
Don't know about Mac, but I have some memories of interleaved banks and such...
Not sure I've ever seen accelerators or memory upgrades on the Macs that I hacked on. 4 MB was sort of plenty in those days.
Cheers,
Michael
Geert Uytterhoeven
maintainerHi Michael,
Quoted 11 lines · schmitz
Quoted 8 lines
Quoted 3 lines · Michael Schmitz
do we know the size of the first memory chunk early enough in
head.S? Maybe it's time to increaseINIT_MAPPED_SIZEat least in cases where we know that there's more than 4 MB in the first memchunk ..."
get_bi_recordBI_MEMCHUNK" will return a pointer to the firstmem_infostruct.Yep, that's as far as I got - if I read
bootinfo.hright, this will need to have an offset of 12 bytes added to get to the size member, correct?
Nope, only 4. A0 points to the bootinfo record payload, which is of type struct mem_info * in this case:
movew %a0@(BIR_SIZE),%d0
lea %a0@(BIR_DATA),%a0Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Geert Uytterhoeven
maintainerHi Michael,
Quoted 12 lines · schmitz
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 3 lines
do we know the size of the first memory chunk early enough in
head.S? Maybe it's time to increaseINIT_MAPPED_SIZEat least in cases where we know that there's more than 4 MB in the first memchunk ...How do you know? You would have to reimplement the check
paging_initdoes.I see - as a heuristic, we can probably assume that the first memchunk is the relevant one, and especially in the case of FastRAM, also the larger one.
Does this hold for Amiga/Mac/VME as well?
Quoted 7 lines
Quoted 4 lines
People want to run the kernel in the fastest memory chunk, which is typically
also the largest (slow Amiga mainboard memory may be 2 - 16 MiB for Linux-capable machines, accelerator memory may be larger).And the chunk the kernel runs from would always be the first chunk listed in bootinfo, since that's the one mapped at virtual address zero?
The kernel always runs in the first chunk.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Hi Geert,
Quoted 15 lines
Hi Michael,
Quoted 10 lines · schmitz
Quoted 10 lines
Quoted 4 lines · Michael Schmitz
do we know the size of the first memory chunk early enough in
head.S? Maybe it's time to increaseINIT_MAPPED_SIZEat least in cases where we know that there's more than 4 MB in the first memchunk ..."
get_bi_recordBI_MEMCHUNK" will return a pointer to the firstmem_infostruct.
Quoted 7 lines
Quoted 3 lines
Yep, that's as far as I got - if I read
bootinfo.hright, this will need to have an offset of 12 bytes added to get to the size member, correct?Nope, only 4. A0 points to the bootinfo record payload, which is of type struct
mem_info* in this case:
Right - should have read on to find the get_bi_record defs.
While poking around in head.S, I came across a comment that stated the second page at the start of the kernel is used for the kernel page dir - that is the second page of virtual address space (FastRAM, in the case we care about here), not physcial address space, right?
Still wondering why the kernel in FastRAM won't reboot cleanly...
Cheers,
Michael
Geert Uytterhoeven
maintainerHi Michael,
Quoted 4 lines · schmitz
While poking around in
head.S, I came across a comment that stated the second page at the start of the kernel is used for the kernel page dir - that is the second page of virtual address space (FastRAM, in the case we care about here), not physcial address space, right?
The kernel is loaded in the second page of RAM. Initially, this page just contains a few branches and the bootinfo versions. The code jumps to _start, and the second page is reused for the kernel page dir:
ENTRY(_stext)
bras 1f /* Jump over bootinfo version numbers */
.long BOOTINFOV_MAGIC
.long MACH_AMIGA, AMIGA_BOOTI_VERSION
....1: jra __start
.equ kernel_pg_dir,_stext
.equ .,_stext+PAGESIZE
ENTRY(_start)
jra __start__INITENTRY(__start)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Quoted 1 line · schmitz
What size FastRAM did precipitate that bug for you, Andreas?
It's the combination of kernel size and FastRAM setting that matters.
You can easily watch it by adding the bootmem_debug kernel parameter.
Andreas.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 13 lines · Geert Uytterhoeven
Quoted 11 lines · Michael Schmitz
Quoted 7 lines
Quoted 4 lines
do we know the size of the first memory chunk early enough in
head.S? Maybe it's time to increaseINIT_MAPPED_SIZEat least in cases where we know that there's more than 4 MB in the first memchunk ...How do you know? You would have to reimplement the check
paging_initdoes.I see - as a heuristic, we can probably assume that the first memchunk is the relevant one, and especially in the case of FastRAM, also the larger one. Does this hold for Amiga/Mac/VME as well?
Quoted 5 lines
People want to run the kernel in the fastest memory chunk, which is typically also the largest (slow Amiga mainboard memory may be 2 - 16 MiB for Linux-capable machines, accelerator memory may be larger).
Don't know about Mac,
It may be possible to boot Linux with MacOS running in 24-bit mode, and ISTR that this leads to a large number of memory chunks. The Penguin documentation says use 32-bit mode (which means installing Mode32 if you have old MacOS and old ROMs). The only Mac I have here is running MacOS 7.6 so I can't test 24-bit mode. You can see the debug output from Penguin below.
Quoted 1 line
but I have some memories of interleaved banks and such...
There are some Mac models with memory controllers that do interleaving. I don't know whether interleaving is relevant here. I'd have to consult the Penguin source code to know whether it behaves differently on different models.
Perhaps you're thinking of this --
"68020: Don't force kernel into bank A: [optional] This is a special option for the 68020 and MacII owners only. It has to do with the physical arrangement of the memory banks in the MacII ... NOTE: This option has been removed from Penguin 18."
from http://www.mac.linux-m68k.org/docs/penguin.php
Signature · 69 lines
Logging started Friday, 1 January 1904 12:19:07 AM Penguin App version 19 Logical To Physical Mapping table (V2) Logical -> physical : length 0x00000000 -> 0x00000000 : 0x00C00000 System: 7.6.1 Gestalt ID: 33 (PowerBook 180) CPU: 68030 FPU: 68882 Physical RAM: 12 MB Command line is 'consoleblank=0 console=tty console=ttyS0 earlyprintk' GUnzipping Macintosh HD:Desktop Folder:vmlinux.gz .Kernel format: ELF The kernel will be located at physical 0x00001000 Kernel at logical address 0x5d4008 GUnzipping Macintosh HD:Desktop Folder:vmlinux.gz ..............................................Read 2794880 bytes for segment 0, requested 2794880 .Read 101752 bytes for segment 1, requested 101752 Bootstrap's bootinfo version: 2.0 Kernel's bootinfo version : 2.0 Kernel entry physical is 0x2000 RAM disk at 0x008b7008, ends at 0x00929008, size is 456 K Kernel segment 0 at 0x5d4008, size 2917724 Kernel segment 1 at 0x89d008, size 102400 Kernel size is 0x2e2000 boot_info is at 0x8b6008 boot_info size is dynamic ramdisk logical target 0xb8e000 ramdisk physical at 0xb8e000 ramdisk physical top at 0xc00000 Bootstrap logical 1: 0x00000000 Bootstrap physical : 0x00000000 Dump of bootinfo, version 2.0: BI_MACHTYPE = 0x3 BI_CPUTYPE = 0x2 BI_FPUTYPE = 0x2 BI_MMUTYPE = 0x2 BI_MEMCHUNK[0].addr = 0x00000000 BI_MEMCHUNK[0].size = 0x00c00000 BI_RAMDISK.addr = 0x00b8e000 BI_RAMDISK.size = 0x00072000 BI_COMMAND_LINE = consoleblank=0 console=tty console=ttyS0 earlyprintk BI_MAC_MODEL = 0x21 BI_MAC_VADDR = 0x60040000 BI_MAC_VDEPTH = 0x4 BI_MAC_VROW = 0x140 BI_MAC_VDIM = 0x01900280 BI_MAC_VLOGICAL = 0x60040000 BI_MAC_SCCBASE = 0x50f04000 BI_MAC_BTIME = 0x83da53fb BI_MAC_GMTBIAS = 0x0 BI_MAC_MEMSIZE = 0xc BI_MAC_CPUID = 0x1 BI_MAC_ROMBASE = 0x40800000 Booting Linux (fasten seat belts, please)... Waking up serial ports, no rest for the wicked... Modem port awake and configured! slot_int_set: slot 0x00, drvr_refnum -49, spID 0xBC, spExtDev 0x00, ON 0 Logging ended Friday, 1 January 1904 12:19:50 AM
Geert Uytterhoeven
maintainerHi Finn,
Quoted 4 lines · Finn Thain
Quoted 1 line
but I have some memories of interleaved banks and such...
There are some Mac models with memory controllers that do interleaving. I don't know whether interleaving is relevant here.
I meant that if you have e.g. 16 MiB of RAM, but it's split in 4 chunks of 4 MiB,
you don't have 8 MiB in the first chunk.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Michael Schmitz
maintainerHi Finn,
Quoted 4 lines
Quoted 1 line
Don't know about Mac,
It may be possible to boot Linux with MacOS running in 24-bit mode, and ISTR that this leads to a large number of memory chunks. The Penguin
The chunk size would still be 16 MB, perhaps?
(Unless Geert is right and interleaving means multiple small memory chunks. I doubt Apple engineers would have gone that far.)
Cheers,
Michael
Quoted 11 lines · Finn Thain
Quoted 3 lines · Geert Uytterhoeven
<snip>
Don't know about Mac,
It may be possible to boot Linux with MacOS running in 24-bit mode, and ISTR that this leads to a large number of memory chunks. The Penguin documentation says use 32-bit mode (which means installing Mode32 if you have old MacOS and old ROMs). The only Mac I have here is running MacOS 7.6 so I can't test 24-bit mode. You can see the debug output from Penguin below.
I happen to have my crazy PearPC/Mac OS X-booting LC475 still up and running with a 7.5.5 system folder on it. I rebooted it into 24-bit mode and loading Penguin does give a warning that 32-bit mode works better. Attempting to boot generates:
*** Too many memory ranges!!!
Error:
*** setup_ram_mappings() failure - too many mappings
I have a 64mb simm in this LC475; I tried popping it out (leaving me with 4mb) and it actually did attempt to unpack the kernel, but there's too little memory to do it. I have a bagful of smaller 72-pin simms kicking around somewhere; I'll have to dig it out of the closet and try it again.
Sadly my IIci is still misbehaving due to bad caps. I do have a working 840AV here... I believe it should work in 24-bit mode. I don't have any older 32-bit unclean Macs of the era when 24-bit was normal to try with to see if maybe the memory controller works better.
Quoted 6 lines
Quoted 2 lines
but I have some memories of interleaved banks and such...
There are some Mac models with memory controllers that do interleaving. I don't know whether interleaving is relevant here. I'd have to consult the Penguin source code to know whether it behaves differently on different models.
All I can say here is I ran 2.0-era kernels on a Quadra 840AV which does have interleaved RAM way back in the day just fine. I haven't yet gotten modern kernels (even the setup that works on the LC475) booting on it yet; sadly I'm not much good for coding or debug tracing.
Scott
Quoted 18 lines · Scott Holder
Quoted 6 lines · Finn Thain
It may be possible to boot Linux with MacOS running in 24-bit mode, and ISTR that this leads to a large number of memory chunks. The Penguin documentation says use 32-bit mode (which means installing Mode32 if you have old MacOS and old ROMs). The only Mac I have here is running MacOS 7.6 so I can't test 24-bit mode. You can see the debug output from Penguin below.
I happen to have my crazy PearPC/Mac OS X-booting LC475 still up and running with a 7.5.5 system folder on it. I rebooted it into 24-bit mode and loading Penguin does give a warning that 32-bit mode works better. Attempting to boot generates:
*** Too many memory ranges!!!
Error:
***setup_ram_mappings()failure - too many mappings
Quoted 8 lines
From the Penguin source,
MMU/MMU_V2.c, that means more than 32 chunks.I have a 64mb simm in this LC475; I tried popping it out (leaving me with 4mb) and it actually did attempt to unpack the kernel, but there's too little memory to do it. I have a bagful of smaller 72-pin simms kicking around somewhere; I'll have to dig it out of the closet and try it again.
You should be able to get Penguin to list the mappings even when it doesn't have room to unpack a kernel.
But there's probably no need: it seems highly likely that you'd see no 16 MB chunk on a 16 MB machine in 24-bit mode.
Finn
Quoted 7 lines · Michael Schmitz
Hi Finn,
Quoted 3 lines
It may be possible to boot Linux with MacOS running in 24-bit mode, and ISTR that this leads to a large number of memory chunks. The Penguin
The chunk size would still be 16 MB, perhaps?
Looking at the Penguin source, findRAM() in Source/mmu_support.c sorts the boot info memory mappings so that the largest chunk comes first. In 32-bit mode, it will probably be the only chunk. Regardless of 24-bit mode or 32-bit mode, it may not be a 16 MB chunk.
Finn
Quoted 10 lines · On Fri, 4 Apr 2014, I wrote:
Quoted 4 lines · Michael Schmitz
Quoted 2 lines
It may be possible to boot Linux with MacOS running in 24-bit mode, and ISTR that this leads to a large number of memory chunks.
The chunk size would still be 16 MB, perhaps?
Looking at the Penguin source,
findRAM()inSource/mmu_support.csorts the boot info memory mappings so that the largest chunk comes first. In 32-bit mode, it will probably be the only chunk.
... but not always: Designing Cards & Drivers 3ed. p.28 says, "In the Macintosh IIci and the Macintosh IIsi, physical memory is not in one contiguous block, so the MMU of the 68030 joins the blocks of physical memory to present contiguous logical memory to application software."