Resolved SDOCM00101586. Added test cases to cover resolved issued
authorJustin Sobota <jsobota@ti.com>
Tue, 28 May 2013 20:56:48 +0000 (16:56 -0400)
committerJustin Sobota <jsobota@ti.com>
Tue, 28 May 2013 20:56:48 +0000 (16:56 -0400)
include/rm_internal.h
src/rm_allocator.c
src/rm_policy.c
test/dts_files/server-policy.c
test/dts_files/server-policy.dtb
test/dts_files/server-policy.dts
test/src/rm_test.c

index 44ec8c420097ed92d56d40af42d10192dee758c2..40a56e0d2520f3bb61d5416813a699ebc07c3189 100644 (file)
@@ -51,8 +51,9 @@ extern "C" {
 #include <rm_osal.h>
 
 /* RM true/false definitions */
-#define RM_FALSE 0
-#define RM_TRUE  1
+#define RM_BOOL_UNDEF (-1)
+#define RM_FALSE      0
+#define RM_TRUE       1
 
 /* RM cache alignment */
 #define RM_MAX_CACHE_ALIGN 128
index 241df5dce2d5d8f92fa366dc46e9b7b126e2918d..50beaa526e7e087301b410d7915894d0ce2cb8ed 100644 (file)
@@ -503,11 +503,11 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator,
         if (matchingNode) {
             matchingEnd = matchingNode->base + matchingNode->length - 1;
             findEnd = findNode.base + findNode.length - 1;
+            nodePassesPolicy = RM_BOOL_UNDEF;
             if ((matchingNode->allocationCount == 0) &&
                 (findNode.base >= matchingNode->base) && (findEnd <= matchingEnd)) {
                 /* Attempt to preallocate from node only if not owned by anyone and sits
                  * within a matching node. */
-                nodePassesPolicy = RM_FALSE;
                 policyCheckCfg.type = policyCheckType;
                 policyCheckCfg.validInstNode = opInfo->serviceSrcInstNode;
                 policyCheckCfg.resourceBase = findNode.base;
@@ -567,11 +567,17 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator,
                     findNode.base = matchingNode->base;
                 }
                 else {
-                    if (nextNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode)) {
-                        findNode.base = nextNode->base;
+                    if (!nodePassesPolicy) {
+                        findNode.base += findNode.length;
                     }
                     else {
-                        retVal = RM_SERVICE_DENIED_RES_ALLOC_REQS_NOT_MET;
+                        /* Matching node allocated, move to next node */
+                        if (nextNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode)) {
+                            findNode.base = nextNode->base;
+                        }
+                        else {
+                            retVal = RM_SERVICE_DENIED_RES_ALLOC_REQS_NOT_MET;
+                        }
                     }
                 }
             }
