Skip to content

Conversation

@miguelafsilva5
Copy link
Member

@miguelafsilva5 miguelafsilva5 commented Aug 29, 2025

PR Description

This PR introduces the initial support for Infineon Tricore architectures.
This PR requires #218 to support boot from flash with a non-unified memory model.
The current state of this port supports baremetal and freeRTOS guests in single or multicore setups. At the moment, each guest is given an unique ID, and each core only executes one guest.

The following list shows what is missing:

  • DMA virtualization/isolation
  • History re-write and commit clean up
  • CI integration
  • bao-demos integration

@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 2 times, most recently from f92535a to 57284c8 Compare September 1, 2025 14:05
@danielRep danielRep force-pushed the feat/non-unified-mem branch from 9ad59e5 to 474545c Compare September 1, 2025 15:56
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 2 times, most recently from b9e1caf to 7da4f29 Compare September 3, 2025 12:51
@danielRep danielRep force-pushed the feat/non-unified-mem branch 2 times, most recently from 829c219 to 61b37aa Compare September 3, 2025 13:06
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 4 times, most recently from 0e5ea75 to bf61453 Compare September 8, 2025 09:37
@danielRep danielRep force-pushed the feat/non-unified-mem branch 2 times, most recently from 674ffd5 to 3d1e91a Compare September 8, 2025 11:01
@danielRep danielRep force-pushed the feat/non-unified-mem branch from 3d1e91a to 53e6ea9 Compare September 9, 2025 13:40
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 2 times, most recently from 44a2cbb to 3d6619f Compare September 10, 2025 10:18
Base automatically changed from feat/non-unified-mem to main September 10, 2025 13:32
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 6 times, most recently from bffccac to 661df87 Compare September 15, 2025 13:43
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 2 times, most recently from ba20ef7 to f2194f5 Compare September 24, 2025 10:31
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 3 times, most recently from 2f2f67b to e1f3764 Compare October 27, 2025 14:55
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 2 times, most recently from b48e54e to 589db10 Compare November 13, 2025 13:45
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 3 times, most recently from eaff81e to 2604d12 Compare November 13, 2025 16:08
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 2 times, most recently from 6a7ac60 to aa1cc63 Compare December 3, 2025 11:31
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 2 times, most recently from 19ee033 to cb1d682 Compare December 4, 2025 11:45
@miguelafsilva5 miguelafsilva5 force-pushed the feat/tricore branch 4 times, most recently from 26b96ec to 85e295e Compare December 16, 2025 13:38
@miguelafsilva5 miguelafsilva5 marked this pull request as ready for review December 16, 2025 13:43
Copy link
Member

@DavidMCerdeira DavidMCerdeira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a quick review.
For now the my main comments are regarding stale code comments and magic numbers, I don't think my comments address them all, please check them more carefully than I did.
There's also some instances of using platformed defined values that need to be made more general to handle multiple platforms.


#include <bao.h>

#define CACHE_MAX_LVL 8 // Does this make sense in all architectures?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Comment on lines 9 to 36
{
__asm__ volatile("isync\n\t" ::: "memory");
}

static inline void fence_ord_read(void)
{
__asm__ volatile("isync\n\t" ::: "memory");
}

static inline void fence_ord(void)
{
__asm__ volatile("isync\n\t" ::: "memory");
}

static inline void fence_sync_write(void)
{
__asm__ volatile("isync\n\t" ::: "memory");
}

static inline void fence_sync_read(void)
{
__asm__ volatile("isync\n\t" ::: "memory");
}

static inline void fence_sync(void)
{
__asm__ volatile("isync\n\t" ::: "memory");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement the correct fence

#define HYPCALL_IN_ARG_REG(ARG) ((ARG) + 1 + 15 + 5)
#define HYPCALL_OUT_ARG_REG(ARG) (HYPCALL_IN_ARG_REG(ARG))

// #define HYPCALL_ARG_REG(ARG) ((ARG) + REG_A0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

Comment on lines +19 to +20
#define IPI_CPU_MSG (0x1460 / 4) /* TODO this is the first GPSR in TC49 */
#define GSPR_SRC_BASE (0x1460 / 4) /* TODO this is the first GPSR in TC49 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to a platform defined

#define GET_IR_SR_VALID(reg) (((reg) & IR_SR_VALID_MASK) >> IR_SR_VALID_POS)
#define GET_IR_SR_PN(reg) (((reg) & IR_SR_PN_MASK) >> IR_SR_PN_POS)

/* ACCESSEN Register */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lost comment

Comment on lines +152 to +157
// TODO: All vms start running at "same" time?
if (1) {
vcpu_arch_entry();
} /*else {
cpu_idle();
}*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfinished

uart->FLAGSENABLE = 0;
uart->FLAGSCLEAR = 0xFFFFFFFF;

uart->FLAGSENABLE = 1 << 16 | 1 << 18 | 1 << 26 | 1 << 27 | 1 << 30; // parity error PEE, frame
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use macros instead of magic numbers

platform_description:=tc4dx_desc.c

TRICORE_MCPU=tc4DAx
#TRICORE_MCPU=tc4xx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stale

Makefile Outdated
Comment on lines 250 to 251
-Wstrict-prototypes -Wunused-but-set-variable \
-Wno-multistatement-macros
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity why is this needed?

const uint32_t plat_int_size = sizeof(plat_ints) / 4;
#endif

const struct plat_device dev_array[] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bao needs to explicitly lock access to these peripherals before selectively assigning them to each VM

Signed-off-by: Miguel Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants