diff options
| author | Missy Connell <missyc@us.ibm.com> | 2012-09-10 16:05:01 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-10-09 17:10:32 -0500 |
| commit | 1bf8c6b8376efacd03e3ec62d5ded5b2be4bff39 (patch) | |
| tree | c266815232142e67f15a61ffcbdf09407737f259 /src/include/kernel | |
| parent | fb1836fd7b1b8839815595db08ae740ec7b86347 (diff) | |
| download | talos-hostboot-1bf8c6b8376efacd03e3ec62d5ded5b2be4bff39.tar.gz talos-hostboot-1bf8c6b8376efacd03e3ec62d5ded5b2be4bff39.zip | |
Extend VMM to 32M
Add mmLinearMap to create block at a specified phys addr.
Added iv_MaptoPhy in the block to indicate we are physically mapped
block and to not apply the HRMOR.
Change-Id: I75ddb19b82ae9a2035ff873edff8a34a33c74639
RTC:43401
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1846
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/kernel')
| -rw-r--r-- | src/include/kernel/basesegment.H | 109 | ||||
| -rw-r--r-- | src/include/kernel/block.H | 69 | ||||
| -rw-r--r-- | src/include/kernel/pagemgr.H | 56 | ||||
| -rw-r--r-- | src/include/kernel/syscalls.H | 6 | ||||
| -rw-r--r-- | src/include/kernel/vmmmgr.H | 22 |
5 files changed, 180 insertions, 82 deletions
diff --git a/src/include/kernel/basesegment.H b/src/include/kernel/basesegment.H index 293b24f1c..f9761ce2d 100644 --- a/src/include/kernel/basesegment.H +++ b/src/include/kernel/basesegment.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/kernel/basesegment.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/kernel/basesegment.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ /** @file basesegment.H * @brief Defines the base segment (0TB) class. */ @@ -83,10 +83,17 @@ class BaseSegment : public Segment * @param i_va[in] - Page aligned base virtual address of the block * to be allocated * @param i_size[in] - Requested virtual memory size of the block + * @param i_mappedToPhy[in] - bool value assigned to the block to + * determine if this blocked is mapped directly to a physical + * address + * DEFAULT - FALSE + * @param i_SPTEaddr[in] - address of where the SPTE should be put. + * DEFAULT = NULL (no specific address) * @return int - 0 for successful block allocation, non-zero otherwise */ - static int mmAllocBlock(MessageQueue* i_mq,void* i_va, - uint64_t i_size); + static int mmAllocBlock(MessageQueue* i_mq,void* i_va,uint64_t i_size, + bool iv_mappedToPhy = false, + uint64_t *i_SPTEaddr = NULL ); /** * @brief Locate the physical address of the given virtual address @@ -119,11 +126,28 @@ class BaseSegment : public Segment static int mmSetPermission(void* i_va, uint64_t i_size, uint64_t i_access_type); - /** - * @breif Cast out older physical memory pages - * @param[in] castout Constraint - */ - virtual void castOutPages(uint64_t i_type); + /** + * @brief Cast out older physical memory pages + * @param[in] castout Constraint + */ + virtual void castOutPages(uint64_t i_type); + + /** + * @brief Allocates a block of virtual memory that extends the VMM + * space upto 32MEG of Mainstore. + */ + static int mmExtend(void); + + /** + * @brief Allocates a block of memory of the given size to at a + * specified physical address. + * @param i_paddr[in] - physical address of the location of the block of + * memory + * @param i_size[in] - range of memory being created + * @return int - 0 for successful block allocation, non-zero otherwise + */ + static int mmLinearMap(void *i_paddr, uint64_t i_size); + private: /** @@ -142,9 +166,17 @@ class BaseSegment : public Segment * @param i_mq[in] - Message queue to be associated with the block * @param i_va[in] - Base virtual address of the block to be allocated * @param i_size[in] - Requested virtual memory size of the block + * @param i_mappedToPhy[in] - bool value assigned to the block to + * determine if this blocked is mapped directly to a physical + * address + * DEFAULT - FALSE + * @param i_SPTEaddr[in] - address of where the SPTE should be put. + * DEFAULT = NULL (no specific address) * @return int - 0 for successful block allocation, non-zero otherwise */ - int _mmAllocBlock(MessageQueue* i_mq,void* i_va,uint64_t i_size); + int _mmAllocBlock(MessageQueue* i_mq,void* i_va,uint64_t i_size, + bool iv_mappedToPhy = false, + uint64_t *i_SPTEaddr = NULL); /** * @brief Sets the page permissions for a given virtual address and size. @@ -170,6 +202,23 @@ class BaseSegment : public Segment int _mmRemovePages(VmmManager::PAGE_REMOVAL_OPS i_op, void* i_vaddr, uint64_t i_size, task_t* i_task); + /** + * @brief Allocates a block of virtual memory that extends the VMM + * space upto 32MEG of Mainstore. + */ + int _mmExtend(void); + + /** + * @brief Allocates a block of memory of the given size to at a + * specified physical address. + * @param i_paddr[in] - physical address of the location of the block of + * memory + * @param i_size[in] - range of memory being created + * @return int - 0 for successful block allocation, non-zero otherwise + */ + int _mmLinearMap(void* i_paddr, uint64_t i_size); + + }; #endif diff --git a/src/include/kernel/block.H b/src/include/kernel/block.H index 5d80ea7c6..403daec83 100644 --- a/src/include/kernel/block.H +++ b/src/include/kernel/block.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/kernel/block.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/kernel/block.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ /** @file block.H * @brief Defines the implementation for the generic VMM block class. */ @@ -65,15 +65,23 @@ class Block * @param[in] i_size - Size of the block (in bytes). * @param[in] i_msgQueue - Message queue passed along to the handler * Default: NULL + * @param[in] i_mappedToPhy - boolean value indicating whether this + * block is a mapped to physical block. + * Default: false + * @param[in] i_spteAddr - address that the SPTE will be created + * at if a specific location is required. + * Default: NULL * * Will allocate enough shadow PTEs to track pages in the block. */ Block(uint64_t i_baseAddr, uint64_t i_size, - MessageQueue* i_msgQueue = NULL) : - iv_baseAddr(i_baseAddr), iv_size(i_size), - iv_parent(NULL), iv_nextBlock(NULL), iv_ptes(NULL), - iv_readMsgHdlr(NULL), iv_writeMsgHdlr(NULL) - { init(i_msgQueue); }; + MessageQueue* i_msgQueue = NULL, bool i_mappedToPhy = false, + uint64_t *i_spteAddr = NULL) : iv_baseAddr(i_baseAddr), + iv_size(i_size),iv_parent(NULL), iv_nextBlock(NULL), + iv_ptes(NULL), iv_readMsgHdlr(NULL),iv_writeMsgHdlr(NULL), + iv_mappedToPhysical(i_mappedToPhy) + {init(i_msgQueue, i_spteAddr);}; + /** * @brief Destructor. @@ -298,10 +306,15 @@ class Block static uint32_t cv_ro_evict_req; //!< memstat ro eviction requests static uint32_t cv_rw_evict_req; //!< memstat rw eviction requests + + bool iv_mappedToPhysical; /** * @brief Finish initialization of block. * * @param[in] i_msgQ - The message queue associated with this block + * @param[in] i_spteAddr - address that the SPTE will be created + * at if a specific address is required. + * Default: NULL * * Construct ShadowPTE entries. * @@ -310,7 +323,7 @@ class Block * "not-in-charge" version of each constructor, so put as much * common code into an init function. */ - void init(MessageQueue* i_msgQ); + void init(MessageQueue* i_msgQ, uint64_t *i_spteAddr); /** * @brief Find the Shadow PTE for a virtual address. diff --git a/src/include/kernel/pagemgr.H b/src/include/kernel/pagemgr.H index 93cd82bb5..ad94d0522 100644 --- a/src/include/kernel/pagemgr.H +++ b/src/include/kernel/pagemgr.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/kernel/pagemgr.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2010-2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/kernel/pagemgr.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2010,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __KERNEL_PAGEMGR_H #define __KERNEL_PAGEMGR_H @@ -167,6 +166,14 @@ class PageManager */ static uint64_t availPages(); + /** + * Add memory to the page manager + * @param[in] i_addr, The start address of the memory to add + * @param[in] i_pageCount, The number of pages to add + * @note i_addr must be on a page boundary + */ + static void addMemory(size_t i_addr, size_t i_pageCount); + enum { MEMLEN = VmmManager::MBOX_DMA_ADDR, @@ -186,9 +193,10 @@ class PageManager private: - void* _allocatePage(size_t,bool); //!< see allocatePage() + void* _allocatePage(size_t,bool); //!< see allocatePage() void _freePage(void*, size_t); //!< see freePage() void _coalesce( void ); //!< see coalesce() + void _addMemory(size_t, size_t); //!< see addMemory() /** see queryAvail() */ ALWAYS_INLINE uint64_t _queryAvail() const diff --git a/src/include/kernel/syscalls.H b/src/include/kernel/syscalls.H index f31526868..2a3ba6095 100644 --- a/src/include/kernel/syscalls.H +++ b/src/include/kernel/syscalls.H @@ -110,6 +110,12 @@ namespace Systemcalls /** mm_virt_to_phys() */ MM_VIRT_TO_PHYS, + /** mm_extend() */ + MM_EXTEND, + + /** mm_linear_map() */ + MM_LINEAR_MAP, + SYSCALL_MAX }; diff --git a/src/include/kernel/vmmmgr.H b/src/include/kernel/vmmmgr.H index 0c11ffeb8..7b8bd07bc 100644 --- a/src/include/kernel/vmmmgr.H +++ b/src/include/kernel/vmmmgr.H @@ -185,6 +185,22 @@ class VmmManager */ static uint64_t findKernelAddress(uint64_t i_vaddr); + /** + * @brief Allocates a block of virtual memory that extends the VMM + * space upto 32MEG of Mainstore. + */ + static int mmExtend( void); + + /** @fn mm_linear_map() + * @brief Allocates a block of memory of the given size + * to at a specified address (direct pa to va mapping) + * @param[in] i_paddr - physical address of the location for the block + * @param[in] i_size - size of the block requested + * + * @return int - 0 for successful add, non-zero otherwise + */ + static int mmLinearMap(void *i_paddr, uint64_t i_size); + protected: VmmManager(); ~VmmManager() {}; @@ -223,11 +239,17 @@ class VmmManager int _mmRemovePages(VmmManager::PAGE_REMOVAL_OPS i_op,void* i_vaddr, uint64_t i_size,task_t* i_task); + /** See mmExtend */ + int _mmExtend( void ); + /** See devMap */ void* _devMap(void* ra, uint64_t i_devDataSize); /** See devUnmap */ int _devUnmap(void* ea); + /** See mmLinearMap */ + int _mmLinearMap(void*, uint64_t); + public: friend class Block; friend class StackSegment; |

