Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
141e691
Create build-kernel.yml
shekar-adv Apr 2, 2025
58ff82b
Create build-kernel.yml
shekar-adv Apr 2, 2025
1f767e8
Delete .github/workflow directory
shekar-adv Apr 2, 2025
47d7617
Create build-kernel.ym
shekar-adv Apr 2, 2025
9de8263
Merge pull request #1 from shekar-adv/shekar-kernel-test
shekar-adv Apr 2, 2025
f19f358
Create configsrk356x_defconfig
shekar-adv Apr 2, 2025
ed40868
Merge pull request #2 from shekar-adv/config-added
shekar-adv Apr 2, 2025
ce84dee
Rename configsrk356x_defconfig to rk356x_defconfig
shekar-adv Apr 2, 2025
e20c913
Merge pull request #3 from shekar-adv/rename
shekar-adv Apr 2, 2025
1977c48
Update cpu.c
shekar-adv Apr 2, 2025
760f8ef
Merge pull request #4 from shekar-adv/cpu.c
shekar-adv Apr 2, 2025
6c7a62a
Update page_alloc.c
shekar-adv Apr 3, 2025
b31b65f
Merge pull request #5 from shekar-adv/page_alloc
shekar-adv Apr 3, 2025
d96b33e
Update extable.c
shekar-adv Apr 3, 2025
88bef0d
Merge pull request #6 from shekar-adv/extable
shekar-adv Apr 3, 2025
392aa51
Update mutex.c
shekar-adv Apr 3, 2025
91f8885
Merge pull request #7 from shekar-adv/mutex
shekar-adv Apr 3, 2025
4151809
Update mutex.c
shekar-adv Apr 3, 2025
8d0d0a8
Merge pull request #8 from shekar-adv/mutex2
shekar-adv Apr 3, 2025
3395fb8
Update mutex.c
shekar-adv Apr 3, 2025
9048bbc
Merge pull request #9 from shekar-adv/mutex3
shekar-adv Apr 3, 2025
aa3fc57
Update mutex.c
shekar-adv Apr 3, 2025
28e7abc
Merge pull request #10 from shekar-adv/mutex4
shekar-adv Apr 3, 2025
0e739a2
Update mutex.c
shekar-adv Apr 3, 2025
b291d4e
Merge pull request #11 from shekar-adv/mutex5
shekar-adv Apr 3, 2025
50894e5
Update semaphore.c
shekar-adv Apr 3, 2025
d94d9bf
Merge pull request #12 from shekar-adv/semaphore
shekar-adv Apr 3, 2025
e69a66a
Update core.c
shekar-adv Apr 3, 2025
5a46fcc
Merge pull request #13 from shekar-adv/core.c
shekar-adv Apr 3, 2025
a384771
Update completion.c
shekar-adv Apr 3, 2025
f148972
Merge pull request #14 from shekar-adv/completion0
shekar-adv Apr 3, 2025
3ac8bfb
Update eth.c
shekar-adv Apr 3, 2025
4559f9b
Merge pull request #15 from shekar-adv/eth
shekar-adv Apr 3, 2025
098ed2d
Update rk356x_defconfig
shekar-adv Apr 3, 2025
7387919
Merge pull request #16 from shekar-adv/dmaConfig
shekar-adv Apr 3, 2025
964d7d8
Update rk356x_defconfig
shekar-adv Apr 3, 2025
0cbb9be
Merge pull request #17 from shekar-adv/config+Usart
shekar-adv Apr 3, 2025
181aea3
Update rga_drv.c
shekar-adv Apr 3, 2025
2bfd9be
Merge pull request #18 from shekar-adv/rda_drv-"dma-buf"
shekar-adv Apr 3, 2025
5c45315
Update rk356x_defconfig
shekar-adv Apr 3, 2025
928fe00
Merge pull request #19 from shekar-adv/shekar-adv-patch-1
shekar-adv Apr 3, 2025
cda436e
Update Makefile
shekar-adv Apr 3, 2025
2b6c686
Merge pull request #20 from shekar-adv/rgaMakefile
shekar-adv Apr 3, 2025
24d8ebc
Update rga_drv.c
shekar-adv Apr 3, 2025
39af768
Update Makefile
shekar-adv Apr 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/build-kernel.ym
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build RK3566 Kernel

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Kernel Source
uses: actions/checkout@v4

- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y build-essential gcc-aarch64-linux-gnu bc bison flex libssl-dev libncurses-dev

- name: Configure Kernel
run: |
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- rk356x_defconfig

- name: Compile Kernel
run: |
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc)

- name: Upload Kernel Image
uses: actions/upload-artifact@v4
with:
name: rk3566-kernel
path: arch/arm64/boot/Image.gz
- name: Create Boot Image
run: |
mkbootimg --kernel arch/arm64/boot/Image.gz \
--ramdisk ramdisk.img \
--cmdline "console=ttyFIQ0 root=/dev/mmcblk0p5 rw" \
--output boot.img

- name: Upload Boot Image
uses: actions/upload-artifact@v4
with:
name: boot-image
path: boot.img

51 changes: 51 additions & 0 deletions .github/workflows/build-kernel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build RK3566 Kernel

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Kernel Source
uses: actions/checkout@v4

- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y build-essential gcc-aarch64-linux-gnu bc bison flex libssl-dev libncurses-dev

- name: Configure Kernel
run: |
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- rk356x_defconfig

- name: Compile Kernel
run: |
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc)

- name: Upload Kernel Image
uses: actions/upload-artifact@v4
with:
name: rk3566-kernel
path: arch/arm64/boot/Image.gz

- name: Create Boot Image
run: |
mkbootimg --kernel arch/arm64/boot/Image.gz \
--ramdisk ramdisk.img \
--cmdline "console=ttyFIQ0 root=/dev/mmcblk0p5 rw" \
--output boot.img

- name: Upload Boot Image
uses: actions/upload-artifact@v4
with:
name: boot-image
path: boot.img

123 changes: 123 additions & 0 deletions arch/arm64/configs/rk356x_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Sample rk356x_defconfig for RK3566

# Basic architecture configuration
CONFIG_ARCH_ROCKCHIP=y
CONFIG_ARCH_ARM64=y
CONFIG_ARCH_MULTI_V7=y
CONFIG_ARM64=y
CONFIG_ARM64_32=y
CONFIG_ARM64_64=y
CONFIG_ARM64_PA_BITS=40
CONFIG_ARM64_VA_BITS=48
CONFIG_ARMV8_DEPRECATED=y
CONFIG_ARMV8_CRYPTO=y

# CPU features
CONFIG_CPU_PABRT=y
CONFIG_CPU_PAN=y
CONFIG_CPU_V7=y
CONFIG_CPU_V8=y

# Memory configuration
CONFIG_ARM64_COHERENT_POOL=y
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_ARM64_PA_BITS=40

# Rockchip specific configuration
CONFIG_ROCKCHIP_PHY=y
CONFIG_ROCKCHIP_VOP=y
CONFIG_ROCKCHIP_DRM=y
CONFIG_ROCKCHIP_HDMI=y
CONFIG_ROCKCHIP_RGA=y
CONFIG_ROCKCHIP_CE=y
CONFIG_ROCKCHIP_SDMA=y

# Kernel features
CONFIG_NETFILTER=y
CONFIG_NETFILTER_ADVANCED=y
CONFIG_INET=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IPV6=y
CONFIG_INET6=y
CONFIG_NETDEVICES=y
CONFIG_PACKET=y
CONFIG_UNIX=y

# File system support
CONFIG_EXT4_FS=y
CONFIG_F2FS_FS=y
CONFIG_SQUASHFS=y
CONFIG_FUSE_FS=y
CONFIG_OVERLAY_FS=y

# Power management
CONFIG_PM=y
CONFIG_PM_SLEEP=y
CONFIG_ARM64_CPU_IDLE=y
CONFIG_ARM64_RAS=y

# Debugging
CONFIG_DEBUG_INFO=y
CONFIG_KGDB=y
CONFIG_KDB=y

