summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ae36250)
raw | patch | inline | side by side (parent: ae36250)
author | Justin Sobota <jsobota@ti.com> | |
Mon, 18 Feb 2013 22:12:31 +0000 (17:12 -0500) | ||
committer | Justin Sobota <jsobota@ti.com> | |
Mon, 18 Feb 2013 22:12:31 +0000 (17:12 -0500) |
index 25b7e706940b694c684bb738c2103d56835a1418..a80ad8275e330db27b2de8e42803eefd700ecfb0 100644 (file)
uint32_t allocType;
/* Resources for which the allocator operation will affect */
Rm_ResourceInfo *resourceInfo;
- /* Linux kernel resource allocations bypass all policy checks */
- bool LinuxKernelBypass;
} Rm_AllocatorOpInfo;
/* RM allocator linked list node */
} Rm_Allocator;
Rm_Allocator *rmAllocatorFind(Rm_Allocator *allocatorList, char *resourceName);
-int32_t rmAllocatorOperation(Rm_Allocator *allocatorList, Rm_AllocatorOpInfo *opInfo);
+int32_t rmAllocatorOperation(Rm_Handle rmHandle, Rm_AllocatorOpInfo *opInfo);
int32_t rmAllocatorInitializeResources(Rm_Handle rmHandle, void *globalResourceDtb, void *linuxDtb);
#ifdef __cplusplus
diff --git a/include/rm_policyloc.h b/include/rm_policyloc.h
index a89a9f9ed584b5e63c1f6a4f376b71175ec0b5d2..bcc6473a60a2d34d2fc444415ebb8598100d6d7e 100644 (file)
--- a/include/rm_policyloc.h
+++ b/include/rm_policyloc.h
* i.e. No other RM instance can reserve the resource if a RM
* instance with exclusive privilege reserves the resource
* 3 : Shared Linux (s) - Resource has been reserved by the Linux kernel but can be
- * allocated by the specified RM instances (NOT IMPLEMENTED YET)
+ * allocated by the specified RM instances
* 4 - 15 : UNUSED
*/
typedef uint16_t Rm_PolicyPermBits;
/* Validate initialization permissions for a resource */
Rm_policyCheck_INIT,
/* Validate usage permissions for a resource */
- Rm_policyCheck_USE
+ Rm_policyCheck_USE,
+ /* Validate shared Linux permissions for a resource */
+ Rm_policyCheck_SHARED_LINUX
} Rm_PolicyCheckType;
/* Permissions validation configuration structure */
index 77143d4b6698345b155b65b36b4364e845c2bbec..a4952fcd2235e659b1128a4b00af2e781ba84787 100644 (file)
--- a/rm.h
+++ b/rm.h
* global policy. RM instance cannot be unlocked. Please make sure static policy and global policy
* are in sync */
#define RM_SERVICE_DENIED_RM_INSTANCE_LOCKED RM_SERVICE_DENIED_BASE+16
+/** Allocate request denied because the resource is already reserved by Linux and "Shared Linux"
+ * privileges are not assigned to the requesting instance */
+#define RM_SERVICE_DENIED_RES_NOT_SHARED_LINUX RM_SERVICE_DENIED_BASE+17
/** Start of libfdt.h error codes */
#define RM_ERROR_LIBFDT_START (-1)
diff --git a/src/rm.c b/src/rm.c
index cb51888a8dc5d3cb8c730511765405cc06aba06a..b846210264c2c99ccabafa688029c94f3ed0374e 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -372,12 +372,6 @@ static void allocationHandler (Rm_Inst *rmInst, Rm_Transaction *transaction, voi
opInfo.policy = rmInst->policy;
opInfo.resourceInfo = &transaction->resourceInfo;
opInfo.serviceSrcInstNode = validInstNode;
- if (validInstNode == rmPolicyGetLinuxInstNode(rmInst->validInstances)) {
- opInfo.LinuxKernelBypass = true;
- }
- else {
- opInfo.LinuxKernelBypass = false;
- }
opInfo.allocType = allocType;
/* Populated NameServer name has precedence over base */
@@ -402,12 +396,12 @@ static void allocationHandler (Rm_Inst *rmInst, Rm_Transaction *transaction, voi
if (retVal == RM_SERVICE_PROCESSING) {
if (transaction->resourceInfo.base == RM_RESOURCE_BASE_UNSPECIFIED) {
opInfo.operation = Rm_allocatorOp_PRE_ALLOCATE;
- retVal = rmAllocatorOperation(rmInst->allocators, &opInfo);
+ retVal = rmAllocatorOperation((Rm_Handle)rmInst, &opInfo);
}
if (retVal == RM_SERVICE_PROCESSING) {
opInfo.operation = Rm_allocatorOp_ALLOCATE;
- retVal = rmAllocatorOperation(rmInst->allocators, &opInfo);
+ retVal = rmAllocatorOperation((Rm_Handle)rmInst, &opInfo);
}
}
@@ -472,7 +466,7 @@ static void freeHandler (Rm_Inst *rmInst, Rm_Transaction *transaction, void *val
if(retVal == RM_SERVICE_PROCESSING) {
opInfo.operation = Rm_allocatorOp_FREE;
- retVal = rmAllocatorOperation(rmInst->allocators, &opInfo);
+ retVal = rmAllocatorOperation((Rm_Handle)rmInst, &opInfo);
}
transaction->state = retVal;
treeNode->base + treeNode->length -1);
if (treeNode->allocationCount == 0) {
- Rm_osalLog("NOT ALLOCATED\n");
+ Rm_osalLog("FREE\n");
}
else {
owners = treeNode->ownerList;
- Rm_osalLog("allocated to");
while (owners) {
- Rm_osalLog(" %s", owners->instNameNode->name);
+ Rm_osalLog("%s ", owners->instNameNode->name);
owners = owners->nextOwner;
}
Rm_osalLog("\n");
diff --git a/src/rm_allocator.c b/src/rm_allocator.c
index d87d00dedac530e0fc767aba0eb2df3bed1a3e8e..803ba5e60a8398c0a4b44cb1e5a2a40a205f1ca9 100644 (file)
--- a/src/rm_allocator.c
+++ b/src/rm_allocator.c
@@ -349,8 +349,10 @@ static bool allocatorResNodeIsOwnedBy(Rm_ResourceNode *node, void *serviceInstNo
* If a valid range is found it will be returned for the
* treeAllocate algorithm to handle.
*/
-static int32_t allocatorPreAllocate(Rm_Allocator *allocator, int32_t resourcePolicy, Rm_AllocatorOpInfo *opInfo)
+static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator, int32_t resourcePolicy,
+ Rm_AllocatorOpInfo *opInfo)
{
+ Rm_Inst *rmInst = (Rm_Inst *)rmHandle;
Rm_ResourceNode findNode;
Rm_ResourceNode *matchingNode = NULL;
uint32_t matchingEnd;
@@ -396,47 +398,60 @@ static int32_t allocatorPreAllocate(Rm_Allocator *allocator, int32_t resourcePol
matchingNode = RB_FIND(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, &findNode);
if (matchingNode) {
- nodePassesPolicy = false;
- policyCheckCfg.type = policyCheckType;
- policyCheckCfg.validInstNode = opInfo->serviceSrcInstNode;
- policyCheckCfg.resourceBase = findNode.base;
- policyCheckCfg.resourceLength = findNode.length;
- nodePassesPolicy = rmPolicyCheckPrivilege(&policyCheckCfg, &retVal);
-
- if (nodePassesPolicy && (matchingNode->allocationCount > 0)) {
- /* Check exclusive privileges of instance requesting resource. Requesting
- * instance with exclusive privileges can't reserve resource if already owned*/
- policyCheckCfg.type = Rm_policyCheck_EXCLUSIVE;
+ if (!allocatorResNodeIsOwnedBy(matchingNode, opInfo->serviceSrcInstNode)) {
+ /* Attempt to preallocate from node only if not owned by instance requesting the allocation */
+ nodePassesPolicy = false;
+ policyCheckCfg.type = policyCheckType;
policyCheckCfg.validInstNode = opInfo->serviceSrcInstNode;
- nodePassesPolicy = !rmPolicyCheckPrivilege(&policyCheckCfg, &retVal);
- }
-
- if (nodePassesPolicy && (matchingNode->allocationCount == 1)) {
- /* Check exclusive privileges of instance that currently owns resource */
- policyCheckCfg.type = Rm_policyCheck_EXCLUSIVE;
- policyCheckCfg.validInstNode = matchingNode->ownerList->instNameNode;
- nodePassesPolicy = !rmPolicyCheckPrivilege(&policyCheckCfg, &retVal);
- }
-
- if (retVal != RM_SERVICE_PROCESSING) {
- break;
- }
+ policyCheckCfg.resourceBase = findNode.base;
+ policyCheckCfg.resourceLength = findNode.length;
+ nodePassesPolicy = rmPolicyCheckPrivilege(&policyCheckCfg, &retVal);
+
+ if (nodePassesPolicy && (matchingNode->allocationCount > 0)) {
+ policyCheckCfg.validInstNode = opInfo->serviceSrcInstNode;
+
+ if (allocatorResNodeIsOwnedBy(matchingNode, rmPolicyGetLinuxInstNode(rmInst->validInstances))) {
+ /* Check if instance requesting resource has privileges to share
+ * a resource already reserved by Linux */
+ policyCheckCfg.type = Rm_policyCheck_SHARED_LINUX;
+ nodePassesPolicy = rmPolicyCheckPrivilege(&policyCheckCfg, &retVal);
+ }
- if (nodePassesPolicy) {
- matchingEnd = matchingNode->base + matchingNode->length - 1;
- /* Initialize indexer to be first resource value that alignment */
- rangeIndex = findNode.base;
- if (rangeIndex % opInfo->resourceInfo->alignment) {
- rangeIndex += (opInfo->resourceInfo->alignment -
- (rangeIndex % opInfo->resourceInfo->alignment));
+ if (nodePassesPolicy) {
+ /* Check exclusive privileges of instance requesting resource. Requesting
+ * instance with exclusive privileges can't reserve resource if already owned*/
+ policyCheckCfg.type = Rm_policyCheck_EXCLUSIVE;
+ nodePassesPolicy = !rmPolicyCheckPrivilege(&policyCheckCfg, &retVal);
+ }
}
- if ((rangeIndex + opInfo->resourceInfo->length - 1) <= matchingEnd) {
- /* Block of unallocated resources within matchingNode that satisfies
- * allocate requirements */
- opInfo->resourceInfo->base = rangeIndex;
- resourceFound = true;
- }
+ if (nodePassesPolicy && (matchingNode->allocationCount == 1)) {
+ /* Check exclusive privileges of instance that currently owns resource */
+ policyCheckCfg.type = Rm_policyCheck_EXCLUSIVE;
+ policyCheckCfg.validInstNode = matchingNode->ownerList->instNameNode;
+ nodePassesPolicy = !rmPolicyCheckPrivilege(&policyCheckCfg, &retVal);
+ }
+
+ if (retVal != RM_SERVICE_PROCESSING) {
+ break;
+ }
+
+ if (nodePassesPolicy) {
+ matchingEnd = matchingNode->base + matchingNode->length - 1;
+ /* Initialize indexer to be first resource value that alignment */
+ rangeIndex = findNode.base;
+ if (rangeIndex % opInfo->resourceInfo->alignment) {
+ rangeIndex += (opInfo->resourceInfo->alignment -
+ (rangeIndex % opInfo->resourceInfo->alignment));
+ }
+
+ if ((rangeIndex + opInfo->resourceInfo->length - 1) <= matchingEnd) {
+ /* Block of unallocated resources within matchingNode that satisfies
+ * allocate requirements */
+ opInfo->resourceInfo->base = rangeIndex;
+ resourceFound = true;
+ }
+ }
}
if (!resourceFound) {
@@ -464,8 +479,10 @@ static int32_t allocatorPreAllocate(Rm_Allocator *allocator, int32_t resourcePol
* resource nodes that may have become equivalent (in terms
* of ownership) after the allocation.
*/
-static int32_t allocatorAllocate(Rm_Allocator *allocator, int32_t resourcePolicy, Rm_AllocatorOpInfo *opInfo)
+static int32_t allocatorAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator, int32_t resourcePolicy,
+ Rm_AllocatorOpInfo *opInfo)
{
+ Rm_Inst *rmInst = (Rm_Inst *)rmHandle;
Rm_ResourceNode findNode;
Rm_ResourceNode *matchingNode = NULL;
Rm_ResourceNode *leftNode = NULL;
@@ -498,7 +515,7 @@ static int32_t allocatorAllocate(Rm_Allocator *allocator, int32_t resourcePolicy
matchingEnd = matchingNode->base + matchingNode->length - 1;
if ((findNode.base >= matchingNode->base) && (findEnd <= matchingEnd)) {
- if (opInfo->LinuxKernelBypass) {
+ if (opInfo->serviceSrcInstNode == rmPolicyGetLinuxInstNode(rmInst->validInstances)) {
/* Bypass policy checks since Linux Kernel has full privileges */
allocPassesPolicy = true;
}
@@ -520,16 +537,26 @@ static int32_t allocatorAllocate(Rm_Allocator *allocator, int32_t resourcePolicy
}
if (!allocatorResNodeIsOwnedBy(matchingNode, opInfo->serviceSrcInstNode)) {
- /* Perform exclusive checks if requesting instance does not already an
- * owner of the resource */
if (allocPassesPolicy && (matchingNode->allocationCount > 0)) {
- /* Check exclusive privileges of instance requesting resource. Requesting
- * instance with exclusive privileges can't reserve resource if already owned*/
- policyCheckCfg.type = Rm_policyCheck_EXCLUSIVE;
- policyCheckCfg.validInstNode = opInfo->serviceSrcInstNode;
- allocPassesPolicy = !rmPolicyCheckPrivilege(&policyCheckCfg, &retVal);
- if (!allocPassesPolicy) {
- retVal = RM_SERVICE_DENIED_EXCLUSIVE_RES_ALLOCD;
+ if (allocatorResNodeIsOwnedBy(matchingNode, rmPolicyGetLinuxInstNode(rmInst->validInstances))) {
+ /* Check if instance requesting resource has privileges to share
+ * a resource already reserved by Linux */
+ policyCheckCfg.type = Rm_policyCheck_SHARED_LINUX;
+ policyCheckCfg.validInstNode = opInfo->serviceSrcInstNode;
+ allocPassesPolicy = rmPolicyCheckPrivilege(&policyCheckCfg, &retVal);
+ if (!allocPassesPolicy) {
+ retVal = RM_SERVICE_DENIED_RES_NOT_SHARED_LINUX;
+ }
+ }
+ if (allocPassesPolicy) {
+ /* Check exclusive privileges of instance requesting resource. Requesting
+ * instance with exclusive privileges can't reserve resource if already owned*/
+ policyCheckCfg.type = Rm_policyCheck_EXCLUSIVE;
+ policyCheckCfg.validInstNode = opInfo->serviceSrcInstNode;
+ allocPassesPolicy = !rmPolicyCheckPrivilege(&policyCheckCfg, &retVal);
+ if (!allocPassesPolicy) {
+ retVal = RM_SERVICE_DENIED_EXCLUSIVE_RES_ALLOCD;
+ }
}
}
if (allocPassesPolicy && (matchingNode->allocationCount == 1)) {
@@ -916,7 +943,6 @@ static int32_t allocatorFree(Rm_Allocator *allocator, Rm_AllocatorOpInfo *opInfo
static int32_t allocatorReserveLinuxResource(Rm_Handle rmHandle, Rm_LinuxAlias *linuxAlias,
Rm_LinuxValueRange *linuxValues, Rm_AllocatorOpInfo *opInfo)
{
- Rm_Inst *rmInst = (Rm_Inst *)rmHandle;
int32_t retVal = RM_OK;
bool baseFound = false;
bool lengthFound = false;
@@ -946,7 +972,7 @@ static int32_t allocatorReserveLinuxResource(Rm_Handle rmHandle, Rm_LinuxAlias *
}
else {
/* Allocate resource to Linux */
- retVal = rmAllocatorOperation(rmInst->allocators, opInfo);
+ retVal = rmAllocatorOperation(rmHandle, opInfo);
}
return (retVal);
}
@@ -983,7 +1009,6 @@ static int32_t allocatorFindLinuxResource(Rm_Handle rmHandle, const char *resour
strncpy(resourceInfo.name, resourceName, RM_NAME_MAX_CHARS);
opInfo.policy = rmInst->policy;
opInfo.serviceSrcInstNode = rmPolicyGetLinuxInstNode(rmInst->validInstances);
- opInfo.LinuxKernelBypass = true;
opInfo.operation = Rm_allocatorOp_ALLOCATE;
opInfo.resourceInfo = &resourceInfo;
@@ -1239,21 +1264,22 @@ Rm_Allocator *rmAllocatorFind(Rm_Allocator *allocatorList, char *resourceName)
* DESCRIPTION: Issues an allocator preallocate, allocate, or free
* for an RM resource.
*/
-int32_t rmAllocatorOperation(Rm_Allocator *allocatorList, Rm_AllocatorOpInfo *opInfo)
+int32_t rmAllocatorOperation(Rm_Handle rmHandle, Rm_AllocatorOpInfo *opInfo)
{
+ Rm_Inst *rmInst = (Rm_Inst *)rmHandle;
Rm_Allocator *allocator = NULL;
int32_t resourceOffsetInPolicy;
int32_t retVal;
resourceOffsetInPolicy = rmPolicyGetResourceOffset(opInfo->policy, opInfo->resourceInfo->name);
- allocator = rmAllocatorFind(allocatorList, opInfo->resourceInfo->name);
+ allocator = rmAllocatorFind(rmInst->allocators, opInfo->resourceInfo->name);
if ((resourceOffsetInPolicy > 0) && allocator) {
if (opInfo->operation == Rm_allocatorOp_PRE_ALLOCATE) {
- retVal = allocatorPreAllocate(allocator, resourceOffsetInPolicy, opInfo);
+ retVal = allocatorPreAllocate(rmHandle, allocator, resourceOffsetInPolicy, opInfo);
}
else if (opInfo->operation == Rm_allocatorOp_ALLOCATE) {
- retVal = allocatorAllocate(allocator, resourceOffsetInPolicy, opInfo);
+ retVal = allocatorAllocate(rmHandle, allocator, resourceOffsetInPolicy, opInfo);
}
else if (opInfo->operation == Rm_allocatorOp_FREE) {
retVal = allocatorFree(allocator, opInfo);
diff --git a/src/rm_policy.c b/src/rm_policy.c
index 75b1c3b1f46b8419f08edff7fc5cb0c853715400..c188219e22aca4e253922a1f0454c30a015f3a5a 100644 (file)
--- a/src/rm_policy.c
+++ b/src/rm_policy.c
Rm_PolicyPermission *permissionsList)
{
while (permissionsList) {
- if (strcmp(permissionsList->instName, Rm_policyAllInstances) &&
+ if (strncmp(permissionsList->instName, Rm_policyAllInstances, RM_NAME_MAX_CHARS) &&
(!rmPolicyGetValidInstNode(validInstTree, permissionsList->instName))) {
return(RM_ERROR_PERM_STR_INST_NOT_VALID);
}
permission = permissionStart = policyGetAssignmentPermissions(assignment, result);
while (permission) {
- if ((strcmp(permission->instName, privilegeCfg->validInstNode->name) == 0) ||
- (strcmp(permission->instName, Rm_policyAllInstances) == 0)) {
+ if ((strncmp(permission->instName, privilegeCfg->validInstNode->name, RM_NAME_MAX_CHARS) == 0) ||
+ (strncmp(permission->instName, Rm_policyAllInstances, RM_NAME_MAX_CHARS) == 0)) {
foundInstance = true;
/* Check instance's permissions */
return(false);
}
}
+ else if (privilegeCfg->type == Rm_policyCheck_SHARED_LINUX) {
+ if (!RM_policy_GET_PERM(permission->permissionBits, RM_POLICY_PERM_SHARED_LINUX_SHIFT)) {
+ policyFreeAssignmentPermissions(permissionStart);
+ rmDtbUtilPolicyFreeAssignments(assignmentStart);
+ return(false);
+ }
+ }
break;
}
permission = permission->nextPermission;
@@ -670,8 +677,8 @@ uint32_t rmPolicyGetResourceBase(void *policyDtb, Rm_PolicyValidInstNode *validI
while (assignment) {
permission = permissionStart = policyGetAssignmentPermissions(assignment, result);
while (permission) {
- if ((strcmp(permission->instName, validInstNode->name) == 0) ||
- (strcmp(permission->instName, Rm_policyAllInstances) == 0)) {
+ if ((strncmp(permission->instName, validInstNode->name, RM_NAME_MAX_CHARS) == 0) ||
+ (strncmp(permission->instName, Rm_policyAllInstances, RM_NAME_MAX_CHARS) == 0)) {
/* Check instance's permissions */
if (RM_policy_GET_PERM(allocType, RM_POLICY_PERM_INIT_SHIFT) &&
RM_policy_GET_PERM(permission->permissionBits, RM_POLICY_PERM_INIT_SHIFT)) {
nodeOffset = fdt_next_node(policyDtb, nodeOffset, &depth);
nodeName = fdt_get_name(policyDtb, nodeOffset, NULL);
- if (strcmp(nodeName, resourceName) == 0)
+ if (strncmp(nodeName, resourceName, RM_NAME_MAX_CHARS) == 0)
{
break;
}
index 1c76f6fabf6e10d91ac3d3dcee542f9e370941a4..eba8c6b40ade9e78d0a47abc15dd360c612ec982 100644 (file)
Binary files a/test/dts_files/server-policy.dtb and b/test/dts_files/server-policy.dtb differ
Binary files a/test/dts_files/server-policy.dtb and b/test/dts_files/server-policy.dtb differ
index 6ec77367661ad1e9a74de827edda7d2a471fe6ca..6b734afa294ccf02c158b3e59d4208d788af8e1a 100644 (file)
memory-regions {
/* Mem-region 12 reserved by Linux kernel */
assignments = <0 12>, "(RM_Server RM_Client_Delegate RM_Client) = iux",
- <12 1>, "(*)", /* No permissions for all instances */
- <13 7>, "(*) = iux ";
+ <12 7>, "(*) = iux ";
};
link-ram {
assignments = <0x00000000 0xFFFFFFFF>, "iux = (*)";
assignments = <736 64>, "iux = (*)";
};
infra-queue {
- assignments = <800 32>, "iux = (*)";
+ assignments = <800 12>, "ius = (RM_Client) & iu = (RM_Server)", /* First 12 queues shared between Linux and RM_Client */
+ <812 20>, "iux = (*)";
};
traffic-shaping-queue {
assignments = <832 32>, "iux = (*)";
diff --git a/test/rm_test.c b/test/rm_test.c
index 363b1b9fa52a5274c542fbe1ed33bcad718d8429..d742d52891e47f6b08d7da4275028ca85499ca92 100644 (file)
--- a/test/rm_test.c
+++ b/test/rm_test.c
Char resourceNameAifQ[RM_NAME_MAX_CHARS] = "aif-queue";
Char resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster";
Char resourceNameAifRxCh[RM_NAME_MAX_CHARS] = "aif-rx-ch";
+Char resourceNameInfraQ[RM_NAME_MAX_CHARS] = "infra-queue";
Char nameServerNameFavQ[RM_NAME_MAX_CHARS] = "My_Favorite_Queue";
responseInfo.serviceState);
}
- Rm_printResourceStatus(rmServerHandle);
+ Rm_printResourceStatus(rmServerHandle);
+
+ /* Attempt to allocate an infrastructure queue taken by the Linux kernel and shared with
+ * Rm_Client */
+ memset((void *) &requestInfo, 0, sizeof(Rm_ServiceReqInfo));
+ requestInfo.type = Rm_service_RESOURCE_ALLOCATE_INIT;
+ requestInfo.resourceName = resourceNameInfraQ;
+ requestInfo.resourceBase = 805;
+ requestInfo.resourceLength = 1;
+ requestInfo.callback.serviceCallback = testServiceCallback;
+
+ System_printf("Core %d: %s Attempting to allocate infrastructure queue taken by Linux...\n", MultiProc_self(), rmServerName);
+ rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
+ if ((responseInfo.serviceState == RM_SERVICE_APPROVED) ||
+ (responseInfo.serviceState == RM_SERVICE_PROCESSING)) {
+ if (blockForResponse(&responseInfo)) {
+ System_printf("Core %d: %s allocate resource: %s base: %d length: %d\n", MultiProc_self(),
+ rmServerName,
+ requestInfo.resourceName,
+ requestInfo.resourceBase,
+ requestInfo.resourceLength);
+ }
+ }
+ else {
+ System_printf("Core %d: Static allocation failed with error: %d\n", MultiProc_self(),
+ responseInfo.serviceState);
+ }
+
+ Rm_printResourceStatus(rmServerHandle);
}
else if (MultiProc_self() == 1) {
/* Issue the service request for the resources tied to the name via the service port */
responseInfo.serviceState);
}
+ /* Attempt to allocate an infrastructure queue taken by the Linux kernel and shared with
+ * Rm_Client */
+ memset((void *) &requestInfo, 0, sizeof(Rm_ServiceReqInfo));
+ requestInfo.type = Rm_service_RESOURCE_ALLOCATE_INIT;
+ requestInfo.resourceName = resourceNameInfraQ;
+ requestInfo.resourceBase = 800;
+ requestInfo.resourceLength = 1;
+ requestInfo.callback.serviceCallback = testServiceCallback;
+
+ System_printf("Core %d: %s Attempting to allocate infrastructure queue taken by Linux...\n", MultiProc_self(), rmClientName);
+ rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+ if ((responseInfo.serviceState == RM_SERVICE_APPROVED) ||
+ (responseInfo.serviceState == RM_SERVICE_PROCESSING)) {
+ if (blockForResponse(&responseInfo)) {
+ System_printf("Core %d: %s allocate resource: %s base: %d length: %d\n", MultiProc_self(),
+ rmClientName,
+ requestInfo.resourceName,
+ requestInfo.resourceBase,
+ requestInfo.resourceLength);
+ }
+ }
+ else {
+ System_printf("Core %d: Static allocation failed with error: %d\n", MultiProc_self(),
+ responseInfo.serviceState);
+ }
+
/* Release the syncObj so Server can print results of resource allocations */
releaseSyncObj();
}