From 5702619620c3cf347097918795379f9bd22e9d0c Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Thu, 12 Dec 2019 10:26:05 +0800 Subject: [PATCH] HV: kconfig: add range check for memory setting When user use make menuconfig to configure memory related kconfig items, we need add range check to avoid compile error or other potential issues: CONFIG_LOW_RAM_SIZE:(0 ~ 0x10000) the value should be less than 64KB; CONFIG_HV_RAM_SIZE: (0x1000000 ~ 0x10000000) the hypervisor RAM size should be supposed between 16MB to 256MB; CONFIG_PLATFORM_RAM_SIZE: (0x100000000 ~ 0x4000000000) the platform RAM size should be larger than 4GB and less than 256GB; CONFIG_SOS_RAM_SIZE: (0x100000000 ~ 0x4000000000) the SOS RAM size should be larger than 4GB and less than 256GB; CONFIG_UOS_RAM_SIZE: (0 ~ 0x2000000000) the UOS RAM size should be less than 128GB; Tracked-On: #4229 Signed-off-by: Victor Sun --- hypervisor/arch/x86/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hypervisor/arch/x86/Kconfig b/hypervisor/arch/x86/Kconfig index 1ebd12900..41a78fe78 100644 --- a/hypervisor/arch/x86/Kconfig +++ b/hypervisor/arch/x86/Kconfig @@ -178,6 +178,7 @@ config NPK_LOGLEVEL_DEFAULT config LOW_RAM_SIZE hex "Size of the low RAM region" + range 0 0x10000 default 0x00010000 help A 32-bit integer indicating the size of RAM region below address @@ -199,6 +200,7 @@ config HV_RAM_START config HV_RAM_SIZE hex "Size of the RAM region used by the hypervisor" + range 0x1000000 0x10000000 default 0x0b800000 help A 64-bit integer indicating the size of RAM used by the hypervisor. @@ -207,6 +209,7 @@ config HV_RAM_SIZE config PLATFORM_RAM_SIZE hex "Size of the physical platform RAM" + range 0x100000000 0x4000000000 default 0x400000000 help A 64-bit integer indicating the size of the physical platform RAM @@ -214,6 +217,7 @@ config PLATFORM_RAM_SIZE config SOS_RAM_SIZE hex "Size of the Service OS (SOS) RAM" + range 0x100000000 0x4000000000 default 0x400000000 help A 64-bit integer indicating the size of the Service OS RAM (MMIO not @@ -221,6 +225,7 @@ config SOS_RAM_SIZE config UOS_RAM_SIZE hex "Size of the User OS (UOS) RAM" + range 0 0x2000000000 default 0x200000000 help A 64-bit integer indicating the size of the User OS RAM (MMIO not