-
Notifications
You must be signed in to change notification settings - Fork 7.9k
enhance GIC v3 ITS and enable it on i.MX 95 EVK A55 platform #92346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fabiobaltieri
merged 10 commits into
zephyrproject-rtos:main
from
nxp-upstream:develop/imx95-netc-gic
Jul 29, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6ae9003
drivers: intc_gicv3: enable dma-noncoherent support
JiafeiPan f073cc9
drivers: gicv3_its: enable dma noncoherent support
JiafeiPan d7a8631
drivers: intc_gicv3_its: fix incorrect RDbase when PE number is used
JiafeiPan 6733840
drivers: intc_gicv3_its: fix sleep issue in pre-kernel
JiafeiPan 771ff66
boards: imx95_evk: a55: enlarge memory size
JiafeiPan 4457217
dts: arm64: imx95_a55: add gic v3 its dts node
JiafeiPan d18d2f3
soc: imx95: a55: include LPI in irq number
JiafeiPan f77238b
soc: imx95: a55: enable GIC redistribute and its noncoherent
JiafeiPan f75699a
boards: imx95_evk: refine GIC and SCMI objects init priority
JiafeiPan 6d877ca
tests: arm64_gicv3_its: add imx95_evk support
JiafeiPan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2024-2025 NXP | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if SOC_MIMX9596_A55 | ||
|
||
# GIC ITS depends on kernel heap which init priority is 30, so set | ||
# GIC to be 31, mailbox and SCMI will be initialized by the order | ||
# according to dts dependency although they use the same init priority. | ||
config INTC_INIT_PRIORITY | ||
default 31 | ||
|
||
config MBOX_INIT_PRIORITY | ||
default 31 | ||
|
||
config ARM_SCMI_SHMEM_INIT_PRIORITY | ||
default 31 | ||
|
||
config ARM_SCMI_TRANSPORT_INIT_PRIORITY | ||
default 31 | ||
|
||
config CLOCK_CONTROL_INIT_PRIORITY | ||
default 31 | ||
|
||
endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
}; | ||
|
||
dram: memory@d0000000 { | ||
reg = <0xd0000000 DT_SIZE_M(1)>; | ||
reg = <0xd0000000 DT_SIZE_M(10)>; | ||
}; | ||
}; | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,3 @@ CONFIG_CLOCK_CONTROL=y | |
|
||
CONFIG_MBOX=y | ||
CONFIG_ARM_SCMI=y | ||
CONFIG_INTC_INIT_PRIORITY=2 | ||
CONFIG_MBOX_INIT_PRIORITY=3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
/* | ||
* Copyright 2020 Broadcom | ||
* Copyright 2024 NXP | ||
* Copyright 2024-2025 NXP | ||
* Copyright 2025 Arm Limited and/or its affiliates <[email protected]> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/cache.h> | ||
#include <zephyr/device.h> | ||
#include <zephyr/kernel.h> | ||
#include <zephyr/arch/cpu.h> | ||
|
@@ -111,7 +112,11 @@ static void arm_gic_lpi_setup(unsigned int intid, bool enable) | |
*cfg &= ~BIT(0); | ||
} | ||
|
||
#ifdef CONFIG_GIC_V3_RDIST_DMA_NONCOHERENT | ||
arch_dcache_flush_and_invd_range(cfg, sizeof(*cfg)); | ||
#else | ||
barrier_dsync_fence_full(); | ||
#endif | ||
|
||
its_rdist_invall(); | ||
} | ||
|
@@ -123,7 +128,11 @@ static void arm_gic_lpi_set_priority(unsigned int intid, unsigned int prio) | |
*cfg &= 0xfc; | ||
*cfg |= prio & 0xfc; | ||
|
||
#ifdef CONFIG_GIC_V3_RDIST_DMA_NONCOHERENT | ||
arch_dcache_flush_and_invd_range(cfg, sizeof(*cfg)); | ||
#else | ||
barrier_dsync_fence_full(); | ||
#endif | ||
|
||
its_rdist_invall(); | ||
} | ||
|
@@ -406,7 +415,7 @@ static void gicv3_rdist_setup_lpis(mem_addr_t rdist) | |
unsigned int lpi_id_bits = | ||
MIN(GICD_TYPER_IDBITS(sys_read32(GICD_TYPER)), ITS_MAX_LPI_NRBITS); | ||
uintptr_t lpi_pend_table; | ||
uint64_t reg; | ||
uint64_t reg, tmp; | ||
uint32_t ctlr; | ||
|
||
/* If not, alloc a common prop table for all redistributors */ | ||
|
@@ -418,6 +427,11 @@ static void gicv3_rdist_setup_lpis(mem_addr_t rdist) | |
lpi_pend_table = (uintptr_t)k_aligned_alloc(64 * 1024, LPI_PENDBASE_SZ(lpi_id_bits)); | ||
memset((void *)lpi_pend_table, 0, LPI_PENDBASE_SZ(lpi_id_bits)); | ||
|
||
#ifdef CONFIG_GIC_V3_RDIST_DMA_NONCOHERENT | ||
arch_dcache_flush_and_invd_range((void *)lpi_prop_table, LPI_PROPBASE_SZ(lpi_id_bits)); | ||
arch_dcache_flush_and_invd_range((void *)lpi_pend_table, LPI_PENDBASE_SZ(lpi_id_bits)); | ||
#endif | ||
|
||
ctlr = sys_read32(rdist + GICR_CTLR); | ||
ctlr &= ~GICR_CTLR_ENABLE_LPIS; | ||
sys_write32(ctlr, rdist + GICR_CTLR); | ||
|
@@ -429,15 +443,33 @@ static void gicv3_rdist_setup_lpis(mem_addr_t rdist) | |
(GIC_BASER_CACHE_INNERLIKE << GITR_PROPBASER_OUTER_CACHE_SHIFT) | | ||
((lpi_id_bits - 1) & GITR_PROPBASER_ID_BITS_MASK); | ||
sys_write64(reg, rdist + GICR_PROPBASER); | ||
/* TOFIX: check SHAREABILITY validity */ | ||
/* Check SHAREABILITY validity */ | ||
tmp = sys_read64(rdist + GICR_PROPBASER); | ||
#ifdef CONFIG_GIC_V3_RDIST_DMA_NONCOHERENT | ||
tmp &= ~MASK(GITR_PROPBASER_SHAREABILITY); | ||
#endif | ||
if (!(tmp & MASK(GITR_PROPBASER_SHAREABILITY))) { | ||
reg &= ~(MASK(GITR_PROPBASER_SHAREABILITY) | MASK(GITR_PROPBASER_INNER_CACHE)); | ||
reg |= GIC_BASER_CACHE_NCACHEABLE << GITR_PROPBASER_INNER_CACHE_SHIFT; | ||
sys_write64(reg, rdist + GICR_PROPBASER); | ||
} | ||
|
||
/* PENDBASE */ | ||
reg = (GIC_BASER_SHARE_INNER << GITR_PENDBASER_SHAREABILITY_SHIFT) | | ||
(GIC_BASER_CACHE_RAWAWB << GITR_PENDBASER_INNER_CACHE_SHIFT) | | ||
(lpi_pend_table & (GITR_PENDBASER_ADDR_MASK << GITR_PENDBASER_ADDR_SHIFT)) | | ||
(GIC_BASER_CACHE_INNERLIKE << GITR_PENDBASER_OUTER_CACHE_SHIFT) | GITR_PENDBASER_PTZ; | ||
sys_write64(reg, rdist + GICR_PENDBASER); | ||
/* TOFIX: check SHAREABILITY validity */ | ||
/* Check SHAREABILITY validity */ | ||
tmp = sys_read64(rdist + GICR_PENDBASER); | ||
#ifdef CONFIG_GIC_V3_RDIST_DMA_NONCOHERENT | ||
tmp &= ~MASK(GITR_PENDBASER_SHAREABILITY); | ||
#endif | ||
if (!(tmp & MASK(GITR_PENDBASER_SHAREABILITY))) { | ||
reg &= ~(MASK(GITR_PENDBASER_SHAREABILITY) | MASK(GITR_PENDBASER_INNER_CACHE)); | ||
reg |= GIC_BASER_CACHE_NCACHEABLE << GITR_PENDBASER_INNER_CACHE_SHIFT; | ||
sys_write64(reg, rdist + GICR_PENDBASER); | ||
} | ||
|
||
ctlr = sys_read32(rdist + GICR_CTLR); | ||
ctlr |= GICR_CTLR_ENABLE_LPIS; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to use a new properity 'dma-noncoherent' in GIC and ITS DT node to indicate this hardware feature respectively instead of a CONFIG entry, just like GICv3/ITS driver in Linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to use kconfig to make the code to be static includable but not checking properties at runtime in order to reduce the resource usage. thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per your suggestion, added a new kconfig GIC_V3_ITS_DMA_NONCOHERENT for ITS driver, so that GIC redistribute and ITS could configure dma coherent separately, thanks.