aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-10-08Merge tag 'gic-v3-for-lsk-v3.14-v1' of ↵v3.14/topic/gicv3Mark Brown
http://git.linaro.org/git-ro/people/christoffer.dall/linux-kvm-arm into lsk-v3.14-gicv3 GICv3 Support for LSK v3.14
2014-10-02arm64: gicv3: Allow GICv3 compilation with older binutilsCatalin Marinas
GICv3 introduces new system registers accessible with the full msr/mrs syntax (e.g. mrs x0, Sop0_op1_CRm_CRn_op2). However, only recent binutils understand the new syntax. This patch introduces msr_s/mrs_s assembly macros which generate the equivalent instructions above and converts the existing GICv3 code (both drivers/irqchip/ and arch/arm64/kernel/). Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: Olof Johansson <olof@lixom.net> Tested-by: Olof Johansson <olof@lixom.net> Suggested-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Jason Cooper <jason@lakedaemon.net> Cc: Will Deacon <will.deacon@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> (cherry picked from commit 72c5839515260dce966cd24f54436e6583288e6c) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02irqchip: gic: Fix core ID calculation when topology is read from DTTomasz Figa
Certain GIC implementation, namely those found on earlier, single cluster, Exynos SoCs, have registers mapped without per-CPU banking, which means that the driver needs to use different offset for each CPU. Currently the driver calculates the offset by multiplying value returned by cpu_logical_map() by CPU offset parsed from DT. This is correct when CPU topology is not specified in DT and aforementioned function returns core ID alone. However when DT contains CPU topology, the function changes to return cluster ID as well, which is non-zero on mentioned SoCs and so breaks the calculation in GIC driver. This patch fixes this by masking out cluster ID in CPU offset calculation so that only core ID is considered. Multi-cluster Exynos SoCs already have banked GIC implementations, so this simple fix should be enough. Reported-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Tomasz Figa <t.figa@samsung.com> Fixes: db0d4db22a78d ("ARM: gic: allow GIC to support non-banked setups") Cc: <stable@vger.kernel.org> # v3.3+ Link: https://lkml.kernel.org/r/1405610624-18722-1-git-send-email-t.figa@samsung.com Signed-off-by: Jason Cooper <jason@lakedaemon.net> (cherry picked from commit 29e697b11853d3f83b1864ae385abdad4aa2c361) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02irqchip: gic: Add binding probe for ARM GIC400Suravee Suthikulpanit
Commit 3ab72f9156bb "dt-bindings: add GIC-400 binding" added the "arm,gic-400" compatible string, but the corresponding IRQCHIP_DECLARE was never added to the gic driver. Therefore add the missing irqchip declaration for it. Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Removed additional empty line and adapted commit message to mark it as fixing an issue. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Will Deacon <will.deacon@arm.com> Fixes: 3ab72f9156bb ("dt-bindings: add GIC-400 binding") Cc: <stable@vger.kernel.org> # v3.14+ Link: https://lkml.kernel.org/r/2621565.f5eISveXXJ@diego Signed-off-by: Jason Cooper <jason@lakedaemon.net> (cherry picked from commit 144cb08864ed44be52d8634ac69cd98e5efcf527) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02irqchip: gic: Add support for cortex a7 compatible stringMatthias Brugger
Patch 0a68214b "ARM: DT: Add binding for GIC virtualization extentions (VGIC)" added the "arm,cortex-a7-gic" compatible string, but the corresponding IRQCHIP_DECLARE was never added to the gic driver. To let real Cortex-A7 SoCs use it, add the necessary declaration to the device driver. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com> Link: https://lkml.kernel.org/r/1404388732-28890-1-git-send-email-matthias.bgg@gmail.com Fixes: 0a68214b76ca ("ARM: DT: Add binding for GIC virtualization extentions (VGIC)") Cc: <stable@vger.kernel.org> # v3.5+ Signed-off-by: Jason Cooper <jason@lakedaemon.net> (cherry picked from commit a97e8027b1d28eafe6bafe062556c1ec926a49c6) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02irqchip: gic-v3: Initial support for GICv3Marc Zyngier
The Generic Interrupt Controller (version 3) offers services that are similar to GICv2, with a number of additional features: - Affinity routing based on the CPU MPIDR (ARE) - System register for the CPU interfaces (SRE) - Support for more that 8 CPUs - Locality-specific Peripheral Interrupts (LPIs) - Interrupt Translation Services (ITS) This patch adds preliminary support for GICv3 with ARE and SRE, non-secure mode only. It relies on higher exception levels to grant ARE and SRE access. Support for LPI and ITS will be added at a later time. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jason Cooper <jason@lakedaemon.net> Reviewed-by: Zi Shen Lim <zlim@broadcom.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> Reviewed-by: Tirumalesh Chalamarla <tchalamarla@cavium.com> Reviewed-by: Yun Wu <wuyun.wu@huawei.com> Reviewed-by: Zhen Lei <thunder.leizhen@huawei.com> Tested-by: Tirumalesh Chalamarla<tchalamarla@cavium.com> Tested-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com> Acked-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Link: https://lkml.kernel.org/r/1404140510-5382-3-git-send-email-marc.zyngier@arm.com Signed-off-by: Jason Cooper <jason@lakedaemon.net> (cherry picked from commit 021f653791ad17e03f98aaa7fb933816ae16f161) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02irqchip: gic: Move some bits of GICv2 to a library-type fileMarc Zyngier
A few GICv2 low-level function are actually very useful to GICv3, and it makes some sense to share them across the two drivers. They end-up in their own file, with an additional parameter used to ensure an optional synchronization (unused on GICv2). Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jason Cooper <jason@lakedaemon.net> Acked-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Link: https://lkml.kernel.org/r/1404140510-5382-2-git-send-email-marc.zyngier@arm.com Signed-off-by: Jason Cooper <jason@lakedaemon.net> (cherry picked from commit d51d0af43b30dcae1ca13ea67fd717e03b37f153) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02irq-gic: remove file name from heading commentSergei Shtylyov
File names in the heading comments fell out of favor long ago, and this one weren't even changed when the driver was moved from arch/arm/common/, so remove it at last... Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> (cherry picked from commit d31e373d077848f5d40abd8621b4ebd4d2179dd7) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02irqchip: gic: Use mask field in GICC_IARHaojian Zhuang
Bit[9:0] is interrupt ID field in GICC_IAR. Bit[12:10] is CPU ID field, and others are reserved. So we should use GICC_IAR_INT_ID_MASK to get interrupt ID. It's not a good way to use ~0x1c00 (CPU ID field) to get interrupt ID. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Link: https://lkml.kernel.org/r/1399795571-17231-3-git-send-email-haojian.zhuang@linaro.org Signed-off-by: Jason Cooper <jason@lakedaemon.net> (cherry picked from commit b8802f76fe473d91886220498aeda157c492f2d1) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02irqchip: Remove asmlinkage from static functionsChristoffer Dall
LTO patches add __visible to the asmlinkage define, causing compilation warnings like: drivers/irqchip/irq-gic.c:283:1: warning: 'externally_visible' attribute have effect only on public objects [-Wattributes] Drop asmlinkage here to avoid such warnings. [ Modified for LSK from it's origin commit (see below) to only touch the irq-gic.c file so that we have a natural progression of the code before factoring out code bits into a library file for GICv3 support later - Christoffer ] Reported-by: Olof's autobuilder <build@lixom.net> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Cc: linux-arm-kernel@lists.infradead.org Cc: khilman@linaro.org Cc: Russell King <linux@arm.linux.org.uk> Cc: Josh Cartwright <joshc@codeaurora.org> Cc: Andi Kleen <ak@linux.intel.com> Link: http://lkml.kernel.org/r/1393980030-17770-1-git-send-email-sboyd@codeaurora.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de> (cherry picked from commit 8783dd3a37a5853689e1a8fa728827a50905b912) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02irqchip: gic: Silence sparse warningsStephen Boyd
drivers/irqchip/irq-gic.c:53:23: warning: duplicate [noderef] drivers/irqchip/irq-gic.c:651:6: warning: symbol 'gic_raise_softirq' was not declared. Should it be static? drivers/irqchip/irq-gic.c:872:29: warning: symbol 'gic_irq_domain_ops' was not declared. Should it be static? drivers/irqchip/irq-gic.c:977:12: warning: symbol 'gic_of_init' was not declared. Should it be static? Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1393981321-25721-1-git-send-email-sboyd@codeaurora.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de> (cherry picked from commit 6859358e4b0bf2e599027dc4c6317e0bc25ff339) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02irqchip: gic: use dmb ishst instead of dsb when raising a softirqWill Deacon
When sending an SGI to another CPU, we require a barrier to ensure that any pending stores to normal memory are made visible to the recipient before the interrupt arrives. Rather than use a vanilla dsb() (which will soon cause an assembly error on arm64) before the writel_relaxed, we can instead use dsb(ishst), since we just need to ensure that any pending normal writes are visible within the inner-shareable domain before we poke the GIC. With this observation, we can then further weaken the barrier to a dmb(ishst), since other CPUs in the inner-shareable domain must observe the write to the distributor before the SGI is generated. Cc: Thomas Gleixner <tglx@linutronix.de> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> (cherry picked from commit 8adbf57fc4294588e9785069215d445a98e6c23a) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-10-02DRIVERS: IRQCHIP: IRQ-GIC: Add support for routable irqsSricharan R
In some socs the gic can be preceded by a crossbar IP which routes the peripheral interrupts to the gic inputs. The peripheral interrupts are associated with a fixed crossbar input line and the crossbar routes that to one of the free gic input line. The DT entries for peripherals provides the fixed crossbar input line as its interrupt number and the mapping code should associate this with a free gic input line. This patch adds the support inside the gic irqchip to handle such routable irqs. The routable irqs are registered in a linear domain. The registered routable domain's callback should be implemented to get a free irq and to configure the IP to route it. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Tony Lindgren <tony@atomide.com> Cc: Rajendra Nayak <rnayak@ti.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Sricharan R <r.sricharan@ti.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> (cherry picked from commit 006e983bbc805431c44e2135e13841f66059a045) Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-09-13arm64: add support for reserved memory defined by device treeMarek Szyprowski
Enable reserved memory initialization from device tree. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 9bf14b7c540ae9ca7747af3a0c0d8470ef77b6ce) Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-13Merge remote-tracking branch 'lsk/v3.14/topic/libfdt' into lsk-v3.14-arm64-miscMark Brown
2014-09-11ARM: samsung: Fix mismerge with new libfdt changesv3.14/topic/libfdtMark Brown
The merge with the new FDT changes incorrectly changed mfc_mem to be a local variable causing boot failures. Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-28Revert "arm64: KVM: define HYP and Stage-2 translation page flags"Alex Shi
This reverts commit 3d20c4a5ebffee4924c20972aea3e68e22ec8ec9 to resolve the following build error: In file included from arch/arm64/kvm/handle_exit.c:26:0: arch/arm64/include/asm/kvm_mmu.h: In function ‘kvm_set_s2pmd_writable’: arch/arm64/include/asm/kvm_mmu.h:122:19: error: ‘PMD_S2_RDWR’ undeclared (first use in this function) pmd_val(*pmd) |= PMD_S2_RDWR; ^ Signed-off-by: Alex Shi <alex.shi@linaro.org>
2014-08-12lib: add fdt_empty_tree.cMark Salter
CONFIG_LIBFDT support does not include fdt_empty_tree.c which is needed by arm64 EFI stub. Add it to libfdt_files. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com> (cherry picked from commit adaf5687846c25613d58c0a2f5d9e024547cdbec) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-12of/fdt: Convert FDT functions to use libfdtRob Herring
The kernel FDT functions predate libfdt and are much more limited in functionality. Also, the kernel functions and libfdt functions are not compatible with each other because they have different definitions of node offsets. To avoid this incompatibility and in preparation to add more FDT parsing functions which will need libfdt, let's first convert the existing code to use libfdt. The FDT unflattening, top-level FDT scanning, and property retrieval functions are converted to use libfdt. The scanning code should be re-worked to be more efficient and understandable by using libfdt to find nodes directly by path or compatible strings. Signed-off-by: Rob Herring <robh@kernel.org> Tested-by: Michal Simek <michal.simek@xilinx.com> Tested-by: Grant Likely <grant.likely@linaro.org> Tested-by: Stephen Chivers <schivers@csc.com> (cherry picked from commit e6a6928c3ea1d0195ed75a091e345696b916c09b) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-12of/fdt: update of_get_flat_dt_prop in prep for libfdtRob Herring
Make of_get_flat_dt_prop arguments compatible with libfdt fdt_getprop call in preparation to convert FDT code to use libfdt. Make the return value const and the property length ptr type an int. Signed-off-by: Rob Herring <robh@kernel.org> Tested-by: Michal Simek <michal.simek@xilinx.com> Tested-by: Grant Likely <grant.likely@linaro.org> Tested-by: Stephen Chivers <schivers@csc.com> (cherry picked from commit 9d0c4dfedd96ee54fc075b16d02f82499c8cc3a6) Signed-off-by: Mark Brown <broonie@linaro.org> Conflicts: arch/arm/plat-samsung/s5p-dev-mfc.c arch/powerpc/platforms/powernv/opal.c
2014-08-12of/fdt: remove unused of_scan_flat_dt_by_pathRob Herring
of_scan_flat_dt_by_path is unused anywhere in the kernel, so remove it. Signed-off-by: Rob Herring <robh@kernel.org> Tested-by: Michal Simek <michal.simek@xilinx.com> Tested-by: Grant Likely <grant.likely@linaro.org> Tested-by: Stephen Chivers <schivers@csc.com> (cherry picked from commit bba04d965d06abbbe10afd3687742389107e198e) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-12of: Fix the section mismatch warnings.Xiubo Li
In tag next-20140407, building with CONFIG_DEBUG_SECTION_MISMATCH enabled, the following WARNING is occured: WARNING: drivers/built-in.o(.text.unlikely+0x2220): Section mismatch in reference from the function __reserved_mem_check_root() to the function .init.text:of_get_flat_dt_prop() The function __reserved_mem_check_root() references the function __init of_get_flat_dt_prop(). This is often because __reserved_mem_check_root lacks a __init annotation or the annotation of of_get_flat_dt_prop is wrong. WARNING: vmlinux.o(.text.unlikely+0xb9d0): Section mismatch in reference from the function __reserved_mem_check_root() to the (unknown reference) .init.data:(unknown) The function __reserved_mem_check_root() references the (unknown reference) __initdata (unknown). This is often because __reserved_mem_check_root lacks a __initdata annotation or the annotation of (unknown) is wrong. This is cause by : 'drivers: of: add initialization code for dynamic reserved memory'. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 5b6241185e2cded07ca3f5f646b55c641928ba4e) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-12of: only scan for reserved mem when fdt presentJosh Cartwright
When the reserved memory patches hit -next, several legacy (non-DT) boot failures were detected and bisected down to that commit. There needs to be some sanity checking whether a DT is even present before parsing the reserved ranges. Reported-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Josh Cartwright <joshc@codeaurora.org> Tested-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 2040b52768ebab6e7bd73af0dc63703269c62f17) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-12drivers: of: add support for custom reserved memory driversMarek Szyprowski
Add support for custom reserved memory drivers. Call their init() function for each reserved region and prepare for using operations provided by them with by the reserved_mem->ops array. Based on previous code provided by Josh Cartwright <joshc@codeaurora.org> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit f618c4703a14672d27bc2ca5d132a844363d6f5f) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-12drivers: of: add initialization code for dynamic reserved memoryMarek Szyprowski
This patch adds support for dynamically allocated reserved memory regions declared in device tree. Such regions are defined by 'size', 'alignment' and 'alloc-ranges' properties. Based on previous code provided by Josh Cartwright <joshc@codeaurora.org> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 3f0c8206644836e4f10a6b9fc47cda6a9a372f9b) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-12drivers: of: add initialization code for static reserved memoryMarek Szyprowski
This patch adds support for static (defined by 'reg' property) reserved memory regions declared in device tree. Memory blocks can be reliably reserved only during early boot. This must happen before the whole memory management subsystem is initialized, because we need to ensure that the given contiguous blocks are not yet allocated by kernel. Also it must happen before kernel mappings for the whole low memory are created, to ensure that there will be no mappings (for reserved blocks). Typically, all this happens before device tree structures are unflattened, so we need to get reserved memory layout directly from fdt. Based on previous code provided by Josh Cartwright <joshc@codeaurora.org> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit e8d9d1f5485b52ec3c4d7af839e6914438f6c285) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Fix barriers used for page table modificationsCatalin Marinas
The architecture specification states that both DSB and ISB are required between page table modifications and subsequent memory accesses using the corresponding virtual address. When TLB invalidation takes place, the tlb_flush_* functions already have the necessary barriers. However, there are other functions like create_mapping() for which this is not the case. The patch adds the DSB+ISB instructions in the set_pte() function for valid kernel mappings. The invalid pte case is handled by tlb_flush_* and the user mappings in general have a corresponding update_mmu_cache() call containing a DSB. Even when update_mmu_cache() isn't called, the kernel can still cope with an unlikely spurious page fault by re-executing the instruction. In addition, the set_pmd, set_pud() functions gain an ISB for architecture compliance when block mappings are created. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Steve Capper <steve.capper@linaro.org> Cc: Will Deacon <will.deacon@arm.com> (cherry picked from commit 54d6ba0ede61f12b2a03d74bdbf004719a9cfefc) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: mm: Optimise tlb flush logic where we have >4K granuleSteve Capper
The tlb maintainence functions: __cpu_flush_user_tlb_range and __cpu_flush_kern_tlb_range do not take into consideration the page granule when looping through the address range, and repeatedly flush tlb entries for the same page when operating with 64K pages. This patch re-works the logic s.t. we instead advance the loop by 1 << (PAGE_SHIFT - 12), so avoid repeating ourselves. Also the routines have been converted from assembler to static inline functions to aid with legibility and potential compiler optimisations. The isb() has been removed from flush_tlb_kernel_range(.) as it is only needed when changing the execute permission of a mapping. If one needs to set an area of the kernel as execute/non-execute an isb() must be inserted after the call to flush_tlb_kernel_range. Cc: Laura Abbott <lauraa@codeaurora.org> Signed-off-by: Steve Capper <steve.capper@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit fa48e6f780a681cdbc7820e33259edfe1a79b9e3) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: KVM: define HYP and Stage-2 translation page flagsMarc Zyngier
Add HYP and S2 page flags, for both normal and device memory. Reviewed-by: Christopher Covington <cov@codeaurora.org> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> (cherry picked from commit 363116073a26dbc2903d8417047597eebcc05273) Signed-off-by: Mark Brown <broonie@linaro.org> Conflicts: arch/arm64/include/asm/pgtable-hwdef.h arch/arm64/include/asm/pgtable.h
2014-08-11arm64: Fix for the arm64 kern_addr_valid() functionDave Anderson
Fix for the arm64 kern_addr_valid() function to recognize virtual addresses in the kernel logical memory map. The function fails as written because it does not check whether the addresses in that region are mapped at the pmd level to 2MB or 512MB pages, continues the page table walk to the pte level, and issues a garbage value to pfn_valid(). Tested on 4K-page and 64K-page kernels. Signed-off-by: Dave Anderson <anderson@redhat.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit da6e4cb67c6dd1f72257c0a4a97c26dc4e80d3a7) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Clean up the default pgprot settingCatalin Marinas
The primary aim of this patchset is to remove the pgprot_default and prot_sect_default global variables and rely strictly on predefined values. The original goal was to be able to run SMP kernels on UP hardware by not setting the Shareability bit. However, it is unlikely to see UP ARMv8 hardware and even if we do, the Shareability bit is no longer assumed to disable cacheable accesses. A side effect is that the device mappings now have the Shareability attribute set. The hardware, however, should ignore it since Device accesses are always Outer Shareable. Following the removal of the two global variables, there is some PROT_* macro reshuffling and cleanup, including the __PAGE_* macros (replaced by PAGE_*). Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> (cherry picked from commit a501e32430d4232012ab708b8f0ce841f29e0f02) Signed-off-by: Mark Brown <broonie@linaro.org> Conflicts: arch/arm64/include/asm/pgtable.h arch/arm64/mm/mmu.c
2014-08-11arm64: Add function to create identity mappingsMark Salter
At boot time, before switching to a virtual UEFI memory map, firmware expects UEFI memory and IO regions to be identity mapped whenever kernel makes runtime services calls. The existing early boot code creates an identity map of kernel text/data but this is not sufficient for UEFI. This patch adds a create_id_mapping() function which reuses the core code of the existing create_mapping(). Signed-off-by: Mark Salter <msalter@redhat.com> [ Fixed error message formatting (%pa). ] Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com> (cherry picked from commit d7ecbddf4caefbac1b99478dd2b679f83dfc2545) Signed-off-by: Mark Brown <broonie@linaro.org> Conflicts: arch/arm64/mm/mmu.c
2014-08-11arm64: head: create a new function for setting the boot_cpu_mode flagMatthew Leach
Currently, the code for setting the __cpu_boot_mode flag is munged in with el2_setup. This makes things difficult on a BE bringup as a memory access has to have occurred before el2_setup which is the place that we'd like to set the endianess on the current EL. Create a new function for setting __cpu_boot_mode and have el2_setup return the mode the CPU. Also define a new constant in virt.h, BOOT_CPU_MODE_EL1, for readability. Acked-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Matthew Leach <matthew.leach@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit 828e9834e9a5b7e61046aa3c5f603a4fecba2fb4) Signed-off-by: Mark Brown <broonie@linaro.org> Conflicts (restoring a previous mismerge): arch/arm64/kernel/head.S
2014-08-11arm64: introduce virt_to_pfnStefano Stabellini
virt_to_pfn has been defined in arch/arm/include/asm/memory.h by commit e26a9e0 "ARM: Better virt_to_page() handling" and Xen has come to rely on it. Introduce virt_to_pfn on arm64 too. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit 1f53ba6e81749a420226e5502c49ab83ba85c81d) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11Revert "arm64: Introduce execute-only page access permissions"Catalin Marinas
This reverts commit bc07c2c6e9ed125d362af0214b6313dca180cb08. While the aim is increased security for --x memory maps, it does not protect against kernel level reads. Until SECCOMP is implemented for arm64, revert this patch to avoid giving a false idea of execute-only mappings. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit 5a0fdfada3a2aa50d7b947a2e958bf00cbe0d830) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Fix up earlier backportMark Brown
Crept in during a cherry-pick run; ideally should be squished down. Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Clean up the default pgprot settingMark Brown
The primary aim of this patchset is to remove the pgprot_default and prot_sect_default global variables and rely strictly on predefined values. The original goal was to be able to run SMP kernels on UP hardware by not setting the Shareability bit. However, it is unlikely to see UP ARMv8 hardware and even if we do, the Shareability bit is no longer assumed to disable cacheable accesses. A side effect is that the device mappings now have the Shareability attribute set. The hardware, however, should ignore it since Device accesses are always Outer Shareable. Following the removal of the two global variables, there is some PROT_* macro reshuffling and cleanup, including the __PAGE_* macros (replaced by PAGE_*). Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> (cherry picked from commit a501e32430d4232012ab708b8f0ce841f29e0f02) Signed-off-by: Mark Brown <broonie@linaro.org> Conflicts: arch/arm64/mm/mmu.c
2014-08-11arm64: add early_ioremap supportMark Salter
Add support for early IO or memory mappings which are needed before the normal ioremap() is usable. This also adds fixmap support for permanent fixed mappings such as that used by the earlyprintk device register region. Signed-off-by: Mark Salter <msalter@redhat.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Borislav Petkov <borislav.petkov@amd.com> Cc: Dave Young <dyoung@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit bf4b558eba920a38f91beb5ee62a8ce2628c92f7) Signed-off-by: Mark Brown <broonie@linaro.org> Conflicts: Documentation/arm64/memory.txt arch/arm64/Kconfig arch/arm64/kernel/head.S arch/arm64/mm/mmu.c
2014-08-11mm: create generic early_ioremap() supportMark Salter
This patch creates a generic implementation of early_ioremap() support based on the existing x86 implementation. early_ioremp() is useful for early boot code which needs to temporarily map I/O or memory regions before normal mapping functions such as ioremap() are available. Some architectures have optional MMU. In the no-MMU case, the remap functions simply return the passed in physical address and the unmap functions do nothing. Signed-off-by: Mark Salter <msalter@redhat.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Cc: Borislav Petkov <borislav.petkov@amd.com> Cc: Dave Young <dyoung@redhat.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit 9e5c33d7aeeef62e5fa7e74f94432685bd03026b) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Add APM X-Gene SoC 15Gbps Multi-purpose PHY DTS entriesLoc Ho
This patch adds the DTS entries for the APM X-Gene SoC 15Gbps Multi-purpose PHY driver. The PHY for SATA controller 2 and 3 are enabled by default. Signed-off-by: Loc Ho <lho@apm.com> Signed-off-by: Tuan Phan <tphan@apm.com> Signed-off-by: Suman Tripathi <stripathi@apm.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Tejun Heo <tj@kernel.org> (cherry picked from commit 71b70ee9350f239ea021bbb737771ebd5d02c020) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: barriers: make use of barrier options with explicit barriersWill Deacon
When calling our low-level barrier macros directly, we can often suffice with more relaxed behaviour than the default "all accesses, full system" option. This patch updates the users of dsb() to specify the option which they actually require. Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit 98f7685ee69f871ba991089cb9685f0da07517ea) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: xchg: prevent warning if return value is unusedWill Deacon
Some users of xchg() don't bother using the return value, which results in a compiler warning like the following (from kgdb): In file included from linux/arch/arm64/include/asm/atomic.h:27:0, from include/linux/atomic.h:4, from include/linux/spinlock.h:402, from include/linux/seqlock.h:35, from include/linux/time.h:5, from include/uapi/linux/timex.h:56, from include/linux/timex.h:56, from include/linux/sched.h:19, from include/linux/pid_namespace.h:4, from kernel/debug/debug_core.c:30: kernel/debug/debug_core.c: In function ‘kgdb_cpu_enter’: linux/arch/arm64/include/asm/cmpxchg.h:75:3: warning: value computed is not used [-Wunused-value] ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) ^ linux/arch/arm64/include/asm/atomic.h:132:30: note: in expansion of macro ‘xchg’ #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) kernel/debug/debug_core.c:504:4: note: in expansion of macro ‘atomic_xchg’ atomic_xchg(&kgdb_active, cpu); ^ This patch makes use of the same trick as we do for cmpxchg, by assigning the return value to a dummy variable in the xchg() macro itself. Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit e1dfda9ced9bea1413a736f0d578f8218a7788ec) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Make atomic64_t() return "long", not "long long"Bjorn Helgaas
arm64 sets CONFIG_64BIT=y and hence uses the "long counter" atomic64_t definition from include/linux/types.h. Make atomic64_read() return "long", not "long long". Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit ba6bf8c85cb0d263ca9a98ef6a76ab651a97c60b) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Introduce execute-only page access permissionsCatalin Marinas
The ARMv8 architecture allows execute-only user permissions by clearing the PTE_UXN and PTE_USER bits. The kernel, however, can still access such page, so execute-only page permission does not protect against read(2)/write(2) etc. accesses. Systems requiring such protection must implement/enable features like SECCOMP. This patch changes the arm64 __P100 and __S100 protection_map[] macros to the new __PAGE_EXECONLY attributes. A side effect is that pte_valid_user() no longer triggers for __PAGE_EXECONLY since PTE_USER isn't set. To work around this, the check is done on the PTE_NG bit via the pte_valid_ng() macro. VM_READ is also checked now for page faults. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit bc07c2c6e9ed125d362af0214b6313dca180cb08) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Remove pgprot_dmacoherent()Catalin Marinas
Since this macro is identical to pgprot_writecombine() and is only used in a single place, remove it completely to avoid confusion. On ARMv7+ processors, the coherent DMA mapping must be Normal NonCacheable (a.k.a. writecombine) to avoid mismatched hardware attribute aliases (with the kernel linear mapping as Normal Cacheable). Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit 196adf2f3015eacac0567278ba538e3ffdd16d0e) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: mm: Route pmd thp functions through pte equivalentsSteve Capper
Rather than have separate hugetlb and transparent huge page pmd manipulation functions, re-wire our thp functions to simply call the pte equivalents. This allows THP to take advantage of the new PTE_WRITE logic introduced in: c2c93e5 arm64: mm: Introduce PTE_WRITE To represent splitting THPs we use the PTE_SPECIAL bit as this is not used for pmds. Signed-off-by: Steve Capper <steve.capper@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit 9c7e535fcc1725fc2e2d4f0d9dd14137f0243e23) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Do not synchronise I and D caches for special ptesCatalin Marinas
Special pte mappings are not intended to be executable and do not even have an associated struct page. This patch ensures that we do not call __sync_icache_dcache() on such ptes. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: Steve Capper <Steve.Capper@arm.com> Tested-by: Laura Abbott <lauraa@codeaurora.org> Tested-by: Bharat Bhushan <Bharat.Bhushan@freescale.com> Cc: <stable@vger.kernel.org> (cherry picked from commit 71fdb6bf61bf0692f004f9daf5650392c0cfe300) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Make DMA coherent and strongly ordered mappings not executableCatalin Marinas
pgprot_{dmacoherent,writecombine,noncached} don't need to generate executable mappings with side-effects like __sync_icache_dcache() being called when the mapping is in user space. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: Bharat Bhushan <Bharat.Bhushan@freescale.com> Tested-by: Laura Abbott <lauraa@codeaurora.org> Tested-by: Bharat Bhushan <Bharat.Bhushan@freescale.com> Cc: <stable@vger.kernel.org> (cherry picked from commit de2db7432917a82b62d55bb59635586eeca6d1bd) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Remove the aux_context structureCatalin Marinas
This patch removes the aux_context structure (and the containing file) to allow the placement of the _aarch64_ctx end magic based on the context stored on the signal stack. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit 0e0276d1e1dd063cd14ce377707970d0417a0792) Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-11arm64: Remove boot thread synchronisation for spin-table release methodCatalin Marinas
The synchronisation with the boot thread already happens in __cpu_up() via wait_for_completion_timeout(). In addition, __cpu_up() calls are protected by the cpu_add_remove_lock mutex and already serialised. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit 6400111399e16a535231ebd76389c894ea1837ff) Signed-off-by: Mark Brown <broonie@linaro.org>