1. 09 11月, 2012 3 次提交
    • W
      ARM: mm: introduce present, faulting entries for PAGE_NONE · 26ffd0d4
      Will Deacon 提交于
      PROT_NONE mappings apply the page protection attributes defined by _P000
      which translate to PAGE_NONE for ARM. These attributes specify an XN,
      RDONLY pte that is inaccessible to userspace. However, on kernels
      configured without support for domains, such a pte *is* accessible to
      the kernel and can be read via get_user, allowing tasks to read
      PROT_NONE pages via syscalls such as read/write over a pipe.
      
      This patch introduces a new software pte flag, L_PTE_NONE, that is set
      to identify faulting, present entries.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      26ffd0d4
    • W
      ARM: mm: introduce L_PTE_VALID for page table entries · dbf62d50
      Will Deacon 提交于
      For long-descriptor translation table formats, the ARMv7 architecture
      defines the last two bits of the second- and third-level descriptors to
      be:
      
      	x0b	- Invalid
      	01b	- Block (second-level), Reserved (third-level)
      	11b	- Table (second-level), Page (third-level)
      
      This allows us to define L_PTE_PRESENT as (3 << 0) and use this value to
      create ptes directly. However, when determining whether a given pte
      value is present in the low-level page table accessors, we only need to
      check the least significant bit of the descriptor, allowing us to write
      faulting, present entries which are required for PROT_NONE mappings.
      
      This patch introduces L_PTE_VALID, which can be used to test whether a
      pte should fault, and updates the low-level page table accessors
      accordingly.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      dbf62d50
    • W
      ARM: mm: don't use the access flag permissions mechanism for classic MMU · 0cbbbad6
      Will Deacon 提交于
      The simplified access permissions model is not used for the classic MMU
      translation regime, so ensure that it is turned off in the sctlr prior
      to turning on address translation for ARMv7.
      Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      0cbbbad6
  2. 10 7月, 2012 1 次提交
    • W
      ARM: 7445/1: mm: update CONTEXTIDR register to contain PID of current process · 575320d6
      Will Deacon 提交于
      This patch introduces a new Kconfig option which, when enabled, causes
      the kernel to write the PID of the current task into the PROCID field
      of the CONTEXTIDR on context switch. This is useful when analysing
      hardware trace, since writes to this register can be configured to emit
      an event into the trace stream.
      
      The thread notifier for writing the PID is deliberately kept separate
      from the ASID-writing code so that we can support newer processors using
      LPAE, where the ASID is stored in TTBR0. As such, the switch_mm code is
      updated to perform a read-modify-write sequence to ensure that we don't
      clobber the PID on CPUs using the classic 2-level page tables.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      575320d6
  3. 17 4月, 2012 2 次提交
    • C
      ARM: Remove __ARCH_WANT_INTERRUPTS_ON_CTXSW on ASID-capable CPUs · 7fec1b57
      Catalin Marinas 提交于
      Since the ASIDs must be unique to an mm across all the CPUs in a system,
      the __new_context() function needs to broadcast a context reset event to
      all the CPUs during ASID allocation if a roll-over occurred. Such IPIs
      cannot be issued with interrupts disabled and ARM had to define
      __ARCH_WANT_INTERRUPTS_ON_CTXSW.
      
      This patch changes the check_context() function to
      check_and_switch_context() called from switch_mm(). In case of
      ASID-capable CPUs (ARMv6 onwards), if a new ASID is needed and the
      interrupts are disabled, it defers the __new_context() and
      cpu_switch_mm() calls to the post-lock switch hook where the interrupts
      are enabled. Setting the reserved TTBR0 was also moved to
      check_and_switch_context() from cpu_v7_switch_mm().
      Reviewed-by: NWill Deacon <will.deacon@arm.com>
      Tested-by: NWill Deacon <will.deacon@arm.com>
      Reviewed-by: NFrank Rowand <frank.rowand@am.sony.com>
      Tested-by: NMarc Zyngier <Marc.Zyngier@arm.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      7fec1b57
    • W
      ARM: Use TTBR1 instead of reserved context ID · 3c5f7e7b
      Will Deacon 提交于
      On ARMv7 CPUs that cache first level page table entries (like the
      Cortex-A15), using a reserved ASID while changing the TTBR or flushing
      the TLB is unsafe.
      
      This is because the CPU may cache the first level entry as the result of
      a speculative memory access while the reserved ASID is assigned. After
      the process owning the page tables dies, the memory will be reallocated
      and may be written with junk values which can be interpreted as global,
      valid PTEs by the processor. This will result in the TLB being populated
      with bogus global entries.
      
      This patch avoids the use of a reserved context ID in the v7 switch_mm
      and ASID rollover code by temporarily using the swapper_pg_dir pointed
      at by TTBR1, which contains only global entries that are not tagged
      with ASIDs.
      Reviewed-by: NFrank Rowand <frank.rowand@am.sony.com>
      Tested-by: NMarc Zyngier <Marc.Zyngier@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      [catalin.marinas@arm.com: add LPAE support]
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      3c5f7e7b
  4. 08 12月, 2011 1 次提交