# Networking
CONFIG_NET=y
CONFIG_NETFILTER=y
CONFIG_NETFILTER_XT_MATCH_IPVS=y

# Generic defconfig
CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait rw"

# DMA configuration
CONFIG_DMA_BUF=y
CONFIG_DMA_SHARED_BUFFER=y

# Enable USART (UART) ports
# Enabling driver support for UART
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_RUNTIME_UARTS=4 # Change this to the number of UARTs you have
CONFIG_SERIAL_8250_DW=y

# Enable specific USART port driver
CONFIG_SERIAL_8250_PNP=y
CONFIG_SERIAL_8250_RSA=y # For Rockchip-specific UART support (if applicable)
CONFIG_SERIAL_8250_RSA_NR_PORTS=4 # Change this to your port number if needed

# Enable specific console ports for UART (use ttyS0, ttyS1, etc.)
CONFIG_CONSOLE_POLL=y
CONFIG_SERIAL_8250_PNP=y
CONFIG_SERIAL_8250_EXTENDED=y

# Enable DMA for UARTs if needed
CONFIG_SERIAL_8250_DMA=y

# Ensure all ports are enabled for use (if not specified, you might need to check with hardware configuration)
CONFIG_SERIAL_8250_NR_UARTS=4 # Change this based on how many UART ports you have
CONFIG_SERIAL_8250_SHARE_IRQ=y

# Enable debugging for serial (optional)
CONFIG_SERIAL_DEBUG=y

# Miscellaneous kernel options
CONFIG_ZLIB_DEFLATE=y
CONFIG_SQUASHFS=y

# Enable DMA and DMA Buffer Subsystem
CONFIG_DMA_ENGINE=y
CONFIG_DMA_VIRTUAL=y
CONFIG_DMA_DIRECT=y

# Enable specific Rockchip DMA options (if applicable)
CONFIG_ROCKCHIP_DMA=y
CONFIG_ROCKCHIP_DRM_DMA=y
CONFIG_ROCKCHIP_RGA=y

# Ensure proper support for `dma-buf` buffer management
CONFIG_DMA_BUF=y
CONFIG_DMA_SHARED_BUFFER=y
CONFIG_DMA_CMA=y # Contiguous Memory Allocator for DMA
CONFIG_DMA_API=y # Enable the DMA API interface

1 change: 1 addition & 0 deletions drivers/video/rockchip/rga/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
rga-y := rga_drv.o rga_mmu_info.o rga_reg_info.o RGA_API.o

obj-$(CONFIG_ROCKCHIP_RGA) += rga.o

2 changes: 1 addition & 1 deletion kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ void notify_cpu_starting(unsigned int cpu)
unsigned long val = CPU_STARTING;

#ifdef CONFIG_PM_SLEEP_SMP
if (frozen_cpus != NULL && cpumask_test_cpu(cpu, frozen_cpus))
if (cpumask_test_cpu(cpu, frozen_cpus))
val = CPU_STARTING_FROZEN;
#endif /* CONFIG_PM_SLEEP_SMP */
cpu_notify(val, (void *)(long)cpu);
Expand Down
2 changes: 1 addition & 1 deletion kernel/extable.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ u32 __initdata __visible main_extable_sort_needed = 1;
/* Sort the kernel's built-in exception table */
void __init sort_main_extable(void)
{
if (main_extable_sort_needed && __stop___ex_table > __start___ex_table) {
if (main_extable_sort_needed && &__stop___ex_table[0] > &__start___ex_table[0]) {
pr_notice("Sorting __ex_table...\n");
sort_extable(__start___ex_table, __stop___ex_table);
}
Expand Down
30 changes: 21 additions & 9 deletions kernel/locking/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/interrupt.h>
#include <linux/debug_locks.h>
#include <linux/osq_lock.h>
#include <linux/slab.h> // Required for kmalloc() and kfree()

/*
* In the DEBUG case we are using the "NULL fastpath" for mutexes,
Expand Down Expand Up @@ -507,14 +508,22 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
struct ww_acquire_ctx *ww_ctx, const bool use_ww_ctx)
{
struct task_struct *task = current;
struct mutex_waiter waiter;
struct mutex_waiter *waiter;
unsigned long flags;
int ret;

waiter = kmalloc(sizeof(*waiter), GFP_KERNEL);
if (!waiter)
return -ENOMEM;


if (use_ww_ctx) {
struct ww_mutex *ww = container_of(lock, struct ww_mutex, base);
if (unlikely(ww_ctx == READ_ONCE(ww->ctx)))
{
kfree(waiter);
return -EALREADY;
}
}

preempt_disable();
Expand All @@ -523,6 +532,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
if (mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx)) {
/* got the lock, yay! */
preempt_enable();
kfree(waiter);
return 0;
}

Expand All @@ -536,12 +546,12 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
(atomic_xchg_acquire(&lock->count, 0) == 1))
goto skip_wait;