index d83b4bc7273c9fb26248a80f52a8fd99b7dd3895..ca62fce38bf6085ac11137203b88d0a5e29f4040 100644 (file)
@@ -676,7 +676,7 @@ uint32_t rmPolicyGetResourceBase(void *policyDtb, Rm_PolicyValidInstNode *validI
     Rm_PolicyAssignment *assignmentStart = NULL;
     Rm_PolicyPermission *permission = NULL;
     Rm_PolicyPermission *permissionStart = NULL;
-    int32_t              resourceBase = 0;
+    int32_t              resourceBase = RM_RESOURCE_BASE_UNSPECIFIED;
 
     *result = RM_OK;
 
index 0903cb6102630dfe5030422873284128a995198c..304c4352de3f5e35c418944c3e710cda1a8476c1 100644 (file)
@@ -8,7 +8,7 @@ const char rmGlobalPolicy[] = {
 0x00,
 0x00,
 0x0a,
-0xd4,
+0xfc,
 0x00,
 0x00,
 0x00,
@@ -16,7 +16,7 @@ const char rmGlobalPolicy[] = {
 0x00,
 0x00,
 0x0a,
-0x90,
+0xb8,
 0x00,
 0x00,
 0x00,
@@ -40,7 +40,7 @@ const char rmGlobalPolicy[] = {
 0x00,
 0x00,
 0x0a,
-0x58,
+0x80,
 0x00,
 0x00,
 0x00,
@@ -700,7 +700,7 @@ const char rmGlobalPolicy[] = {
 0x00,
 0x00,
 0x00,
-0x12,
+0x3c,
 0x00,
 0x00,
 0x00,
@@ -712,7 +712,19 @@ const char rmGlobalPolicy[] = {
 0x00,
 0x00,
 0x00,
-0x09,
+0x01,
+0x28,
+0x2a,
+0x29,
+0x00,
+0x00,
+0x00,
+0x02,
+0x81,
+0x00,
+0x00,
+0x00,
+0x01,
 0x69,
 0x75,
 0x78,
@@ -725,6 +737,34 @@ const char rmGlobalPolicy[] = {
 0x00,
 0x00,
 0x00,
+0x02,
+0x82,
+0x00,
+0x00,
+0x00,
+0x01,
+0x28,
+0x2a,
+0x29,
+0x00,
+0x00,
+0x00,
+0x02,
+0x83,
+0x00,
+0x00,
+0x00,
+0x06,
+0x69,
+0x75,
+0x78,
+0x20,
+0x3d,
+0x20,
+0x28,
+0x2a,
+0x29,
+0x00,
 0x00,
 0x00,
 0x00,
@@ -2777,44 +2817,4 @@ const char rmGlobalPolicy[] = {
 0x00,
 0x00,
 0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
-0x00,
 };
index 8d1b7cd53e79271b5555f75623f2dd5afcc76bf9..1e4c4d26daed0608914578447f6638b3bb250fe6 100644 (file)
Binary files a/test/dts_files/server-policy.dtb and b/test/dts_files/server-policy.dtb differ
index 78592d9c641dd6373d1a7601a64758c31f036c0a..e6faf97997cd1b482db669ca62b18fed1e3910ed 100644 (file)
                           <526 114>, "iux = (*)";
         };
         pass-queue {
-            assignments = <640 9>, "iux = (*)";
+            assignments = <640 1>, "(*)",
+                          <641 1>, "iux = (*)",
+                          <642 1>, "(*)",
+                          <643 6>, "iux = (*)";
         };     
         intc-queue {
             assignments = <662 10>, "iux = (*)";
index e1b87868ce842f88fe250e2565a876cd942aa06a..a24954e46f1c14245e007b1d4cc031bf1e236dd4 100644 (file)
@@ -358,6 +358,7 @@ 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                resourceNameLowPrioQ[RM_NAME_MAX_CHARS]   = "low-prio-queue";
+char                resourceNamePassQ[RM_NAME_MAX_CHARS]      = "pass-queue";
 
 /* Test RM NameServer name */
 char                nameServerNameFavQ[RM_NAME_MAX_CHARS]     = "My_Favorite_Queue";
@@ -662,7 +663,39 @@ void rmServerTsk(UArg arg0, UArg arg1)
     POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------", 
                         coreNum, rmServerName, resourceNameGpQ,
                         RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
-                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);        
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNamePassQ, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    POSITIVE_PASS_CHECK("- UNSPECIFIED Allocation Avoiding Policy Denial (Part 1)-", 
+                        coreNum, rmServerName, resourceNameGpQ,
+                        RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNamePassQ, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    POSITIVE_PASS_CHECK("- UNSPECIFIED Allocation Avoiding Policy Denial (Part 2)-", 
+                        coreNum, rmServerName, resourceNameGpQ,
+                        RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNamePassQ, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    POSITIVE_PASS_CHECK("- UNSPECIFIED Allocation Avoiding Policy Denial (Part 3)-", 
+                        coreNum, rmServerName, resourceNameGpQ,
+                        RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNamePassQ, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    POSITIVE_PASS_CHECK("- UNSPECIFIED Allocation Avoiding Policy Denial (Part 4)-", 
+                        coreNum, rmServerName, resourceNameGpQ,
+                        RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
     /* END testing UNSPECIFIED base and alignment requests on Server */      
 
     /* Create new NameServer object */