This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, devel/native-drivers has been updated
via d99b3beb5ba18f061b4baa2debd46d674e542403 (commit)
from 217b610fa1c7c14e0e8f4a33a94dba6f50c79328 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d99b3beb5ba18f061b4baa2debd46d674e542403
Author: Josep Puigdemont <josep.puigdemont(a)linaro.org>
Date: Tue Jan 2 15:47:50 2018 +0100
physmem: change API, alloc now does a mapping too
We add the _reserve() function to the API to do what was previously
achieved with _alloc(), which is to reserve a set of huge pages that are
physically contiguous.
We changed _alloc() so it now calls _reserve() and _map() and it returns
a block that is already mapped in the process' virtual address space.
Signed-off-by: Josep Puigdemont <josep.puigdemont(a)linaro.org>
Reviewed-by: Yi He <yi.he(a)linaro.org>
diff --git a/platform/linux-generic/pktio/physmem/physmem.c b/platform/linux-generic/pktio/physmem/physmem.c
index 297ff2fa..a01b54fe 100644
--- a/platform/linux-generic/pktio/physmem/physmem.c
+++ b/platform/linux-generic/pktio/physmem/physmem.c
@@ -251,7 +251,7 @@ static struct physmem_block *block_get(void)
return block;
}
-struct physmem_block *physmem_block_alloc(uint64_t size)
+struct physmem_block *physmem_block_reserve(uint64_t size)
{
struct physmem_block *block;
struct physmem_block *ret = NULL;
@@ -331,6 +331,22 @@ struct physmem_block *physmem_block_alloc(uint64_t size)
return ret;
}
+struct physmem_block *physmem_block_alloc(uint64_t size)
+{
+ struct physmem_block *block;
+
+ block = physmem_block_reserve(size);
+ if (block == NULL)
+ return NULL;
+
+ if (physmem_block_map(block, NULL)) {
+ physmem_block_free(block);
+ return NULL;
+ }
+
+ return block;
+}
+
void physmem_block_free(struct physmem_block *block)
{
if (block == NULL)
@@ -547,7 +563,6 @@ exit_failure:
block->va_reserved = NULL;
block->va_reserved_size = 0;
-
while (mapped_cnt--) {
hp = &pages[block->first + mapped_cnt];
munmap(hp->va, hp->size);
diff --git a/platform/linux-generic/pktio/physmem/physmem.h b/platform/linux-generic/pktio/physmem/physmem.h
index 77dcb389..ea3e6567 100644
--- a/platform/linux-generic/pktio/physmem/physmem.h
+++ b/platform/linux-generic/pktio/physmem/physmem.h
@@ -37,6 +37,7 @@ struct physmem_block {
int physmem_block_init_global(void);
int physmem_block_term_global(void);
+struct physmem_block *physmem_block_reserve(uint64_t size);
struct physmem_block *physmem_block_alloc(uint64_t size);
void physmem_block_free(struct physmem_block *block);
int physmem_block_map(struct physmem_block *block, void *addr);
-----------------------------------------------------------------------
Summary of changes:
platform/linux-generic/pktio/physmem/physmem.c | 19 +++++++++++++++++--
platform/linux-generic/pktio/physmem/physmem.h | 1 +
2 files changed, 18 insertions(+), 2 deletions(-)
hooks/post-receive
--