On 9/14/2023 12:10 PM, Anand Balagopalakrishnan wrote:
SGX needs a preemptible kernel. CONFIG_PREEMPT has always been enabled
on TI Linux kernels upto K5.1.

This is enabled on AM65x by default but missed out AM335x and AM437x.
Add a kernel config fragment to enable config preempt.

Signed-off-by: Anand Balagopalakrishnan <ana...@ti.com>
---
  .../linux/files/configs/config-preempt.cfg           | 12 ++++++++++++
  .../recipes-kernel/linux/linux-ti-staging_6.1.bb     |  1 +
  2 files changed, 13 insertions(+)
  create mode 100644 
meta-ti-bsp/recipes-kernel/linux/files/configs/config-preempt.cfg

diff --git a/meta-ti-bsp/recipes-kernel/linux/files/configs/config-preempt.cfg 
b/meta-ti-bsp/recipes-kernel/linux/files/configs/config-preempt.cfg
new file mode 100644
index 00000000..c1e5ad7d
--- /dev/null
+++ b/meta-ti-bsp/recipes-kernel/linux/files/configs/config-preempt.cfg
@@ -0,0 +1,12 @@
+CONFIG_PREEMPT_BUILD=y
+# CONFIG_PREEMPT_NONE is not set
+CONFIG_PREEMPT=y
+CONFIG_PREEMPT_COUNT=y
+CONFIG_PREEMPTION=y
+CONFIG_PREEMPT_RCU=y
+CONFIG_TASKS_RCU_GENERIC=y
+CONFIG_TASKS_RCU=y
+CONFIG_UNINLINE_SPIN_UNLOCK=y
+# CONFIG_CEC_GPIO is not set
+CONFIG_DEBUG_PREEMPT=y
+# CONFIG_PREEMPT_TRACER is not set
diff --git a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.1.bb 
b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.1.bb
index 8a883878..0ee63358 100644
--- a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.1.bb
+++ b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.1.bb
@@ -33,6 +33,7 @@ PR = "${MACHINE_KERNEL_PR}"
KERNEL_GIT_URI ?= "git://git.ti.com/git/ti-linux-kernel/ti-linux-kernel.git"
  KERNEL_GIT_PROTOCOL = "https"
+KERNEL_CONFIG_FRAGMENTS += "${WORKDIR}/config-preempt.cfg"
  SRC_URI += 
"${KERNEL_GIT_URI};protocol=${KERNEL_GIT_PROTOCOL};branch=${BRANCH} \
              file://defconfig"

I'm going to provide comments just as a learning moment for those paying attention.

1) The location of where you stuck KERNEL_CONFIG_FRAGMENTS is out of place. It just there in the middle of the SRC_URI variables.

2) We do not need to add this for ALL platforms, just the ones that you identified (am3, am4, am57, etc...) So you should use the SOC_FAMILY override syntax to limit the change to just those families:

KERNEL_CONFIG_FRAGMENTS:append:ti33x = " ${WORKDIR}/config-preempt.cfg"
KERNEL_CONFIG_FRAGMENTS:append:ti43x = " ${WORKDIR}/config-preempt.cfg"
KERNEL_CONFIG_FRAGMENTS:append:dra7x = " ${WORKDIR}/config-preempt.cfg"

3) As this patch is adding the RT prempt stuff, it does not need to be present for building the RT kernel. But the RT recipe includes this recipe and just changes the branch and SRCREV. So this change would conflict with what the RT kernel recipe is doing.

4) All of the RT stuff is done with config fragments. You can look in meta-ti-bsp/recipes-kernel/linux/linux-ti-staging-rt-6.1/defconfig:

use-kernel-config=multi_v7_defconfig
config-fragment=kernel/configs/ti_multi_v7_prune.config kernel/configs/ti_rt.config

So this patch should be done using the existing method fragments, not just setting the variable. A new config fragment needs to be added to the kernel that sets CONFIG_PREMPT=y (maybe kernel/configs/ti_preempt.config).

And then create three new files:

meta-ti-bsp/recipes-linux/linux/linux-ti-staging-6.1/ti33x/defconfig
--------------------------------------------------------------------
use-kernel-config=multi_v7_defconfig
config-fragment=kernel/configs/ti_multi_v7_prune.config kernel/configs/ti_preempt.config

meta-ti-bsp/recipes-linux/linux/linux-ti-staging-6.1/ti43x/defconfig
--------------------------------------------------------------------
use-kernel-config=multi_v7_defconfig
config-fragment=kernel/configs/ti_multi_v7_prune.config kernel/configs/ti_preempt.config

meta-ti-bsp/recipes-linux/linux/linux-ti-staging-6.1/dra7x/defconfig
--------------------------------------------------------------------
use-kernel-config=multi_v7_defconfig
config-fragment=kernel/configs/ti_multi_v7_prune.config kernel/configs/ti_preempt.config


--
Ryan Eatmon                reat...@ti.com
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16973): 
https://lists.yoctoproject.org/g/meta-ti/message/16973
Mute This Topic: https://lists.yoctoproject.org/mt/101362535/21656
Group Owner: meta-ti+ow...@lists.yoctoproject.org
Unsubscribe: 
https://lists.yoctoproject.org/g/meta-ti/leave/6695321/21656/1393940836/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to