Git Product home page Git Product logo

Comments (10)

M1cha avatar M1cha commented on June 3, 2024

I tried my fork on another qcom device and it works. I'm not sure if it's a arch problem or not.
Noticeable differences:

from lk.

M1cha avatar M1cha commented on June 3, 2024

If I enable the full identity map on the working device, vmm alloc breaks there too.
Is there anything I'm missing?

from lk.

M1cha avatar M1cha commented on June 3, 2024

fixed by excluding the VM's aspace from the identity map.

from lk.

snagar6 avatar snagar6 commented on June 3, 2024

Here is my guess.. (However, I work on the x86 PC platforms; not completely familiar with ARM)

Looks like you are mapping a physical address which is not section aligned (1MB alignment) ? Whereas, your virtual address is "MB" aligned (SECTION aligned).

And, then the flag is set as “MMU_MEMORY_L1_DESCRIPTOR_SECTION” hinting that you or looking at L1 table rather than going with a L2 page table by creating one?
So, should you be having "MMU_MEMORY_L1_DESCRIPTOR_INVALID" flag instead of the "MMU_MEMORY_L1_DESCRIPTOR_SECTION" at this point?

from lk.

travisg avatar travisg commented on June 3, 2024

The main problem is the kernel is not running out of the 'memory' identity map. There's probably a hidden kernel mapping at 0x40000000 where the kernel is based to run at, which immediately gets trashed as soon as you create a VMM region.

Generally speaking you should identity map memory at the base of the kernel, so that the kernel can run out of it. There should be no mappings anywhere that aren't covered by a VMM region, or the vmm allocator will step on it and get upset like it did.

If you need to move the base of the kernel, you can move it in your platform's rules file like
https://github.com/travisg/lk/blob/master/platform/zynq/rules.mk#L51

The default is 0x40000000 on arm, so that the eventual user space page directory would only need to be a page in size, but it's pretty flexible, and kernel space can be set anywhere on a 1MB section boundary.

from lk.

M1cha avatar M1cha commented on June 3, 2024

@travisg The problem is, that qcom's msm8960 has a weird MMU setup. Without a identity map registers are completely inaccessible.
That means I need a identity map on the whole RAM which is persistent - as soon as it get's unmapped the system crashes.

I guess since everything above 0x40000000 gets handled and mapped by LK's VMM anyway it's ok to use a identity map that covers the first 0x40000000 bytes only - at least the system boots and works this way.

offtopic: It just took me 1h to fix the PMM mapping on msm8610, because the usable RAM starts at 0x0 there and the heap treats the return value from pmm_alloc(=0x0) as a error then :P (I ignore the first page as a workaround)

from lk.

travisg avatar travisg commented on June 3, 2024

The general idea for registers is to map them into kernel space at a different offset, and access them through the offset. For example, you may map registers up at 0xf0000000 regardless of where they are in physical space.

from lk.

M1cha avatar M1cha commented on June 3, 2024

@travisg that registers are the problem was just a theory because it usually fails when initializing timer or gic.(I can't debug these things that early).

I guess another problem are applications like TZ(TrustedZone) which are running in the background and have no idea how virtual memory works.

from lk.

M1cha avatar M1cha commented on June 3, 2024

@travisg you're right about the phys-virt mapping(that I should access registers via a virtual address).
The problem is that I need the fixed (qcom generic) reg map from the linux kernel to not break TZ.
This by itself is not a big deal - what's bad is that these are 4K aligned.

So could you change LK's MMU alignment to 4k - or even better: make it dynamic ?

from lk.

M1cha avatar M1cha commented on June 3, 2024

I researched on that topic and it seems we need level2 translation table support in LK for that.

from lk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.