Add ppc_init_cacheline_sizes() function for OpenBSD.
PATCH 1/3 Add ppc_init_cacheline_sizes() function for OpenBSD.
Add ppc_init_cacheline_sizes() function for OpenBSD to fix compilation of PowerPC host support for OpenBSD/powerpc based architectures.
--- cache-utils.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
cache-utils.c +9 -2
@@ -55,9 +55,16 @@ static void ppc_init_cacheline_sizes(void) qemu_cache_conf.icache_bsize = cacheline; } } -#endif -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#elif defined(__OpenBSD__) + +static void ppc_init_cacheline_sizes (void ) +{ + qemu_cache_conf.dcache_bsize =32 ; + qemu_cache_conf.icache_bsize =32 ; +} + +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)#include <errno.h> #include <stdio.h> #include <stdlib.h>
Signature · 6 lines
1.7.5 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Quoted 23 lines · Brad
Add
ppc_init_cacheline_sizes()function for OpenBSD to fix compilation of PowerPC host support for OpenBSD/powerpc based architectures.Signed-off-by Brad Smith <[email protected]>--- cache-utils.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)cache-utils.c +2
-2@@ -55,9 +55,16 @@ static void ppc_init_cacheline_sizes(void) qemu_cache_conf.icache_bsize = cacheline; } } -#endif -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#elif defined(__OpenBSD__) +
cache-utils.c static void ppc_init_cacheline_sizes(void) · line 70
Quoted 10 lines
cache-utils.c +7
-0+static void ppc_init_cacheline_sizes (void ) +{ + qemu_cache_conf.dcache_bsize =32 ; + qemu_cache_conf.icache_bsize =32 ; +} + +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)#include <errno.h> #include <stdio.h> #include <stdlib.h>
This can't be right for most ppc64's.
Signature · 1 line
mailto:[email protected]
----- Original message -----
Quoted 21 lines · Brad
Quoted 20 lines
Add
ppc_init_cacheline_sizes()function for OpenBSD to fix compilation of PowerPC host support for OpenBSD/powerpc based architectures.Signed-off-by Brad Smith <[email protected]>---
cache-utils.c| 11 +++++++++--1 files changed, 9 insertions(+), 2 deletions(-)cache-utils.c +0
-1@@ -55,9 +55,16 @@ static void ppc_init_cacheline_sizes(void) qemu_cache_conf.icache_bsize = cacheline; } } -#endif
Quoted 16 lines
Quoted 4 lines
cache-utils.c +2
-1-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#elif defined(__OpenBSD__) +cache-utils.c static void ppc_init_cacheline_sizes(void) · line 70
Quoted 10 lines
cache-utils.c +7
-0+static void ppc_init_cacheline_sizes (void ) +{ + qemu_cache_conf.dcache_bsize = 32; + qemu_cache_conf.icache_bsize = 32; +} + +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)#include <errno.h> #include <stdio.h> #include <stdlib.h> This can't be right for most ppc64's.
Well this is what OpenBSD currently does and runs on G5's in 32-bit mode only.
Signature · 3 lines
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Quoted 39 lines · Brad
----- Original message -----
Quoted 21 lines · Brad
Quoted 20 lines
Add
ppc_init_cacheline_sizes()function for OpenBSD to fix compilation of PowerPC host support for OpenBSD/powerpc based architectures.Signed-off-by Brad Smith <[email protected]>---
cache-utils.c| 11 +++++++++--1 files changed, 9 insertions(+), 2 deletions(-)cache-utils.c +0
-1@@ -55,9 +55,16 @@ static void ppc_init_cacheline_sizes(void) qemu_cache_conf.icache_bsize = cacheline; } } -#endif Quoted 16 lines
Quoted 4 lines
cache-utils.c +2
-1-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#elif defined(__OpenBSD__) +cache-utils.c static void ppc_init_cacheline_sizes(void) · line 70
Quoted 10 lines
cache-utils.c +7
-0+static void ppc_init_cacheline_sizes (void ) +{ + qemu_cache_conf.dcache_bsize = 32; + qemu_cache_conf.icache_bsize = 32; +} + +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)#include <errno.h> #include <stdio.h> #include <stdlib.h> This can't be right for most ppc64's.
Quoted 2 lines
Well this is what OpenBSD currently does and runs on G5's in 32-bit mode only.
Mode of operation does not, to the best of my knowledge, change the hardware limits, the cache line size will still be 128 on those G5s.
Signature · 1 line
mailto:[email protected]
Quoted 41 lines · malc
Quoted 39 lines · Brad
----- Original message -----
Quoted 37 lines · Brad
Quoted 24 lines
Add
ppc_init_cacheline_sizes()function for OpenBSD to fix compilation of PowerPC host support for OpenBSD/powerpc based architectures.Signed-off-by Brad Smith<[email protected]>---
cache-utils.c| 11 +++++++++--1 files changed, 9 insertions(+), 2 deletions(-)cache-utils.c +2
-2@@ -55,9 +55,16 @@ static void ppc_init_cacheline_sizes(void) qemu_cache_conf.icache_bsize = cacheline; } } -#endif -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#elif defined(__OpenBSD__) +cache-utils.c static void ppc_init_cacheline_sizes(void) · line 70
Quoted 10 lines
cache-utils.c +7
-0+static void ppc_init_cacheline_sizes (void ) +{ + qemu_cache_conf.dcache_bsize =32 ; + qemu_cache_conf.icache_bsize =32 ; +} + +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)#include <errno.h> #include <stdio.h> #include <stdlib.h> This can't be right for most ppc64's.
Quoted 5 lines
Quoted 2 lines
Well this is what OpenBSD currently does and runs on G5's in 32-bit mode only.
Mode of operation does not, to the best of my knowledge, change the hardware limits, the cache line size will still be 128 on those G5s.
Well this is the behavior of our kernel no matter what the CPU type is.
from sys/arch/powerpc/cpu.h..
#define CACHELINE 32 /* Note that this value is really hardwired */
static __inline voidsyncicache(void *from, int len)
{
int l;
char *p = from;
len = len + (((u_int32_t) from) & (CACHELINESIZE - 1));
l = len;
do {
__asm __volatile ("dcbst 0,%0" :: "r"(p));
p += CACHELINESIZE;
} while ((l -= CACHELINESIZE) > 0);
__asm __volatile ("sync");
p = from;
l = len;
do {
__asm __volatile ("icbi 0,%0" :: "r"(p));
p += CACHELINESIZE;
} while ((l -= CACHELINESIZE) > 0);
__asm __volatile ("isync");
}static __inline voidinvdcache(void *from, int len)
{
int l;
char *p = from;
len = len + (((u_int32_t) from) & (CACHELINESIZE - 1));
l = len;
do {
__asm __volatile ("dcbi 0,%0" :: "r"(p));
p += CACHELINESIZE;
} while ((l -= CACHELINESIZE) > 0);
__asm __volatile ("sync");
}Signature · 3 lines
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Quoted 11 lines · Brad
Quoted 10 lines · malc
Quoted 8 lines · Brad
----- Original message -----
Quoted 7 lines · Brad
Quoted 6 lines
Add
ppc_init_cacheline_sizes()function for OpenBSD to fix compilation of PowerPC host support for OpenBSD/powerpc based architectures.Signed-off-by Brad Smith<[email protected]>
[..snip..]
Quoted 9 lines
Well this is the behavior of our kernel no matter what the CPU type is.
from
sys/arch/powerpc/cpu.h..#define CACHELINE 32 /* Note that this value is really
hardwired */
[..snip..]
I sure hope that OpenBSD doesn't use this value for dcbz/a's on ppc's with less than 32 bytes per cache line and am not sure i want to take this patch even if the kernel itself does this, not without some nagging printf in the init cache line function urging OpenBSD kernel developers to fix things..
Signature · 1 line
mailto:[email protected]
Quoted 26 lines · malc
Quoted 11 lines · Brad
Quoted 10 lines · malc
Quoted 8 lines · Brad
----- Original message -----
Quoted 7 lines · Brad
Quoted 6 lines
Add
ppc_init_cacheline_sizes()function for OpenBSD to fix compilation of PowerPC host support for OpenBSD/powerpc based architectures.Signed-off-by Brad Smith<[email protected]>[..snip..]
Quoted 9 lines
Well this is the behavior of our kernel no matter what the CPU type is.
from
sys/arch/powerpc/cpu.h..#define CACHELINE 32 /* Note that this value is really
hardwired */
Quoted 7 lines
[..snip..]
I sure hope that OpenBSD doesn't use this value for dcbz/a's on ppc's with less than 32 bytes per cache line and am not sure i want to take this patch even if the kernel itself does this, not without some nagging printf in the init cache line function urging OpenBSD kernel developers to fix things..
USE_DCBZ is not defined.
/*
* Fill the given physical page with zeros.
*/
voidpmap_zero_page(struct vm_page *pg)
{
paddr_t pa = VM_PAGE_TO_PHYS(pg);
#ifdef USE_DCBZ
int i;
paddr_t addr = zero_page;#endif
/* simple_lock(&pmap_zero_page_lock); */
pmap_kenter_pa(zero_page, pa, VM_PROT_READ|VM_PROT_WRITE);
#ifdef USE_DCBZ
for (i = PAGE_SIZE/CACHELINESIZE; i>0; i--) {
__asm volatile ("dcbz 0,%0" :: "r"(addr));
addr += CACHELINESIZE;
}
#else
bzero((void *)zero_page, PAGE_SIZE);
#endif
pmap_kremove_pg(zero_page);
/* simple_unlock(&pmap_zero_page_lock); */
}Signature · 3 lines
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.