This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM cortext A53 Physical Address Flush

Since ARM caches are physically indexed is there any way to flush based on the PA? I know I can get the set, but what about the way? If I am flushing from L1 would I have to flush all ways in L1 and then L2 assuming there is no L3 to get to system memory?

Is there an example of this written somewhere? All examples I have seen use VA.

Thanks!

Parents
  • Please also find below a ready to use function for address translation with all the attributes. This is for EL3 but you should be able to modify it use at at EL2 and EL1 too.

    void static
    display_mapping(unsigned long address)
    {
        unsigned long par_el1;
    
        printf("----- Translating VA 0x%lx\n", address);
        __asm__ __volatile__ ("at s1e3r, %0" : : "r" (address));
        __asm__ __volatile__ ("mrs %0, PAR_EL1\n" : "=r" (par_el1));
    
        if (0 != (par_el1 & 1)) {
            printf("Address Translation Failed: 0x%lx\n"
                  "    FSC: 0x%lx\n"
                  "    PTW: 0x%lx\n"
                  "      S: 0x%lx\n",
                  address,
                  (par_el1 & 0x7e) >> 1,
                  (par_el1 & 0x100) >> 8,
                  (par_el1 & 0x200) >> 9);
        } else {
            printf("Address Translation Succeeded: 0x%lx\n"
                  "  SH: 0x%lx\n"
                  "  NS: 0x%lx\n"
                  "  PA: 0x%lx\n"
                  "ATTR: 0x%lx\n",
                  address,
                  (par_el1 & 0x180) >> 7,
                  (par_el1 & 0x200) >> 9,
                  par_el1 & 0xfffffffff000,
                  (par_el1 & 0xff00000000000000) >> 56);
        }
    
        return;
    }
    

Reply
  • Please also find below a ready to use function for address translation with all the attributes. This is for EL3 but you should be able to modify it use at at EL2 and EL1 too.

    void static
    display_mapping(unsigned long address)
    {
        unsigned long par_el1;
    
        printf("----- Translating VA 0x%lx\n", address);
        __asm__ __volatile__ ("at s1e3r, %0" : : "r" (address));
        __asm__ __volatile__ ("mrs %0, PAR_EL1\n" : "=r" (par_el1));
    
        if (0 != (par_el1 & 1)) {
            printf("Address Translation Failed: 0x%lx\n"
                  "    FSC: 0x%lx\n"
                  "    PTW: 0x%lx\n"
                  "      S: 0x%lx\n",
                  address,
                  (par_el1 & 0x7e) >> 1,
                  (par_el1 & 0x100) >> 8,
                  (par_el1 & 0x200) >> 9);
        } else {
            printf("Address Translation Succeeded: 0x%lx\n"
                  "  SH: 0x%lx\n"
                  "  NS: 0x%lx\n"
                  "  PA: 0x%lx\n"
                  "ATTR: 0x%lx\n",
                  address,
                  (par_el1 & 0x180) >> 7,
                  (par_el1 & 0x200) >> 9,
                  par_el1 & 0xfffffffff000,
                  (par_el1 & 0xff00000000000000) >> 56);
        }
    
        return;
    }
    

Children