[Skiboot] [PATCH v6 03/10] skiboot: Add chip id to HOMER reserved region
Madhavan Srinivasan
maddy at linux.vnet.ibm.com
Wed Mar 1 01:53:30 AEDT 2017
From: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
This patch adds a "ibm,chip-id" property to HOMER reserved region. That
helps us in relating the HOMER reserved region to the chip that its
associated with.
This patch is required for nest IMC counters since, the counter values
are stored in an offset inside the HOMER region. To read those values
from the kernel for a chip, we need to associate the region to its
associated chip.
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
core/init.c | 3 +++
hw/homer.c | 30 ++++++++++++++++++++++++++++++
include/skiboot.h | 1 +
3 files changed, 34 insertions(+)
diff --git a/core/init.c b/core/init.c
index 983ead5d4c2f..cfb50424884c 100644
--- a/core/init.c
+++ b/core/init.c
@@ -968,6 +968,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt)
prd_register_reserved_memory();
+ /* Add ibm,chip-id porperty to homer reserved region */
+ homer_fixup_dt();
+
load_and_boot_kernel(false);
}
diff --git a/hw/homer.c b/hw/homer.c
index 84eb536e632c..c7b17c4f6cf2 100644
--- a/hw/homer.c
+++ b/hw/homer.c
@@ -116,6 +116,36 @@ static void homer_init_chip(struct proc_chip *chip)
}
}
+void homer_fixup_dt(void)
+{
+ struct mem_region *region;
+ struct proc_chip *chip;
+
+ lock(&mem_region_lock);
+
+ for (region = mem_region_next(NULL); region;
+ region = mem_region_next(region)) {
+ if (region->type != REGION_HW_RESERVED)
+ continue;
+
+ if (!region->node)
+ continue;
+
+ if (strncmp("ibm,homer-image",
+ region->node->name, strlen("ibm,homer-image")))
+ continue;
+
+ for_each_chip(chip) {
+ if (region->start == chip->homer_base) {
+ dt_add_property_cells(region->node,
+ "ibm,chip-id", chip->id);
+ break;
+ }
+ }
+ }
+ unlock(&mem_region_lock);
+}
+
void homer_init(void)
{
struct proc_chip *chip;
diff --git a/include/skiboot.h b/include/skiboot.h
index 7904eee9e921..d9135f59dd38 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -270,6 +270,7 @@ extern void prd_tmgt_interrupt(uint32_t proc);
extern void prd_occ_reset(uint32_t proc);
extern void prd_init(void);
extern void prd_register_reserved_memory(void);
+extern void homer_fixup_dt(void);
/* Flatten device-tree */
extern void *create_dtb(const struct dt_node *root, bool exclusive);
--
2.7.4
More information about the Skiboot
mailing list