diff options
author | Nick Bofferding <bofferdn@us.ibm.com> | 2015-03-02 18:04:05 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-04-09 21:59:24 -0500 |
commit | 343014b3095462dbec20efe456cbb945d4844b4e (patch) | |
tree | e7a4f1b0b522e63ba0c0baea82a6add01b09772c /src/include/kernel | |
parent | 77f3ab96fd87a9bbecb19aba9f3b48cfb09983bd (diff) | |
download | talos-hostboot-343014b3095462dbec20efe456cbb945d4844b4e.tar.gz talos-hostboot-343014b3095462dbec20efe456cbb945d4844b4e.zip |
Prevent out-of-order data access to FSP mailbox memory area
- Added system call to map FSP mailbox memory with guard permission
- Call new mapping in DMA area init
- Propagate guard permission down to MMIO map
- Apply guard permission in page fault handler
- Updated debug tools to support extra bit in MMIO struct
Change-Id: I8335ac7d3ef57e46d4c8b6c2b2a42b8a0bf7c4b0
Backport: release-fips830
Backport: release-fips820
CQ: SW295345
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16307
Tested-by: Jenkins Server
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
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/devicesegment.H | 17 | ||||
-rw-r--r-- | src/include/kernel/segmentmgr.H | 14 | ||||
-rw-r--r-- | src/include/kernel/vmmmgr.H | 9 |
3 files changed, 30 insertions, 10 deletions
diff --git a/src/include/kernel/devicesegment.H b/src/include/kernel/devicesegment.H index 4adfaf04f..58f381f06 100644 --- a/src/include/kernel/devicesegment.H +++ b/src/include/kernel/devicesegment.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -70,9 +72,12 @@ class DeviceSegment : public Segment * @param ra[in] - Void pointer to real address to be mapped in * @param i_devDataSize[in] - Size of device segment block * @param i_nonCI[in] - Device should be mapped cacheable instead of CI + * @param i_guarded[in] - Whether to prevent out-of-order acces to + * instructions or data in the segment. Ignored if CI. * @return void* - Pointer to beginning virtual address, NULL otherwise */ - void* devMap(void* ra, uint64_t i_devDataSize, bool i_nonCI); + void* devMap(void* ra, uint64_t i_devDataSize, bool i_nonCI, + bool i_guarded); /** * @brief Unmap a device from the device segment. @@ -95,9 +100,11 @@ class DeviceSegment : public Segment */ struct devSegData { - uint64_t addr; //< Real address assigned to device - uint64_t no_ci:1; //< Device should be mapped non-CI. - uint64_t size:63; //< A particular device's segment block size + uint64_t addr; //< Real address assigned to device + uint64_t no_ci:1; //< Device should be mapped non-CI. + uint64_t guarded:1; //< Whether to prevent out-of-order access to + //< instructions or data in the segment + uint64_t size:62; //< A particular device's segment block size }; /** diff --git a/src/include/kernel/segmentmgr.H b/src/include/kernel/segmentmgr.H index fae616a2e..34bbe8fb6 100644 --- a/src/include/kernel/segmentmgr.H +++ b/src/include/kernel/segmentmgr.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -138,9 +140,12 @@ class SegmentManager * @param ra[in] - Void pointer to real address to be mapped in * @param i_devDataSize[in] - Size of device segment block * @param i_nonCI[in] - Device should be mapped cacheable instead of CI + * @param i_guarded[in] - Whether to prevent out-of-order acces to + * instructions or data in the segment. Ignored if CI. * @return void* - Pointer to beginning virtual address, NULL otherwise */ - static void* devMap(void* ra, uint64_t i_devDataSize, bool i_nonCI); + static void* devMap(void* ra, uint64_t i_devDataSize, bool i_nonCI, + bool i_guarded); /** * @brief Unmap a device from the device segment @@ -165,8 +170,11 @@ class SegmentManager PageTableManager::UsageStats_t i_stats ); /** See castOutPages */ void _castOutPages(uint64_t i_type); + /** See devMap */ - void* _devMap(void* ra, uint64_t i_devDataSize, bool i_nonCI); + void* _devMap( + void* ra, uint64_t i_devDataSize, bool i_nonCI, bool i_guarded); + /** See devUnmap */ int _devUnmap(void* ea); diff --git a/src/include/kernel/vmmmgr.H b/src/include/kernel/vmmmgr.H index d7b359d32..18897a6b5 100644 --- a/src/include/kernel/vmmmgr.H +++ b/src/include/kernel/vmmmgr.H @@ -110,9 +110,12 @@ class VmmManager * @param ra[in] - Void pointer to real address to be mapped in * @param i_devDataSize[in] - Size of device segment block * @param i_nonCI[in] - Device should be mapped cacheable instead of CI + * @param i_guarded[in] - Whether to prevent out-of-order acces to + * instructions or data in the segment. Ignored if CI. * @return void* - Pointer to beginning virtual address, NULL otherwise */ - static void* devMap(void* ra, uint64_t i_devDataSize, bool i_nonCI); + static void* devMap(void* ra, uint64_t i_devDataSize, bool i_nonCI, + bool i_guarded); /** * @brief Unmap a device from the device segment @@ -253,7 +256,9 @@ class VmmManager int _mmExtend( void ); /** See devMap */ - void* _devMap(void* ra, uint64_t i_devDataSize, bool i_nonCI); + void* _devMap( + void* ra, uint64_t i_devDataSize, bool i_nonCI, bool i_guarded); + /** See devUnmap */ int _devUnmap(void* ea); |