Skip to content

Commit

Permalink
rk3588: edge: update kernel to 6.5-rc5 and fix its timeout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
efectn authored and igorpecovnik committed Aug 12, 2023
1 parent c268d2f commit c6ba228
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 39 deletions.
7 changes: 5 additions & 2 deletions config/kernel/linux-rockchip-rk3588-edge.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 6.5.0-rc1 Kernel Configuration
# Linux/arm64 6.5.0-rc5 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
CONFIG_CC_IS_GCC=y
Expand Down Expand Up @@ -3856,6 +3856,8 @@ CONFIG_WLCORE_SPI=m
CONFIG_WLCORE_SDIO=m
CONFIG_RTL8723DU=m
CONFIG_RTL8723DS=m
# CONFIG_RTL8822BU is not set
# CONFIG_RTL8821CU is not set
CONFIG_88XXAU=m
CONFIG_RTL8192EU=m
CONFIG_RTL8189FS=m
Expand Down Expand Up @@ -9470,7 +9472,6 @@ CONFIG_QUOTA_TREE=m
CONFIG_QFMT_V1=m
CONFIG_QFMT_V2=m
CONFIG_QUOTACTL=y
CONFIG_AUTOFS4_FS=m
CONFIG_AUTOFS_FS=m
CONFIG_FUSE_FS=y
CONFIG_CUSE=m
Expand Down Expand Up @@ -10613,6 +10614,8 @@ CONFIG_PROBE_EVENTS=y
# CONFIG_KPROBE_EVENT_GEN_TEST is not set
# CONFIG_RV is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_SAMPLE_FTRACE_DIRECT=y
CONFIG_HAVE_SAMPLE_FTRACE_DIRECT_MULTI=y
CONFIG_STRICT_DEVMEM=y
# CONFIG_IO_STRICT_DEVMEM is not set

Expand Down
2 changes: 1 addition & 1 deletion config/sources/families/rockchip-rk3588.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ case $BRANCH in
LINUXFAMILY=rockchip-rk3588
LINUXCONFIG='linux-rockchip-rk3588-'$BRANCH
KERNEL_MAJOR_MINOR="6.5" # Major and minor versions of this kernel.
KERNELBRANCH='tag:v6.5-rc1'
KERNELBRANCH='tag:v6.5-rc5'
KERNELPATCHDIR='rockchip-rk3588-edge'
;;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
From d441305416aa91190df5865bbc0e3c684ec183b0 Mon Sep 17 00:00:00 2001
From: Muhammed Efe Cetin <[email protected]>
Date: Fri, 11 Aug 2023 17:56:00 +0300
Subject: [PATCH 1/1] irqchip/irq-gic-v3-its: fix its timeout issue for rk35xx
boards

---
drivers/irqchip/irq-gic-v3-its.c | 79 +++++++++++++++++++++++++++++---
1 file changed, 72 insertions(+), 7 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index e0c2b10d154d..eef86e179a52 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -167,6 +167,7 @@ struct its_device {
struct its_node *its;
struct event_lpi_map event_map;
void *itt;
+ u32 itt_sz;
u32 nr_ites;
u32 device_id;
bool shared;
@@ -2204,6 +2205,9 @@ static void gic_reset_prop_table(void *va)
static struct page *its_allocate_prop_table(gfp_t gfp_flags)
{
struct page *prop_page;
+
+ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588"))
+ gfp_flags |= GFP_DMA32;

prop_page = alloc_pages(gfp_flags, get_order(LPI_PROPBASE_SZ));
if (!prop_page)
@@ -2328,6 +2332,7 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser,
u32 alloc_pages, psz;
struct page *page;
void *base;
+ gfp_t gfp_flags;

psz = baser->psz;
alloc_pages = (PAGE_ORDER_TO_SIZE(order) / psz);
@@ -2339,7 +2344,11 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser,
order = get_order(GITS_BASER_PAGES_MAX * psz);
}

- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, order);
+ gfp_flags = GFP_KERNEL | __GFP_ZERO;
+ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588"))
+ gfp_flags |= GFP_DMA32;
+
+ page = alloc_pages_node(its->numa_node, gfp_flags, order);
if (!page)
return -ENOMEM;

@@ -2389,6 +2398,15 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser,
if (its->flags & ITS_FLAGS_FORCE_NON_SHAREABLE)
tmp &= ~GITS_BASER_SHAREABILITY_MASK;

