boards: qemu_x86: properly enable XIP

The '#if XIP' in the DTS file never worked properly,
causing the QEMU build to think it has much more RAM
then it actually has. If RAM overflowed, this would not
be caught by the build, instead there would be strange
crashes when the data copy takes place.

The QEMU targets themselves are not XIP, everything
is actually RAM, but the first 4 megabytes are
considered to be a memory-mapped flash region. This
is done to ensure that the XIP data copying infrastructure
doesn't bit-rot on x86. We are at the point where
a lot of things depend on this, so just select it in
the board Kconfig instead of enabling in the
defconfigs.

Fixes: #15835

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
diff --git a/boards/x86/qemu_x86/Kconfig.board b/boards/x86/qemu_x86/Kconfig.board
index 736a402..d1a2182 100644
--- a/boards/x86/qemu_x86/Kconfig.board
+++ b/boards/x86/qemu_x86/Kconfig.board
@@ -1,4 +1,9 @@
 # SPDX-License-Identifier: Apache-2.0
+#
+# The QEMU targets themselves are not XIP, everything is actually RAM, but we
+# pretend the first 4 megabytes are a memory-mapped flash region. This is done
+# to ensure that the XIP data copying infrastructure doesn't bit-rot on
+# x86.
 
 config BOARD_QEMU_X86
 	bool "QEMU x86"
@@ -7,6 +12,7 @@
 	select HAS_DTS_ETHERNET
 	select CPU_HAS_FPU
 	select HAS_COVERAGE_SUPPORT
+	select XIP
 
 config BOARD_QEMU_X86_IAMCU
 	bool "QEMU x86 (IAMCU ABI)"
@@ -14,3 +20,4 @@
 	select QEMU_TARGET
 	select HAS_DTS_ETHERNET
 	select HAS_COVERAGE_SUPPORT
+	select XIP
diff --git a/boards/x86/qemu_x86/qemu_x86.dts b/boards/x86/qemu_x86/qemu_x86.dts
index 6d1c824..e83ec7e 100644
--- a/boards/x86/qemu_x86/qemu_x86.dts
+++ b/boards/x86/qemu_x86/qemu_x86.dts
@@ -5,12 +5,7 @@
 #include <mem.h>
 
 #define DT_FLASH_SIZE		DT_SIZE_K(1024)
-
-#if XIP
-	#define DT_SRAM_SIZE		DT_SIZE_K(4096)
-#else
-	#define DT_SRAM_SIZE		DT_SIZE_K(8188)
-#endif
+#define DT_SRAM_SIZE		DT_SIZE_K(4096)
 
 #include <ia32.dtsi>
 
diff --git a/boards/x86/qemu_x86/qemu_x86_defconfig b/boards/x86/qemu_x86/qemu_x86_defconfig
index 16fc2c3..ca82b60 100644
--- a/boards/x86/qemu_x86/qemu_x86_defconfig
+++ b/boards/x86/qemu_x86/qemu_x86_defconfig
@@ -15,7 +15,6 @@
 CONFIG_UART_CONSOLE=y
 CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=25000000
 CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_XIP=y
 CONFIG_X86_MMU=y
 CONFIG_DEBUG_INFO=y
 CONFIG_SCHED_SCALABLE=y
diff --git a/boards/x86/qemu_x86/qemu_x86_iamcu_defconfig b/boards/x86/qemu_x86/qemu_x86_iamcu_defconfig
index f0e151b..06b3c5c 100644
--- a/boards/x86/qemu_x86/qemu_x86_iamcu_defconfig
+++ b/boards/x86/qemu_x86/qemu_x86_iamcu_defconfig
@@ -15,6 +15,5 @@
 CONFIG_UART_CONSOLE=y
 CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=25000000
 CONFIG_X86_IAMCU=y
-CONFIG_XIP=y
 CONFIG_X86_MMU=y
 CONFIG_DEBUG_INFO=y
diff --git a/boards/x86/qemu_x86/qemu_x86_nommu_defconfig b/boards/x86/qemu_x86/qemu_x86_nommu_defconfig
index 0aa3c9e..0316974 100644
--- a/boards/x86/qemu_x86/qemu_x86_nommu_defconfig
+++ b/boards/x86/qemu_x86/qemu_x86_nommu_defconfig
@@ -15,5 +15,4 @@
 CONFIG_UART_CONSOLE=y
 CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=25000000
 CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_XIP=y
 CONFIG_DEBUG_INFO=y