From nobody Tue Jun 23 06:21:23 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCCA9C433EF for ; Wed, 9 Mar 2022 22:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238753AbiCIWhL (ORCPT ); Wed, 9 Mar 2022 17:37:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229715AbiCIWhK (ORCPT ); Wed, 9 Mar 2022 17:37:10 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21FDB1216B9 for ; Wed, 9 Mar 2022 14:36:11 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id mr24-20020a17090b239800b001bf0a375440so6582678pjb.4 for ; Wed, 09 Mar 2022 14:36:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KaZ7UiCMXi8qMFjPqiV4xU9nDrqqMiEGUN4hXGJXHL0=; b=f1Vc4QOkkBXv6009fjawNvWMX9OxrPebOlqoDZEQhDLnw1gEwD14g81AO62Vc7PZSM 0iUzd91hEUZhS3UI0SmnX5hGatAnQKj7z52vrmX9o+qdBDkPUNoKaAeC/GcOm6q8vJel Y6wwFooGD3tTJpth4TUXsPLxLc5l2TEewJTu8J1oywVo4m7NRv+/ucWEgDn2C9iXl5vL i6y5BReYAhUiEHPwojq307v1ALmQ+QoXaD1bJS2QpqJPJs7fbDzdjillX1xuPVOViKfI sgCFjbKq19VXiVd3eTk8UiJqCaSkb9L/im9cUALFc1QHRFlr7I/yIoyoyLtq4A25KUTP 200Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KaZ7UiCMXi8qMFjPqiV4xU9nDrqqMiEGUN4hXGJXHL0=; b=C9wiKp3BLOqzd6dQopw2C4fBjM1J0CJIWHcRYKAPEJGsvZCGvFRaF1qS/yrCzymXIn RWUkX5ejZXNCiLSjCVkoJJ9duRDxMBwzWsUMK76zioQjq8ZOoXsGzwaHf7OsXE8bt1Ub xmGhI7ZA45wRCwXAEDhBnD5ELVuQttlR+HVyU2ydHoVGahF7p+ssYuzY2ytLyMHp09uK yz9o7HR578/zWeDxBWbhbg8GUZWcYZy9Tu+SReso+el6X1YFUzVduS2LKvOPzkrRsIk4 uIn1SJyFNA+aXt0Oi/CN+cTpeRe4LN4uxmVd5osYPGBIqpTLNYHpFqj3WZavdSFATp7N lCHQ== X-Gm-Message-State: AOAM5326KBH3z7O+wWP/4VXXwDIgqTuOdMx2oEHrlLF8RAIiKdgTQyk5 IweoWIxgt1Pe4oshMLlaVPc= X-Google-Smtp-Source: ABdhPJweOMbhERmw1l+0POpTBXvnE5YjxPi6T3FchbPLhWMokyMkH/qrladgyIE5jlyra7QRpDmbpA== X-Received: by 2002:a17:90b:4d8a:b0:1be:f5f1:89d3 with SMTP id oj10-20020a17090b4d8a00b001bef5f189d3mr1794464pjb.79.1646865370688; Wed, 09 Mar 2022 14:36:10 -0800 (PST) Received: from octofox.hsd1.ca.comcast.net ([2601:641:401:1d20:6f34:be93:349a:f478]) by smtp.gmail.com with ESMTPSA id z16-20020a056a00241000b004f3a647ae89sm4023446pfh.174.2022.03.09.14.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 14:36:09 -0800 (PST) From: Max Filippov To: linux-xtensa@linux-xtensa.org Cc: Chris Zankel , linux-kernel@vger.kernel.org, Max Filippov Subject: [PATCH] xtensa: add kernel ABI selection to Kconfig Date: Wed, 9 Mar 2022 14:35:57 -0800 Message-Id: <20220309223557.1253417-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add choice to use default or call0 ABI for the kernel code. If call0 ABI is chosen add '-mabi=3Dcall0' to the flags. The toolchain support for this option is rather new so only enable it when the compiler supports it. Signed-off-by: Max Filippov --- arch/xtensa/Kconfig | 35 +++++++++++++++++++++++++++++++++++ arch/xtensa/Makefile | 4 ++++ 2 files changed, 39 insertions(+) diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index b324f6743073..cf03ed54c8f0 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -92,6 +92,9 @@ config CPU_BIG_ENDIAN config CPU_LITTLE_ENDIAN def_bool !CPU_BIG_ENDIAN =20 +config CC_HAVE_CALL0_ABI + def_bool $(success,test "$(shell,echo __XTENSA_CALL0_ABI__ | $(CC) -mabi= =3Dcall0 -E -P - 2>/dev/null)" =3D 1) + menu "Processor type and features" =20 choice @@ -250,6 +253,38 @@ config FAST_SYSCALL_SPILL_REGISTERS =20 If unsure, say N. =20 +choice + prompt "Kernel ABI" + default KERNEL_ABI_DEFAULT + help + Select ABI for the kernel code. This ABI is independent of the + supported userspace ABI and any combination of the + kernel/userspace ABI is possible and should work. + + In case both kernel and userspace support only call0 ABI + all register windows support code will be omitted from the + build. + + If unsure, choose the default ABI. + +config KERNEL_ABI_DEFAULT + bool "Default ABI" + help + Select this option to compile kernel code with the default ABI + selected for the toolchain. + Normally cores with windowed registers option use windowed ABI and + cores without it use call0 ABI. + +config KERNEL_ABI_CALL0 + bool "Call0 ABI" if CC_HAVE_CALL0_ABI + help + Select this option to compile kernel code with call0 ABI even with + toolchain that defaults to windowed ABI. + When this option is not selected the default toolchain ABI will + be used for the kernel code. + +endchoice + config USER_ABI_CALL0 bool =20 diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile index 725cd4cd8b30..5097caa7bf0c 100644 --- a/arch/xtensa/Makefile +++ b/arch/xtensa/Makefile @@ -35,6 +35,10 @@ KBUILD_CFLAGS +=3D -ffreestanding -D__linux__ KBUILD_CFLAGS +=3D -pipe -mlongcalls -mtext-section-literals KBUILD_CFLAGS +=3D $(call cc-option,-mforce-no-pic,) KBUILD_CFLAGS +=3D $(call cc-option,-mno-serialize-volatile,) +ifneq ($(CONFIG_KERNEL_ABI_CALL0),) +KBUILD_CFLAGS +=3D -mabi=3Dcall0 +KBUILD_AFLAGS +=3D -mabi=3Dcall0 +endif =20 KBUILD_AFLAGS +=3D -mlongcalls -mtext-section-literals =20 --=20 2.30.2