<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can I set the MPU for the memory area used by rpmsg? in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1978796#M229960</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;The memory can of course be set with more detailed rules.&lt;/P&gt;
&lt;P&gt;For the shared bit in board.c, if we check the function in CMSIS\Core\Include\mpu_armv7.h, the&amp;nbsp;IsShareable&amp;nbsp; is used to control&amp;nbsp;shareable property between&lt;STRONG&gt; multiple bus masters,&lt;/STRONG&gt; not two cores.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;/**
* MPU Region Attribute and Size Register Value
* 
* \param DisableExec       Instruction access disable bit, 1= disable instruction fetches.
* \param AccessPermission  Data access permissions, allows you to configure read/write access for User and Privileged mode.
* \param TypeExtField      Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral.
* \param IsShareable       Region is shareable between multiple bus masters.
* \param IsCacheable       Region is cacheable, i.e. its value may be kept in cache.
* \param IsBufferable      Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy.
* \param SubRegionDisable  Sub-region disable field.
* \param Size              Region size of the region to be configured, for example 4K, 8K.
*/                         
#define ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size) \
  ARM_MPU_RASR_EX(DisableExec, AccessPermission, ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable), SubRegionDisable, Size)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;Zhiming&lt;/P&gt;</description>
    <pubDate>Tue, 22 Oct 2024 05:28:00 GMT</pubDate>
    <dc:creator>Zhiming_Liu</dc:creator>
    <dc:date>2024-10-22T05:28:00Z</dc:date>
    <item>
      <title>How can I set the MPU for the memory area used by rpmsg?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1977913#M229905</link>
      <description>&lt;DIV&gt;Hi community.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have using i.MX8MP with yocto kirkstone(5.15.71).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Are the memories used by rpmsg the four listed in the dts file: vdev0vring0, vdev0vring1, vdevbuffer, and rsc_table?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For example, if I refer to &lt;A href="https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/arch/arm64/boot/dts/freescale/imx8mp-evk-rpmsg.dts" target="_blank" rel="noopener"&gt;https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/arch/arm64/boot/dts/freescale/imx8mp-evk-rpmsg.dts&lt;/A&gt;, is it correct to assume that it will look like the following?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;	{   /* DDR[0x4000_0000 - 0x8000_0000]: Memory with Normal type, not shareable, non-cacheable */
		.RBAR = ARM_MPU_RBAR(3, 0x40000000U),
		.RASR = ARM_MPU_RASR(0, ARM_MPU_AP_RO, 1, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB),
	},
	{   /* DDR[0x55000000 - 0x5500FFFF]: Memory with Normal type, SHAREABLE, not cacheable */
		.RBAR = ARM_MPU_RBAR(4, 0x55000000),	// vdev0vring0: vdev0vring0@55000000,  vdev0vring1: vdev0vring1@55008000
		.RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 1, 0, 0, 0, ARM_MPU_REGION_SIZE_64KB),	// for vring. Determine this by referring to the vring item in the dts file.
	},
	{   /* DDR[0x550FF000 - 0x550FFFFF]: Memory with Normal type, SHAREABLE, not cacheable */
		.RBAR = ARM_MPU_RBAR(5, 0x550ff000),	// rsc_table: rsc_table@550ff000
		.RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 1, 0, 0, 0, ARM_MPU_REGION_SIZE_4KB),	// for rsc_table. Determine this by referring to the rsc_table item in the dts file.
	},
	{   /* DDR[0x55400000 - 0x54FFFFFF]: Memory with Normal type, SHAREABLE, not cacheable */
		.RBAR = ARM_MPU_RBAR(6, 0x55400000),	// vdevbuffer: vdevbuffer@55400000
		.RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 1, 0, 0, 0, ARM_MPU_REGION_SIZE_1MB),	// for vdevbuffer. Determine this by referring to the vdevbuffer item in the dts file.
	},&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Best Regards,&lt;/DIV&gt;&lt;DIV&gt;KASHIWAGI Takashi&lt;/DIV&gt;</description>
      <pubDate>Mon, 21 Oct 2024 07:47:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1977913#M229905</guid>
      <dc:creator>Takashi_Kashiwagi</dc:creator>
      <dc:date>2024-10-21T07:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I set the MPU for the memory area used by rpmsg?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1977999#M229910</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Are the memories used by rpmsg the four listed in the dts file: vdev0vring0, vdev0vring1, vdevbuffer, and rsc_table?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;--&amp;gt;Yes, the related code are like this:&lt;/P&gt;