+ if (of_machine_is_compatible("rockchip,rk3568") ||
+ of_machine_is_compatible("rockchip,rk3566") ||
+ of_machine_is_compatible("rockchip,rk3588")) {
+ if (tmp & GITS_BASER_SHAREABILITY_MASK)
+ tmp &= ~GITS_BASER_SHAREABILITY_MASK;
+ else
+ gic_flush_dcache_to_poc(base, PAGE_ORDER_TO_SIZE(order));
+ }
+
if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) {
/*
* Shareability didn't stick. Just use
@@ -2970,7 +2988,9 @@ static int its_alloc_collections(struct its_node *its)
static struct page *its_allocate_pending_table(gfp_t gfp_flags)
{
struct page *pend_page;
-
+
+ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588"))
+ gfp_flags |= GFP_DMA32;
pend_page = alloc_pages(gfp_flags | __GFP_ZERO,
get_order(LPI_PENDBASE_SZ));
if (!pend_page)
@@ -3129,6 +3149,11 @@ static void its_cpu_init_lpis(void)
if (gic_rdists->flags & RDIST_FLAGS_FORCE_NON_SHAREABLE)
tmp &= ~GICR_PROPBASER_SHAREABILITY_MASK;

+ if (of_machine_is_compatible("rockchip,rk3568") ||
+ of_machine_is_compatible("rockchip,rk3566") ||
+ of_machine_is_compatible("rockchip,rk3588"))
+ tmp &= ~GICR_PROPBASER_SHAREABILITY_MASK;
+
if ((tmp ^ val) & GICR_PROPBASER_SHAREABILITY_MASK) {
if (!(tmp & GICR_PROPBASER_SHAREABILITY_MASK)) {
/*
@@ -3156,6 +3181,11 @@ static void its_cpu_init_lpis(void)
if (gic_rdists->flags & RDIST_FLAGS_FORCE_NON_SHAREABLE)
tmp &= ~GICR_PENDBASER_SHAREABILITY_MASK;

+ if (of_machine_is_compatible("rockchip,rk3568") ||
+ of_machine_is_compatible("rockchip,rk3566") ||
+ of_machine_is_compatible("rockchip,rk3588"))
+ tmp &= ~GICR_PENDBASER_SHAREABILITY_MASK;
+
if (!(tmp & GICR_PENDBASER_SHAREABILITY_MASK)) {
/*
* The HW reports non-shareable, we must remove the
@@ -3319,7 +3349,11 @@ static bool its_alloc_table_entry(struct its_node *its,

/* Allocate memory for 2nd level table */
if (!table[idx]) {
- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO,
+ gfp_t gfp_flags = GFP_KERNEL | __GFP_ZERO;
+
+ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588"))
+ gfp_flags |= GFP_DMA32;
+ page = alloc_pages_node(its->numa_node, gfp_flags,
get_order(baser->psz));
if (!page)
return false;
@@ -3408,6 +3442,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
int nr_lpis;
int nr_ites;
int sz;
+ gfp_t gfp_flags;

if (!its_alloc_device_table(its, dev_id))
return NULL;
@@ -3423,7 +3458,15 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
nr_ites = max(2, nvecs);
sz = nr_ites * (FIELD_GET(GITS_TYPER_ITT_ENTRY_SIZE, its->typer) + 1);
sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1;
- itt = kzalloc_node(sz, GFP_KERNEL, its->numa_node);
+ gfp_flags = GFP_KERNEL;
+
+ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588")) {
+ gfp_flags |= GFP_DMA32;
+ itt = (void *)__get_free_pages(gfp_flags, get_order(sz));
+ } else {
+ itt = kzalloc_node(sz, gfp_flags, its->numa_node);
+ }
+
if (alloc_lpis) {
lpi_map = its_lpi_alloc(nvecs, &lpi_base, &nr_lpis);
if (lpi_map)
@@ -3437,7 +3480,13 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,

if (!dev || !itt || !col_map || (!lpi_map && alloc_lpis)) {
kfree(dev);
- kfree(itt);
+
+ if (of_machine_is_compatible("rockchip,rk3568") ||
+ of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588"))
+ free_pages((unsigned long)itt, get_order(sz));
+ else
+ kfree(itt);
+
bitmap_free(lpi_map);
kfree(col_map);
return NULL;
@@ -3447,6 +3496,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,

dev->its = its;
dev->itt = itt;
+ dev->itt_sz = sz;
dev->nr_ites = nr_ites;
dev->event_map.lpi_map = lpi_map;
dev->event_map.col_map = col_map;
@@ -3474,7 +3524,13 @@ static void its_free_device(struct its_device *its_dev)
list_del(&its_dev->entry);
raw_spin_unlock_irqrestore(&its_dev->its->lock, flags);
kfree(its_dev->event_map.col_map);
- kfree(its_dev->itt);
+
+ if (of_machine_is_compatible("rockchip,rk3568") ||
+ of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588"))
+ free_pages((unsigned long)its_dev->itt, get_order(its_dev->itt_sz));
+ else
+ kfree(its_dev->itt);
+
kfree(its_dev);
}

@@ -5064,6 +5120,7 @@ static int __init its_probe_one(struct resource *res,
struct page *page;
u32 ctlr;
int err;
+ gfp_t gfp_flags;

its_base = its_map_one(res, &err);
if (!its_base)
@@ -5117,7 +5174,10 @@ static int __init its_probe_one(struct resource *res,

its->numa_node = numa_node;

- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO,
+ gfp_flags = GFP_KERNEL | __GFP_ZERO;
+ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588"))
+ gfp_flags |= GFP_DMA32;
+ page = alloc_pages_node(its->numa_node, gfp_flags,
get_order(ITS_CMD_QUEUE_SZ));
if (!page) {
err = -ENOMEM;
@@ -5151,6 +5211,11 @@ static int __init its_probe_one(struct resource *res,
if (its->flags & ITS_FLAGS_FORCE_NON_SHAREABLE)
tmp &= ~GITS_CBASER_SHAREABILITY_MASK;

+ if (of_machine_is_compatible("rockchip,rk3568") ||
+ of_machine_is_compatible("rockchip,rk3566") ||
+ of_machine_is_compatible("rockchip,rk3588"))
+ tmp &= ~GITS_CBASER_SHAREABILITY_MASK;
+
if ((tmp ^ baser) & GITS_CBASER_SHAREABILITY_MASK) {
if (!(tmp & GITS_CBASER_SHAREABILITY_MASK)) {
/*
--
2.41.0

0 comments on commit c6ba228

Please sign in to comment.