Page MenuHomeFreeBSD

efi: Update efi_phys_to_kva to accept the size of the object being mapped.
AcceptedPublic

Authored by alfredo.mazzinghi_cl.cam.ac.uk on Tue, May 23, 5:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 1, 8:34 PM
Unknown Object (File)
Sun, May 28, 9:47 AM
Unknown Object (File)
Thu, May 25, 9:27 PM
Unknown Object (File)
Wed, May 24, 4:00 AM
Unknown Object (File)
Wed, May 24, 3:32 AM
Unknown Object (File)
Tue, May 23, 9:52 PM

Details

Summary

This allows to check that the entire object falls into the direct map.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 51861
Build 48752: arc lint + arc unit

Event Timeline

I like it. But let's get Andy and kib to sign off on it too...

This revision is now accepted and ready to land.Tue, May 23, 6:02 PM

I think it would be cleaner to have macro like PHYS_SZ_IN_DMAP(pa, sz) which would check for [pa, pa+sz) belonging to the DMAPed region.

Added the PHYS_SZ_IN_DMAP macro as requested.

Currently this is only added for arm64 and amd64, which are the platforms that use it.
I'm not sure what the policy is in this case, should I add the same macro for other archs to keep the interface consistent?

This revision now requires review to proceed.Thu, Jun 1, 2:48 PM

Only add the macro where needed.

sys/amd64/include/vmparam.h
247

No, this is not what I mean. PHYS_SZ_IN_DMAP(pa, sz) should verify that [pa, ps+sz) is mapped by DMAP.

Should now be fixed. I misinterpreted the desired behaviour for PHYS_SZ_IN_DMAP.

sys/amd64/include/vmparam.h
248

Should the check verify pa+sz-1 instead of pa+sz? Consider the last page in the DMAP, at the address x. If you want to check if the whole page belongs to DMAP-mapped region, you would check the x+PAGE_SIZE address, which lives in the next page not covered by DMAP.

alfredo.mazzinghi_cl.cam.ac.uk added inline comments.
sys/amd64/include/vmparam.h
248

Uh, yes I think it should, the check in PHYS_IN_DMAP uses strict inequality for (pa) < dmaplimit.

Fixed off-by-one check for the DMAP limit.

This revision is now accepted and ready to land.Fri, Jun 2, 7:22 PM