Some further work on trying to boot Solaris under qemu-system-sparc64 shows that allowing the full virtual memory range in the available property causes the memory list calculations to overflow.
The first couple of patches fix up SPARC32/SPARC64 to set the appropriate upper virtual memory limits (PPC is already correct), whilst the last patch enables the upper limit in the OFMEM virtual memory allocator.
With this patchset applied, 64-bit Solaris 9 gets beyond the "VAC too big!" panic upon boot and fails further down the line trying to setup the kernel memory regions.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (3): SPARC32: fixup available memory list and modify ofmem_arch_get_virt_top() SPARC64: set upper bound for virtual memory allocations libopenbios: limit upper virtual memory range to ofmem_arch_get_virt_top()
arch/sparc32/boot.c | 2 +- arch/sparc64/ofmem_sparc64.c | 2 +- include/arch/sparc32/ofmem_sparc32.h | 2 +- include/arch/sparc64/ofmem_sparc64.h | 2 ++ libopenbios/ofmem_common.c | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-)
In preparation for applying the ofmem_arch_get_virt_top() restriction to the virtual memory region, fix up the calculation of the available list tail plus increase the virtual memory region to cover the IO memory.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- arch/sparc32/boot.c | 2 +- include/arch/sparc32/ofmem_sparc32.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sparc32/boot.c b/arch/sparc32/boot.c index d458658..e9605f5 100644 --- a/arch/sparc32/boot.c +++ b/arch/sparc32/boot.c @@ -178,7 +178,7 @@ void setup_romvec(void) (**pp).num_bytes = (intprop_ptr[4] + intprop_ptr[5]) - (intprop_ptr[1] + intprop_ptr[2]); } else { /* Tail (size from top of virtual memory) */ - (**pp).num_bytes = 0xffffffffUL - (intprop_ptr[1] + intprop_ptr[2]) + 1; + (**pp).num_bytes = ofmem_arch_get_virt_top() - 1 - (intprop_ptr[1] + intprop_ptr[2]) + 1; }
intprop_ptr += 3; diff --git a/include/arch/sparc32/ofmem_sparc32.h b/include/arch/sparc32/ofmem_sparc32.h index efc21b4..a23780b 100644 --- a/include/arch/sparc32/ofmem_sparc32.h +++ b/include/arch/sparc32/ofmem_sparc32.h @@ -17,7 +17,7 @@ #include "libopenbios/ofmem.h"
#define OF_CODE_START 0xffd00000 -#define OFMEM_VIRT_TOP 0xfe000000 +#define OFMEM_VIRT_TOP 0xffff0000
struct mem; extern struct mem cdvmem;
Comparing with real device trees, the maximum virtual memory address available for allocation on sun4u machines is 0xff000000.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- arch/sparc64/ofmem_sparc64.c | 2 +- include/arch/sparc64/ofmem_sparc64.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/sparc64/ofmem_sparc64.c b/arch/sparc64/ofmem_sparc64.c index bdfaf56..5c742cd 100644 --- a/arch/sparc64/ofmem_sparc64.c +++ b/arch/sparc64/ofmem_sparc64.c @@ -62,7 +62,7 @@ ucell ofmem_arch_get_heap_top(void)
ucell ofmem_arch_get_virt_top(void) { - return (ucell)TOP_OF_RAM; + return (ucell)OFMEM_VIRT_TOP; }
ucell ofmem_arch_get_iomem_base(void) diff --git a/include/arch/sparc64/ofmem_sparc64.h b/include/arch/sparc64/ofmem_sparc64.h index 7ff24ae..19f2747 100644 --- a/include/arch/sparc64/ofmem_sparc64.h +++ b/include/arch/sparc64/ofmem_sparc64.h @@ -16,6 +16,8 @@
#include "libopenbios/ofmem.h"
+#define OFMEM_VIRT_TOP 0xff000000 + #define PAGE_SIZE_4M (4 * 1024 * 1024) #define PAGE_SIZE_512K (512 * 1024) #define PAGE_SIZE_64K (64 * 1024)
64-bit Solaris appears to overflow in its memory list calculations if the entire virtual memory space is represented in the available memory list.
Enforcing the upper limit from the previous patch enables 64-bit Solaris 9 boot to get beyond the "VAC too big!" error message upon boot.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- libopenbios/ofmem_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libopenbios/ofmem_common.c b/libopenbios/ofmem_common.c index 052aa2f..217bd9b 100644 --- a/libopenbios/ofmem_common.c +++ b/libopenbios/ofmem_common.c @@ -350,7 +350,7 @@ static void ofmem_update_translations( void ) ofmem_update_memory_available(s_phandle_memory, ofmem->phys_range, &phys_range_prop, &phys_range_prop_size, &phys_range_prop_used, get_ram_size() - 1); ofmem_update_memory_available(s_phandle_mmu, ofmem->virt_range, - &virt_range_prop, &virt_range_prop_size, &virt_range_prop_used, (ucell)-1); + &virt_range_prop, &virt_range_prop_size, &virt_range_prop_used, ofmem_arch_get_virt_top() - 1); ofmem_update_mmu_translations(); }
On 16/10/16 18:26, Mark Cave-Ayland wrote:
Some further work on trying to boot Solaris under qemu-system-sparc64 shows that allowing the full virtual memory range in the available property causes the memory list calculations to overflow.
The first couple of patches fix up SPARC32/SPARC64 to set the appropriate upper virtual memory limits (PPC is already correct), whilst the last patch enables the upper limit in the OFMEM virtual memory allocator.
With this patchset applied, 64-bit Solaris 9 gets beyond the "VAC too big!" panic upon boot and fails further down the line trying to setup the kernel memory regions.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (3): SPARC32: fixup available memory list and modify ofmem_arch_get_virt_top() SPARC64: set upper bound for virtual memory allocations libopenbios: limit upper virtual memory range to ofmem_arch_get_virt_top()
arch/sparc32/boot.c | 2 +- arch/sparc64/ofmem_sparc64.c | 2 +- include/arch/sparc32/ofmem_sparc32.h | 2 +- include/arch/sparc64/ofmem_sparc64.h | 2 ++ libopenbios/ofmem_common.c | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-)
Applied to master.
ATB,
Mark.