IMX RT1170 EVKB - Access policy behavior issue when trying to block an eDMA transfer using XRDC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX RT1170 EVKB - Access policy behavior issue when trying to block an eDMA transfer using XRDC

Jump to solution
575 Views
mneroda
Contributor II

Dear NXP Support Team,

I am making eDMA memory to memory transfer that I want to allow or not from writing in a specific memory address by using the XRDC2.

The issue is that I can't manage to make the access policy work right.

Here is how I assign a Domain ID to the eDMA Bus Master :


xrdc2_master_domain_assignment_t assignment;

XRDC2_GetDefaultMasterDomainAssignment(&assignment);

/* Defining privileges to the EDMA */
assignment.lock = false;
assignment.privilegeAttr = kXRDC2_ForcePrivilege;
assignment.secureAttr = kXRDC2_ForceNonSecure;
assignment.domainId = 3;

XRDC2_SetMasterDomainAssignment(DEMO_XRDC2, kXRDC2_Master_M7_EDMA, 0, &assignment);

XRDC2_SetMasterDomainAssignment(DEMO_XRDC2, kXRDC2_Master_M4_EDMA, 0, &assignment);


Here is how I assign the access rights to the memory that I want to manage with the XRDC :

xrdc2_mem_access_config_t memAccessConfig;

XRDC2_GetMemAccessDefaultConfig(&memAccessConfig);

memAccessConfig.startAddr = DEMO_XRDC2_MEM_START_ADDR;
memAccessConfig.endAddr = DEMO_XRDC2_MEM_END_ADDR;
memAccessConfig.policy[3] = kXRDC2_AccessPolicyAlt6;


But this configuration blocks the EDMA transfer from happening. Normally the transfer should happen as eDMA is assigned to the Domain ID 3 that has the NonSecurePriv attributes and as I am using the kXRDC2_AccessPolicyAlt6 policy (which gives NonSecurePriv transfers read and write rights) over the memory I want to manage with the XRDC2.

I only manage to block or allow that eDMA transfer when assigning the eDMA to the Domain ID 0 (which is the default one) and when I use the kXRDC2_AccessPolicyAll and kXRDC2_AccessPolicyNone access policy. I don't understand actually why the other access policies does not work as intended when using the Domain ID 0. For example when using kXRDC2_AccessPolicyAlt3 the transfer is happening but it should not.

I feel like I am not not assigning the eDMA Bus Master to the Domains correctly. That is why the behaviors of the eDMA transfers are not working like I want.

In case you need more details or bites of my code feel free to reach out ! Thanks !

Labels (1)
0 Kudos
Reply
1 Solution
447 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @mneroda ,

 

The match for M7 DMA is MATCH[14:0]= {CHANNEL_ID[4:0],HMASTER[3:0],XID[5:0]}  , you may mask the XID part, and set up CHANNEL_ID and HMASTER according to your application. Please kindly refer to the following for details.

CHANNEL_ID: channel id from EDMA, indicates DMA channel index
• HMASTER: Master id from EDMA, indicates the master id of master that
programmed the DMA channel that is active

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
3 Replies
478 Views
Kan_Li
NXP TechSupport
NXP TechSupport

 Hi @mneroda ,

 

Did you also set up assignment as below? Please kindly clarify.

assignment.mask  = 0xFFFFFFFFUL;

assignment.match = 0UL;

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
455 Views
mneroda
Contributor II

Hi @Kan_Li ,

Thanks a lot for your answer.

Yes I've set up the assignment as you did and I managed to block the eDMA transfer with the XRDC as I wanted. I did another post that shows how I am making that assignment : https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/IMX-RT1170-EVKB-How-to-configure-XRDC2-domain-as....

However, I would like to know if it is possible to fine tune the MASK and MATCH field because by setting the fields as you show it seems like a hit is generated for all the eDMA transfers (I only want to block the DMA0 transfers). The previous link I have shared is a post about this topic.

Have a great day,
Mickaël

0 Kudos
Reply
448 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @mneroda ,

 

The match for M7 DMA is MATCH[14:0]= {CHANNEL_ID[4:0],HMASTER[3:0],XID[5:0]}  , you may mask the XID part, and set up CHANNEL_ID and HMASTER according to your application. Please kindly refer to the following for details.

