Skip to content

Commit be10aa6

Browse files
authored
Merge branch 'main' into feat/tda4vm_plat_support
Signed-off-by: Vinit Puranik <kvp933.vinit@gmail.com>
2 parents df0c79a + 0af4a1a commit be10aa6

44 files changed

Lines changed: 1495 additions & 211 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CONTRIBUTORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ joaopeixoto13 <joaopeixotooficial@gmail.com>
2121
Miguel Silva <miguelafsilva5@gmail.com>
2222
Nikolai Kosmatov
2323
Bin Meng <bmeng.cn@gmail.com>
24-
noobsplzwin <huizhezheng@gmail.com>
24+
leon6002 <>

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ platforms is presented below:
4747
- [x] QEMU virt
4848
- [x] Arm Fixed Virtual Platforms
4949
- [x] Toradex Verdin iMX8M Plus (w/ Dahlia Carrier Board)
50-
- [ ] NXP S32G
50+
- [x] NXP S32G3
5151
- [x] BeagleBone AI-64
5252

5353
**Armv7-A / Armv8-A AArch32**
@@ -60,7 +60,8 @@ platforms is presented below:
6060
**Armv8-R AArch32**
6161
- [x] Arm Fixed Virtual Platforms
6262
- [x] Arm MPS3-AN536
63-
- [ ] NXP S32Z/E
63+
- [x] Semidrive E3650
64+
- [x] NXP S32Z270
6465
- [ ] Renesas RZT2M
6566

6667
**RISC-V RV64**

src/arch/armv8/armv8-r/cpus/core_impl.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
#include <arch/sysregs.h>
77
#include <arch/core_impl.h>
88

9-
#define ARMV8R_R52_PARTNUMBER 0xD13
9+
#define ARMV8R_R52_PARTNUMBER 0xD13
10+
#define ARMV8R_R52P_PARTNUMBER 0xD16
1011

1112
/* Weak references to CPU implementation init functions */
1213
extern void cortex_r52_impl_init(void) __attribute__((weak));
@@ -18,7 +19,8 @@ void cpu_arch_core_impl_init(void)
1819
uint32_t part_num = MIDR_EL1_PARTNUM(midr);
1920

