diff --git a/sys/arm/allwinner/std.allwinner b/sys/arm/allwinner/std.allwinner index 360d16932e0..4823d64a9f0 100644 --- a/sys/arm/allwinner/std.allwinner +++ b/sys/arm/allwinner/std.allwinner @@ -5,9 +5,6 @@ cpu CPU_CORTEXA machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a" -makeoptions KERNVIRTADDR=0xc0200000 -options KERNVIRTADDR=0xc0200000 - options IPI_IRQ_START=0 options IPI_IRQ_END=15 diff --git a/sys/arm/allwinner/std.allwinner_up b/sys/arm/allwinner/std.allwinner_up index 0d5661eed55..3fdfb7bba15 100644 --- a/sys/arm/allwinner/std.allwinner_up +++ b/sys/arm/allwinner/std.allwinner_up @@ -5,9 +5,6 @@ cpu CPU_CORTEXA machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a" -makeoptions KERNVIRTADDR=0xc0200000 -options KERNVIRTADDR=0xc0200000 - files "../allwinner/files.allwinner_up" files "../allwinner/files.allwinner" files "../allwinner/a10/files.a10" diff --git a/sys/arm/altera/socfpga/std.socfpga b/sys/arm/altera/socfpga/std.socfpga index bbfb218da28..563491ca76c 100644 --- a/sys/arm/altera/socfpga/std.socfpga +++ b/sys/arm/altera/socfpga/std.socfpga @@ -4,9 +4,6 @@ cpu CPU_CORTEXA machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a" -makeoptions KERNVIRTADDR=0xc0f00000 -options KERNVIRTADDR=0xc0f00000 - options IPI_IRQ_START=0 options IPI_IRQ_END=15 diff --git a/sys/arm/arm/dump_machdep.c b/sys/arm/arm/dump_machdep.c index c339689fe29..ead54ca7b22 100644 --- a/sys/arm/arm/dump_machdep.c +++ b/sys/arm/arm/dump_machdep.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* For KERNVIRTADDR */ int do_minidump = 1; SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RWTUN, &do_minidump, 0, diff --git a/sys/arm/arm/elf_trampoline.c b/sys/arm/arm/elf_trampoline.c index 4b9396adcec..0d93998016d 100644 --- a/sys/arm/arm/elf_trampoline.c +++ b/sys/arm/arm/elf_trampoline.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* For KERNVIRTADDR */ #if __ARM_ARCH >= 6 #error "elf_trampline is not supported on ARMv6/v7 platforms" diff --git a/sys/arm/arm/genassym.c b/sys/arm/arm/genassym.c index ab7ec0f6636..6884b803701 100644 --- a/sys/arm/arm/genassym.c +++ b/sys/arm/arm/genassym.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* For KERNVIRTADDR */ #include #include @@ -59,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include ASSYM(KERNBASE, KERNBASE); +ASSYM(KERNVIRTADDR, KERNVIRTADDR); #if __ARM_ARCH >= 6 ASSYM(CPU_ASID_KERNEL,CPU_ASID_KERNEL); #endif diff --git a/sys/arm/arm/machdep_boot.c b/sys/arm/arm/machdep_boot.c index cb2c68203f6..adb15f427be 100644 --- a/sys/arm/arm/machdep_boot.c +++ b/sys/arm/arm/machdep_boot.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* For KERNVIRTADDR */ #ifdef FDT #include diff --git a/sys/arm/broadcom/bcm2835/std.rpi b/sys/arm/broadcom/bcm2835/std.rpi index 793eab16c79..48593c117c5 100644 --- a/sys/arm/broadcom/bcm2835/std.rpi +++ b/sys/arm/broadcom/bcm2835/std.rpi @@ -1,5 +1,3 @@ # $FreeBSD$ -options KERNVIRTADDR=0xc0100000 -makeoptions KERNVIRTADDR=0xc0100000 options LINUX_BOOT_ABI diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index e48cc57ce30..cb84f781766 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -25,9 +25,6 @@ options SMP_ON_UP machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a" -makeoptions KERNVIRTADDR=0xc0000000 -options KERNVIRTADDR=0xc0000000 - include "std.armv7" files "../allwinner/files.allwinner" files "../allwinner/files.allwinner_up" diff --git a/sys/arm/conf/NOTES b/sys/arm/conf/NOTES index 4b8dbc3edf1..9f5f6574abc 100644 --- a/sys/arm/conf/NOTES +++ b/sys/arm/conf/NOTES @@ -24,11 +24,9 @@ files "../xscale/ixp425/files.ixp425" files "../xscale/pxa/files.pxa" options PHYSADDR=0x00000000 -options KERNVIRTADDR=0xc0000000 makeoptions LDFLAGS="-zmuldefs" makeoptions KERNPHYSADDR=0x00000000 -makeoptions KERNVIRTADDR=0xc0000000 options FDT diff --git a/sys/arm/freescale/imx/std.imx51 b/sys/arm/freescale/imx/std.imx51 index 730c976899a..7f8a95dc0c4 100644 --- a/sys/arm/freescale/imx/std.imx51 +++ b/sys/arm/freescale/imx/std.imx51 @@ -3,9 +3,6 @@ machine arm armv7 cpu CPU_CORTEXA makeoptions CONF_CFLAGS="-march=armv7a" -options KERNVIRTADDR=0xc0100000 -makeoptions KERNVIRTADDR=0xc0100000 - device fdt_pinctrl files "../freescale/imx/files.imx5" diff --git a/sys/arm/freescale/imx/std.imx53 b/sys/arm/freescale/imx/std.imx53 index 730c976899a..7f8a95dc0c4 100644 --- a/sys/arm/freescale/imx/std.imx53 +++ b/sys/arm/freescale/imx/std.imx53 @@ -3,9 +3,6 @@ machine arm armv7 cpu CPU_CORTEXA makeoptions CONF_CFLAGS="-march=armv7a" -options KERNVIRTADDR=0xc0100000 -makeoptions KERNVIRTADDR=0xc0100000 - device fdt_pinctrl files "../freescale/imx/files.imx5" diff --git a/sys/arm/freescale/imx/std.imx6 b/sys/arm/freescale/imx/std.imx6 index 8778a29a705..0d57ff5c22e 100644 --- a/sys/arm/freescale/imx/std.imx6 +++ b/sys/arm/freescale/imx/std.imx6 @@ -3,9 +3,6 @@ machine arm armv7 cpu CPU_CORTEXA makeoptions CONF_CFLAGS="-march=armv7a" -options KERNVIRTADDR = 0xc2000000 -makeoptions KERNVIRTADDR = 0xc2000000 - options IPI_IRQ_START=0 options IPI_IRQ_END=15 diff --git a/sys/arm/freescale/vybrid/std.vybrid b/sys/arm/freescale/vybrid/std.vybrid index 25d2a6b3915..d92a520898b 100644 --- a/sys/arm/freescale/vybrid/std.vybrid +++ b/sys/arm/freescale/vybrid/std.vybrid @@ -4,7 +4,4 @@ cpu CPU_CORTEXA machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a" -makeoptions KERNVIRTADDR=0xc0100000 -options KERNVIRTADDR=0xc0100000 - files "../freescale/vybrid/files.vybrid" diff --git a/sys/arm/include/vmparam.h b/sys/arm/include/vmparam.h index 916cb1377ec..ba43e9e91e6 100644 --- a/sys/arm/include/vmparam.h +++ b/sys/arm/include/vmparam.h @@ -74,6 +74,19 @@ #define KERNBASE 0xc0000000 #endif +/* + * The virtual address the kernel is linked to run at. For armv4/5 platforms + * the low-order 30 bits of this must match the low-order bits of the physical + * address the kernel is loaded at, so the value is most often provided as a + * kernel config option in the std.platform file. For armv6/7 the kernel can + * be loaded at any 2MB boundary, and KERNVIRTADDR can also be set to any 2MB + * boundary. It is typically overridden in the std.platform file only when + * KERNBASE is also set to a lower address to provide more KVA. + */ +#ifndef KERNVIRTADDR +#define KERNVIRTADDR 0xc0000000 +#endif + /* * max number of non-contig chunks of physical RAM you can have */ diff --git a/sys/arm/mv/armada38x/std.armada38x b/sys/arm/mv/armada38x/std.armada38x index abda7a76940..5ed40d13374 100644 --- a/sys/arm/mv/armada38x/std.armada38x +++ b/sys/arm/mv/armada38x/std.armada38x @@ -5,8 +5,6 @@ cpu CPU_CORTEXA machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a" -makeoptions KERNVIRTADDR=0xc0000000 -options KERNVIRTADDR=0xc0000000 options IPI_IRQ_START=0 options IPI_IRQ_END=15 diff --git a/sys/arm/mv/armadaxp/std.armadaxp b/sys/arm/mv/armadaxp/std.armadaxp index 84361f53eb2..b720e3de68b 100644 --- a/sys/arm/mv/armadaxp/std.armadaxp +++ b/sys/arm/mv/armadaxp/std.armadaxp @@ -1,4 +1,2 @@ # $FreeBSD$ -makeoptions KERNVIRTADDR=0xc0200000 -options KERNVIRTADDR=0xc0200000 diff --git a/sys/arm/nvidia/tegra124/std.tegra124 b/sys/arm/nvidia/tegra124/std.tegra124 index e9688732d69..ab58d763216 100644 --- a/sys/arm/nvidia/tegra124/std.tegra124 +++ b/sys/arm/nvidia/tegra124/std.tegra124 @@ -3,9 +3,6 @@ cpu CPU_CORTEXA machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a" -options KERNVIRTADDR = 0xc0200000 -makeoptions KERNVIRTADDR = 0xc0200000 - options INTRNG options IPI_IRQ_START=0 diff --git a/sys/arm/rockchip/std.rk30xx b/sys/arm/rockchip/std.rk30xx index 4747145d4b8..6cf2ecbc9ca 100644 --- a/sys/arm/rockchip/std.rk30xx +++ b/sys/arm/rockchip/std.rk30xx @@ -5,9 +5,6 @@ cpu CPU_CORTEXA machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a" -makeoptions KERNVIRTADDR=0xc0400000 -options KERNVIRTADDR=0xc0400000 - options IPI_IRQ_START=0 options IPI_IRQ_END=15 diff --git a/sys/arm/samsung/exynos/std.exynos5250 b/sys/arm/samsung/exynos/std.exynos5250 index 7f0a2fb190e..0c14f0c7293 100644 --- a/sys/arm/samsung/exynos/std.exynos5250 +++ b/sys/arm/samsung/exynos/std.exynos5250 @@ -4,9 +4,6 @@ cpu CPU_CORTEXA machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a" -makeoptions KERNVIRTADDR=0xc0f00000 -options KERNVIRTADDR=0xc0f00000 - options IPI_IRQ_START=0 options IPI_IRQ_END=15 diff --git a/sys/arm/samsung/exynos/std.exynos5420 b/sys/arm/samsung/exynos/std.exynos5420 index 7f0a2fb190e..0c14f0c7293 100644 --- a/sys/arm/samsung/exynos/std.exynos5420 +++ b/sys/arm/samsung/exynos/std.exynos5420 @@ -4,9 +4,6 @@ cpu CPU_CORTEXA machine arm armv7 makeoptions CONF_CFLAGS="-march=armv7a" -makeoptions KERNVIRTADDR=0xc0f00000 -options KERNVIRTADDR=0xc0f00000 - options IPI_IRQ_START=0 options IPI_IRQ_END=15 diff --git a/sys/arm/ti/am335x/std.am335x b/sys/arm/ti/am335x/std.am335x index 717d6046e80..98b1d3c310a 100644 --- a/sys/arm/ti/am335x/std.am335x +++ b/sys/arm/ti/am335x/std.am335x @@ -5,7 +5,4 @@ include "../ti/std.ti" cpu CPU_CORTEXA -options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm -makeoptions KERNVIRTADDR=0xc0200000 - options SOC_TI_AM335X diff --git a/sys/arm/ti/omap4/std.omap4 b/sys/arm/ti/omap4/std.omap4 index 1426fa8f959..b3edb8bec42 100644 --- a/sys/arm/ti/omap4/std.omap4 +++ b/sys/arm/ti/omap4/std.omap4 @@ -5,7 +5,4 @@ include "../ti/std.ti" cpu CPU_CORTEXA -options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm -makeoptions KERNVIRTADDR=0xc0200000 - options SOC_OMAP4 diff --git a/sys/arm/xilinx/std.zynq7 b/sys/arm/xilinx/std.zynq7 index 6690fd5e9a0..7fbcd47a412 100644 --- a/sys/arm/xilinx/std.zynq7 +++ b/sys/arm/xilinx/std.zynq7 @@ -9,8 +9,5 @@ makeoptions CONF_CFLAGS="-march=armv7a" files "../xilinx/files.zynq7" -options KERNVIRTADDR=0xc0100000 # Used in ldscript.arm -makeoptions KERNVIRTADDR=0xc0100000 - options IPI_IRQ_START=0 options IPI_IRQ_END=15 diff --git a/sys/conf/Makefile.arm b/sys/conf/Makefile.arm index 53ff25ab239..5bbcddc98fa 100644 --- a/sys/conf/Makefile.arm +++ b/sys/conf/Makefile.arm @@ -53,6 +53,11 @@ CFLAGS += -mllvm -arm-enable-ehabi .endif .endif +# "makeoptions KERNVIRTADDR=" is now optional, supply the default value. +.if empty(KERNVIRTADDR) +KERNVIRTADDR= 0xc0000000 +.endif + # hack because genassym.c includes sys/bus.h which includes these. genassym.o: bus_if.h device_if.h