&lt;P&gt;rsc_table.c&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;void copyResourceTable(void)
{
    /*
     * Resource table should be copied to VDEV0_VRING_BASE + RESOURCE_TABLE_OFFSET.
     * VDEV0_VRING_BASE is temperorily kept for backward compatibility, will be
     * removed in future release
     */
    memcpy((void *)VDEV0_VRING_BASE, &amp;amp;resources, sizeof(resources));
    memcpy((void *)(VDEV0_VRING_BASE + RESOURCE_TABLE_OFFSET), &amp;amp;resources, sizeof(resources));
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;board.c&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    /* Region 4 DDR[0x4000_0000 - 0x8000_0000]: Memory with Normal type, not shareable, non-cacheable */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(4, 0x40000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB); 
/*
       Non-cacheable area is provided in DDR memory, the DDR region [0x80000000 ~ 0x81000000](please see the
       imx8mp-evk-rpmsg.dts) totally 16MB is revserved for CM7 core. You can put global or static uninitialized
       variables in NonCacheable section(initialized variables in NonCacheable.init section) to make them uncacheable.
       Since the base address of MPU region should be multiples of region size, to make it simple, the MPU region 5 set
       the address space 0x80000000 ~ 0xBFFFFFFF to be non-cacheable. Then MPU region 6 set the text and data section to
       be cacheable if the program running on DDR. The cacheable area base address should be multiples of its size in
       linker file, they can be modified per your needs.
    */
    /* Region 5 DDR[0x8000_0000 - 0xBFFFFFFF]: Memory with Normal type, not shareable, non-cacheable */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(5, 0x80000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;Zhiming&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 08:51:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1977999#M229910</guid>
      <dc:creator>Zhiming_Liu</dc:creator>
      <dc:date>2024-10-21T08:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I set the MPU for the memory area used by rpmsg?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1978680#M229951</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/151788"&gt;@Zhiming_Liu&lt;/a&gt;&amp;nbsp; san&lt;/P&gt;&lt;P&gt;Thank you for reply!&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Are the memories used by rpmsg the four listed in the dts file: vdev0vring0, vdev0vring1, vdevbuffer, and rsc_table?&lt;BR /&gt;--&amp;gt;Yes, the related code are like this:&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Understood. However, this setting allows full access to 0x40000000-0x7FFFFFFF, which is a bit dangerous. It would be easier to understand if the settings for the memory range used by rpmsg were explained in the comments.&lt;/P&gt;&lt;P&gt;Also, in sample board.c, Shared Disable is set. The vring, vdevbuffer, and rsc_table areas used by rpmsg are accessed by both the RTOS and Linux. &lt;STRONG&gt;Is it okay not to set the shared bit?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;KASHIWAGI Takashi&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 02:04:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1978680#M229951</guid>
      <dc:creator>Takashi_Kashiwagi</dc:creator>
      <dc:date>2024-10-22T02:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I set the MPU for the memory area used by rpmsg?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1978796#M229960</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;The memory can of course be set with more detailed rules.&lt;/P&gt;
&lt;P&gt;For the shared bit in board.c, if we check the function in CMSIS\Core\Include\mpu_armv7.h, the&amp;nbsp;IsShareable&amp;nbsp; is used to control&amp;nbsp;shareable property between&lt;STRONG&gt; multiple bus masters,&lt;/STRONG&gt; not two cores.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;/**
* MPU Region Attribute and Size Register Value
* 
* \param DisableExec       Instruction access disable bit, 1= disable instruction fetches.
* \param AccessPermission  Data access permissions, allows you to configure read/write access for User and Privileged mode.
* \param TypeExtField      Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral.
* \param IsShareable       Region is shareable between multiple bus masters.
* \param IsCacheable       Region is cacheable, i.e. its value may be kept in cache.
* \param IsBufferable      Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy.
* \param SubRegionDisable  Sub-region disable field.
* \param Size              Region size of the region to be configured, for example 4K, 8K.
*/                         
#define ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size) \
  ARM_MPU_RASR_EX(DisableExec, AccessPermission, ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable), SubRegionDisable, Size)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;Zhiming&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 05:28:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1978796#M229960</guid>
      <dc:creator>Zhiming_Liu</dc:creator>
      <dc:date>2024-10-22T05:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I set the MPU for the memory area used by rpmsg?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1978985#M229975</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/151788"&gt;@Zhiming_Liu&lt;/a&gt;&amp;nbsp;san&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for reply!&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;For the shared bit in board.c, if we check the function in CMSIS\Core\Include\mpu_armv7.h, the IsShareable is used to control shareable property between multiple bus masters, not two cores.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I understand! My question has been resolved. Thank you.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;KASHIWAGI Takashi&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 08:19:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-can-I-set-the-MPU-for-the-memory-area-used-by-rpmsg/m-p/1978985#M229975</guid>
      <dc:creator>Takashi_Kashiwagi</dc:creator>
      <dc:date>2024-10-22T08:19:45Z</dc:date>
    </item>
  </channel>
</rss>

