summaryrefslogtreecommitdiffstats
path: root/src/kernel
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2012-11-13 15:36:05 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-11-14 15:45:36 -0600
commit073d82a61ee7ce0ec4522c18ce92cd93537025db (patch)
tree382b3db4c6032fb83b2e1c7e9f50eb6c0507fb5b /src/kernel
parentf5fc4c94d84ed3a5263d4139cb09179a5722f382 (diff)
downloadtalos-hostboot-073d82a61ee7ce0ec4522c18ce92cd93537025db.tar.gz
talos-hostboot-073d82a61ee7ce0ec4522c18ce92cd93537025db.zip
Expand memory footprint to full 8MB cache.
If fake PNOR isn't being used, we can expand our memory space to the full 8MB cache. There will be follow up work with RTC: 49137 to support 4MB degraded caches for bring-up. Change-Id: I1248efa37965f39ebab62aae556349c34aa24b66 RTC: 47356 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2319 Tested-by: Jenkins Server Reviewed-by: Melissa J. Connell <missyc@us.ibm.com> Reviewed-by: ADAM R. MUHLE <armuhle@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/misc.C57
-rw-r--r--src/kernel/pagemgr.C9
-rw-r--r--src/kernel/syscall.C29
3 files changed, 84 insertions, 11 deletions
diff --git a/src/kernel/misc.C b/src/kernel/misc.C
index 329bc4fbc..d1a4b2833 100644
--- a/src/kernel/misc.C
+++ b/src/kernel/misc.C
@@ -29,6 +29,9 @@
#include <assert.h>
#include <kernel/terminate.H>
#include <kernel/hbterminatetypes.H>
+#include <sys/mm.h>
+#include <errno.h>
+#include <kernel/pagemgr.H>
extern "C"
void kernel_shutdown(size_t, uint64_t, uint64_t, uint64_t) NO_RETURN;
@@ -231,4 +234,58 @@ namespace KernelMisc
// the process.
kassert(false);
}
+
+ int expand_full_cache()
+ {
+ static bool executed = false;
+
+ if (executed) // Why are we being called a second time?
+ {
+ return -EFAULT;
+ }
+
+ uint64_t* startAddr = NULL;
+ uint64_t* endAddr = NULL;
+
+ switch(CpuID::getCpuType())
+ {
+ case CORE_POWER8_MURANO:
+ case CORE_POWER8_VENICE:
+ /* TODO: RTC 52972 - Change to INITIAL_MEM_SIZE once
+ * SLW images are put in the "right" spot.
+ */
+ startAddr =
+ reinterpret_cast<uint64_t*>((OUTPUT_PORE_IMG_ADDR +
+ MAX_OUTPUT_PORE_IMG_SIZE));
+ endAddr =
+ reinterpret_cast<uint64_t*>(8 * MEGABYTE);
+
+ default:
+ break;
+ }
+
+ if (startAddr != NULL)
+ {
+ populate_cache_lines(startAddr, endAddr);
+ size_t pages = (reinterpret_cast<uint64_t>(endAddr) -
+ reinterpret_cast<uint64_t>(startAddr)) / PAGESIZE;
+
+ PageManager::addMemory(reinterpret_cast<uint64_t>(startAddr),
+ pages);
+ }
+
+ executed = true;
+ return 0;
+ }
+
+ void populate_cache_lines(uint64_t* i_start, uint64_t* i_end)
+ {
+ size_t cache_line_size = getCacheLineWords();
+
+ while(i_start != i_end)
+ {
+ dcbz(i_start);
+ i_start += cache_line_size;
+ }
+ }
};
diff --git a/src/kernel/pagemgr.C b/src/kernel/pagemgr.C
index ca534efdd..f1a1f2976 100644
--- a/src/kernel/pagemgr.C
+++ b/src/kernel/pagemgr.C
@@ -198,12 +198,9 @@ PageManager::PageManager()
// Populate L3 cache lines.
uint64_t* cache_line = reinterpret_cast<uint64_t*>(addr);
- uint64_t* end_cache_line = (uint64_t*) VmmManager::FULL_MEM_SIZE;
- while (cache_line != end_cache_line)
- {
- dcbz(cache_line);
- cache_line += getCacheLineWords();
- }
+ uint64_t* end_cache_line = (uint64_t*) VmmManager::INITIAL_MEM_SIZE;
+ KernelMisc::populate_cache_lines(cache_line, end_cache_line);
+
// Allocate pages
iv_heapKernel.addMemory( addr, RESERVED_PAGES );
diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C
index 6535e7c19..b2a72d420 100644
--- a/src/kernel/syscall.C
+++ b/src/kernel/syscall.C
@@ -804,18 +804,37 @@ namespace Systemcalls
}
/**
- * Allocates a block of virtual memory that extends the VMM
- * space upto 32MEG of Mainstore.
- * @param[in] t: The task used to extend Memory
+ * Extends the initial footprint of the image further into memory.
+ *
+ * Depending on the syscall parameter, we will either switch from 4MB
+ * to 8MB cache-contained mode or expand into 32MB of space using real
+ * system memory.
+
+ * @param[in] t: The task used to extend Memory
*/
void MmExtend(task_t* t)
{
- TASK_SETRTN(t, VmmManager::mmExtend());
+ uint64_t size = TASK_GETARG0(t);
+
+ switch (size)
+ {
+ case MM_EXTEND_FULL_CACHE:
+ TASK_SETRTN(t, KernelMisc::expand_full_cache());
+ break;
+
+ case MM_EXTEND_REAL_MEMORY:
+ TASK_SETRTN(t, VmmManager::mmExtend());
+ break;
+
+ default:
+ TASK_SETRTN(t, -EINVAL);
+ break;
+ }
}
/**
* Allocates a block of memory of the given size
- * to at a specified physical address
+ * to at a specified physical address
*/
void MmLinearMap(task_t* t)
{
OpenPOWER on IntegriCloud