debug_mutex_lock_common(lock, &waiter);
debug_mutex_add_waiter(lock, &waiter, task);
debug_mutex_lock_common(lock, waiter);
debug_mutex_add_waiter(lock, waiter, task);

/* add waiting tasks to the end of the waitqueue (FIFO): */
list_add_tail(&waiter.list, &lock->wait_list);
waiter.task = task;
list_add_tail(&waiter->list, &lock->wait_list);
waiter->task = task;

lock_contended(&lock->dep_map, ip);

Expand Down Expand Up @@ -584,11 +594,11 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
}
__set_task_state(task, TASK_RUNNING);

mutex_remove_waiter(lock, &waiter, task);
mutex_remove_waiter(lock, waiter, task);
/* set it to 0 if there are no waiters left: */
if (likely(list_empty(&lock->wait_list)))
atomic_set(&lock->count, 0);
debug_mutex_free_waiter(&waiter);
debug_mutex_free_waiter(waiter);

skip_wait:
/* got the lock - cleanup and rejoice! */
Expand All @@ -602,14 +612,16 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,

spin_unlock_mutex(&lock->wait_lock, flags);
preempt_enable();
kfree(waiter);
return 0;

err:
mutex_remove_waiter(lock, &waiter, task);
mutex_remove_waiter(lock, waiter, task);
spin_unlock_mutex(&lock->wait_lock, flags);
debug_mutex_free_waiter(&waiter);
debug_mutex_free_waiter(waiter);
mutex_release(&lock->dep_map, 1, ip);
preempt_enable();
kfree(waiter);
return ret;
}

Expand Down
23 changes: 16 additions & 7 deletions kernel/locking/semaphore.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <linux/semaphore.h>
#include <linux/spinlock.h>
#include <linux/ftrace.h>
#include <linux/slab.h> // Required for kmalloc() and kfree()

static noinline void __down(struct semaphore *sem);
static noinline int __down_interruptible(struct semaphore *sem);
Expand Down Expand Up @@ -205,11 +206,14 @@ static inline int __sched __down_common(struct semaphore *sem, long state,
long timeout)
{
struct task_struct *task = current;
struct semaphore_waiter waiter;
struct semaphore_waiter *waiter;
waiter = kmalloc(sizeof(*waiter), GFP_KERNEL);
if (!waiter)
return -ENOMEM; // Handle allocation failure

list_add_tail(&waiter.list, &sem->wait_list);
waiter.task = task;
waiter.up = false;
list_add_tail(&waiter->list, &sem->wait_list);
waiter->task = task;
waiter->up = false;

for (;;) {
if (signal_pending_state(state, task))
Expand All @@ -220,16 +224,21 @@ static inline int __sched __down_common(struct semaphore *sem, long state,
raw_spin_unlock_irq(&sem->lock);
timeout = schedule_timeout(timeout);
raw_spin_lock_irq(&sem->lock);
if (waiter.up)
if (waiter->up)
{
kfree(waiter);
return 0;
}
}

timed_out:
list_del(&waiter.list);
list_del(&waiter->list);
kfree(waiter);
return -ETIME;

interrupted:
list_del(&waiter.list);
list_del(&waiter->list);
kfree(waiter);
return -EINTR;
}

Expand Down
Loading