[Skiboot] [PATCH v2] core/init: remove master_cpu parameter
Oliver O'Halloran
oohall at gmail.com
Fri Sep 23 15:55:14 AEST 2016
master_cpu is used to determine the ChipTOD master if no ChipTOD
information is available in the HDAT. However, it is set to zero at every
skiboot entry point (fdt_entry, the 0x180 FSP entry and
opal_boot_trampoline) and is otherwise unused. This patch removes this
passing around and uses the boot CPU PIR to find the ChipTOD master rather
than zero.
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
asm/head.S | 5 -----
core/init.c | 8 ++++----
hdata/spira.c | 15 ++++++---------
hdata/test/hdata_to_dt.c | 2 +-
include/skiboot.h | 2 +-
5 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/asm/head.S b/asm/head.S
index 60bdbe8bba86..a4105ca4812b 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -57,7 +57,6 @@ __head:
.global fdt_entry
fdt_entry:
mr %r27,%r3
- li %r25,0
b boot_entry
/* This is a pointer to a descriptor used by debugging tools
@@ -109,7 +108,6 @@ hir_trigger:
/* Entry point set by the FSP */
.= 0x180
li %r27,0
- li %r25,0
b boot_entry
#define EXCEPTION(nr) \
@@ -249,7 +247,6 @@ boot_offset:
* r28 : PVR
* r27 : DTB pointer (or NULL)
* r26 : PIR thread mask
- * r25 : Selected master CPU (OPAL boot)
*/
.global boot_entry
boot_entry:
@@ -390,7 +387,6 @@ boot_entry:
#endif
/* Jump to C */
mr %r3,%r27
- mr %r4,%r25
bl main_cpu_entry
b .
@@ -819,7 +815,6 @@ opal_naca:
* got to the same entry we use for pHyp and FDT HB.
*/
opal_boot_trampoline:
- li %r25,0
li %r27,-1
ba boot_entry - __head
diff --git a/core/init.c b/core/init.c
index a2daddb86d0b..db03d9777f5b 100644
--- a/core/init.c
+++ b/core/init.c
@@ -645,9 +645,9 @@ static void per_thread_sanity_checks(void)
}
/* Called from head.S, thus no prototype. */
-void main_cpu_entry(const void *fdt, u32 master_cpu);
+void main_cpu_entry(const void *fdt);
-void __noreturn __nomcount main_cpu_entry(const void *fdt, u32 master_cpu)
+void __noreturn __nomcount main_cpu_entry(const void *fdt)
{
/*
* WARNING: At this point. the timebases have
@@ -711,10 +711,10 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt, u32 master_cpu)
dt_root = dt_new_root("");
if (fdt == (void *)-1ul) {
- if (parse_hdat(true, master_cpu) < 0)
+ if (parse_hdat(true) < 0)
abort();
} else if (fdt == NULL) {
- if (parse_hdat(false, master_cpu) < 0)
+ if (parse_hdat(false) < 0)
abort();
} else {
dt_expand(fdt);
diff --git a/hdata/spira.c b/hdata/spira.c
index 51d918f87481..6f384fdc7450 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -624,10 +624,10 @@ static bool add_chiptod_old(void)
return found;
}
-static bool add_chiptod_new(uint32_t master_cpu)
+static bool add_chiptod_new(void)
{
const void *hdif;
- unsigned int i, master_chip;
+ unsigned int i;
bool found = false;
/*
@@ -636,8 +636,6 @@ static bool add_chiptod_new(uint32_t master_cpu)
if (!get_hdif(&spira.ntuples.proc_chip, SPPCRD_HDIF_SIG))
return found;
- master_chip = pir_to_chip_id(master_cpu);
-
for_each_ntuple_idx(&spira.ntuples.proc_chip, hdif, i,
SPPCRD_HDIF_SIG) {
const struct sppcrd_chip_info *cinfo;
@@ -668,12 +666,11 @@ static bool add_chiptod_new(uint32_t master_cpu)
/* The FSP may strip the chiptod info from HDAT; if we find
* a zero-ed out entry, assume that the chiptod is
* present, but we don't have any primary/secondary info. In
- * this case, pick the primary based on the CPU that was
- * assigned master.
+ * this case, pick chip zero as the master.
*/
if (!size) {
flags = CHIPTOD_ID_FLAGS_STATUS_OK;
- if (be32_to_cpu(cinfo->xscom_id) == master_chip)
+ if (be32_to_cpu(cinfo->xscom_id) == 0x0)
flags |= CHIPTOD_ID_FLAGS_PRIMARY;
}
@@ -1092,7 +1089,7 @@ static void fixup_spira(void)
spira.ntuples.hs_data = spiras->ntuples.hs_data;
}
-int parse_hdat(bool is_opal, uint32_t master_cpu)
+int parse_hdat(bool is_opal)
{
cpu_type = PVR_TYPE(mfspr(SPR_PVR));
@@ -1131,7 +1128,7 @@ int parse_hdat(bool is_opal, uint32_t master_cpu)
fsp_parse();
/* Add ChipTOD's */
- if (!add_chiptod_old() && !add_chiptod_new(master_cpu))
+ if (!add_chiptod_old() && !add_chiptod_new())
prerror("CHIPTOD: No ChipTOD found !\n");
/* Add NX */
diff --git a/hdata/test/hdata_to_dt.c b/hdata/test/hdata_to_dt.c
index 1a644301986d..06f900544fcb 100644
--- a/hdata/test/hdata_to_dt.c
+++ b/hdata/test/hdata_to_dt.c
@@ -234,7 +234,7 @@ int main(int argc, char *argv[])
dt_root = dt_new_root("");
- if(parse_hdat(false, 0) < 0) {
+ if(parse_hdat(false) < 0) {
fprintf(stderr, "FATAL ERROR parsing HDAT\n");
exit(EXIT_FAILURE);
}
diff --git a/include/skiboot.h b/include/skiboot.h
index 4ccf46d9e565..52a235b57beb 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -175,7 +175,7 @@ extern void start_kernel32(uint64_t entry, void* fdt,
extern void start_kernel_secondary(uint64_t entry) __noreturn;
/* Get description of machine from HDAT and create device-tree */
-extern int parse_hdat(bool is_opal, uint32_t master_cpu);
+extern int parse_hdat(bool is_opal);
/* Root of device tree. */
extern struct dt_node *dt_root;
--
2.5.5
More information about the Skiboot
mailing list