2021
switch (part_num) {
21-
case ARMV8R_R52_PARTNUMBER: /* Cortex-R52 */
22+
case ARMV8R_R52_PARTNUMBER: /* Cortex-R52 */
23+
case ARMV8R_R52P_PARTNUMBER: /* Cortex-R52+ */
2224
if (cortex_r52_impl_init != NULL) {
2325
cortex_r52_impl_init();
2426
}

src/arch/armv8/inc/arch/psci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define PSCI_INVALID_ADDRESS (-1L)
4141

4242
#define PSCI_VERSION_0_2 (2U)
43+
#define PSCI_VERSION_1_1 (0x10001)
4344
#define PSCI_GET_VERSION_MAJOR(ver) (u16)((ver) >> 16)
4445
#define PSCI_GET_VERSION(major, minor) (((major) << 16) | (minor))
4546

src/arch/armv8/inc/arch/smcc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#define SMCC64_BIT (0x40000000)
1010

11+
#define SMCCC_VERSION (0x80000000)
12+
1113
#define SMCC_E_NOT_SUPPORTED (-1)
1214

1315
#define SMCC32_FID_STD_SRVC (0x84000000)

src/arch/armv8/psci.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <mem.h>
1212
#include <cache.h>
1313
#include <config.h>
14+
#include <arch/smcc.h>
1415

1516
enum { PSCI_MSG_ON };
1617

@@ -170,8 +171,12 @@ static int32_t psci_features_handler(uint32_t feature_id)
170171
case PSCI_AFFINITY_INFO_SMC32:
171172
case PSCI_AFFINITY_INFO_SMC64:
172173
case PSCI_FEATURES:
174+
#ifdef PLAT_PSCI_SUPPORT_SMCCC_VERSION
175+
case SMCCC_VERSION:
176+
#endif
173177
ret = PSCI_E_SUCCESS;
174178
break;
179+
175180
default:
176181
ret = PSCI_E_NOT_SUPPORTED;
177182
break;
@@ -186,7 +191,7 @@ int32_t psci_smc_handler(uint32_t smc_fid, unsigned long x1, unsigned long x2, u
186191

187192
switch (smc_fid) {
188193
case PSCI_VERSION:
189-
ret = PSCI_VERSION_0_2;
194+
ret = PSCI_VERSION_1_1;
190195
break;
191196

192197
case PSCI_CPU_OFF:

src/arch/riscv/inc/arch/bao.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@
2929
#define BAO_VM_BASE (0xffffffe000000000)
3030
#define BAO_VAS_TOP (0xfffffff000000000)
3131
#else
32-
// Because sv32 only lowest level only supports 4MiB pages, this should be enough for each section
33-
// otherwise we need allow for N shared PTEs for each section. For now, it seems to suffice. We also
34-
// are assuming, for now that all available physical memory resides in 0x0 - 0xefffffff of virtual
35-
// memory. Otherwise we need to implement a "highmem"-like mechanism.
32+
/**
33+
* When using sv32 only the lowest level supports 4MiB pages. This should be
34+
* enough for the shared regions, while the private region is left with 256 MiB.
35+
* For now, it seems to suffice. Otherwise, we need allow for N shared PTEs for
36+
* the shared sections. We are also assuming, for now, that all available
37+
* physical memory resides in 0x0 - 0xefffffff of virtual memory. Otherwise we
38+
* need to implement a "highmem"-like mechanism.
39+
*/
3640
#define BAO_VAS_BASE (0xc0000000)
37-
#define BAO_CPU_BASE (0xcf400000)
38-
#define BAO_VM_BASE (0xcf800000)
39-
#define BAO_VAS_TOP (0xcfc00000)
41+
#define BAO_CPU_BASE (0xc0400000)
42+
#define BAO_VM_BASE (0xe0400000)
43+
#define BAO_VAS_TOP (0xe0800000)
4044
#endif
4145

4246
#define PAGE_SIZE (0x1000)

src/arch/riscv/irqc/aia/imsic.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,6 @@ void imsic_clr_pend(irqid_t intp_id)
6767
csrs_sireg_clear(1UL << imsic_eie_bit(intp_id));
6868
}
6969

70-
/**
71-
* For now we only support 1 guest file per hart.
72-
* Should I remove the guest_file from the API?
73-
*/
74-
void imsic_inject_pend(size_t guest_file, irqid_t intp_id)
75-
{
76-
UNUSED_ARG(guest_file);
77-
78-
csrs_vsiselect_write(IMSIC_EIP + imsic_eie_index(intp_id));
79-
csrs_vsireg_clear(1UL << imsic_eie_bit(intp_id));
80-
}
81-
82-
void imsic_send_msi(cpuid_t target_cpu)
83-
{
84-
imsic[target_cpu]->s_file.seteipnum_le = interrupts_ipi_id;
85-
}
86-
8770
void imsic_handle(void)
8871
{
8972
/* Read STOPEI and write to it to claim the interrupt */

src/arch/riscv/irqc/aia/inc/imsic.h

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ struct imsic_intp_file_hw {
2525

2626
struct imsic_global_hw {
2727
struct imsic_intp_file_hw s_file;
28+
struct imsic_intp_file_hw guest_file;
2829
} __attribute__((__packed__, aligned(0x1000ULL)));
2930

31+
extern volatile struct imsic_global_hw* imsic[PLAT_CPU_NUM];
32+
3033
/**
3134
* @brief Initializes the IMSIC
3235
*
@@ -68,16 +71,28 @@ void imsic_set_enbl(irqid_t intp_id);
6871
* Only little endian is supported.
6972
*
7073
* @param target_cpu The ID of the target CPU
74+
* @param msi_id The MSI ID to be sent
7175
*/
72-
void imsic_send_msi(cpuid_t target_cpu);
76+
static inline void imsic_send_msi(cpuid_t target_cpu, irqid_t msi_id)
77+
{
78+
imsic[target_cpu]->s_file.seteipnum_le = msi_id;
79+
}
7380

7481
/**
75-
* @brief Inject an interrupt into a guest.
82+
* @brief Sends an MSI to the guest file of specified CPU with the specified IPI ID.
83+
*
84+
* The function sends an MSI to the target CPU's guest file by setting the seteipnum_le
85+
* register in the IMSIC. The seteipnum_le register is used to specify the ID of the
86+
* interrupt being sent. Only little endian is supported. This function assume a single guest
87+
* interrupt file per hart.
7688
*
77-
* @param guest_file Guest interrupt file ID
78-
* @param intp_id Interrupt ID
89+
* @param target_cpu The ID of the target CPU
90+
* @param msi_id The MSI ID to be injected in the guest interrupt file
7991
*/
80-
void imsic_inject_pend(size_t guest_file, irqid_t intp_id);
92+
static inline void imsic_send_guest_msi(cpuid_t target_cpu, irqid_t msi_id)
93+
{
94+
imsic[target_cpu]->guest_file.seteipnum_le = msi_id;
95+
}
8196

8297
/**
8398
* @brief Handles interrupts in the IMSIC.

src/arch/riscv/irqc/aia/inc/irqc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ static inline irqid_t irqc_reserve(irqid_t pintp_id)
9191

9292
static inline void irqc_send_ipi(cpuid_t target_cpu)
9393
{
94-
imsic_send_msi(target_cpu);
94+
extern irqid_t interrupts_ipi_id;
95+
imsic_send_msi(target_cpu, interrupts_ipi_id);
9596
}
9697

9798
static inline void irqc_handle(void)

0 commit comments

Comments
 (0)