From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Catalin Marinas <catalin.marinas@arm.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
James Morse <james.morse@arm.com>,
Will Deacon <will.deacon@arm.com>
Subject: [PATCH 4.2 065/110] arm64: kernel: fix tcr_el1.t0sz restore on systems with extended idmap
Date: Fri, 6 Nov 2015 11:19:12 -0800 [thread overview]
Message-ID: <20151106191706.909413720@linuxfoundation.org> (raw)
In-Reply-To: <20151106191703.247930828@linuxfoundation.org>
4.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
commit e13d918a19a7b6cba62b32884f5e336e764c2cc6 upstream.
Commit dd006da21646 ("arm64: mm: increase VA range of identity map")
introduced a mechanism to extend the virtual memory map range
to support arm64 systems with system RAM located at very high offset,
where the identity mapping used to enable/disable the MMU requires
additional translation levels to map the physical memory at an equal
virtual offset.
The kernel detects at boot time the tcr_el1.t0sz value required by the
identity mapping and sets-up the tcr_el1.t0sz register field accordingly,
any time the identity map is required in the kernel (ie when enabling the
MMU).
After enabling the MMU, in the cold boot path the kernel resets the
tcr_el1.t0sz to its default value (ie the actual configuration value for
the system virtual address space) so that after enabling the MMU the
memory space translated by ttbr0_el1 is restored as expected.
Commit dd006da21646 ("arm64: mm: increase VA range of identity map")
also added code to set-up the tcr_el1.t0sz value when the kernel resumes
from low-power states with the MMU off through cpu_resume() in order to
effectively use the identity mapping to enable the MMU but failed to add
the code required to restore the tcr_el1.t0sz to its default value, when
the core returns to the kernel with the MMU enabled, so that the kernel
might end up running with tcr_el1.t0sz value set-up for the identity
mapping which can be lower than the value required by the actual virtual
address space, resulting in an erroneous set-up.
This patchs adds code in the resume path that restores the tcr_el1.t0sz
default value upon core resume, mirroring this way the cold boot path
behaviour therefore fixing the issue.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Fixes: dd006da21646 ("arm64: mm: increase VA range of identity map")
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/kernel/suspend.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -80,17 +80,21 @@ int cpu_suspend(unsigned long arg, int (
if (ret == 0) {
/*
* We are resuming from reset with TTBR0_EL1 set to the
- * idmap to enable the MMU; restore the active_mm mappings in
- * TTBR0_EL1 unless the active_mm == &init_mm, in which case
- * the thread entered cpu_suspend with TTBR0_EL1 set to
- * reserved TTBR0 page tables and should be restored as such.
+ * idmap to enable the MMU; set the TTBR0 to the reserved
+ * page tables to prevent speculative TLB allocations, flush
+ * the local tlb and set the default tcr_el1.t0sz so that
+ * the TTBR0 address space set-up is properly restored.
+ * If the current active_mm != &init_mm we entered cpu_suspend
+ * with mappings in TTBR0 that must be restored, so we switch
+ * them back to complete the address space configuration
+ * restoration before returning.
*/
- if (mm == &init_mm)
- cpu_set_reserved_ttbr0();
- else
- cpu_switch_mm(mm->pgd, mm);
-
+ cpu_set_reserved_ttbr0();
flush_tlb_all();
+ cpu_set_default_tcr_t0sz();
+
+ if (mm != &init_mm)
+ cpu_switch_mm(mm->pgd, mm);
/*
* Restore per-cpu offset before any kernel
next prev parent reply other threads:[~2015-11-06 19:19 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 19:18 [PATCH 4.2 000/110] 4.2.6-stable review Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 001/110] mac80211: Fix hwflags debugfs file format Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 002/110] ath9k: declare required extra tx headroom Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 003/110] mmc: core: Fix init_card in 52Mhz Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 004/110] iwlwifi: dvm: fix D3 firmware PN programming Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 005/110] iwlwifi: fix firmware filename for 3160 Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 006/110] rtlwifi: rtl8821ae: Fix system lockups on boot Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 007/110] iwlwifi: mvm: clear csa countdown when AP is stopped Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 008/110] iwlwifi: mvm: fix D3 CCMP TX PN assignment Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 009/110] iwlwifi: mvm: fix D3 firmware PN programming Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 010/110] iwlwifi: mvm: init card correctly on ctkill exit check Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 011/110] iwlwifi: mvm: flush fw_dump_wk when mvm fails to start Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 012/110] iwlwifi: pci: add a few more PCI subvendor IDs for the 7265 series Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 013/110] iommu/vt-d: fix range computation when making room for large pages Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 014/110] iommu/amd: Fix BUG when faulting a PROT_NONE VMA Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 015/110] iommu/amd: Dont clear DTE flags when modifying it Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 016/110] powerpc/rtas: Validate rtas.entry before calling enter_rtas() Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 017/110] drm: fix mutex leak in drm_dp_get_mst_branch_device Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 018/110] drm: Correct arguments to list_tail_add in create blob ioctl Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 019/110] drm: crtc: integer overflow in drm_property_create_blob() Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 020/110] [media] m88ds3103: use own reg update_bits() implementation Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 021/110] [media] si2157: Bounds check firmware Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 022/110] [media] si2168: " Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 023/110] [media] rtl28xxu: fix control message flaws Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 024/110] KVM: arm: use GIC support unconditionally Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 025/110] ALSA: hdac: Explicitly add io.h Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 026/110] ALSA: hda - Fix inverted internal mic on Lenovo G50-80 Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 027/110] ALSA: hda - Fix deadlock at error in building PCM Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 028/110] ASoC: Add info callback for SX_TLV controls Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 029/110] ASoC: wm8904: Correct number of EQ registers Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 031/110] x86/setup: Extend low identity map to cover whole kernel range Greg Kroah-Hartman
2015-11-06 19:33 ` Borislav Petkov
2015-11-06 19:48 ` Greg Kroah-Hartman
2015-11-13 9:20 ` Borislav Petkov
2015-12-07 7:29 ` Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 032/110] x86/ioapic: Prevent NULL pointer dereference in setup_ioapic_dest() Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 033/110] mm: make sendfile(2) killable Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 034/110] fault-inject: fix inverted interval/probability values in printk Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 035/110] tracing: Have stack tracer force RCU to be watching Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 036/110] bus: arm-ccn: Fix irq affinity setting on CPU migration Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 037/110] drm/nouveau/gem: return only valid domain when theres only one Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 038/110] drm/radeon/dpm: dont add pwm attributes if DPM is disabled Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 039/110] drm/amdgpu: add missing dpm check for KV dpm late init Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 043/110] drm/radeon: dont try to recreate sysfs entries on resume Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 044/110] drm/amdgpu: " Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 048/110] iio: st_accel: fix interrupt handling on LIS3LV02 Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 049/110] iio: accel: sca3000: memory corruption in sca3000_read_first_n_hw_rb() Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 050/110] rbd: require stable pages if message data CRCs are enabled Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 051/110] rbd: dont leak parent_spec in rbd_dev_probe_parent() Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 052/110] rbd: prevent kernel stack blow up on rbd map Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 053/110] ARM: EXYNOS: Fix double of_node_put() when parsing child power domains Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 054/110] ARM: orion: Fix DSA platform device after mvmdio conversion Greg Kroah-Hartman
2015-11-06 19:32 ` Florian Fainelli
2015-11-06 19:19 ` [PATCH 4.2 055/110] ARM: mvebu: correct a385-db-ap compatible string Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 056/110] ARM: dts: berlin: change BG2Qs USB PHY compatible Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 057/110] ARM: dts: Fix audio card detection on Peach boards Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 058/110] ARM: dts: imx7d: Fix UART2 base address Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 059/110] ARM: dts: am57xx-beagle-x15: set VDD_SD to always-on Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 060/110] ARM: ux500: modify initial levelshifter status Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 061/110] ARM: OMAP1: fix incorrect INT_DMA_LCD Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 062/110] ARM: 8445/1: fix vdsomunge not to depend on glibc specific byteswap.h Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 063/110] ARM: 8449/1: fix bug in vdsomunge swab32 macro Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 064/110] Revert "ARM64: unwind: Fix PC calculation" Greg Kroah-Hartman
2015-11-06 19:19 ` Greg Kroah-Hartman [this message]
2015-11-06 19:19 ` [PATCH 4.2 066/110] block: dont release bdi while request_queue has live references Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 067/110] dm btree remove: fix a bug when rebalancing nodes after removal Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 068/110] dm cache: the CLEAN_SHUTDOWN flag was not being set Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 069/110] dm btree: fix leak of bufio-backed block in btree_split_beneath error path Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 070/110] nvme: fix 32-bit build warning Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 071/110] Revert "serial: 8250_dma: dont bother DMA with small transfers" Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 073/110] i2c: mv64xxx: really allow I2C offloading Greg Kroah-Hartman
2015-11-07 16:26 ` Ben Hutchings
2015-11-06 19:19 ` [PATCH 4.2 074/110] clkdev: fix clk_add_alias() with a NULL alias device name Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 075/110] fbcon: initialize blink interval before calling fb_set_par Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 076/110] xhci: handle no ping response error properly Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 077/110] xhci: Add spurious wakeup quirk for LynxPoint-LP controllers Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 078/110] xen-blkfront: check for null drvdata in blkback_changed (XenbusStateClosing) Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 079/110] module: Fix locking in symbol_put_addr() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 080/110] PCI: Prevent out of bounds access in numa_node override Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 081/110] ovl: free stack of paths in ovl_fill_super Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 082/110] ovl: free lower_mnt array in ovl_put_super Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 083/110] ovl: use O_LARGEFILE in ovl_copy_up() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 084/110] ovl: fix dentry reference leak Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 085/110] ovl: fix open in stacked overlay Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 087/110] crypto: api - Only abort operations on fatal signal Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 088/110] md/raid1: submit_bio_wait() returns 0 on success Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 089/110] md/raid10: " Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 090/110] md/raid5: fix locking in handle_stripe_clean_event() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 091/110] Revert "md: allow a partially recovered device to be hot-added to an array." Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 092/110] EDAC, sb_edac: Fix TAD presence check for sbridge_mci_bind_devs() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 093/110] irqchip/tegra: Propagate IRQ type setting to parent Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 095/110] netfilter: ipset: Fix sleeping memory allocation in atomic context Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 096/110] btrfs: fix possible leak in btrfs_ioctl_balance() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 097/110] kvm: irqchip: fix memory leak Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 098/110] thermal: exynos: Fix register read in TMU Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 099/110] um: Fix kernel mode fault condition Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 100/110] blk-mq: fix use-after-free in blk_mq_free_tag_set() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 101/110] IB/cm: Fix rb-tree duplicate free and use-after-free Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 102/110] sched/deadline: Fix migration of SCHED_DEADLINE tasks Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 103/110] cpufreq: intel_pstate: Fix divide by zero on Knights Landing (KNL) Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 104/110] arm64: compat: fix stxr failure case in SWP emulation Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 105/110] NVMe: Fix memory leak on retried commands Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 106/110] drm/vmwgfx: Fix up user_dmabuf refcounting Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 107/110] thp: use is_zero_pfn() only after pte_present() check Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 108/110] pinctrl: baytrail: Serialize all register access Greg Kroah-Hartman
2015-11-08 9:38 ` Ben Hutchings
2015-11-06 19:19 ` [PATCH 4.2 109/110] pinctrl: baytrail: Use raw_spinlock for locking Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 110/110] xen: fix backport of previous kexec patch Greg Kroah-Hartman
2015-11-07 1:45 ` [PATCH 4.2 000/110] 4.2.6-stable review Guenter Roeck
2015-11-07 2:44 ` Greg Kroah-Hartman
2015-11-07 2:53 ` Shuah Khan
2015-11-07 3:00 ` Greg Kroah-Hartman
2015-11-09 9:27 ` Sudip Mukherjee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151106191706.909413720@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=stable@vger.kernel.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).