[Skiboot] [PATCH v8 03/10] skiboot: Add chip id to HOMER reserved region
Madhavan Srinivasan
maddy at linux.vnet.ibm.com
Mon Apr 3 17:41:40 AEST 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: Hemant Kumar <hemant 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 6b8137c8c7b9..568addee3867 100644
--- a/core/init.c
+++ b/core/init.c
@@ -986,6 +986,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 1e2298b12e59..b8fd74c94d14 100644
--- a/hw/homer.c
+++ b/hw/homer.c
@@ -157,6 +157,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 8bc767a4d084..e23762d7f7a2 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -274,6 +274,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