summaryrefslogtreecommitdiff
path: root/sys/arm/include/pmap.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove now unused armv4 and not-INTRNG files.Michal Meloun2020-11-281-4/+0
| | | | Notes: svn path=/head/; revision=368126
* Introduce vm_page_astate.Mark Johnston2019-12-101-1/+1
| | | | | | | | | | | | | | | | | This is a 32-bit structure embedded in each vm_page, consisting mostly of page queue state. The use of a structure makes it easy to store a snapshot of a page's queue state in a stack variable and use cmpset loops to update that state without requiring the page lock. This change merely adds the structure and updates references to atomic state fields. No functional change intended. Reviewed by: alc, jeff, kib Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D22650 Notes: svn path=/head/; revision=355586
* Port r353622 to sparc64 and arm v4.Konstantin Belousov2019-10-161-0/+2
| | | | | | | | | | Noted by: alc Reviewed by: alc, jeff, markj Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D22056 Notes: svn path=/head/; revision=353664
* Move phys_avail definition into MI code. It is consumed in the MI layer andJeff Roberson2019-08-161-3/+0
| | | | | | | | | | | doing so adds more flexibility with less redundant code. Reviewed by: jhb, markj, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21250 Notes: svn path=/head/; revision=351108
* Add kernel support for Intel userspace protection keys feature onKonstantin Belousov2019-02-201-0/+7
| | | | | | | | | | | | | | | | Skylake Xeons. See SDM rev. 68 Vol 3 4.6.2 Protection Keys and the description of the RDPKRU and WRPKRU instructions. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D18893 Notes: svn path=/head/; revision=344353
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326023
* Fix the armv6 build after r309553.Luiz Otavio O Souza2016-12-061-1/+1
| | | | | | | Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=309604
* Fix build breakage caused by r309531.Michal Meloun2016-12-051-0/+1
| | | | | | | | | Reported by: andrew MFC after: 2 weeks X-MFC with: r309531 Notes: svn path=/head/; revision=309553
* Implement fake pmap_mapdev_attr() for ARMv6.Michal Meloun2016-12-041-0/+6
| | | | | | | | | | | This function is referenced, but never called from DRM2 code. Also, real behavior of pmap_mapdev_attr() in ARM world is unclear as we don't have any additional attribute for a device memory type. MFC after: 2 weeks Notes: svn path=/head/; revision=309531
* Include machine/acle-compat.h in cdefs.h on arm if the compiler doesn'tIan Lepore2016-05-251-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | have ACLE support built in. The ACLE (ARM C Language Extensions) defines a set of standardized symbols which indicate the architecture version and features available. ACLE support is built in to modern compilers (both clang and gcc), but absent from gcc prior to 4.4. ARM (the company) provides the acle-compat.h header file to define the right symbols for older versions of gcc. Basically, acle-compat.h does for arm about the same thing cdefs.h does for freebsd: defines standardized macros that work no matter which compiler you use. If ARM hadn't provided this file we would have ended up with a big #ifdef __arm__ section in cdefs.h with our own compatibility shims. Remove #include <machine/acle-compat.h> from the zillion other places (an ever-growing list) that it appears. Since style(9) requires sys/types.h or sys/param.h early in the include list, and both of those lead to including cdefs.h, only a couple special cases still need to include acle-compat.h directly. Loves it: imp Notes: svn path=/head/; revision=300694
* Move common definitions from both pmap-v4.h and pmap-v6.h into pmap.h.Svatopluk Kraus2016-02-191-0/+27
| | | | | | | | | (1) MI interface needed for vm subsystem. (2) MD interface created for ARM architecture to be used in files shared by armv4 and armv6 platforms. Notes: svn path=/head/; revision=295799
* Rename pmap.h to pmap-v4.h and remove pmap-v6.h include from it.Svatopluk Kraus2016-02-191-514/+8
| | | | | | | | | | | Create new pmap.h which includes specific header according to __ARM_ARCH. Note that <machine/pmap.h> is included from <vm/pmap.h> so one common <machine/pmap.h> must exist. Notes: svn path=/head/; revision=295798
* Remove redundant ARM_L2_ADDR_BITS and L2_ADDR_BITS definitions andSvatopluk Kraus2016-02-181-1/+1
| | | | | | | replace them by primary ones where needed. Notes: svn path=/head/; revision=295752
* Remove all stuff related to __ARM_ARCH >= 6 from pmap.h header exceptSvatopluk Kraus2016-02-011-162/+4
| | | | | | | for <machine/pmap-v6.h> include. It was used by old pmap-v6 code. Notes: svn path=/head/; revision=295129
* Retire pmap_pte_init_mmu_v6() which was used by old pmap-v6.Svatopluk Kraus2016-01-291-3/+0
| | | | Notes: svn path=/head/; revision=295049
* Use kernel_pmap directly instead of pmap_kernel(). The kernel_pmap isSvatopluk Kraus2016-01-291-2/+1
| | | | | | | | already used for __ARM_ARCH >= 6 and so even for __ARM_ARCH < 6 on some common places. Notes: svn path=/head/; revision=295042
* ARM: remove old pmap-v6 code. The new pmap-v6 is mature enough, andMichal Meloun2016-01-291-3/+5
| | | | | | | | | dual implementation is showstopper for major cleanup. This patch only removes old code from tree. Cleanups will follow asap. Notes: svn path=/head/; revision=295036
* Create new pmap dump interface for minidump and use it for existingSvatopluk Kraus2016-01-251-0/+1
| | | | | | | | | | | | pmap implementations on ARM. This way minidump code can be used without any platform specific modification. Also, this is the last piece missing for ARM_NEW_PMAP. Differential Revision: https://reviews.freebsd.org/D5023 Notes: svn path=/head/; revision=294722
* Retire pmap_dmap_iscurrent(). It is only a wrapper around ↵Jason A. Harmening2015-10-281-1/+0
| | | | | | | pmap_is_current(), and is no longer called. Notes: svn path=/head/; revision=290120
* Add a pmap_kremove_device() to undo mappings made with pmap_kenter_device().Ian Lepore2015-04-101-1/+2
| | | | | | | | | | | | Previously we used pmap_kremove(), but with ARM_NEW_PMAP it does the remove in a way that isn't SMP-coherent (which is appropriate in some circumstances such as mapping/unmapping sf buffers). With matching enter/remove routines for device mappings, each low-level implementation can do the right thing. Reviewed by: Svatopluk Kraus <onwahe@gmail.com> Notes: svn path=/head/; revision=281369
* Remove ARM9_CACHE_WRITE_THROUGH, none of our configs define it.Andrew Turner2015-03-291-4/+1
| | | | Notes: svn path=/head/; revision=280817
* Remove support for CPU_ARM10. No kernel configs could possibly use this asAndrew Turner2015-03-291-3/+0
| | | | | | | | it's not an available option. Along with this we will never support this cpu type as very few arm10 chips were made. Notes: svn path=/head/; revision=280809
* New pmap code for armv6. Disabled by default, option ARM_NEW_PMAP enables it.Ian Lepore2015-03-261-0/+4
| | | | | | | | | | | | | | | | | This is pretty much a complete rewrite based on the existing i386 code. The patches have been circulating for a couple years and have been looked at by plenty of people, but I'm not putting anybody on the hook as having reviewed this in any formal sense except myself. After this has gotten wider testing from the user community, ARM_NEW_PMAP will become the default and various dregs of the old pmap code will be removed. Submitted by: Svatopluk Kraus <onwahe@gmail.com>, Michal Meloun <meloun@miracle.cz> Notes: svn path=/head/; revision=280712
* Rename pmap_kenter_temp to pmap_kenter_temporary to be consistent with theAndrew Turner2014-09-111-1/+1
| | | | | | | | | | other architectures with this function. Submitted by: Svatopluk Kraus <onwahe at gmail.com> Submitted by: Michal Meloun <meloun at miracle.cz> Notes: svn path=/head/; revision=271422
* Move an else case that was missed in r263676Andrew Turner2014-03-241-25/+25
| | | | Notes: svn path=/head/; revision=263679
* Reorder the pmap macros so "ARM_MMU_V6 + ARM_MMU_V7" is first. As they areAndrew Turner2014-03-231-41/+42
| | | | | | | identical this allows us to build for both v6 and v7 together. Notes: svn path=/head/; revision=263676
* Remove all traces of support for ARM chips prior to the arm9 series. WeIan Lepore2014-03-091-15/+5
| | | | | | | | | | never actually ran on these chips (other than using SA1 support in an emulator to do the early porting to FreeBSD long long ago). The clutter and complexity of some of this code keeps getting in the way of other maintenance, so it's time to go. Notes: svn path=/head/; revision=262958
* Always clear L1 PTE descriptor when removing superpage on ARMZbigniew Bodek2014-02-151-0/+1
| | | | | | | | | | Invalidate L1 PTE regardles of existance of the corresponding l2_bucket. This is relevant when superpage is entered via pmap_enter_object() and will fix crash on entering page in place of not properly removed superpage. Notes: svn path=/head/; revision=261917
* Remove the ARM_USE_SMALL_ALLOC option and code related to it.Ian Lepore2014-02-081-11/+0
| | | | | | | | | | | | | This was an optimization used only by a few xscale platforms. Part of the optimization was to create a direct map for all physical pages, and that resulted in making multiple mappings of pages in a way that bypassed the logic in pmap.c to handle VIVT cache aliasing. It also just generally made the code more complex and hard to maintain for all SoCs. Reviewed by: cognet Notes: svn path=/head/; revision=261642
* Make PTE_DEVICE a synonym for PTE_NOCACHE on armv4, to make it easier toIan Lepore2013-11-051-0/+1
| | | | | | | share the same code on both architectures. Notes: svn path=/head/; revision=257672
* Move remaining code and data related to static device mapping into theIan Lepore2013-11-041-14/+0
| | | | | | | | | | new devmap.[ch] files. Emphasize the MD nature of these things by using the prefix arm_devmap_ on the function and type names (already a few of these things found their way into MI code, hopefully it will be harder to do by accident in the future). Notes: svn path=/head/; revision=257660
* Begin reducing code duplication in arm pmap.c and pmap-v6.c by factoringIan Lepore2013-11-041-4/+1
| | | | | | | | | | | | | out common code related to mapping device memory into a new devmap.c file. Remove the growing duplication of code that used pmap_devmap_find_pa() and then did some math with the returned results to generate a virtual address, and likewise in reverse to get a physical address. Now there are a pair of functions, arm_devmap_vtop() and arm_devmap_ptov(), to do that. The bus_space_map() implementations are rewritten in terms of these. Notes: svn path=/head/; revision=257648
* Fix condition that determines PMAP_NEEDS_PTE_SYNC value for ARMZbigniew Bodek2013-10-281-1/+1
| | | | | | | | | | Use values of the correct defines to determine statement's result. ARM_ARCH_ symbols are always defined, hence only values are relevant. Reviewed by: cognet Notes: svn path=/head/; revision=257291
* Retire arm_remap_nocache() and the data and constants associated with it.Ian Lepore2013-10-271-5/+0
| | | | | | | | | The only remaining user was the code that allocates bounce pages for armv4 busdma. It's not clear why bounce pages would need uncached memory, but if that ever changes, kmem_alloc_attr() would be the way to get it. Notes: svn path=/head/; revision=257201
* Spell cpu_l2cache_wb_range correctly.Olivier Houchard2013-10-171-1/+1
| | | | Notes: svn path=/head/; revision=256708
* - Switch to use WBWA mappings for page tables on armv6, this is needed for SMP.Olivier Houchard2013-10-171-4/+12
| | | | | | | | - Fix PTE_SYNC() for PIPT L2 caches, using the virtual address wasn't so useful. - Use PTE_SYNC() for >= armv6 Notes: svn path=/head/; revision=256707
* Introduce superpages support for ARMv6/v7.Rafal Jaworowski2013-08-261-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | Promoting base pages to superpages can increase TLB coverage and allow for efficient use of page table entries. This development provides FreeBSD/ARM with superpages management mechanism roughly equivalent to what we have for i386 and amd64 architectures. 1. Add mechanism for automatic promotion of 4KB page mappings to 1MB section mappings (and demotion when not needed, respectively). 2. Managed and non-kernel mappings are now superpages-aware. 3. The functionality can be enabled by setting "vm.pmap.sp_enabled" tunable to a non-zero value (either in loader.conf or by modifying "sp_enabled" variable in pmap-v6.c file). By default, automatic promotion is currently disabled. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Reviewed by: alc Sponsored by: The FreeBSD Foundation, Semihalf Notes: svn path=/head/; revision=254918
* Do not use pv_kva on ARMv6/v7 and save some space on each vm_page. It's onlyRafal Jaworowski2013-08-191-0/+2
| | | | | | | | | | | relevant for older ARM variants (with virtual cache). Submitted by: Zbigniew Bodek <zbb@semihalf.com> Reviewed by: gber Sponsored by: The FreeBSD Foundation, Semihalf Notes: svn path=/head/; revision=254536
* Clear all L2 PTE protection bits before their configuration.Rafal Jaworowski2013-08-191-1/+1
| | | | | | | | | | | | | | | | | | Revise L2_S_PROT_MASK to include all of the protection bits. Notice that clearing these bits does not always take away the corresponding permissions (for example, permission is granted when the bit is cleared). The bits are cleared but are to be set or left cleared accordingly in pmap_set_prot(), pmap_enter_locked(), etc. Clear L2_XN along with L2_S_PROT_MASK in pmap_set_prot() so that all permissions related bits are cleared before actual configuration. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Reviewed by: gber Sponsored by: The FreeBSD Foundation, Semihalf Notes: svn path=/head/; revision=254532
* Stop using PVF_MOD, PVF_REF & PVF_EXEC flags in pv_entry, use PTE.Grzegorz Bernacki2013-05-231-0/+1
| | | | | | | | | | | | | | | | Using PVF_MOD, PVF_REF and PVF_EXEC is redundant as we can get the proper info from PTE bits. When the mapping is marked as executable and has been referenced we assume that it has been executed. Similarly, when the mapping is set to be writable and is referenced, it must have been due to write access to it. PVF_MOD and PVF_REF flags are kept just for pmap_clearbit() usage, to pass the information on which bit should be cleared. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Sponsored by: The FreeBSD Foundation, Semihalf Notes: svn path=/head/; revision=250930
* Improve, optimize and clean-up ARMv6/v7 memory management related code.Grzegorz Bernacki2013-05-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use pmap_find_pv if needed instead of multiplying its code throughout pmap-v6. Avoid possible NULL pointer dereference in pmap_enter_locked() When trying to get m->md.pv_memattr, make sure that m != NULL, in particular that vector_page is set to be NULL. Do not set PGA_REFERENCED flag in pmap_enter_pv(). On ARM any new page reference will result in either entering the new mapping by calling pmap_enter, etc. or fixing-up the existing mapping in pmap_fault_fixup(). Therefore we set PGA_REFERENCED flag in the earlier mentioned cases and setting it later in pmap_enter_pv() is just waste of cycles. Delete unused pm_pdir pointer from the pmap structure. Rearrange brackets in the fault cause detection in trap.c Place the brackets correctly in order to see course of the conditions instantaneously. Unify naming in pmap-v6.c and improve style Use naming common for whole pmap and compatible with other pmaps, improve style where possible: pm -> pmap pg -> m opg -> om *pt -> *ptep *pte -> *ptep *pde -> *pdep Submitted by: Zbigniew Bodek <zbb@semihalf.com> Sponsored by: The FreeBSD Foundation, Semihalf Notes: svn path=/head/; revision=250929
* Switch to AP[2:1] access permissions model. Store "referenced"Grzegorz Bernacki2013-05-231-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bit in PTE. Enable Access Flag in CPU control. With AF enabled each valid mapping needs to have referenced bit in PTE set in order to be able to cache it in the TLB. AP[0] bit is to be used as reference flag. All access permissions are encoded by AP[2:1] wherein AP[1] is in fact "user enable" and AP[2](APX) is "write disable". All mappings are always set to be valid. Reference emulation is performed by setting/clearing reference flag in PTE. md.pvh_attrs are no longer necessary however pv_flags are still being used for now. Marking vm_page as "dirty" or "referenced" is being performed on: - page or flag fault servicing in pmap_fault_fixup(), basing on the fault type - vm_fault servicing in pmap_enter() according to the desired protections and faulty access type Redundant page marking has been removed as on ARM we know exactly when the particular page is referenced or is going to be written. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Sponsored by: The FreeBSD Foundation, Semihalf Notes: svn path=/head/; revision=250928
* Port the new PV entry allocator from amd64/i386/mips to armv6/v7.Grzegorz Bernacki2013-05-141-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PV entries are now roughly half the size. Instead of using a shared UMA zone for 28 byte pv entries (two 8-byte tailq nodes, a 4 byte pointer, a 4 byte address and 4 byte flags), we allocate a page at a time per process. This provides 252 pv entries per process (actually, per pmap address space) and eliminates one of the 8-byte tailq entries since we now can track per-process pv entries implicitly. The pointer to the pmap can be eliminated by doing address arithmetic to find the metadata on the page headers to find a single pointer shared by all 252 entries. There is an 8-int bitmap for the freelist of those 252 entries. When in serious low memory condition, allocation of another pv_chunk is possible by freeing some pages in pmap_pv_reclaim(). Added pv_entry/pv_chunk related statistics to pmap. pv_entry/pv_chunk statistics can be accessed via sysctl vm.pmap. Ported PTE freelist of KVA allocation and maintenance from i386. Using an idea from Stephan Uphoff, use the empty pte's that correspond to the unused kva in the pv memory block to thread a freelist through. This allows us to free pages that used to be used for pv entry chunks since we can now track holes in the kva memory block. As both ARM pmap.c and pmap-v6.c use the same header and pv_entry, pmap and md_page structures are different, it was needed to separate code designed for ARMv6/7 from the one for other ARMs. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Reviewed by: alc Sponsored by: The FreeBSD Foundation, Semihalf Notes: svn path=/head/; revision=250634
* Fix L2 PTE access permissions management.Grzegorz Bernacki2013-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep following access permissions: APX AP Kernel User 1 01 R N 1 10 R R 0 01 R/W N 0 11 R/W R/W Avoid using reserved in ARMv6 APX|AP settings: - In case of unprivileged (user) access without permission to write, the access permission bits were being set to reserved for ARMv6 (but valid for ARMv7) value of APX|AP = 111. Fix-up faulting userland accesses properly: - Wrong condition statement in pmap_fault_fixup() caused that any genuine, unprivileged access was being fixed-up instead of just skip doing anything and return. Staring from now we ensure proper reaction for illicit user accesses. L2_S_PROT_R and L2_S_PROT_U names might be misleading as they do not reflect real permission levels. It will be clarified in following patches (switch to AP[2:1] permissions model). Obtained from: Semihalf Notes: svn path=/head/; revision=250297
* Add pmap function pmap_copy_pages(), which copies the content of theKonstantin Belousov2013-03-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | pages around, taking array of vm_page_t both for source and destination. Starting offsets and total transfer size are specified. The function implements optimal algorithm for copying using the platform-specific optimizations. For instance, on the architectures were the direct map is available, no transient mappings are created, for i386 the per-cpu ephemeral page frame is used. The code was typically borrowed from the pmap_copy_page() for the same architecture. Only i386/amd64, powerpc aim and arm/arm-v6 implementations were tested at the time of commit. High-level code, not committed yet to the tree, ensures that the use of the function is only allowed after explicit enablement. For sparc64, the existing code has known issues and a stab is added instead, to allow the kernel linking. Sponsored by: The FreeBSD Foundation Tested by: pho (i386, amd64), scottl (amd64), ian (arm and arm-v6) MFC after: 2 weeks Notes: svn path=/head/; revision=248280
* Initialize vm_max_kernel_address on non-FDT platforms. (This should haveAlan Cox2013-02-201-1/+1
| | | | | | | | | | | been included in r246926.) The second parameter to pmap_bootstrap() is redundant. Eliminate it. Reviewed by: andrew Notes: svn path=/head/; revision=247046
* Switch default cache type for ARMv6/ARMv7 from write-through toOleksandr Tymoshenko2013-01-081-1/+1
| | | | | | | writeback-writeallocate Notes: svn path=/head/; revision=245147
* Fix misleading commentOleksandr Tymoshenko2012-12-201-1/+1
| | | | Notes: svn path=/head/; revision=244476
* Properly implement pmap_[get|set]_memattrOlivier Houchard2012-12-191-2/+3
| | | | | | | Submitted by: Ian Lepore <freebsd@damnhippie.dyndns.org> Notes: svn path=/head/; revision=244414
* Eliminate an unused declaration.Alan Cox2012-09-291-2/+0
| | | | Notes: svn path=/head/; revision=241058