CHANNEL_ID: channel id from EDMA, indicates DMA channel index
• HMASTER: Master id from EDMA, indicates the master id of master that
programmed the DMA channel that is active

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2139974%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EIMX%20RT1170%20EVKB%20-%20Access%20policy%20behavior%20issue%20when%20trying%20to%20block%20an%20eDMA%20transfer%20using%20XRDC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2139974%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EDear%20NXP%20Support%20Team%2C%3C%2FP%3E%3CP%3EI%20am%20making%20eDMA%20memory%20to%20memory%20transfer%20that%20I%20want%20to%20allow%20or%20not%20from%20writing%20in%20a%20specific%20memory%20address%20by%20using%20the%20XRDC2.%3C%2FP%3E%3CP%3EThe%20issue%20is%20that%20I%20can't%20manage%20to%20make%20the%20access%20policy%20work%20right.%3C%2FP%3E%3CP%3EHere%20is%20how%20I%20assign%20a%20Domain%20ID%20to%20the%20eDMA%20Bus%20Master%20%3A%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Exrdc2_master_domain_assignment_t%20assignment%3B%3C%2FP%3E%3CP%3EXRDC2_GetDefaultMasterDomainAssignment(%26amp%3Bassignment)%3B%3C%2FP%3E%3CP%3E%2F*%20Defining%20privileges%20to%20the%20EDMA%20*%2F%3CBR%20%2F%3Eassignment.lock%20%3D%20false%3B%3CBR%20%2F%3Eassignment.privilegeAttr%20%3D%20kXRDC2_ForcePrivilege%3B%3CBR%20%2F%3Eassignment.secureAttr%20%3D%20kXRDC2_ForceNonSecure%3B%3CBR%20%2F%3Eassignment.domainId%20%3D%203%3B%3C%2FP%3E%3CP%3EXRDC2_SetMasterDomainAssignment(DEMO_XRDC2%2C%20kXRDC2_Master_M7_EDMA%2C%200%2C%20%26amp%3Bassignment)%3B%3C%2FP%3E%3CP%3EXRDC2_SetMasterDomainAssignment(DEMO_XRDC2%2C%20kXRDC2_Master_M4_EDMA%2C%200%2C%20%26amp%3Bassignment)%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EHere%20is%20how%20I%20assign%20the%20access%20rights%20to%20the%20memory%20that%20I%20want%20to%20manage%20with%20the%20XRDC%20%3A%3C%2FP%3E%3CP%3Exrdc2_mem_access_config_t%20memAccessConfig%3B%3C%2FP%3E%3CP%3EXRDC2_GetMemAccessDefaultConfig(%26amp%3BmemAccessConfig)%3B%3C%2FP%3E%3CP%3EmemAccessConfig.startAddr%20%3D%20DEMO_XRDC2_MEM_START_ADDR%3B%3CBR%20%2F%3EmemAccessConfig.endAddr%20%3D%20DEMO_XRDC2_MEM_END_ADDR%3B%3CBR%20%2F%3EmemAccessConfig.policy%5B3%5D%20%3D%20kXRDC2_AccessPolicyAlt6%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EBut%20this%20configuration%20blocks%20the%20EDMA%20transfer%20from%20happening.%20Normally%20the%20transfer%20should%20happen%20as%20eDMA%20is%20assigned%20to%20the%20Domain%20ID%203%20that%20has%20the%20NonSecurePriv%20attributes%20and%20as%20I%20am%20using%20the%20kXRDC2_AccessPolicyAlt6%20policy%20(which%20gives%20NonSecurePriv%20transfers%20read%20and%20write%20rights)%20over%20the%20memory%20I%20want%20to%20manage%20with%20the%20XRDC2.%3C%2FP%3E%3CP%3EI%20only%20manage%20to%20block%20or%20allow%20that%20eDMA%20transfer%20when%20assigning%20the%20eDMA%20to%20the%20Domain%20ID%200%20(which%20is%20the%20default%20one)%20and%20when%20I%20use%20the%20kXRDC2_AccessPolicyAll%20and%20kXRDC2_AccessPolicyNone%20access%20policy.%20I%20don't%20understand%20actually%20why%20the%20other%20access%20policies%20does%20not%20work%20as%20intended%20when%20using%20the%20Domain%20ID%200.%20For%20example%20when%20using%20kXRDC2_AccessPolicyAlt3%20the%20transfer%20is%20happening%20but%20it%20should%20not.%3C%2FP%3E%3CP%3EI%20feel%20like%20I%20am%20not%20not%20assigning%20the%20eDMA%20Bus%20Master%20to%20the%20Domains%20correctly.%20That%20is%20why%20the%20behaviors%20of%20the%20eDMA%20transfers%20are%20not%20working%20like%20I%20want.%3C%2FP%3E%3CP%3EIn%20case%20you%20need%20more%20details%20or%20bites%20of%20my%20code%20feel%20free%20to%20reach%20out%20!%20Thanks%20!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2139974%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3Ei.MXRT%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2149099%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20IMX%20RT1170%20EVKB%20-%20Access%20policy%20behavior%20issue%20when%20trying%20to%20block%20an%20eDMA%20transfer%20using%20XRDC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2149099%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F253043%22%20target%3D%22_blank%22%3E%40mneroda%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EThe%20match%20for%20M7%20DMA%20is%26nbsp%3BMATCH%5B14%3A0%5D%3D%20%7BCHANNEL_ID%5B4%3A0%5D%2CHMASTER%5B3%3A0%5D%2CXID%5B5%3A0%5D%7D%26nbsp%3B%20%2C%20you%20may%20mask%20the%20XID%20part%2C%20and%20set%20up%26nbsp%3BCHANNEL_ID%20and%26nbsp%3BHMASTER%20according%20to%20your%20application.%20Please%20kindly%20refer%20to%20the%20following%20for%20details.%3C%2FP%3E%0A%3CP%3ECHANNEL_ID%3A%20channel%20id%20from%20EDMA%2C%20indicates%20DMA%20channel%20index%3CBR%20%2F%3E%E2%80%A2%20HMASTER%3A%20Master%20id%20from%20EDMA%2C%20indicates%20the%20master%20id%20of%20master%20that%3CBR%20%2F%3Eprogrammed%20the%20DMA%20channel%20that%20is%20active%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EHave%20a%20great%20day%2C%3CBR%20%2F%3EKan%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E-------------------------------------------------------------------------------%3CBR%20%2F%3ENote%3A%3CBR%20%2F%3E-%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22Mark%20Correct%22%20button.%20Thank%20you!%3CBR%20%2F%3E-%20We%20are%20following%20threads%20for%207%20weeks%20after%20the%20last%20post%2C%20later%20replies%20are%20ignored%3CBR%20%2F%3EPlease%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20question%20at%20a%20later%20point%20in%20time.%3CBR%20%2F%3E-------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2148986%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20IMX%20RT1170%20EVKB%20-%20Access%20policy%20behavior%20issue%20when%20trying%20to%20block%20an%20eDMA%20transfer%20using%20XRDC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2148986%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F59276%22%20target%3D%22_blank%22%3E%40Kan_Li%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3EThanks%20a%20lot%20for%20your%20answer.%3C%2FP%3E%3CP%3EYes%20I've%20set%20up%20the%20assignment%20as%20you%20did%20and%20I%20managed%20to%20block%20the%20eDMA%20transfer%20with%20the%20XRDC%20as%20I%20wanted.%20I%20did%20another%20post%20that%20shows%20how%20I%20am%20making%20that%20assignment%20%3A%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-RT-Crossover-MCUs%2FIMX-RT1170-EVKB-How-to-configure-XRDC2-domain-assignment-for-an%2Fm-p%2F2147528%23M34902%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-RT-Crossover-MCUs%2FIMX-RT1170-EVKB-How-to-configure-XRDC2-domain-as...%3C%2FA%3E.%3C%2FP%3E%3CP%3EHowever%2C%20I%20would%20like%20to%20know%20if%20it%20is%20possible%20to%20fine%20tune%20the%20MASK%20and%20MATCH%20field%20because%20by%20setting%20the%20fields%20as%20you%20show%20it%20seems%20like%20a%20hit%20is%20generated%20for%20all%20the%20eDMA%20transfers%20(I%20only%20want%20to%20block%20the%20DMA0%20transfers).%20The%20previous%20link%20I%20have%20shared%20is%20a%20post%20about%20this%20topic.%3C%2FP%3E%3CP%3EHave%20a%20great%20day%2C%3CBR%20%2F%3EMicka%C3%ABl%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2148016%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20IMX%20RT1170%20EVKB%20-%20Access%20policy%20behavior%20issue%20when%20trying%20to%20block%20an%20eDMA%20transfer%20using%20XRDC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2148016%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%26nbsp%3BHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F253043%22%20target%3D%22_blank%22%3E%40mneroda%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EDid%20you%20also%20set%20up%20assignment%20as%20below%3F%20Please%20kindly%20clarify.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Eassignment.mask%20%20%3D%200xFFFFFFFFUL%3B%0A%0Aassignment.match%20%3D%200UL%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CBR%20%2F%3E%0A%3CP%3EHave%20a%20great%20day%2C%3CBR%20%2F%3EKan%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E-------------------------------------------------------------------------------%3CBR%20%2F%3ENote%3A%3CBR%20%2F%3E-%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22Mark%20Correct%22%20button.%20Thank%20you!%3CBR%20%2F%3E-%20We%20are%20following%20threads%20for%207%20weeks%20after%20the%20last%20post%2C%20later%20replies%20are%20ignored%3CBR%20%2F%3EPlease%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20question%20at%20a%20later%20point%20in%20time.%3CBR%20%2F%3E-------------------------------------------------------------------------------%3C%2FP%3E%0A%3CP%3E%3CLI-WRAPPER%3E%3C%2FLI-WRAPPER%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E