[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 02/23] lib: move 64-bit div/mod compiler helpers



Hi Jan,

On 01/04/2021 11:19, Jan Beulich wrote:
These were built for 32-bit architectures only (the same code could,
with some tweaking, sensibly be used to provide TI-mode helpers on
64-bit arch-es) - retain this property, while still avoiding to have
a CU without any contents at all. For this, Arm's CONFIG_64BIT gets
generalized.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
  xen/arch/Kconfig                   |  2 ++
  xen/arch/arm/Kconfig               | 12 +++---------
  xen/arch/x86/Kconfig               |  1 +
  xen/common/Makefile                |  1 -
  xen/lib/Makefile                   |  4 ++++
  xen/{common/lib.c => lib/divmod.c} |  2 --
  6 files changed, 10 insertions(+), 12 deletions(-)
  rename xen/{common/lib.c => lib/divmod.c} (99%)

diff --git a/xen/arch/Kconfig b/xen/arch/Kconfig
index d144d4c8d3ee..f16eb0df43af 100644
--- a/xen/arch/Kconfig
+++ b/xen/arch/Kconfig
@@ -1,3 +1,5 @@
+config 64BIT
+       bool
config NR_CPUS
        int "Maximum number of CPUs"
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 330bbf6232d4..ecfa6822e4d3 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -1,17 +1,11 @@
-config 64BIT
-       bool
-       default "$(ARCH)" != "arm32"
-       help
-         Say yes to build a 64-bit Xen
-         Say no to build a 32-bit Xen
-
  config ARM_32
        def_bool y
-       depends on !64BIT
+       depends on "$(ARCH)" = "arm32"
config ARM_64
        def_bool y
-       depends on 64BIT
+       depends on !ARM_32
+       select 64BIT
        select HAS_FAST_MULTIPLY
config ARM
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index f79e6634db3f..4d6911ffa467 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -1,5 +1,6 @@
  config X86_64
        def_bool y
+       select 64BIT
config X86
        def_bool y
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 71c1d466bd8f..e2a7e62d14bf 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -21,7 +21,6 @@ obj-y += kernel.o
  obj-y += keyhandler.o
  obj-$(CONFIG_KEXEC) += kexec.o
  obj-$(CONFIG_KEXEC) += kimage.o
-obj-y += lib.o
  obj-$(CONFIG_LIVEPATCH) += livepatch.o livepatch_elf.o
  obj-$(CONFIG_MEM_ACCESS) += mem_access.o
  obj-y += memory.o
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 0b274583ef0b..a5dc1442a422 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -10,3 +10,7 @@ lib-y += rbtree.o
  lib-y += sort.o
  lib-$(CONFIG_X86) += xxhash32.o
  lib-$(CONFIG_X86) += xxhash64.o
+
+lib32-y := divmod.o
+lib32-$(CONFIG_64BIT) :=
+lib-y += $(lib32-y)
diff --git a/xen/common/lib.c b/xen/lib/divmod.c
similarity index 99%
rename from xen/common/lib.c
rename to xen/lib/divmod.c
index 5b8f49153dad..0be6ccc70096 100644
--- a/xen/common/lib.c
+++ b/xen/lib/divmod.c
@@ -40,7 +40,6 @@
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   */
-#if BITS_PER_LONG == 32

In theory BITS_PER_LONG == 32 is not quite the same as 32-bit arch. Can you clarify whether this code is necessary on 64-bit arch where long is only 32-bit.

Cheers?

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.