<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style='--code-editor-font: var(--default-mono-font, "GitLab Mono"), JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;'>
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>
<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>
<style>img {
max-width: 100%; height: auto;
}
body {
font-size: .875rem;
}
body {
-webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px;
}
body {
font-family: var(--default-regular-font, "GitLab Sans"),-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px; font-family: var(--default-regular-font, "GitLab Sans"),-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";'>
<div class="content">
<p class="details" style="font-style: italic; color: #737278;">
<a href="https://gitlab.rtems.org/zhengxiaojun">xiaojun zheng</a> created an issue: <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5064">#5064</a>
</p>
<div class="md" style="color: #333238; word-wrap: break-word;">
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #333238; margin: 0 0 16px;" align="initial">
<a href="#summary" aria-hidden="true" class="anchor" id="user-content-summary" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Summary</h2>
<p dir="auto" style="color: #333238; margin: 0 0 16px;" align="initial">The multicore CPU may arrange in a cluster or multi-clusters, the current RTEMS do not deal
with the cluster id, so it can not run on CPU arranged in clusters. Some changes about MPIDR must
be made to make RTEMS run. I describe the changes here, so it can be discussed.</p>
<p dir="auto" style="color: #333238; margin: 0 0 16px;" align="initial">MPIDR provides an additional PE identification mechanism In a multiprocessor system.
There are 4 levels, .... Aff0 indicates the core number, Aff1,Aff2
indicates the cluster. For a cluster with four cores MPIDR is: 0x0, 0x1, 0x2, 0x3,
for 4 clusters MPIDR is:0x100,0x200,0x300,0x400</p>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #333238; margin: 24px 0 16px;" align="initial">
<a href="#issue" aria-hidden="true" class="anchor" id="user-content-issue" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Issue</h2>
<p dir="auto" style="color: #333238; margin: 0 0 16px;" align="initial">MPIDR is used as the processer index in irq,start code.</p>
<ul dir="auto" style="text-align: initial; list-style-type: disc; margin: 0 0 16px; padding: 0;">
<li style="margin-top: 0; line-height: 1.6em; margin-left: 25px; padding-left: 3px;">
<p style="color: #333238; margin: 0 0 16px;">start.S <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/blob/main/bsps/aarch64/shared/start/start.S?ref_type=heads#L285" style="margin-top: 0;">https://gitlab.rtems.org/rtems/rtos/rtems/-/blob/main/bsps/aarch64/shared/start/start.S?ref_type=heads#L285</a>
secondary CPU use MPIDR calculate stack pointer, the code assume MPIDR is current processor index, so if the MPIDR
is 0x100,0x200,... the SP may be out of memory.</p>
</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">
<p style="color: #333238; margin: 0 0 16px;">gicv3_trigger_sgi() <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/blob/main/bsps/include/dev/irq/arm-gicv3.h?ref_type=heads#L255" style="margin-top: 0;">https://gitlab.rtems.org/rtems/rtos/rtems/-/blob/main/bsps/include/dev/irq/arm-gicv3.h?ref_type=heads#L255</a>
The function used current MPIDR to setup the request, so it can not trigger the target core in the diffrent cluster.</p>
</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">
<p style="color: #333238; margin: 0 0 16px;">_CPU_SMP_Get_current_processor() <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/blob/main/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h?ref_type=heads#L342" style="margin-top: 0;">https://gitlab.rtems.org/rtems/rtos/rtems/-/blob/main/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h?ref_type=heads#L342</a>
The function is assumed to return the core index.</p>
</li>
</ul>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #333238; margin: 24px 0 16px;" align="initial">
<a href="#changes" aria-hidden="true" class="anchor" id="user-content-changes" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Changes</h2>
<p dir="auto" style="color: #333238; margin: 0 0 16px;" align="initial">I think it should setup a map from MPIDR to core index when the primary CPU boot up, and then</p>
<ul dir="auto" style="text-align: initial; list-style-type: disc; margin: 0 0 16px; padding: 0;">
<li style="margin-top: 0; line-height: 1.6em; margin-left: 25px; padding-left: 3px;">
<p style="color: #333238; margin: 0 0 16px;">start.S: use a global variable to pass cluster ID to secondary CPU as parameters, something like this:
struct boot_params {
uint64_t mpidr;
uint32_t cpu_index;
};</p>
</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">
<p style="color: #333238; margin: 0 0 16px;">gicv3_trigger_sgi: add a parameter to pass the cluster ID
change gicv3_trigger_sgi(rtems_vector_number vector, uint32_t targets) to
gicv3_trigger_sgi(rtems_vector_number vector, uint64_t cluster_id, uint32_t targets)</p>
</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">
<p style="color: #333238; margin: 0 0 16px;">_CPU_SMP_Get_current_processor(): use _Per_CPU_Get_index() return the CPU index, do not read MPIDR.</p>
</li>
</ul>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #333238; margin: 24px 0 16px;" align="initial">
<a href="#to-be-disscussed" aria-hidden="true" class="anchor" id="user-content-to-be-disscussed" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>To be disscussed</h2>
<ul dir="auto" style="text-align: initial; list-style-type: disc; margin: 0; padding: 0;">
<li style="margin-top: 0; line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Where to store the map?
Linux get the CPU ID from a dts file, but RTEMS doesn't always use a dts file.
Declare a map in the bsps source file, it doesn't seem flexible enough.</li>
</ul>
</div>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #737278;">
—
<br>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5064">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.rtems.org">gitlab.rtems.org</a>. <a href="https://gitlab.rtems.org/-/sent_notifications/5df1a00d9da8810468ad1898ada18d21/unsubscribe" target="_blank" rel="noopener noreferrer">Unsubscribe</a> from this thread · <a href="https://gitlab.rtems.org/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.rtems.org/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5064"}}</script>
</p>
</div>
</body>
</html>