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

armv8 cache issue with virtualization

I am now writing a hyper-visor based on arm-v8 aarch64. and now Linux kernel can boot  successfully on this hyper-visor. and I test the code on DS5. But there is a cache issue.

The issue is:

after Linux kernel modify the content of translation table (such as called io_remap to map some device memory), it need to flush the related cache, otherwise when accessing the memory space which mapped by io_remap will cause an EL1 data abort.

I found in the DS5 cache view, when executed in EL1, only the content of translation table are cached, but other EL1 memory are not. so question is:

 

1: what the EL1 cache state when EL2 is implemented?

2: why it is need do cache flush after change the translation table ? what am I missing ?

the issue seems that CPU think the cache is disabled in EL1, but the translation table content is cached, so when do translation walk, cpu will not fetch content from the cache.

Thanks

Parents
  • Thanks Zhefei's reply.

    I have found the root cause of my issue. it is because that HCR_EL2.ID and HCR_EL2.CD bit does not set correctly. after set these two bits to 1. the issue is fix and Kernel can run correctly on my heper-visor.

    so i summarize this issue:

    1: HCR_EL2.ID HCR_EL2.CD bits are used to enable stage 2 translations cache

    2: even the stage 2 translations cache not enabled (HCR_EL2.ID HCR_EL2.CD are all 0),  the  translation table for stage 1 also will be cached.

    Am i right. thanks

Reply
  • Thanks Zhefei's reply.

    I have found the root cause of my issue. it is because that HCR_EL2.ID and HCR_EL2.CD bit does not set correctly. after set these two bits to 1. the issue is fix and Kernel can run correctly on my heper-visor.

    so i summarize this issue:

    1: HCR_EL2.ID HCR_EL2.CD bits are used to enable stage 2 translations cache

    2: even the stage 2 translations cache not enabled (HCR_EL2.ID HCR_EL2.CD are all 0),  the  translation table for stage 1 also will be cached.

    Am i right. thanks

Children