Merge remote-tracking branch 'torvalds/master' into perf/core

To pick up fixes, since perf/urgent is already upstream.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo
2021-06-22 13:56:50 -03:00
725 changed files with 6786 additions and 3341 deletions

View File

@@ -109,8 +109,8 @@ ForEachMacros:
- 'css_for_each_child' - 'css_for_each_child'
- 'css_for_each_descendant_post' - 'css_for_each_descendant_post'
- 'css_for_each_descendant_pre' - 'css_for_each_descendant_pre'
- 'cxl_for_each_cmd'
- 'device_for_each_child_node' - 'device_for_each_child_node'
- 'displayid_iter_for_each'
- 'dma_fence_chain_for_each' - 'dma_fence_chain_for_each'
- 'do_for_each_ftrace_op' - 'do_for_each_ftrace_op'
- 'drm_atomic_crtc_for_each_plane' - 'drm_atomic_crtc_for_each_plane'
@@ -136,6 +136,7 @@ ForEachMacros:
- 'drm_mm_for_each_node_in_range' - 'drm_mm_for_each_node_in_range'
- 'drm_mm_for_each_node_safe' - 'drm_mm_for_each_node_safe'
- 'flow_action_for_each' - 'flow_action_for_each'
- 'for_each_acpi_dev_match'
- 'for_each_active_dev_scope' - 'for_each_active_dev_scope'
- 'for_each_active_drhd_unit' - 'for_each_active_drhd_unit'
- 'for_each_active_iommu' - 'for_each_active_iommu'
@@ -171,7 +172,6 @@ ForEachMacros:
- 'for_each_dapm_widgets' - 'for_each_dapm_widgets'
- 'for_each_dev_addr' - 'for_each_dev_addr'
- 'for_each_dev_scope' - 'for_each_dev_scope'
- 'for_each_displayid_db'
- 'for_each_dma_cap_mask' - 'for_each_dma_cap_mask'
- 'for_each_dpcm_be' - 'for_each_dpcm_be'
- 'for_each_dpcm_be_rollback' - 'for_each_dpcm_be_rollback'
@@ -179,6 +179,7 @@ ForEachMacros:
- 'for_each_dpcm_fe' - 'for_each_dpcm_fe'
- 'for_each_drhd_unit' - 'for_each_drhd_unit'
- 'for_each_dss_dev' - 'for_each_dss_dev'
- 'for_each_dtpm_table'
- 'for_each_efi_memory_desc' - 'for_each_efi_memory_desc'
- 'for_each_efi_memory_desc_in_map' - 'for_each_efi_memory_desc_in_map'
- 'for_each_element' - 'for_each_element'
@@ -215,6 +216,7 @@ ForEachMacros:
- 'for_each_migratetype_order' - 'for_each_migratetype_order'
- 'for_each_msi_entry' - 'for_each_msi_entry'
- 'for_each_msi_entry_safe' - 'for_each_msi_entry_safe'
- 'for_each_msi_vector'
- 'for_each_net' - 'for_each_net'
- 'for_each_net_continue_reverse' - 'for_each_net_continue_reverse'
- 'for_each_netdev' - 'for_each_netdev'
@@ -270,6 +272,12 @@ ForEachMacros:
- 'for_each_prime_number_from' - 'for_each_prime_number_from'
- 'for_each_process' - 'for_each_process'
- 'for_each_process_thread' - 'for_each_process_thread'
- 'for_each_prop_codec_conf'
- 'for_each_prop_dai_codec'
- 'for_each_prop_dai_cpu'
- 'for_each_prop_dlc_codecs'
- 'for_each_prop_dlc_cpus'
- 'for_each_prop_dlc_platforms'
- 'for_each_property_of_node' - 'for_each_property_of_node'
- 'for_each_registered_fb' - 'for_each_registered_fb'
- 'for_each_requested_gpio' - 'for_each_requested_gpio'
@@ -430,6 +438,7 @@ ForEachMacros:
- 'queue_for_each_hw_ctx' - 'queue_for_each_hw_ctx'
- 'radix_tree_for_each_slot' - 'radix_tree_for_each_slot'
- 'radix_tree_for_each_tagged' - 'radix_tree_for_each_tagged'
- 'rb_for_each'
- 'rbtree_postorder_for_each_entry_safe' - 'rbtree_postorder_for_each_entry_safe'
- 'rdma_for_each_block' - 'rdma_for_each_block'
- 'rdma_for_each_port' - 'rdma_for_each_port'

View File

@@ -243,6 +243,9 @@ Maxime Ripard <mripard@kernel.org> <maxime.ripard@free-electrons.com>
Mayuresh Janorkar <mayur@ti.com> Mayuresh Janorkar <mayur@ti.com>
Michael Buesch <m@bues.ch> Michael Buesch <m@bues.ch>
Michel Dänzer <michel@tungstengraphics.com> Michel Dänzer <michel@tungstengraphics.com>
Michel Lespinasse <michel@lespinasse.org>
Michel Lespinasse <michel@lespinasse.org> <walken@google.com>
Michel Lespinasse <michel@lespinasse.org> <walken@zoy.org>
Miguel Ojeda <ojeda@kernel.org> <miguel.ojeda.sandonis@gmail.com> Miguel Ojeda <ojeda@kernel.org> <miguel.ojeda.sandonis@gmail.com>
Mike Rapoport <rppt@kernel.org> <mike@compulab.co.il> Mike Rapoport <rppt@kernel.org> <mike@compulab.co.il>
Mike Rapoport <rppt@kernel.org> <mike.rapoport@gmail.com> Mike Rapoport <rppt@kernel.org> <mike.rapoport@gmail.com>

View File

@@ -149,6 +149,17 @@ properties:
maxItems: 6 maxItems: 6
$ref: /schemas/types.yaml#/definitions/uint32-array $ref: /schemas/types.yaml#/definitions/uint32-array
sink-vdos-v1:
description: An array of u32 with each entry, a Vendor Defined Message Object (VDO),
providing additional information corresponding to the product, the detailed bit
definitions and the order of each VDO can be found in
"USB Power Delivery Specification Revision 2.0, Version 1.3" chapter 6.4.4.3.1 Discover
Identity. User can specify the VDO array via VDO_IDH/_CERT/_PRODUCT/_CABLE/_AMA defined in
dt-bindings/usb/pd.h.
minItems: 3
maxItems: 6
$ref: /schemas/types.yaml#/definitions/uint32-array
op-sink-microwatt: op-sink-microwatt:
description: Sink required operating power in microwatt, if source can't description: Sink required operating power in microwatt, if source can't
offer the power, Capability Mismatch is set. Required for power sink and offer the power, Capability Mismatch is set. Required for power sink and
@@ -207,6 +218,10 @@ properties:
SNK_READY for non-pd link. SNK_READY for non-pd link.
type: boolean type: boolean
dependencies:
sink-vdos-v1: [ 'sink-vdos' ]
sink-vdos: [ 'sink-vdos-v1' ]
required: required:
- compatible - compatible

View File

@@ -49,7 +49,7 @@ examples:
#size-cells = <0>; #size-cells = <0>;
adc@48 { adc@48 {
comatible = "ti,ads7828"; compatible = "ti,ads7828";
reg = <0x48>; reg = <0x48>;
vref-supply = <&vref>; vref-supply = <&vref>;
ti,differential-input; ti,differential-input;

View File

@@ -67,9 +67,7 @@ properties:
maxItems: 1 maxItems: 1
clock-names: clock-names:
maxItems: 1 const: fck
items:
- const: fck
resets: resets:
maxItems: 1 maxItems: 1

View File

@@ -57,7 +57,7 @@ patternProperties:
rate rate
sound-dai: sound-dai:
$ref: /schemas/types.yaml#/definitions/phandle $ref: /schemas/types.yaml#/definitions/phandle-array
description: phandle of the CPU DAI description: phandle of the CPU DAI
patternProperties: patternProperties:
@@ -71,7 +71,7 @@ patternProperties:
properties: properties:
sound-dai: sound-dai:
$ref: /schemas/types.yaml#/definitions/phandle $ref: /schemas/types.yaml#/definitions/phandle-array
description: phandle of the codec DAI description: phandle of the codec DAI
required: required:

View File

@@ -58,6 +58,6 @@ RISC-V Linux Kernel SV39
| |
____________________________________________________________|____________________________________________________________ ____________________________________________________________|____________________________________________________________
| | | | | | | |
ffffffff00000000 | -4 GB | ffffffff7fffffff | 2 GB | modules ffffffff00000000 | -4 GB | ffffffff7fffffff | 2 GB | modules, BPF
ffffffff80000000 | -2 GB | ffffffffffffffff | 2 GB | kernel, BPF ffffffff80000000 | -2 GB | ffffffffffffffff | 2 GB | kernel
__________________|____________|__________________|_________|____________________________________________________________ __________________|____________|__________________|_________|____________________________________________________________

View File

@@ -171,8 +171,8 @@ Shadow pages contain the following information:
shadow pages) so role.quadrant takes values in the range 0..3. Each shadow pages) so role.quadrant takes values in the range 0..3. Each
quadrant maps 1GB virtual address space. quadrant maps 1GB virtual address space.
role.access: role.access:
Inherited guest access permissions in the form uwx. Note execute Inherited guest access permissions from the parent ptes in the form uwx.
permission is positive, not negative. Note execute permission is positive, not negative.
role.invalid: role.invalid:
The page is invalid and should not be used. It is a root page that is The page is invalid and should not be used. It is a root page that is
currently pinned (by a cpu hardware register pointing to it); once it is currently pinned (by a cpu hardware register pointing to it); once it is

View File

@@ -181,7 +181,7 @@ SLUB Debug output
Here is a sample of slub debug output:: Here is a sample of slub debug output::
==================================================================== ====================================================================
BUG kmalloc-8: Redzone overwritten BUG kmalloc-8: Right Redzone overwritten
-------------------------------------------------------------------- --------------------------------------------------------------------
INFO: 0xc90f6d28-0xc90f6d2b. First byte 0x00 instead of 0xcc INFO: 0xc90f6d28-0xc90f6d2b. First byte 0x00 instead of 0xcc
@@ -189,10 +189,10 @@ Here is a sample of slub debug output::
INFO: Object 0xc90f6d20 @offset=3360 fp=0xc90f6d58 INFO: Object 0xc90f6d20 @offset=3360 fp=0xc90f6d58
INFO: Allocated in get_modalias+0x61/0xf5 age=53 cpu=1 pid=554 INFO: Allocated in get_modalias+0x61/0xf5 age=53 cpu=1 pid=554
Bytes b4 0xc90f6d10: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ Bytes b4 (0xc90f6d10): 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ
Object 0xc90f6d20: 31 30 31 39 2e 30 30 35 1019.005 Object (0xc90f6d20): 31 30 31 39 2e 30 30 35 1019.005
Redzone 0xc90f6d28: 00 cc cc cc . Redzone (0xc90f6d28): 00 cc cc cc .
Padding 0xc90f6d50: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ Padding (0xc90f6d50): 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ
[<c010523d>] dump_trace+0x63/0x1eb [<c010523d>] dump_trace+0x63/0x1eb
[<c01053df>] show_trace_log_lvl+0x1a/0x2f [<c01053df>] show_trace_log_lvl+0x1a/0x2f

View File

@@ -3877,6 +3877,7 @@ L: linux-btrfs@vger.kernel.org
S: Maintained S: Maintained
W: http://btrfs.wiki.kernel.org/ W: http://btrfs.wiki.kernel.org/
Q: http://patchwork.kernel.org/project/linux-btrfs/list/ Q: http://patchwork.kernel.org/project/linux-btrfs/list/
C: irc://irc.libera.chat/btrfs
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git
F: Documentation/filesystems/btrfs.rst F: Documentation/filesystems/btrfs.rst
F: fs/btrfs/ F: fs/btrfs/
@@ -12904,7 +12905,7 @@ F: net/ipv4/nexthop.c
NFC SUBSYSTEM NFC SUBSYSTEM
M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
L: linux-nfc@lists.01.org (moderated for non-subscribers) L: linux-nfc@lists.01.org (subscribers-only)
L: netdev@vger.kernel.org L: netdev@vger.kernel.org
S: Maintained S: Maintained
F: Documentation/devicetree/bindings/net/nfc/ F: Documentation/devicetree/bindings/net/nfc/
@@ -12917,7 +12918,7 @@ F: net/nfc/
NFC VIRTUAL NCI DEVICE DRIVER NFC VIRTUAL NCI DEVICE DRIVER
M: Bongsu Jeon <bongsu.jeon@samsung.com> M: Bongsu Jeon <bongsu.jeon@samsung.com>
L: netdev@vger.kernel.org L: netdev@vger.kernel.org
L: linux-nfc@lists.01.org (moderated for non-subscribers) L: linux-nfc@lists.01.org (subscribers-only)
S: Supported S: Supported
F: drivers/nfc/virtual_ncidev.c F: drivers/nfc/virtual_ncidev.c
F: tools/testing/selftests/nci/ F: tools/testing/selftests/nci/
@@ -13215,7 +13216,7 @@ F: sound/soc/codecs/tfa9879*
NXP-NCI NFC DRIVER NXP-NCI NFC DRIVER
R: Charles Gorand <charles.gorand@effinnov.com> R: Charles Gorand <charles.gorand@effinnov.com>
L: linux-nfc@lists.01.org (moderated for non-subscribers) L: linux-nfc@lists.01.org (subscribers-only)
S: Supported S: Supported
F: drivers/nfc/nxp-nci F: drivers/nfc/nxp-nci
@@ -14118,6 +14119,7 @@ F: drivers/pci/controller/pci-v3-semi.c
PCI ENDPOINT SUBSYSTEM PCI ENDPOINT SUBSYSTEM
M: Kishon Vijay Abraham I <kishon@ti.com> M: Kishon Vijay Abraham I <kishon@ti.com>
M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
R: Krzysztof Wilczyński <kw@linux.com>
L: linux-pci@vger.kernel.org L: linux-pci@vger.kernel.org
S: Supported S: Supported
F: Documentation/PCI/endpoint/* F: Documentation/PCI/endpoint/*
@@ -14166,6 +14168,7 @@ F: drivers/pci/controller/pci-xgene-msi.c
PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS
M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
R: Rob Herring <robh@kernel.org> R: Rob Herring <robh@kernel.org>
R: Krzysztof Wilczyński <kw@linux.com>
L: linux-pci@vger.kernel.org L: linux-pci@vger.kernel.org
S: Supported S: Supported
Q: http://patchwork.ozlabs.org/project/linux-pci/list/ Q: http://patchwork.ozlabs.org/project/linux-pci/list/
@@ -16144,7 +16147,7 @@ F: include/media/drv-intf/s3c_camif.h
SAMSUNG S3FWRN5 NFC DRIVER SAMSUNG S3FWRN5 NFC DRIVER
M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
M: Krzysztof Opasiak <k.opasiak@samsung.com> M: Krzysztof Opasiak <k.opasiak@samsung.com>
L: linux-nfc@lists.01.org (moderated for non-subscribers) L: linux-nfc@lists.01.org (subscribers-only)
S: Maintained S: Maintained
F: Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml F: Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml
F: drivers/nfc/s3fwrn5 F: drivers/nfc/s3fwrn5
@@ -16557,6 +16560,7 @@ F: drivers/misc/sgi-xp/
SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS
M: Karsten Graul <kgraul@linux.ibm.com> M: Karsten Graul <kgraul@linux.ibm.com>
M: Guvenc Gulce <guvenc@linux.ibm.com>
L: linux-s390@vger.kernel.org L: linux-s390@vger.kernel.org
S: Supported S: Supported
W: http://www.ibm.com/developerworks/linux/linux390/ W: http://www.ibm.com/developerworks/linux/linux390/
@@ -18334,7 +18338,7 @@ F: sound/soc/codecs/tas571x*
TI TRF7970A NFC DRIVER TI TRF7970A NFC DRIVER
M: Mark Greer <mgreer@animalcreek.com> M: Mark Greer <mgreer@animalcreek.com>
L: linux-wireless@vger.kernel.org L: linux-wireless@vger.kernel.org
L: linux-nfc@lists.01.org (moderated for non-subscribers) L: linux-nfc@lists.01.org (subscribers-only)
S: Supported S: Supported
F: Documentation/devicetree/bindings/net/nfc/trf7970a.txt F: Documentation/devicetree/bindings/net/nfc/trf7970a.txt
F: drivers/nfc/trf7970a.c F: drivers/nfc/trf7970a.c
@@ -18870,6 +18874,13 @@ S: Maintained
F: drivers/usb/host/isp116x* F: drivers/usb/host/isp116x*
F: include/linux/usb/isp116x.h F: include/linux/usb/isp116x.h
USB ISP1760 DRIVER
M: Rui Miguel Silva <rui.silva@linaro.org>
L: linux-usb@vger.kernel.org
S: Maintained
F: drivers/usb/isp1760/*
F: Documentation/devicetree/bindings/usb/nxp,isp1760.yaml
USB LAN78XX ETHERNET DRIVER USB LAN78XX ETHERNET DRIVER
M: Woojung Huh <woojung.huh@microchip.com> M: Woojung Huh <woojung.huh@microchip.com>
M: UNGLinuxDriver@microchip.com M: UNGLinuxDriver@microchip.com

View File

@@ -2,8 +2,8 @@
VERSION = 5 VERSION = 5
PATCHLEVEL = 13 PATCHLEVEL = 13
SUBLEVEL = 0 SUBLEVEL = 0
EXTRAVERSION = -rc4 EXTRAVERSION = -rc7
NAME = Frozen Wasteland NAME = Opossums on Parade
# *DOCUMENTATION* # *DOCUMENTATION*
# To see a list of typical targets execute "make help" # To see a list of typical targets execute "make help"
@@ -929,11 +929,14 @@ CC_FLAGS_LTO += -fvisibility=hidden
# Limit inlining across translation units to reduce binary size # Limit inlining across translation units to reduce binary size
KBUILD_LDFLAGS += -mllvm -import-instr-limit=5 KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
# Check for frame size exceeding threshold during prolog/epilog insertion. # Check for frame size exceeding threshold during prolog/epilog insertion
# when using lld < 13.0.0.
ifneq ($(CONFIG_FRAME_WARN),0) ifneq ($(CONFIG_FRAME_WARN),0)
ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN) KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN)
endif endif
endif endif
endif
ifdef CONFIG_LTO ifdef CONFIG_LTO
KBUILD_CFLAGS += -fno-lto $(CC_FLAGS_LTO) KBUILD_CFLAGS += -fno-lto $(CC_FLAGS_LTO)

View File

@@ -18,6 +18,7 @@
*/ */
struct sigcontext { struct sigcontext {
struct user_regs_struct regs; struct user_regs_struct regs;
struct user_regs_arcv2 v2abi;
}; };
#endif /* _ASM_ARC_SIGCONTEXT_H */ #endif /* _ASM_ARC_SIGCONTEXT_H */

View File

@@ -61,6 +61,41 @@ struct rt_sigframe {
unsigned int sigret_magic; unsigned int sigret_magic;
}; };
static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
{
int err = 0;
#ifndef CONFIG_ISA_ARCOMPACT
struct user_regs_arcv2 v2abi;
v2abi.r30 = regs->r30;
#ifdef CONFIG_ARC_HAS_ACCL_REGS
v2abi.r58 = regs->r58;
v2abi.r59 = regs->r59;
#else
v2abi.r58 = v2abi.r59 = 0;
#endif
err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi));
#endif
return err;
}
static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
{
int err = 0;
#ifndef CONFIG_ISA_ARCOMPACT
struct user_regs_arcv2 v2abi;
err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi));
regs->r30 = v2abi.r30;
#ifdef CONFIG_ARC_HAS_ACCL_REGS
regs->r58 = v2abi.r58;
regs->r59 = v2abi.r59;
#endif
#endif
return err;
}
static int static int
stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
sigset_t *set) sigset_t *set)
@@ -94,6 +129,10 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch, err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch,
sizeof(sf->uc.uc_mcontext.regs.scratch)); sizeof(sf->uc.uc_mcontext.regs.scratch));
if (is_isa_arcv2())
err |= save_arcv2_regs(&(sf->uc.uc_mcontext), regs);
err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
return err ? -EFAULT : 0; return err ? -EFAULT : 0;
@@ -109,6 +148,10 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
err |= __copy_from_user(&uregs.scratch, err |= __copy_from_user(&uregs.scratch,
&(sf->uc.uc_mcontext.regs.scratch), &(sf->uc.uc_mcontext.regs.scratch),
sizeof(sf->uc.uc_mcontext.regs.scratch)); sizeof(sf->uc.uc_mcontext.regs.scratch));
if (is_isa_arcv2())
err |= restore_arcv2_regs(&(sf->uc.uc_mcontext), regs);
if (err) if (err)
return -EFAULT; return -EFAULT;

View File

@@ -57,7 +57,6 @@ SECTIONS
.init.ramfs : { INIT_RAM_FS } .init.ramfs : { INIT_RAM_FS }
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
_stext = .;
HEAD_TEXT_SECTION HEAD_TEXT_SECTION
INIT_TEXT_SECTION(L1_CACHE_BYTES) INIT_TEXT_SECTION(L1_CACHE_BYTES)
@@ -83,6 +82,7 @@ SECTIONS
.text : { .text : {
_text = .; _text = .;
_stext = .;
TEXT_TEXT TEXT_TEXT
SCHED_TEXT SCHED_TEXT
CPUIDLE_TEXT CPUIDLE_TEXT

View File

@@ -105,9 +105,13 @@
phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
phy-reset-duration = <20>; phy-reset-duration = <20>;
phy-supply = <&sw2_reg>; phy-supply = <&sw2_reg>;
phy-handle = <&ethphy0>;
status = "okay"; status = "okay";
fixed-link {
speed = <1000>;
full-duplex;
};
mdio { mdio {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;

View File

@@ -406,6 +406,18 @@
vin-supply = <&sw1_reg>; vin-supply = <&sw1_reg>;
}; };
&reg_pu {
vin-supply = <&sw1_reg>;
};
&reg_vdd1p1 {
vin-supply = <&sw2_reg>;
};
&reg_vdd2p5 {
vin-supply = <&sw2_reg>;
};
&uart1 { &uart1 {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>; pinctrl-0 = <&pinctrl_uart1>;

View File

@@ -126,7 +126,7 @@
compatible = "nxp,pca8574"; compatible = "nxp,pca8574";
reg = <0x3a>; reg = <0x3a>;
gpio-controller; gpio-controller;
#gpio-cells = <1>; #gpio-cells = <2>;
}; };
}; };

View File

@@ -193,7 +193,7 @@
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usdhc1>; pinctrl-0 = <&pinctrl_usdhc1>;
keep-power-in-suspend; keep-power-in-suspend;
tuning-step = <2>; fsl,tuning-step = <2>;
vmmc-supply = <&reg_3p3v>; vmmc-supply = <&reg_3p3v>;
no-1-8-v; no-1-8-v;
broken-cd; broken-cd;

View File

@@ -351,7 +351,7 @@
pinctrl-2 = <&pinctrl_usdhc1_200mhz>; pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
bus-width = <4>; bus-width = <4>;
tuning-step = <2>; fsl,tuning-step = <2>;
vmmc-supply = <&reg_3p3v>; vmmc-supply = <&reg_3p3v>;
wakeup-source; wakeup-source;
no-1-8-v; no-1-8-v;

View File

@@ -7,9 +7,11 @@
#ifdef CONFIG_CPU_IDLE #ifdef CONFIG_CPU_IDLE
extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev, extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index); struct cpuidle_driver *drv, int index);
#define __cpuidle_method_section __used __section("__cpuidle_method_of_table")
#else #else
static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev, static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index) { return -ENODEV; } struct cpuidle_driver *drv, int index) { return -ENODEV; }
#define __cpuidle_method_section __maybe_unused /* drop silently */
#endif #endif
/* Common ARM WFI state */ /* Common ARM WFI state */
@@ -42,8 +44,7 @@ struct of_cpuidle_method {
#define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops) \ #define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops) \
static const struct of_cpuidle_method __cpuidle_method_of_table_##name \ static const struct of_cpuidle_method __cpuidle_method_of_table_##name \
__used __section("__cpuidle_method_of_table") \ __cpuidle_method_section = { .method = _method, .ops = _ops }
= { .method = _method, .ops = _ops }
extern int arm_cpuidle_suspend(int index); extern int arm_cpuidle_suspend(int index);

View File

@@ -545,9 +545,11 @@ void notrace cpu_init(void)
* In Thumb-2, msr with an immediate value is not allowed. * In Thumb-2, msr with an immediate value is not allowed.
*/ */
#ifdef CONFIG_THUMB2_KERNEL #ifdef CONFIG_THUMB2_KERNEL
#define PLC "r" #define PLC_l "l"
#define PLC_r "r"
#else #else
#define PLC "I" #define PLC_l "I"
#define PLC_r "I"
#endif #endif
/* /*
@@ -569,15 +571,15 @@ void notrace cpu_init(void)
"msr cpsr_c, %9" "msr cpsr_c, %9"
: :
: "r" (stk), : "r" (stk),
PLC (PSR_F_BIT | PSR_I_BIT | IRQ_MODE), PLC_r (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
"I" (offsetof(struct stack, irq[0])), "I" (offsetof(struct stack, irq[0])),
PLC (PSR_F_BIT | PSR_I_BIT | ABT_MODE), PLC_r (PSR_F_BIT | PSR_I_BIT | ABT_MODE),
"I" (offsetof(struct stack, abt[0])), "I" (offsetof(struct stack, abt[0])),
PLC (PSR_F_BIT | PSR_I_BIT | UND_MODE), PLC_r (PSR_F_BIT | PSR_I_BIT | UND_MODE),
"I" (offsetof(struct stack, und[0])), "I" (offsetof(struct stack, und[0])),
PLC (PSR_F_BIT | PSR_I_BIT | FIQ_MODE), PLC_r (PSR_F_BIT | PSR_I_BIT | FIQ_MODE),
"I" (offsetof(struct stack, fiq[0])), "I" (offsetof(struct stack, fiq[0])),
PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE) PLC_l (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
: "r14"); : "r14");
#endif #endif
} }

View File

@@ -12,6 +12,7 @@
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/io.h> #include <linux/io.h>
#include "common.h"
#include "hardware.h" #include "hardware.h"
static int mx27_suspend_enter(suspend_state_t state) static int mx27_suspend_enter(suspend_state_t state)

View File

@@ -458,20 +458,6 @@ static struct gpiod_lookup_table leds_gpio_table = {
#ifdef CONFIG_LEDS_TRIGGERS #ifdef CONFIG_LEDS_TRIGGERS
DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger); DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger);
static int ams_delta_camera_power(struct device *dev, int power)
{
/*
* turn on camera LED
*/
if (power)
led_trigger_event(ams_delta_camera_led_trigger, LED_FULL);
else
led_trigger_event(ams_delta_camera_led_trigger, LED_OFF);
return 0;
}
#else
#define ams_delta_camera_power NULL
#endif #endif
static struct platform_device ams_delta_audio_device = { static struct platform_device ams_delta_audio_device = {

View File

@@ -394,6 +394,8 @@ static void __init h2_init(void)
BUG_ON(gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0); BUG_ON(gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0);
gpio_direction_input(H2_NAND_RB_GPIO_PIN); gpio_direction_input(H2_NAND_RB_GPIO_PIN);
gpiod_add_lookup_table(&isp1301_gpiod_table);
omap_cfg_reg(L3_1610_FLASH_CS2B_OE); omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
omap_cfg_reg(M8_1610_FLASH_CS2B_WE); omap_cfg_reg(M8_1610_FLASH_CS2B_WE);

View File

@@ -655,9 +655,13 @@ static int __init omap_pm_init(void)
irq = INT_7XX_WAKE_UP_REQ; irq = INT_7XX_WAKE_UP_REQ;
else if (cpu_is_omap16xx()) else if (cpu_is_omap16xx())
irq = INT_1610_WAKE_UP_REQ; irq = INT_1610_WAKE_UP_REQ;
if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", else
NULL)) irq = -1;
if (irq >= 0) {
if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", NULL))
pr_err("Failed to request irq %d (peripheral wakeup)\n", irq); pr_err("Failed to request irq %d (peripheral wakeup)\n", irq);
}
/* Program new power ramp-up time /* Program new power ramp-up time
* (0 for most boards since we don't lower voltage when in deep sleep) * (0 for most boards since we don't lower voltage when in deep sleep)

View File

@@ -322,6 +322,7 @@ static int n8x0_mmc_get_cover_state(struct device *dev, int slot)
static void n8x0_mmc_callback(void *data, u8 card_mask) static void n8x0_mmc_callback(void *data, u8 card_mask)
{ {
#ifdef CONFIG_MMC_OMAP
int bit, *openp, index; int bit, *openp, index;
if (board_is_n800()) { if (board_is_n800()) {
@@ -339,7 +340,6 @@ static void n8x0_mmc_callback(void *data, u8 card_mask)
else else
*openp = 0; *openp = 0;
#ifdef CONFIG_MMC_OMAP
omap_mmc_notify_cover_event(mmc_device, index, *openp); omap_mmc_notify_cover_event(mmc_device, index, *openp);
#else #else
pr_warn("MMC: notify cover event not available\n"); pr_warn("MMC: notify cover event not available\n");

View File

@@ -165,6 +165,7 @@ config ARCH_MEDIATEK
config ARCH_MESON config ARCH_MESON
bool "Amlogic Platforms" bool "Amlogic Platforms"
select COMMON_CLK
select MESON_IRQ_GPIO select MESON_IRQ_GPIO
help help
This enables support for the arm64 based Amlogic SoCs This enables support for the arm64 based Amlogic SoCs

View File

@@ -46,7 +46,8 @@
eee-broken-100tx; eee-broken-100tx;
qca,clk-out-frequency = <125000000>; qca,clk-out-frequency = <125000000>;
qca,clk-out-strength = <AR803X_STRENGTH_FULL>; qca,clk-out-strength = <AR803X_STRENGTH_FULL>;
vddio-supply = <&vddh>; qca,keep-pll-enabled;
vddio-supply = <&vddio>;
vddio: vddio-regulator { vddio: vddio-regulator {
regulator-name = "VDDIO"; regulator-name = "VDDIO";

View File

@@ -31,11 +31,10 @@
reg = <0x4>; reg = <0x4>;
eee-broken-1000t; eee-broken-1000t;
eee-broken-100tx; eee-broken-100tx;
qca,clk-out-frequency = <125000000>; qca,clk-out-frequency = <125000000>;
qca,clk-out-strength = <AR803X_STRENGTH_FULL>; qca,clk-out-strength = <AR803X_STRENGTH_FULL>;
qca,keep-pll-enabled;
vddio-supply = <&vddh>; vddio-supply = <&vddio>;
vddio: vddio-regulator { vddio: vddio-regulator {
regulator-name = "VDDIO"; regulator-name = "VDDIO";

View File

@@ -197,8 +197,8 @@
ddr: memory-controller@1080000 { ddr: memory-controller@1080000 {
compatible = "fsl,qoriq-memory-controller"; compatible = "fsl,qoriq-memory-controller";
reg = <0x0 0x1080000 0x0 0x1000>; reg = <0x0 0x1080000 0x0 0x1000>;
interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>; interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
big-endian; little-endian;
}; };
dcfg: syscon@1e00000 { dcfg: syscon@1e00000 {

View File

@@ -88,11 +88,11 @@
pinctrl-0 = <&pinctrl_codec2>; pinctrl-0 = <&pinctrl_codec2>;
reg = <0x18>; reg = <0x18>;
#sound-dai-cells = <0>; #sound-dai-cells = <0>;
HPVDD-supply = <&reg_3p3v>; HPVDD-supply = <&reg_gen_3p3>;
SPRVDD-supply = <&reg_3p3v>; SPRVDD-supply = <&reg_gen_3p3>;
SPLVDD-supply = <&reg_3p3v>; SPLVDD-supply = <&reg_gen_3p3>;
AVDD-supply = <&reg_3p3v>; AVDD-supply = <&reg_gen_3p3>;
IOVDD-supply = <&reg_3p3v>; IOVDD-supply = <&reg_gen_3p3>;
DVDD-supply = <&vgen4_reg>; DVDD-supply = <&vgen4_reg>;
reset-gpios = <&gpio3 4 GPIO_ACTIVE_HIGH>; reset-gpios = <&gpio3 4 GPIO_ACTIVE_HIGH>;
}; };

View File

@@ -45,8 +45,8 @@
reg_12p0_main: regulator-12p0-main { reg_12p0_main: regulator-12p0-main {
compatible = "regulator-fixed"; compatible = "regulator-fixed";
regulator-name = "12V_MAIN"; regulator-name = "12V_MAIN";
regulator-min-microvolt = <5000000>; regulator-min-microvolt = <12000000>;
regulator-max-microvolt = <5000000>; regulator-max-microvolt = <12000000>;
regulator-always-on; regulator-always-on;
}; };
@@ -77,15 +77,6 @@
regulator-always-on; regulator-always-on;
}; };
reg_3p3v: regulator-3p3v {
compatible = "regulator-fixed";
vin-supply = <&reg_3p3_main>;
regulator-name = "GEN_3V3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
reg_usdhc2_vmmc: regulator-vsd-3v3 { reg_usdhc2_vmmc: regulator-vsd-3v3 {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&pinctrl_reg_usdhc2>; pinctrl-0 = <&pinctrl_reg_usdhc2>;
@@ -415,11 +406,11 @@
pinctrl-0 = <&pinctrl_codec1>; pinctrl-0 = <&pinctrl_codec1>;
reg = <0x18>; reg = <0x18>;
#sound-dai-cells = <0>; #sound-dai-cells = <0>;
HPVDD-supply = <&reg_3p3v>; HPVDD-supply = <&reg_gen_3p3>;
SPRVDD-supply = <&reg_3p3v>; SPRVDD-supply = <&reg_gen_3p3>;
SPLVDD-supply = <&reg_3p3v>; SPLVDD-supply = <&reg_gen_3p3>;
AVDD-supply = <&reg_3p3v>; AVDD-supply = <&reg_gen_3p3>;
IOVDD-supply = <&reg_3p3v>; IOVDD-supply = <&reg_gen_3p3>;
DVDD-supply = <&vgen4_reg>; DVDD-supply = <&vgen4_reg>;
reset-gpios = <&gpio3 3 GPIO_ACTIVE_LOW>; reset-gpios = <&gpio3 3 GPIO_ACTIVE_LOW>;
}; };

View File

@@ -42,12 +42,12 @@
}; };
}; };
dmss: dmss { dmss: bus@48000000 {
compatible = "simple-mfd"; compatible = "simple-mfd";
#address-cells = <2>; #address-cells = <2>;
#size-cells = <2>; #size-cells = <2>;
dma-ranges; dma-ranges;
ranges; ranges = <0x00 0x48000000 0x00 0x48000000 0x00 0x06400000>;
ti,sci-dev-id = <25>; ti,sci-dev-id = <25>;
@@ -134,7 +134,7 @@
}; };
}; };
dmsc: dmsc@44043000 { dmsc: system-controller@44043000 {
compatible = "ti,k2g-sci"; compatible = "ti,k2g-sci";
ti,host-id = <12>; ti,host-id = <12>;
mbox-names = "rx", "tx"; mbox-names = "rx", "tx";
@@ -148,7 +148,7 @@
#power-domain-cells = <2>; #power-domain-cells = <2>;
}; };
k3_clks: clocks { k3_clks: clock-controller {
compatible = "ti,k2g-sci-clk"; compatible = "ti,k2g-sci-clk";
#clock-cells = <2>; #clock-cells = <2>;
}; };
@@ -373,8 +373,9 @@
clocks = <&k3_clks 145 0>; clocks = <&k3_clks 145 0>;
}; };
main_gpio_intr: interrupt-controller0 { main_gpio_intr: interrupt-controller@a00000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x00 0x00a00000 0x00 0x800>;
ti,intr-trigger-type = <1>; ti,intr-trigger-type = <1>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;

View File

@@ -74,8 +74,9 @@
clocks = <&k3_clks 148 0>; clocks = <&k3_clks 148 0>;
}; };
mcu_gpio_intr: interrupt-controller1 { mcu_gpio_intr: interrupt-controller@4210000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x00 0x04210000 0x00 0x200>;
ti,intr-trigger-type = <1>; ti,intr-trigger-type = <1>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;

View File

@@ -433,8 +433,9 @@
#phy-cells = <0>; #phy-cells = <0>;
}; };
intr_main_gpio: interrupt-controller0 { intr_main_gpio: interrupt-controller@a00000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x0 0x00a00000 0x0 0x400>;
ti,intr-trigger-type = <1>; ti,intr-trigger-type = <1>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;
@@ -444,18 +445,19 @@
ti,interrupt-ranges = <0 392 32>; ti,interrupt-ranges = <0 392 32>;
}; };
main-navss { main_navss: bus@30800000 {
compatible = "simple-mfd"; compatible = "simple-mfd";
#address-cells = <2>; #address-cells = <2>;
#size-cells = <2>; #size-cells = <2>;
ranges; ranges = <0x0 0x30800000 0x0 0x30800000 0x0 0xbc00000>;
dma-coherent; dma-coherent;
dma-ranges; dma-ranges;
ti,sci-dev-id = <118>; ti,sci-dev-id = <118>;
intr_main_navss: interrupt-controller1 { intr_main_navss: interrupt-controller@310e0000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x0 0x310e0000 0x0 0x2000>;
ti,intr-trigger-type = <4>; ti,intr-trigger-type = <4>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;

View File

@@ -116,11 +116,11 @@
}; };
}; };
mcu-navss { mcu_navss: bus@28380000 {
compatible = "simple-mfd"; compatible = "simple-mfd";
#address-cells = <2>; #address-cells = <2>;
#size-cells = <2>; #size-cells = <2>;
ranges; ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>;
dma-coherent; dma-coherent;
dma-ranges; dma-ranges;

View File

@@ -6,24 +6,24 @@
*/ */
&cbass_wakeup { &cbass_wakeup {
dmsc: dmsc { dmsc: system-controller@44083000 {
compatible = "ti,am654-sci"; compatible = "ti,am654-sci";
ti,host-id = <12>; ti,host-id = <12>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
mbox-names = "rx", "tx"; mbox-names = "rx", "tx";
mboxes= <&secure_proxy_main 11>, mboxes= <&secure_proxy_main 11>,
<&secure_proxy_main 13>; <&secure_proxy_main 13>;
reg-names = "debug_messages";
reg = <0x44083000 0x1000>;
k3_pds: power-controller { k3_pds: power-controller {
compatible = "ti,sci-pm-domain"; compatible = "ti,sci-pm-domain";
#power-domain-cells = <2>; #power-domain-cells = <2>;
}; };
k3_clks: clocks { k3_clks: clock-controller {
compatible = "ti,k2g-sci-clk"; compatible = "ti,k2g-sci-clk";
#clock-cells = <2>; #clock-cells = <2>;
}; };
@@ -69,8 +69,9 @@
power-domains = <&k3_pds 115 TI_SCI_PD_EXCLUSIVE>; power-domains = <&k3_pds 115 TI_SCI_PD_EXCLUSIVE>;
}; };
intr_wkup_gpio: interrupt-controller2 { intr_wkup_gpio: interrupt-controller@42200000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x42200000 0x200>;
ti,intr-trigger-type = <1>; ti,intr-trigger-type = <1>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;

View File

@@ -85,12 +85,6 @@
gpios = <&wkup_gpio0 27 GPIO_ACTIVE_LOW>; gpios = <&wkup_gpio0 27 GPIO_ACTIVE_LOW>;
}; };
}; };
clk_ov5640_fixed: clock {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24000000>;
};
}; };
&wkup_pmx0 { &wkup_pmx0 {
@@ -287,23 +281,6 @@
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&main_i2c1_pins_default>; pinctrl-0 = <&main_i2c1_pins_default>;
clock-frequency = <400000>; clock-frequency = <400000>;
ov5640: camera@3c {
compatible = "ovti,ov5640";
reg = <0x3c>;
clocks = <&clk_ov5640_fixed>;
clock-names = "xclk";
port {
csi2_cam0: endpoint {
remote-endpoint = <&csi2_phy0>;
clock-lanes = <0>;
data-lanes = <1 2>;
};
};
};
}; };
&main_i2c2 { &main_i2c2 {
@@ -496,14 +473,6 @@
}; };
}; };
&csi2_0 {
csi2_phy0: endpoint {
remote-endpoint = <&csi2_cam0>;
clock-lanes = <0>;
data-lanes = <1 2>;
};
};
&mcu_cpsw { &mcu_cpsw {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>; pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;

View File

@@ -68,8 +68,9 @@
}; };
}; };
main_gpio_intr: interrupt-controller0 { main_gpio_intr: interrupt-controller@a00000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x00 0x00a00000 0x00 0x800>;
ti,intr-trigger-type = <1>; ti,intr-trigger-type = <1>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;
@@ -85,9 +86,12 @@
#size-cells = <2>; #size-cells = <2>;
ranges = <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>; ranges = <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>;
ti,sci-dev-id = <199>; ti,sci-dev-id = <199>;
dma-coherent;
dma-ranges;
main_navss_intr: interrupt-controller1 { main_navss_intr: interrupt-controller@310e0000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x00 0x310e0000 0x00 0x4000>;
ti,intr-trigger-type = <4>; ti,intr-trigger-type = <4>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;

View File

@@ -6,7 +6,7 @@
*/ */
&cbass_mcu_wakeup { &cbass_mcu_wakeup {
dmsc: dmsc@44083000 { dmsc: system-controller@44083000 {
compatible = "ti,k2g-sci"; compatible = "ti,k2g-sci";
ti,host-id = <12>; ti,host-id = <12>;
@@ -23,7 +23,7 @@
#power-domain-cells = <2>; #power-domain-cells = <2>;
}; };
k3_clks: clocks { k3_clks: clock-controller {
compatible = "ti,k2g-sci-clk"; compatible = "ti,k2g-sci-clk";
#clock-cells = <2>; #clock-cells = <2>;
}; };
@@ -96,8 +96,9 @@
clock-names = "fclk"; clock-names = "fclk";
}; };
wkup_gpio_intr: interrupt-controller2 { wkup_gpio_intr: interrupt-controller@42200000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x00 0x42200000 0x00 0x400>;
ti,intr-trigger-type = <1>; ti,intr-trigger-type = <1>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;

View File

@@ -76,8 +76,9 @@
}; };
}; };
main_gpio_intr: interrupt-controller0 { main_gpio_intr: interrupt-controller@a00000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x00 0x00a00000 0x00 0x800>;
ti,intr-trigger-type = <1>; ti,intr-trigger-type = <1>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;
@@ -87,18 +88,19 @@
ti,interrupt-ranges = <8 392 56>; ti,interrupt-ranges = <8 392 56>;
}; };
main-navss { main_navss: bus@30000000 {
compatible = "simple-mfd"; compatible = "simple-mfd";
#address-cells = <2>; #address-cells = <2>;
#size-cells = <2>; #size-cells = <2>;
ranges; ranges = <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>;
dma-coherent; dma-coherent;
dma-ranges; dma-ranges;
ti,sci-dev-id = <199>; ti,sci-dev-id = <199>;
main_navss_intr: interrupt-controller1 { main_navss_intr: interrupt-controller@310e0000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x0 0x310e0000 0x0 0x4000>;
ti,intr-trigger-type = <4>; ti,intr-trigger-type = <4>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;

View File

@@ -6,7 +6,7 @@
*/ */
&cbass_mcu_wakeup { &cbass_mcu_wakeup {
dmsc: dmsc@44083000 { dmsc: system-controller@44083000 {
compatible = "ti,k2g-sci"; compatible = "ti,k2g-sci";
ti,host-id = <12>; ti,host-id = <12>;
@@ -23,7 +23,7 @@
#power-domain-cells = <2>; #power-domain-cells = <2>;
}; };
k3_clks: clocks { k3_clks: clock-controller {
compatible = "ti,k2g-sci-clk"; compatible = "ti,k2g-sci-clk";
#clock-cells = <2>; #clock-cells = <2>;
}; };
@@ -96,8 +96,9 @@
clock-names = "fclk"; clock-names = "fclk";
}; };
wkup_gpio_intr: interrupt-controller2 { wkup_gpio_intr: interrupt-controller@42200000 {
compatible = "ti,sci-intr"; compatible = "ti,sci-intr";
reg = <0x00 0x42200000 0x00 0x400>;
ti,intr-trigger-type = <1>; ti,intr-trigger-type = <1>;
interrupt-controller; interrupt-controller;
interrupt-parent = <&gic500>; interrupt-parent = <&gic500>;
@@ -249,11 +250,11 @@
}; };
}; };
mcu-navss { mcu_navss: bus@28380000 {
compatible = "simple-mfd"; compatible = "simple-mfd";
#address-cells = <2>; #address-cells = <2>;
#size-cells = <2>; #size-cells = <2>;
ranges; ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>;
dma-coherent; dma-coherent;
dma-ranges; dma-ranges;

View File

@@ -158,31 +158,29 @@ unsigned long _page_cachable_default;
EXPORT_SYMBOL(_page_cachable_default); EXPORT_SYMBOL(_page_cachable_default);
#define PM(p) __pgprot(_page_cachable_default | (p)) #define PM(p) __pgprot(_page_cachable_default | (p))
#define PVA(p) PM(_PAGE_VALID | _PAGE_ACCESSED | (p))
static inline void setup_protection_map(void) static inline void setup_protection_map(void)
{ {
protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
protection_map[1] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC); protection_map[1] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
protection_map[2] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); protection_map[2] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
protection_map[3] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC); protection_map[3] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
protection_map[4] = PVA(_PAGE_PRESENT); protection_map[4] = PM(_PAGE_PRESENT);
protection_map[5] = PVA(_PAGE_PRESENT); protection_map[5] = PM(_PAGE_PRESENT);
protection_map[6] = PVA(_PAGE_PRESENT); protection_map[6] = PM(_PAGE_PRESENT);
protection_map[7] = PVA(_PAGE_PRESENT); protection_map[7] = PM(_PAGE_PRESENT);
protection_map[8] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); protection_map[8] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
protection_map[9] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC); protection_map[9] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
protection_map[10] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | protection_map[10] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE |
_PAGE_NO_READ); _PAGE_NO_READ);
protection_map[11] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); protection_map[11] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
protection_map[12] = PVA(_PAGE_PRESENT); protection_map[12] = PM(_PAGE_PRESENT);
protection_map[13] = PVA(_PAGE_PRESENT); protection_map[13] = PM(_PAGE_PRESENT);
protection_map[14] = PVA(_PAGE_PRESENT); protection_map[14] = PM(_PAGE_PRESENT | _PAGE_WRITE);
protection_map[15] = PVA(_PAGE_PRESENT); protection_map[15] = PM(_PAGE_PRESENT | _PAGE_WRITE);
} }
#undef _PVA
#undef PM #undef PM
void cpu_cache_init(void) void cpu_cache_init(void)

View File

@@ -50,7 +50,7 @@ l_yes:
1098: nop; \ 1098: nop; \
.pushsection __jump_table, "aw"; \ .pushsection __jump_table, "aw"; \
.long 1098b - ., LABEL - .; \ .long 1098b - ., LABEL - .; \
FTR_ENTRY_LONG KEY; \ FTR_ENTRY_LONG KEY - .; \
.popsection .popsection
#endif #endif

View File

@@ -31,6 +31,35 @@ static inline pte_t *find_init_mm_pte(unsigned long ea, unsigned *hshift)
pgd_t *pgdir = init_mm.pgd; pgd_t *pgdir = init_mm.pgd;
return __find_linux_pte(pgdir, ea, NULL, hshift); return __find_linux_pte(pgdir, ea, NULL, hshift);
} }
/*
* Convert a kernel vmap virtual address (vmalloc or ioremap space) to a
* physical address, without taking locks. This can be used in real-mode.
*/
static inline phys_addr_t ppc_find_vmap_phys(unsigned long addr)
{
pte_t *ptep;
phys_addr_t pa;
int hugepage_shift;
/*
* init_mm does not free page tables, and does not do THP. It may
* have huge pages from huge vmalloc / ioremap etc.
*/
ptep = find_init_mm_pte(addr, &hugepage_shift);
if (WARN_ON(!ptep))
return 0;
pa = PFN_PHYS(pte_pfn(*ptep));
if (!hugepage_shift)
hugepage_shift = PAGE_SHIFT;
pa |= addr & ((1ul << hugepage_shift) - 1);
return pa;
}
/* /*
* This is what we should always use. Any other lockless page table lookup needs * This is what we should always use. Any other lockless page table lookup needs
* careful audit against THP split. * careful audit against THP split.

View File

@@ -346,28 +346,7 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity)
*/ */
static inline unsigned long eeh_token_to_phys(unsigned long token) static inline unsigned long eeh_token_to_phys(unsigned long token)
{ {
pte_t *ptep; return ppc_find_vmap_phys(token);
unsigned long pa;
int hugepage_shift;
/*
* We won't find hugepages here(this is iomem). Hence we are not
* worried about _PAGE_SPLITTING/collapse. Also we will not hit
* page table free, because of init_mm.
*/
ptep = find_init_mm_pte(token, &hugepage_shift);
if (!ptep)
return token;
pa = pte_pfn(*ptep);
/* On radix we can do hugepage mappings for io, so handle that */
if (!hugepage_shift)
hugepage_shift = PAGE_SHIFT;
pa <<= PAGE_SHIFT;
pa |= token & ((1ul << hugepage_shift) - 1);
return pa;
} }
/* /*

View File

@@ -55,7 +55,6 @@ static struct iowa_bus *iowa_pci_find(unsigned long vaddr, unsigned long paddr)
#ifdef CONFIG_PPC_INDIRECT_MMIO #ifdef CONFIG_PPC_INDIRECT_MMIO
struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr) struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
{ {
unsigned hugepage_shift;
struct iowa_bus *bus; struct iowa_bus *bus;
int token; int token;
@@ -65,22 +64,13 @@ struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
bus = &iowa_busses[token - 1]; bus = &iowa_busses[token - 1];
else { else {
unsigned long vaddr, paddr; unsigned long vaddr, paddr;
pte_t *ptep;
vaddr = (unsigned long)PCI_FIX_ADDR(addr); vaddr = (unsigned long)PCI_FIX_ADDR(addr);
if (vaddr < PHB_IO_BASE || vaddr >= PHB_IO_END) if (vaddr < PHB_IO_BASE || vaddr >= PHB_IO_END)
return NULL; return NULL;
/*
* We won't find huge pages here (iomem). Also can't hit paddr = ppc_find_vmap_phys(vaddr);
* a page table free due to init_mm
*/
ptep = find_init_mm_pte(vaddr, &hugepage_shift);
if (ptep == NULL)
paddr = 0;
else {
WARN_ON(hugepage_shift);
paddr = pte_pfn(*ptep) << PAGE_SHIFT;
}
bus = iowa_pci_find(vaddr, paddr); bus = iowa_pci_find(vaddr, paddr);
if (bus == NULL) if (bus == NULL)

View File

@@ -898,7 +898,6 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
unsigned int order; unsigned int order;
unsigned int nio_pages, io_order; unsigned int nio_pages, io_order;
struct page *page; struct page *page;
size_t size_io = size;
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
order = get_order(size); order = get_order(size);
@@ -925,9 +924,8 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
memset(ret, 0, size); memset(ret, 0, size);
/* Set up tces to cover the allocated range */ /* Set up tces to cover the allocated range */
size_io = IOMMU_PAGE_ALIGN(size_io, tbl); nio_pages = size >> tbl->it_page_shift;
nio_pages = size_io >> tbl->it_page_shift; io_order = get_iommu_order(size, tbl);
io_order = get_iommu_order(size_io, tbl);
mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL, mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL,
mask >> tbl->it_page_shift, io_order, 0); mask >> tbl->it_page_shift, io_order, 0);
if (mapping == DMA_MAPPING_ERROR) { if (mapping == DMA_MAPPING_ERROR) {
@@ -942,9 +940,10 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t size,
void *vaddr, dma_addr_t dma_handle) void *vaddr, dma_addr_t dma_handle)
{ {
if (tbl) { if (tbl) {
size_t size_io = IOMMU_PAGE_ALIGN(size, tbl); unsigned int nio_pages;
unsigned int nio_pages = size_io >> tbl->it_page_shift;
size = PAGE_ALIGN(size);
nio_pages = size >> tbl->it_page_shift;
iommu_free(tbl, dma_handle, nio_pages); iommu_free(tbl, dma_handle, nio_pages);
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
free_pages((unsigned long)vaddr, get_order(size)); free_pages((unsigned long)vaddr, get_order(size));

View File

@@ -108,7 +108,6 @@ int arch_prepare_kprobe(struct kprobe *p)
int ret = 0; int ret = 0;
struct kprobe *prev; struct kprobe *prev;
struct ppc_inst insn = ppc_inst_read((struct ppc_inst *)p->addr); struct ppc_inst insn = ppc_inst_read((struct ppc_inst *)p->addr);
struct ppc_inst prefix = ppc_inst_read((struct ppc_inst *)(p->addr - 1));
if ((unsigned long)p->addr & 0x03) { if ((unsigned long)p->addr & 0x03) {
printk("Attempt to register kprobe at an unaligned address\n"); printk("Attempt to register kprobe at an unaligned address\n");
@@ -116,7 +115,8 @@ int arch_prepare_kprobe(struct kprobe *p)
} else if (IS_MTMSRD(insn) || IS_RFID(insn) || IS_RFI(insn)) { } else if (IS_MTMSRD(insn) || IS_RFID(insn) || IS_RFI(insn)) {
printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n"); printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n");
ret = -EINVAL; ret = -EINVAL;
} else if (ppc_inst_prefixed(prefix)) { } else if ((unsigned long)p->addr & ~PAGE_MASK &&
ppc_inst_prefixed(ppc_inst_read((struct ppc_inst *)(p->addr - 1)))) {
printk("Cannot register a kprobe on the second word of prefixed instruction\n"); printk("Cannot register a kprobe on the second word of prefixed instruction\n");
ret = -EINVAL; ret = -EINVAL;
} }

View File

@@ -902,6 +902,10 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
unsafe_copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set), badframe_block); unsafe_copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set), badframe_block);
user_write_access_end(); user_write_access_end();
/* Save the siginfo outside of the unsafe block. */
if (copy_siginfo_to_user(&frame->info, &ksig->info))
goto badframe;
/* Make sure signal handler doesn't get spurious FP exceptions */ /* Make sure signal handler doesn't get spurious FP exceptions */
tsk->thread.fp_state.fpscr = 0; tsk->thread.fp_state.fpscr = 0;
@@ -915,11 +919,6 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
regs->nip = (unsigned long) &frame->tramp[0]; regs->nip = (unsigned long) &frame->tramp[0];
} }
/* Save the siginfo outside of the unsafe block. */
if (copy_siginfo_to_user(&frame->info, &ksig->info))
goto badframe;
/* Allocate a dummy caller frame for the signal handler. */ /* Allocate a dummy caller frame for the signal handler. */
newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE; newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE;
err |= put_user(regs->gpr[1], (unsigned long __user *)newsp); err |= put_user(regs->gpr[1], (unsigned long __user *)newsp);

View File

@@ -4455,7 +4455,6 @@ static int kvmppc_vcpu_run_hv(struct kvm_vcpu *vcpu)
mtspr(SPRN_EBBRR, ebb_regs[1]); mtspr(SPRN_EBBRR, ebb_regs[1]);
mtspr(SPRN_BESCR, ebb_regs[2]); mtspr(SPRN_BESCR, ebb_regs[2]);
mtspr(SPRN_TAR, user_tar); mtspr(SPRN_TAR, user_tar);
mtspr(SPRN_FSCR, current->thread.fscr);
} }
mtspr(SPRN_VRSAVE, user_vrsave); mtspr(SPRN_VRSAVE, user_vrsave);

View File

@@ -23,20 +23,9 @@
#include <asm/pte-walk.h> #include <asm/pte-walk.h>
/* Translate address of a vmalloc'd thing to a linear map address */ /* Translate address of a vmalloc'd thing to a linear map address */
static void *real_vmalloc_addr(void *x) static void *real_vmalloc_addr(void *addr)
{ {
unsigned long addr = (unsigned long) x; return __va(ppc_find_vmap_phys((unsigned long)addr));
pte_t *p;
/*
* assume we don't have huge pages in vmalloc space...
* So don't worry about THP collapse/split. Called
* Only in realmode with MSR_EE = 0, hence won't need irq_save/restore.
*/
p = find_init_mm_pte(addr, NULL);
if (!p || !pte_present(*p))
return NULL;
addr = (pte_pfn(*p) << PAGE_SHIFT) | (addr & ~PAGE_MASK);
return __va(addr);
} }
/* Return 1 if we need to do a global tlbie, 0 if we can use tlbiel */ /* Return 1 if we need to do a global tlbie, 0 if we can use tlbiel */

View File

@@ -59,6 +59,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300)
#define STACK_SLOT_UAMOR (SFS-88) #define STACK_SLOT_UAMOR (SFS-88)
#define STACK_SLOT_DAWR1 (SFS-96) #define STACK_SLOT_DAWR1 (SFS-96)
#define STACK_SLOT_DAWRX1 (SFS-104) #define STACK_SLOT_DAWRX1 (SFS-104)
#define STACK_SLOT_FSCR (SFS-112)
/* the following is used by the P9 short path */ /* the following is used by the P9 short path */
#define STACK_SLOT_NVGPRS (SFS-152) /* 18 gprs */ #define STACK_SLOT_NVGPRS (SFS-152) /* 18 gprs */
@@ -686,6 +687,8 @@ BEGIN_FTR_SECTION
std r6, STACK_SLOT_DAWR0(r1) std r6, STACK_SLOT_DAWR0(r1)
std r7, STACK_SLOT_DAWRX0(r1) std r7, STACK_SLOT_DAWRX0(r1)
std r8, STACK_SLOT_IAMR(r1) std r8, STACK_SLOT_IAMR(r1)
mfspr r5, SPRN_FSCR
std r5, STACK_SLOT_FSCR(r1)
END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
BEGIN_FTR_SECTION BEGIN_FTR_SECTION
mfspr r6, SPRN_DAWR1 mfspr r6, SPRN_DAWR1
@@ -1663,6 +1666,10 @@ FTR_SECTION_ELSE
ld r7, STACK_SLOT_HFSCR(r1) ld r7, STACK_SLOT_HFSCR(r1)
mtspr SPRN_HFSCR, r7 mtspr SPRN_HFSCR, r7
ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300) ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300)
BEGIN_FTR_SECTION
ld r5, STACK_SLOT_FSCR(r1)
mtspr SPRN_FSCR, r5
END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
/* /*
* Restore various registers to 0, where non-zero values * Restore various registers to 0, where non-zero values
* set by the guest could disrupt the host. * set by the guest could disrupt the host.

View File

@@ -20,6 +20,7 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/rtas.h> #include <asm/rtas.h>
#include <asm/kasan.h> #include <asm/kasan.h>
#include <asm/sparsemem.h>
#include <asm/svm.h> #include <asm/svm.h>
#include <mm/mmu_decl.h> #include <mm/mmu_decl.h>

View File

@@ -2254,7 +2254,7 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs)
bool use_siar = regs_use_siar(regs); bool use_siar = regs_use_siar(regs);
unsigned long siar = mfspr(SPRN_SIAR); unsigned long siar = mfspr(SPRN_SIAR);
if (ppmu->flags & PPMU_P10_DD1) { if (ppmu && (ppmu->flags & PPMU_P10_DD1)) {
if (siar) if (siar)
return siar; return siar;
else else

View File

@@ -61,11 +61,11 @@ config RISCV
select GENERIC_TIME_VSYSCALL if MMU && 64BIT select GENERIC_TIME_VSYSCALL if MMU && 64BIT
select HANDLE_DOMAIN_IRQ select HANDLE_DOMAIN_IRQ
select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
select HAVE_ARCH_JUMP_LABEL_RELATIVE select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
select HAVE_ARCH_KASAN if MMU && 64BIT select HAVE_ARCH_KASAN if MMU && 64BIT
select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
select HAVE_ARCH_KGDB select HAVE_ARCH_KGDB if !XIP_KERNEL
select HAVE_ARCH_KGDB_QXFER_PKT select HAVE_ARCH_KGDB_QXFER_PKT
select HAVE_ARCH_MMAP_RND_BITS if MMU select HAVE_ARCH_MMAP_RND_BITS if MMU
select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_SECCOMP_FILTER
@@ -80,9 +80,9 @@ config RISCV
select HAVE_GCC_PLUGINS select HAVE_GCC_PLUGINS
select HAVE_GENERIC_VDSO if MMU && 64BIT select HAVE_GENERIC_VDSO if MMU && 64BIT
select HAVE_IRQ_TIME_ACCOUNTING select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_KPROBES select HAVE_KPROBES if !XIP_KERNEL
select HAVE_KPROBES_ON_FTRACE select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
select HAVE_KRETPROBES select HAVE_KRETPROBES if !XIP_KERNEL
select HAVE_PCI select HAVE_PCI
select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS
select HAVE_PERF_REGS select HAVE_PERF_REGS
@@ -231,11 +231,11 @@ config ARCH_RV64I
bool "RV64I" bool "RV64I"
select 64BIT select 64BIT
select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000
select HAVE_DYNAMIC_FTRACE if MMU && $(cc-option,-fpatchable-function-entry=8) select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
select HAVE_FTRACE_MCOUNT_RECORD select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_TRACER if !XIP_KERNEL
select SWIOTLB if MMU select SWIOTLB if MMU
endchoice endchoice

View File

@@ -14,6 +14,7 @@ config SOC_SIFIVE
select CLK_SIFIVE select CLK_SIFIVE
select CLK_SIFIVE_PRCI select CLK_SIFIVE_PRCI
select SIFIVE_PLIC select SIFIVE_PLIC
select RISCV_ERRATA_ALTERNATIVE
select ERRATA_SIFIVE select ERRATA_SIFIVE
help help
This enables support for SiFive SoC platform hardware. This enables support for SiFive SoC platform hardware.

View File

@@ -16,7 +16,7 @@ ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
CC_FLAGS_FTRACE := -fpatchable-function-entry=8 CC_FLAGS_FTRACE := -fpatchable-function-entry=8
endif endif
ifeq ($(CONFIG_64BIT)$(CONFIG_CMODEL_MEDLOW),yy) ifeq ($(CONFIG_CMODEL_MEDLOW),y)
KBUILD_CFLAGS_MODULE += -mcmodel=medany KBUILD_CFLAGS_MODULE += -mcmodel=medany
endif endif
@@ -38,6 +38,15 @@ else
KBUILD_LDFLAGS += -melf32lriscv KBUILD_LDFLAGS += -melf32lriscv
endif endif
ifeq ($(CONFIG_LD_IS_LLD),y)
KBUILD_CFLAGS += -mno-relax
KBUILD_AFLAGS += -mno-relax
ifneq ($(LLVM_IAS),1)
KBUILD_CFLAGS += -Wa,-mno-relax
KBUILD_AFLAGS += -Wa,-mno-relax
endif
endif
# ISA string setting # ISA string setting
riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima
riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima

View File

@@ -1,2 +1,3 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
dtb-$(CONFIG_SOC_MICROCHIP_POLARFIRE) += microchip-mpfs-icicle-kit.dtb dtb-$(CONFIG_SOC_MICROCHIP_POLARFIRE) += microchip-mpfs-icicle-kit.dtb
obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))

View File

@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
dtb-$(CONFIG_SOC_SIFIVE) += hifive-unleashed-a00.dtb \ dtb-$(CONFIG_SOC_SIFIVE) += hifive-unleashed-a00.dtb \
hifive-unmatched-a00.dtb hifive-unmatched-a00.dtb
obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))

View File

@@ -273,7 +273,7 @@
cache-size = <2097152>; cache-size = <2097152>;
cache-unified; cache-unified;
interrupt-parent = <&plic0>; interrupt-parent = <&plic0>;
interrupts = <19 20 21 22>; interrupts = <19 21 22 20>;
reg = <0x0 0x2010000 0x0 0x1000>; reg = <0x0 0x2010000 0x0 0x1000>;
}; };
gpio: gpio@10060000 { gpio: gpio@10060000 {

View File

@@ -1,2 +1,2 @@
obj-y += errata_cip_453.o obj-$(CONFIG_ERRATA_SIFIVE_CIP_453) += errata_cip_453.o
obj-y += errata.o obj-y += errata.o

View File

@@ -51,7 +51,7 @@
REG_ASM " " newlen "\n" \ REG_ASM " " newlen "\n" \
".word " errata_id "\n" ".word " errata_id "\n"
#define ALT_NEW_CONSTENT(vendor_id, errata_id, enable, new_c) \ #define ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c) \
".if " __stringify(enable) " == 1\n" \ ".if " __stringify(enable) " == 1\n" \
".pushsection .alternative, \"a\"\n" \ ".pushsection .alternative, \"a\"\n" \
ALT_ENTRY("886b", "888f", __stringify(vendor_id), __stringify(errata_id), "889f - 888f") \ ALT_ENTRY("886b", "888f", __stringify(vendor_id), __stringify(errata_id), "889f - 888f") \
@@ -69,7 +69,7 @@
"886 :\n" \ "886 :\n" \
old_c "\n" \ old_c "\n" \
"887 :\n" \ "887 :\n" \
ALT_NEW_CONSTENT(vendor_id, errata_id, enable, new_c) ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c)
#define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \ #define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \
__ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k)) __ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k))

View File

@@ -30,9 +30,8 @@
#define BPF_JIT_REGION_SIZE (SZ_128M) #define BPF_JIT_REGION_SIZE (SZ_128M)
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
/* KASLR should leave at least 128MB for BPF after the kernel */ #define BPF_JIT_REGION_START (BPF_JIT_REGION_END - BPF_JIT_REGION_SIZE)
#define BPF_JIT_REGION_START PFN_ALIGN((unsigned long)&_end) #define BPF_JIT_REGION_END (MODULES_END)
#define BPF_JIT_REGION_END (BPF_JIT_REGION_START + BPF_JIT_REGION_SIZE)
#else #else
#define BPF_JIT_REGION_START (PAGE_OFFSET - BPF_JIT_REGION_SIZE) #define BPF_JIT_REGION_START (PAGE_OFFSET - BPF_JIT_REGION_SIZE)
#define BPF_JIT_REGION_END (VMALLOC_END) #define BPF_JIT_REGION_END (VMALLOC_END)

View File

@@ -231,13 +231,13 @@ static void __init init_resources(void)
/* Clean-up any unused pre-allocated resources */ /* Clean-up any unused pre-allocated resources */
mem_res_sz = (num_resources - res_idx + 1) * sizeof(*mem_res); mem_res_sz = (num_resources - res_idx + 1) * sizeof(*mem_res);
memblock_free((phys_addr_t) mem_res, mem_res_sz); memblock_free(__pa(mem_res), mem_res_sz);
return; return;
error: error:
/* Better an empty resource tree than an inconsistent one */ /* Better an empty resource tree than an inconsistent one */
release_child_resources(&iomem_resource); release_child_resources(&iomem_resource);
memblock_free((phys_addr_t) mem_res, mem_res_sz); memblock_free(__pa(mem_res), mem_res_sz);
} }

View File

@@ -86,8 +86,13 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code,
} }
} }
#if defined (CONFIG_XIP_KERNEL) && defined (CONFIG_RISCV_ERRATA_ALTERNATIVE)
#define __trap_section __section(".xip.traps")
#else
#define __trap_section
#endif
#define DO_ERROR_INFO(name, signo, code, str) \ #define DO_ERROR_INFO(name, signo, code, str) \
asmlinkage __visible void name(struct pt_regs *regs) \ asmlinkage __visible __trap_section void name(struct pt_regs *regs) \
{ \ { \
do_trap_error(regs, signo, code, regs->epc, "Oops - " str); \ do_trap_error(regs, signo, code, regs->epc, "Oops - " str); \
} }
@@ -111,7 +116,7 @@ DO_ERROR_INFO(do_trap_store_misaligned,
int handle_misaligned_load(struct pt_regs *regs); int handle_misaligned_load(struct pt_regs *regs);
int handle_misaligned_store(struct pt_regs *regs); int handle_misaligned_store(struct pt_regs *regs);
asmlinkage void do_trap_load_misaligned(struct pt_regs *regs) asmlinkage void __trap_section do_trap_load_misaligned(struct pt_regs *regs)
{ {
if (!handle_misaligned_load(regs)) if (!handle_misaligned_load(regs))
return; return;
@@ -119,7 +124,7 @@ asmlinkage void do_trap_load_misaligned(struct pt_regs *regs)
"Oops - load address misaligned"); "Oops - load address misaligned");
} }
asmlinkage void do_trap_store_misaligned(struct pt_regs *regs) asmlinkage void __trap_section do_trap_store_misaligned(struct pt_regs *regs)
{ {
if (!handle_misaligned_store(regs)) if (!handle_misaligned_store(regs))
return; return;
@@ -146,7 +151,7 @@ static inline unsigned long get_break_insn_length(unsigned long pc)
return GET_INSN_LENGTH(insn); return GET_INSN_LENGTH(insn);
} }
asmlinkage __visible void do_trap_break(struct pt_regs *regs) asmlinkage __visible __trap_section void do_trap_break(struct pt_regs *regs)
{ {
#ifdef CONFIG_KPROBES #ifdef CONFIG_KPROBES
if (kprobe_single_step_handler(regs)) if (kprobe_single_step_handler(regs))

View File

@@ -99,9 +99,22 @@ SECTIONS
} }
PERCPU_SECTION(L1_CACHE_BYTES) PERCPU_SECTION(L1_CACHE_BYTES)
. = ALIGN(PAGE_SIZE); . = ALIGN(8);
.alternative : {
__alt_start = .;
*(.alternative)
__alt_end = .;
}
__init_end = .; __init_end = .;
. = ALIGN(16);
.xip.traps : {
__xip_traps_start = .;
*(.xip.traps)
__xip_traps_end = .;
}
. = ALIGN(PAGE_SIZE);
.sdata : { .sdata : {
__global_pointer$ = . + 0x800; __global_pointer$ = . + 0x800;
*(.sdata*) *(.sdata*)

View File

@@ -746,14 +746,18 @@ void __init protect_kernel_text_data(void)
unsigned long init_data_start = (unsigned long)__init_data_begin; unsigned long init_data_start = (unsigned long)__init_data_begin;
unsigned long rodata_start = (unsigned long)__start_rodata; unsigned long rodata_start = (unsigned long)__start_rodata;
unsigned long data_start = (unsigned long)_data; unsigned long data_start = (unsigned long)_data;
unsigned long max_low = (unsigned long)(__va(PFN_PHYS(max_low_pfn))); #if defined(CONFIG_64BIT) && defined(CONFIG_MMU)
unsigned long end_va = kernel_virt_addr + load_sz;
#else
unsigned long end_va = (unsigned long)(__va(PFN_PHYS(max_low_pfn)));
#endif
set_memory_ro(text_start, (init_text_start - text_start) >> PAGE_SHIFT); set_memory_ro(text_start, (init_text_start - text_start) >> PAGE_SHIFT);
set_memory_ro(init_text_start, (init_data_start - init_text_start) >> PAGE_SHIFT); set_memory_ro(init_text_start, (init_data_start - init_text_start) >> PAGE_SHIFT);
set_memory_nx(init_data_start, (rodata_start - init_data_start) >> PAGE_SHIFT); set_memory_nx(init_data_start, (rodata_start - init_data_start) >> PAGE_SHIFT);
/* rodata section is marked readonly in mark_rodata_ro */ /* rodata section is marked readonly in mark_rodata_ro */
set_memory_nx(rodata_start, (data_start - rodata_start) >> PAGE_SHIFT); set_memory_nx(rodata_start, (data_start - rodata_start) >> PAGE_SHIFT);
set_memory_nx(data_start, (max_low - data_start) >> PAGE_SHIFT); set_memory_nx(data_start, (end_va - data_start) >> PAGE_SHIFT);
} }
void mark_rodata_ro(void) void mark_rodata_ro(void)

View File

@@ -169,7 +169,7 @@ static void __init kasan_shallow_populate(void *start, void *end)
void __init kasan_init(void) void __init kasan_init(void)
{ {
phys_addr_t _start, _end; phys_addr_t p_start, p_end;
u64 i; u64 i;
/* /*
@@ -189,9 +189,9 @@ void __init kasan_init(void)
(void *)kasan_mem_to_shadow((void *)VMALLOC_END)); (void *)kasan_mem_to_shadow((void *)VMALLOC_END));
/* Populate the linear mapping */ /* Populate the linear mapping */
for_each_mem_range(i, &_start, &_end) { for_each_mem_range(i, &p_start, &p_end) {
void *start = (void *)__va(_start); void *start = (void *)__va(p_start);
void *end = (void *)__va(_end); void *end = (void *)__va(p_end);
if (start >= end) if (start >= end)
break; break;
@@ -201,7 +201,7 @@ void __init kasan_init(void)
/* Populate kernel, BPF, modules mapping */ /* Populate kernel, BPF, modules mapping */
kasan_populate(kasan_mem_to_shadow((const void *)MODULES_VADDR), kasan_populate(kasan_mem_to_shadow((const void *)MODULES_VADDR),
kasan_mem_to_shadow((const void *)BPF_JIT_REGION_END)); kasan_mem_to_shadow((const void *)MODULES_VADDR + SZ_2G));
for (i = 0; i < PTRS_PER_PTE; i++) for (i = 0; i < PTRS_PER_PTE; i++)
set_pte(&kasan_early_shadow_pte[i], set_pte(&kasan_early_shadow_pte[i],

View File

@@ -651,9 +651,9 @@ ENDPROC(stack_overflow)
.Lcleanup_sie_mcck: .Lcleanup_sie_mcck:
larl %r13,.Lsie_entry larl %r13,.Lsie_entry
slgr %r9,%r13 slgr %r9,%r13
larl %r13,.Lsie_skip lghi %r13,.Lsie_skip - .Lsie_entry
clgr %r9,%r13 clgr %r9,%r13
jh .Lcleanup_sie_int jhe .Lcleanup_sie_int
oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST
.Lcleanup_sie_int: .Lcleanup_sie_int:
BPENTER __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST) BPENTER __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST)

View File

@@ -200,8 +200,9 @@ endif
KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE) KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE)
ifdef CONFIG_LTO_CLANG ifdef CONFIG_LTO_CLANG
KBUILD_LDFLAGS += -plugin-opt=-code-model=kernel \ ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
-plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8) KBUILD_LDFLAGS += -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
endif
endif endif
ifdef CONFIG_X86_NEED_RELOCS ifdef CONFIG_X86_NEED_RELOCS

View File

@@ -1406,6 +1406,8 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool
die_id = i; die_id = i;
else else
die_id = topology_phys_to_logical_pkg(i); die_id = topology_phys_to_logical_pkg(i);
if (die_id < 0)
die_id = -ENODEV;
map->pbus_to_dieid[bus] = die_id; map->pbus_to_dieid[bus] = die_id;
break; break;
} }
@@ -1452,14 +1454,14 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool
i = -1; i = -1;
if (reverse) { if (reverse) {
for (bus = 255; bus >= 0; bus--) { for (bus = 255; bus >= 0; bus--) {
if (map->pbus_to_dieid[bus] >= 0) if (map->pbus_to_dieid[bus] != -1)
i = map->pbus_to_dieid[bus]; i = map->pbus_to_dieid[bus];
else else
map->pbus_to_dieid[bus] = i; map->pbus_to_dieid[bus] = i;
} }
} else { } else {
for (bus = 0; bus <= 255; bus++) { for (bus = 0; bus <= 255; bus++) {
if (map->pbus_to_dieid[bus] >= 0) if (map->pbus_to_dieid[bus] != -1)
i = map->pbus_to_dieid[bus]; i = map->pbus_to_dieid[bus];
else else
map->pbus_to_dieid[bus] = i; map->pbus_to_dieid[bus] = i;
@@ -5097,9 +5099,10 @@ static struct intel_uncore_type icx_uncore_m2m = {
.perf_ctr = SNR_M2M_PCI_PMON_CTR0, .perf_ctr = SNR_M2M_PCI_PMON_CTR0,
.event_ctl = SNR_M2M_PCI_PMON_CTL0, .event_ctl = SNR_M2M_PCI_PMON_CTL0,
.event_mask = SNBEP_PMON_RAW_EVENT_MASK, .event_mask = SNBEP_PMON_RAW_EVENT_MASK,
.event_mask_ext = SNR_M2M_PCI_PMON_UMASK_EXT,
.box_ctl = SNR_M2M_PCI_PMON_BOX_CTL, .box_ctl = SNR_M2M_PCI_PMON_BOX_CTL,
.ops = &snr_m2m_uncore_pci_ops, .ops = &snr_m2m_uncore_pci_ops,
.format_group = &skx_uncore_format_group, .format_group = &snr_m2m_uncore_format_group,
}; };
static struct attribute *icx_upi_uncore_formats_attr[] = { static struct attribute *icx_upi_uncore_formats_attr[] = {

View File

@@ -174,6 +174,7 @@ static inline int apic_is_clustered_box(void)
extern int setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask); extern int setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask);
extern void lapic_assign_system_vectors(void); extern void lapic_assign_system_vectors(void);
extern void lapic_assign_legacy_vector(unsigned int isairq, bool replace); extern void lapic_assign_legacy_vector(unsigned int isairq, bool replace);
extern void lapic_update_legacy_vectors(void);
extern void lapic_online(void); extern void lapic_online(void);
extern void lapic_offline(void); extern void lapic_offline(void);
extern bool apic_needs_pit(void); extern bool apic_needs_pit(void);

View File

@@ -56,11 +56,8 @@
# define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31)) # define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31))
#endif #endif
#ifdef CONFIG_IOMMU_SUPPORT /* Force disable because it's broken beyond repair */
# define DISABLE_ENQCMD 0 #define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
#else
# define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
#endif
#ifdef CONFIG_X86_SGX #ifdef CONFIG_X86_SGX
# define DISABLE_SGX 0 # define DISABLE_SGX 0

View File

@@ -106,10 +106,6 @@ extern int cpu_has_xfeatures(u64 xfeatures_mask, const char **feature_name);
*/ */
#define PASID_DISABLED 0 #define PASID_DISABLED 0
#ifdef CONFIG_IOMMU_SUPPORT
/* Update current's PASID MSR/state by mm's PASID. */
void update_pasid(void);
#else
static inline void update_pasid(void) { } static inline void update_pasid(void) { }
#endif
#endif /* _ASM_X86_FPU_API_H */ #endif /* _ASM_X86_FPU_API_H */

View File

@@ -578,19 +578,19 @@ static inline void switch_fpu_finish(struct fpu *new_fpu)
* PKRU state is switched eagerly because it needs to be valid before we * PKRU state is switched eagerly because it needs to be valid before we
* return to userland e.g. for a copy_to_user() operation. * return to userland e.g. for a copy_to_user() operation.
*/ */
if (current->mm) { if (!(current->flags & PF_KTHREAD)) {
/*
* If the PKRU bit in xsave.header.xfeatures is not set,
* then the PKRU component was in init state, which means
* XRSTOR will set PKRU to 0. If the bit is not set then
* get_xsave_addr() will return NULL because the PKRU value
* in memory is not valid. This means pkru_val has to be
* set to 0 and not to init_pkru_value.
*/
pk = get_xsave_addr(&new_fpu->state.xsave, XFEATURE_PKRU); pk = get_xsave_addr(&new_fpu->state.xsave, XFEATURE_PKRU);
if (pk) pkru_val = pk ? pk->pkru : 0;
pkru_val = pk->pkru;
} }
__write_pkru(pkru_val); __write_pkru(pkru_val);
/*
* Expensive PASID MSR write will be avoided in update_pasid() because
* TIF_NEED_FPU_LOAD was set. And the PASID state won't be updated
* unless it's different from mm->pasid to reduce overhead.
*/
update_pasid();
} }
#endif /* _ASM_X86_FPU_INTERNAL_H */ #endif /* _ASM_X86_FPU_INTERNAL_H */

View File

@@ -3,10 +3,12 @@
#define _ASM_X86_THERMAL_H #define _ASM_X86_THERMAL_H
#ifdef CONFIG_X86_THERMAL_VECTOR #ifdef CONFIG_X86_THERMAL_VECTOR
void therm_lvt_init(void);
void intel_init_thermal(struct cpuinfo_x86 *c); void intel_init_thermal(struct cpuinfo_x86 *c);
bool x86_thermal_enabled(void); bool x86_thermal_enabled(void);
void intel_thermal_interrupt(void); void intel_thermal_interrupt(void);
#else #else
static inline void therm_lvt_init(void) { }
static inline void intel_init_thermal(struct cpuinfo_x86 *c) { } static inline void intel_init_thermal(struct cpuinfo_x86 *c) { }
#endif #endif

View File

@@ -182,42 +182,70 @@ done:
n_dspl, (unsigned long)orig_insn + n_dspl + repl_len); n_dspl, (unsigned long)orig_insn + n_dspl + repl_len);
} }
/*
* optimize_nops_range() - Optimize a sequence of single byte NOPs (0x90)
*
* @instr: instruction byte stream
* @instrlen: length of the above
* @off: offset within @instr where the first NOP has been detected
*
* Return: number of NOPs found (and replaced).
*/
static __always_inline int optimize_nops_range(u8 *instr, u8 instrlen, int off)
{
unsigned long flags;
int i = off, nnops;
while (i < instrlen) {
if (instr[i] != 0x90)
break;
i++;
}
nnops = i - off;
if (nnops <= 1)
return nnops;
local_irq_save(flags);
add_nops(instr + off, nnops);
local_irq_restore(flags);
DUMP_BYTES(instr, instrlen, "%px: [%d:%d) optimized NOPs: ", instr, off, i);
return nnops;
}
/* /*
* "noinline" to cause control flow change and thus invalidate I$ and * "noinline" to cause control flow change and thus invalidate I$ and
* cause refetch after modification. * cause refetch after modification.
*/ */
static void __init_or_module noinline optimize_nops(struct alt_instr *a, u8 *instr) static void __init_or_module noinline optimize_nops(struct alt_instr *a, u8 *instr)
{ {
unsigned long flags;
struct insn insn; struct insn insn;
int nop, i = 0; int i = 0;
/* /*
* Jump over the non-NOP insns, the remaining bytes must be single-byte * Jump over the non-NOP insns and optimize single-byte NOPs into bigger
* NOPs, optimize them. * ones.
*/ */
for (;;) { for (;;) {
if (insn_decode_kernel(&insn, &instr[i])) if (insn_decode_kernel(&insn, &instr[i]))
return; return;
/*
* See if this and any potentially following NOPs can be
* optimized.
*/
if (insn.length == 1 && insn.opcode.bytes[0] == 0x90) if (insn.length == 1 && insn.opcode.bytes[0] == 0x90)
break; i += optimize_nops_range(instr, a->instrlen, i);
else
i += insn.length;
if ((i += insn.length) >= a->instrlen) if (i >= a->instrlen)
return; return;
} }
for (nop = i; i < a->instrlen; i++) {
if (WARN_ONCE(instr[i] != 0x90, "Not a NOP at 0x%px\n", &instr[i]))
return;
}
local_irq_save(flags);
add_nops(instr + nop, i - nop);
local_irq_restore(flags);
DUMP_BYTES(instr, a->instrlen, "%px: [%d:%d) optimized NOPs: ",
instr, nop, a->instrlen);
} }
/* /*

View File

@@ -2604,6 +2604,7 @@ static void __init apic_bsp_setup(bool upmode)
end_local_APIC_setup(); end_local_APIC_setup();
irq_remap_enable_fault_handling(); irq_remap_enable_fault_handling();
setup_IO_APIC(); setup_IO_APIC();
lapic_update_legacy_vectors();
} }
#ifdef CONFIG_UP_LATE_INIT #ifdef CONFIG_UP_LATE_INIT

View File

@@ -738,6 +738,26 @@ void lapic_assign_legacy_vector(unsigned int irq, bool replace)
irq_matrix_assign_system(vector_matrix, ISA_IRQ_VECTOR(irq), replace); irq_matrix_assign_system(vector_matrix, ISA_IRQ_VECTOR(irq), replace);
} }
void __init lapic_update_legacy_vectors(void)
{
unsigned int i;
if (IS_ENABLED(CONFIG_X86_IO_APIC) && nr_ioapics > 0)
return;
/*
* If the IO/APIC is disabled via config, kernel command line or
* lack of enumeration then all legacy interrupts are routed
* through the PIC. Make sure that they are marked as legacy
* vectors. PIC_CASCADE_IRQ has already been marked in
* lapic_assign_system_vectors().
*/
for (i = 0; i < nr_legacy_irqs(); i++) {
if (i != PIC_CASCADE_IR)
lapic_assign_legacy_vector(i, true);
}
}
void __init lapic_assign_system_vectors(void) void __init lapic_assign_system_vectors(void)
{ {
unsigned int i, vector = 0; unsigned int i, vector = 0;

View File

@@ -63,7 +63,7 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr)
case 15: case 15:
return msr - MSR_P4_BPU_PERFCTR0; return msr - MSR_P4_BPU_PERFCTR0;
} }
fallthrough; break;
case X86_VENDOR_ZHAOXIN: case X86_VENDOR_ZHAOXIN:
case X86_VENDOR_CENTAUR: case X86_VENDOR_CENTAUR:
return msr - MSR_ARCH_PERFMON_PERFCTR0; return msr - MSR_ARCH_PERFMON_PERFCTR0;
@@ -96,7 +96,7 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
case 15: case 15:
return msr - MSR_P4_BSU_ESCR0; return msr - MSR_P4_BSU_ESCR0;
} }
fallthrough; break;
case X86_VENDOR_ZHAOXIN: case X86_VENDOR_ZHAOXIN:
case X86_VENDOR_CENTAUR: case X86_VENDOR_CENTAUR:
return msr - MSR_ARCH_PERFMON_EVENTSEL0; return msr - MSR_ARCH_PERFMON_EVENTSEL0;

View File

@@ -212,6 +212,7 @@ static int sgx_vepc_release(struct inode *inode, struct file *file)
list_splice_tail(&secs_pages, &zombie_secs_pages); list_splice_tail(&secs_pages, &zombie_secs_pages);
mutex_unlock(&zombie_secs_pages_lock); mutex_unlock(&zombie_secs_pages_lock);
xa_destroy(&vepc->page_array);
kfree(vepc); kfree(vepc);
return 0; return 0;

View File

@@ -307,13 +307,17 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
return 0; return 0;
} }
if (!access_ok(buf, size)) if (!access_ok(buf, size)) {
return -EACCES; ret = -EACCES;
goto out;
}
if (!static_cpu_has(X86_FEATURE_FPU)) if (!static_cpu_has(X86_FEATURE_FPU)) {
return fpregs_soft_set(current, NULL, ret = fpregs_soft_set(current, NULL, 0,
0, sizeof(struct user_i387_ia32_struct), sizeof(struct user_i387_ia32_struct),
NULL, buf) != 0; NULL, buf);
goto out;
}
if (use_xsave()) { if (use_xsave()) {
struct _fpx_sw_bytes fx_sw_user; struct _fpx_sw_bytes fx_sw_user;
@@ -369,6 +373,25 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
fpregs_unlock(); fpregs_unlock();
return 0; return 0;
} }
/*
* The above did an FPU restore operation, restricted to
* the user portion of the registers, and failed, but the
* microcode might have modified the FPU registers
* nevertheless.
*
* If the FPU registers do not belong to current, then
* invalidate the FPU register state otherwise the task might
* preempt current and return to user space with corrupted
* FPU registers.
*
* In case current owns the FPU registers then no further
* action is required. The fixup below will handle it
* correctly.
*/
if (test_thread_flag(TIF_NEED_FPU_LOAD))
__cpu_invalidate_fpregs_state();
fpregs_unlock(); fpregs_unlock();
} else { } else {
/* /*
@@ -377,7 +400,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
*/ */
ret = __copy_from_user(&env, buf, sizeof(env)); ret = __copy_from_user(&env, buf, sizeof(env));
if (ret) if (ret)
goto err_out; goto out;
envp = &env; envp = &env;
} }
@@ -405,16 +428,9 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
if (use_xsave() && !fx_only) { if (use_xsave() && !fx_only) {
u64 init_bv = xfeatures_mask_user() & ~user_xfeatures; u64 init_bv = xfeatures_mask_user() & ~user_xfeatures;
if (using_compacted_format()) {
ret = copy_user_to_xstate(&fpu->state.xsave, buf_fx); ret = copy_user_to_xstate(&fpu->state.xsave, buf_fx);
} else {
ret = __copy_from_user(&fpu->state.xsave, buf_fx, state_size);
if (!ret && state_size > offsetof(struct xregs_state, header))
ret = validate_user_xstate_header(&fpu->state.xsave.header);
}
if (ret) if (ret)
goto err_out; goto out;
sanitize_restored_user_xstate(&fpu->state, envp, user_xfeatures, sanitize_restored_user_xstate(&fpu->state, envp, user_xfeatures,
fx_only); fx_only);
@@ -434,7 +450,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
ret = __copy_from_user(&fpu->state.fxsave, buf_fx, state_size); ret = __copy_from_user(&fpu->state.fxsave, buf_fx, state_size);
if (ret) { if (ret) {
ret = -EFAULT; ret = -EFAULT;
goto err_out; goto out;
} }
sanitize_restored_user_xstate(&fpu->state, envp, user_xfeatures, sanitize_restored_user_xstate(&fpu->state, envp, user_xfeatures,
@@ -452,7 +468,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
} else { } else {
ret = __copy_from_user(&fpu->state.fsave, buf_fx, state_size); ret = __copy_from_user(&fpu->state.fsave, buf_fx, state_size);
if (ret) if (ret)
goto err_out; goto out;
fpregs_lock(); fpregs_lock();
ret = copy_kernel_to_fregs_err(&fpu->state.fsave); ret = copy_kernel_to_fregs_err(&fpu->state.fsave);
@@ -463,7 +479,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
fpregs_deactivate(fpu); fpregs_deactivate(fpu);
fpregs_unlock(); fpregs_unlock();
err_out: out:
if (ret) if (ret)
fpu__clear_user_states(fpu); fpu__clear_user_states(fpu);
return ret; return ret;

View File

@@ -1402,60 +1402,3 @@ int proc_pid_arch_status(struct seq_file *m, struct pid_namespace *ns,
return 0; return 0;
} }
#endif /* CONFIG_PROC_PID_ARCH_STATUS */ #endif /* CONFIG_PROC_PID_ARCH_STATUS */
#ifdef CONFIG_IOMMU_SUPPORT
void update_pasid(void)
{
u64 pasid_state;
u32 pasid;
if (!cpu_feature_enabled(X86_FEATURE_ENQCMD))
return;
if (!current->mm)
return;
pasid = READ_ONCE(current->mm->pasid);
/* Set the valid bit in the PASID MSR/state only for valid pasid. */
pasid_state = pasid == PASID_DISABLED ?
pasid : pasid | MSR_IA32_PASID_VALID;
/*
* No need to hold fregs_lock() since the task's fpstate won't
* be changed by others (e.g. ptrace) while the task is being
* switched to or is in IPI.
*/
if (!test_thread_flag(TIF_NEED_FPU_LOAD)) {
/* The MSR is active and can be directly updated. */
wrmsrl(MSR_IA32_PASID, pasid_state);
} else {
struct fpu *fpu = &current->thread.fpu;
struct ia32_pasid_state *ppasid_state;
struct xregs_state *xsave;
/*
* The CPU's xstate registers are not currently active. Just
* update the PASID state in the memory buffer here. The
* PASID MSR will be loaded when returning to user mode.
*/
xsave = &fpu->state.xsave;
xsave->header.xfeatures |= XFEATURE_MASK_PASID;
ppasid_state = get_xsave_addr(xsave, XFEATURE_PASID);
/*
* Since XFEATURE_MASK_PASID is set in xfeatures, ppasid_state
* won't be NULL and no need to check its value.
*
* Only update the task's PASID state when it's different
* from the mm's pasid.
*/
if (ppasid_state->pasid != pasid_state) {
/*
* Invalid fpregs so that state restoring will pick up
* the PASID state.
*/
__fpu_invalidate_fpregs_state(fpu);
ppasid_state->pasid = pasid_state;
}
}
}
#endif /* CONFIG_IOMMU_SUPPORT */

View File

@@ -44,6 +44,7 @@
#include <asm/pci-direct.h> #include <asm/pci-direct.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/proto.h> #include <asm/proto.h>
#include <asm/thermal.h>
#include <asm/unwind.h> #include <asm/unwind.h>
#include <asm/vsyscall.h> #include <asm/vsyscall.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
@@ -637,11 +638,11 @@ static void __init trim_snb_memory(void)
* them from accessing certain memory ranges, namely anything below * them from accessing certain memory ranges, namely anything below
* 1M and in the pages listed in bad_pages[] above. * 1M and in the pages listed in bad_pages[] above.
* *
* To avoid these pages being ever accessed by SNB gfx devices * To avoid these pages being ever accessed by SNB gfx devices reserve
* reserve all memory below the 1 MB mark and bad_pages that have * bad_pages that have not already been reserved at boot time.
* not already been reserved at boot time. * All memory below the 1 MB mark is anyway reserved later during
* setup_arch(), so there is no need to reserve it here.
*/ */
memblock_reserve(0, 1<<20);
for (i = 0; i < ARRAY_SIZE(bad_pages); i++) { for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {
if (memblock_reserve(bad_pages[i], PAGE_SIZE)) if (memblock_reserve(bad_pages[i], PAGE_SIZE))
@@ -733,14 +734,14 @@ static void __init early_reserve_memory(void)
* The first 4Kb of memory is a BIOS owned area, but generally it is * The first 4Kb of memory is a BIOS owned area, but generally it is
* not listed as such in the E820 table. * not listed as such in the E820 table.
* *
* Reserve the first memory page and typically some additional * Reserve the first 64K of memory since some BIOSes are known to
* memory (64KiB by default) since some BIOSes are known to corrupt * corrupt low memory. After the real mode trampoline is allocated the
* low memory. See the Kconfig help text for X86_RESERVE_LOW. * rest of the memory below 640k is reserved.
* *
* In addition, make sure page 0 is always reserved because on * In addition, make sure page 0 is always reserved because on
* systems with L1TF its contents can be leaked to user processes. * systems with L1TF its contents can be leaked to user processes.
*/ */
memblock_reserve(0, ALIGN(reserve_low, PAGE_SIZE)); memblock_reserve(0, SZ_64K);
early_reserve_initrd(); early_reserve_initrd();
@@ -751,6 +752,7 @@ static void __init early_reserve_memory(void)
reserve_ibft_region(); reserve_ibft_region();
reserve_bios_regions(); reserve_bios_regions();
trim_snb_memory();
} }
/* /*
@@ -1081,14 +1083,20 @@ void __init setup_arch(char **cmdline_p)
(max_pfn_mapped<<PAGE_SHIFT) - 1); (max_pfn_mapped<<PAGE_SHIFT) - 1);
#endif #endif
reserve_real_mode();
/* /*
* Reserving memory causing GPU hangs on Sandy Bridge integrated * Find free memory for the real mode trampoline and place it
* graphics devices should be done after we allocated memory under * there.
* 1M for the real mode trampoline. * If there is not enough free memory under 1M, on EFI-enabled
* systems there will be additional attempt to reclaim the memory
* for the real mode trampoline at efi_free_boot_services().
*
* Unconditionally reserve the entire first 1M of RAM because
* BIOSes are know to corrupt low memory and several
* hundred kilobytes are not worth complex detection what memory gets
* clobbered. Moreover, on machines with SandyBridge graphics or in
* setups that use crashkernel the entire 1M is reserved anyway.
*/ */
trim_snb_memory(); reserve_real_mode();
init_mem_mapping(); init_mem_mapping();
@@ -1226,6 +1234,14 @@ void __init setup_arch(char **cmdline_p)
x86_init.timers.wallclock_init(); x86_init.timers.wallclock_init();
/*
* This needs to run before setup_local_APIC() which soft-disables the
* local APIC temporarily and that masks the thermal LVT interrupt,
* leading to softlockups on machines which have configured SMI
* interrupt delivery.
*/
therm_lvt_init();
mcheck_init(); mcheck_init();
register_refined_jiffies(CLOCK_TICK_RATE); register_refined_jiffies(CLOCK_TICK_RATE);

View File

@@ -655,6 +655,7 @@ static int __do_cpuid_func_emulated(struct kvm_cpuid_array *array, u32 func)
if (kvm_cpu_cap_has(X86_FEATURE_RDTSCP)) if (kvm_cpu_cap_has(X86_FEATURE_RDTSCP))
entry->ecx = F(RDPID); entry->ecx = F(RDPID);
++array->nent; ++array->nent;
break;
default: default:
break; break;
} }

View File

@@ -1410,6 +1410,9 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len,
if (!apic_x2apic_mode(apic)) if (!apic_x2apic_mode(apic))
valid_reg_mask |= APIC_REG_MASK(APIC_ARBPRI); valid_reg_mask |= APIC_REG_MASK(APIC_ARBPRI);
if (alignment + len > 4)
return 1;
if (offset > 0x3f0 || !(valid_reg_mask & APIC_REG_MASK(offset))) if (offset > 0x3f0 || !(valid_reg_mask & APIC_REG_MASK(offset)))
return 1; return 1;
@@ -1494,6 +1497,15 @@ static void limit_periodic_timer_frequency(struct kvm_lapic *apic)
static void cancel_hv_timer(struct kvm_lapic *apic); static void cancel_hv_timer(struct kvm_lapic *apic);
static void cancel_apic_timer(struct kvm_lapic *apic)
{
hrtimer_cancel(&apic->lapic_timer.timer);
preempt_disable();
if (apic->lapic_timer.hv_timer_in_use)
cancel_hv_timer(apic);
preempt_enable();
}
static void apic_update_lvtt(struct kvm_lapic *apic) static void apic_update_lvtt(struct kvm_lapic *apic)
{ {
u32 timer_mode = kvm_lapic_get_reg(apic, APIC_LVTT) & u32 timer_mode = kvm_lapic_get_reg(apic, APIC_LVTT) &
@@ -1502,11 +1514,7 @@ static void apic_update_lvtt(struct kvm_lapic *apic)
if (apic->lapic_timer.timer_mode != timer_mode) { if (apic->lapic_timer.timer_mode != timer_mode) {
if (apic_lvtt_tscdeadline(apic) != (timer_mode == if (apic_lvtt_tscdeadline(apic) != (timer_mode ==
APIC_LVT_TIMER_TSCDEADLINE)) { APIC_LVT_TIMER_TSCDEADLINE)) {
hrtimer_cancel(&apic->lapic_timer.timer); cancel_apic_timer(apic);
preempt_disable();
if (apic->lapic_timer.hv_timer_in_use)
cancel_hv_timer(apic);
preempt_enable();
kvm_lapic_set_reg(apic, APIC_TMICT, 0); kvm_lapic_set_reg(apic, APIC_TMICT, 0);
apic->lapic_timer.period = 0; apic->lapic_timer.period = 0;
apic->lapic_timer.tscdeadline = 0; apic->lapic_timer.tscdeadline = 0;
@@ -2092,7 +2100,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val)
if (apic_lvtt_tscdeadline(apic)) if (apic_lvtt_tscdeadline(apic))
break; break;
hrtimer_cancel(&apic->lapic_timer.timer); cancel_apic_timer(apic);
kvm_lapic_set_reg(apic, APIC_TMICT, val); kvm_lapic_set_reg(apic, APIC_TMICT, val);
start_apic_timer(apic); start_apic_timer(apic);
break; break;

View File

@@ -4739,9 +4739,33 @@ static void init_kvm_softmmu(struct kvm_vcpu *vcpu)
context->inject_page_fault = kvm_inject_page_fault; context->inject_page_fault = kvm_inject_page_fault;
} }
static union kvm_mmu_role kvm_calc_nested_mmu_role(struct kvm_vcpu *vcpu)
{
union kvm_mmu_role role = kvm_calc_shadow_root_page_role_common(vcpu, false);
/*
* Nested MMUs are used only for walking L2's gva->gpa, they never have
* shadow pages of their own and so "direct" has no meaning. Set it
* to "true" to try to detect bogus usage of the nested MMU.
*/
role.base.direct = true;
if (!is_paging(vcpu))
role.base.level = 0;
else if (is_long_mode(vcpu))
role.base.level = is_la57_mode(vcpu) ? PT64_ROOT_5LEVEL :
PT64_ROOT_4LEVEL;
else if (is_pae(vcpu))
role.base.level = PT32E_ROOT_LEVEL;
else
role.base.level = PT32_ROOT_LEVEL;
return role;
}
static void init_kvm_nested_mmu(struct kvm_vcpu *vcpu) static void init_kvm_nested_mmu(struct kvm_vcpu *vcpu)
{ {
union kvm_mmu_role new_role = kvm_calc_mmu_role_common(vcpu, false); union kvm_mmu_role new_role = kvm_calc_nested_mmu_role(vcpu);
struct kvm_mmu *g_context = &vcpu->arch.nested_mmu; struct kvm_mmu *g_context = &vcpu->arch.nested_mmu;
if (new_role.as_u64 == g_context->mmu_role.as_u64) if (new_role.as_u64 == g_context->mmu_role.as_u64)

View File

@@ -90,8 +90,8 @@ struct guest_walker {
gpa_t pte_gpa[PT_MAX_FULL_LEVELS]; gpa_t pte_gpa[PT_MAX_FULL_LEVELS];
pt_element_t __user *ptep_user[PT_MAX_FULL_LEVELS]; pt_element_t __user *ptep_user[PT_MAX_FULL_LEVELS];
bool pte_writable[PT_MAX_FULL_LEVELS]; bool pte_writable[PT_MAX_FULL_LEVELS];
unsigned pt_access; unsigned int pt_access[PT_MAX_FULL_LEVELS];
unsigned pte_access; unsigned int pte_access;
gfn_t gfn; gfn_t gfn;
struct x86_exception fault; struct x86_exception fault;
}; };
@@ -418,13 +418,15 @@ retry_walk:
} }
walker->ptes[walker->level - 1] = pte; walker->ptes[walker->level - 1] = pte;
/* Convert to ACC_*_MASK flags for struct guest_walker. */
walker->pt_access[walker->level - 1] = FNAME(gpte_access)(pt_access ^ walk_nx_mask);
} while (!is_last_gpte(mmu, walker->level, pte)); } while (!is_last_gpte(mmu, walker->level, pte));
pte_pkey = FNAME(gpte_pkeys)(vcpu, pte); pte_pkey = FNAME(gpte_pkeys)(vcpu, pte);
accessed_dirty = have_ad ? pte_access & PT_GUEST_ACCESSED_MASK : 0; accessed_dirty = have_ad ? pte_access & PT_GUEST_ACCESSED_MASK : 0;
/* Convert to ACC_*_MASK flags for struct guest_walker. */ /* Convert to ACC_*_MASK flags for struct guest_walker. */
walker->pt_access = FNAME(gpte_access)(pt_access ^ walk_nx_mask);
walker->pte_access = FNAME(gpte_access)(pte_access ^ walk_nx_mask); walker->pte_access = FNAME(gpte_access)(pte_access ^ walk_nx_mask);
errcode = permission_fault(vcpu, mmu, walker->pte_access, pte_pkey, access); errcode = permission_fault(vcpu, mmu, walker->pte_access, pte_pkey, access);
if (unlikely(errcode)) if (unlikely(errcode))
@@ -463,7 +465,8 @@ retry_walk:
} }
pgprintk("%s: pte %llx pte_access %x pt_access %x\n", pgprintk("%s: pte %llx pte_access %x pt_access %x\n",
__func__, (u64)pte, walker->pte_access, walker->pt_access); __func__, (u64)pte, walker->pte_access,
walker->pt_access[walker->level - 1]);
return 1; return 1;
error: error:
@@ -643,7 +646,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gpa_t addr,
bool huge_page_disallowed = exec && nx_huge_page_workaround_enabled; bool huge_page_disallowed = exec && nx_huge_page_workaround_enabled;
struct kvm_mmu_page *sp = NULL; struct kvm_mmu_page *sp = NULL;
struct kvm_shadow_walk_iterator it; struct kvm_shadow_walk_iterator it;
unsigned direct_access, access = gw->pt_access; unsigned int direct_access, access;
int top_level, level, req_level, ret; int top_level, level, req_level, ret;
gfn_t base_gfn = gw->gfn; gfn_t base_gfn = gw->gfn;
@@ -675,6 +678,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gpa_t addr,
sp = NULL; sp = NULL;
if (!is_shadow_present_pte(*it.sptep)) { if (!is_shadow_present_pte(*it.sptep)) {
table_gfn = gw->table_gfn[it.level - 2]; table_gfn = gw->table_gfn[it.level - 2];
access = gw->pt_access[it.level - 2];
sp = kvm_mmu_get_page(vcpu, table_gfn, addr, it.level-1, sp = kvm_mmu_get_page(vcpu, table_gfn, addr, it.level-1,
false, access); false, access);
} }

View File

@@ -221,7 +221,7 @@ static u64 *avic_get_physical_id_entry(struct kvm_vcpu *vcpu,
return &avic_physical_id_table[index]; return &avic_physical_id_table[index];
} }
/** /*
* Note: * Note:
* AVIC hardware walks the nested page table to check permissions, * AVIC hardware walks the nested page table to check permissions,
* but does not use the SPA address specified in the leaf page * but does not use the SPA address specified in the leaf page
@@ -764,7 +764,7 @@ out:
return ret; return ret;
} }
/** /*
* Note: * Note:
* The HW cannot support posting multicast/broadcast * The HW cannot support posting multicast/broadcast
* interrupts to a vCPU. So, we still use legacy interrupt * interrupts to a vCPU. So, we still use legacy interrupt
@@ -1005,7 +1005,7 @@ void avic_vcpu_put(struct kvm_vcpu *vcpu)
WRITE_ONCE(*(svm->avic_physical_id_cache), entry); WRITE_ONCE(*(svm->avic_physical_id_cache), entry);
} }
/** /*
* This function is called during VCPU halt/unhalt. * This function is called during VCPU halt/unhalt.
*/ */
static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run) static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run)

View File

@@ -199,9 +199,19 @@ static void sev_asid_free(struct kvm_sev_info *sev)
sev->misc_cg = NULL; sev->misc_cg = NULL;
} }
static void sev_unbind_asid(struct kvm *kvm, unsigned int handle) static void sev_decommission(unsigned int handle)
{ {
struct sev_data_decommission decommission; struct sev_data_decommission decommission;
if (!handle)
return;
decommission.handle = handle;
sev_guest_decommission(&decommission, NULL);
}
static void sev_unbind_asid(struct kvm *kvm, unsigned int handle)
{
struct sev_data_deactivate deactivate; struct sev_data_deactivate deactivate;
if (!handle) if (!handle)
@@ -214,9 +224,7 @@ static void sev_unbind_asid(struct kvm *kvm, unsigned int handle)
sev_guest_deactivate(&deactivate, NULL); sev_guest_deactivate(&deactivate, NULL);
up_read(&sev_deactivate_lock); up_read(&sev_deactivate_lock);
/* decommission handle */ sev_decommission(handle);
decommission.handle = handle;
sev_guest_decommission(&decommission, NULL);
} }
static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp) static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
@@ -341,8 +349,10 @@ static int sev_launch_start(struct kvm *kvm, struct kvm_sev_cmd *argp)
/* Bind ASID to this guest */ /* Bind ASID to this guest */
ret = sev_bind_asid(kvm, start.handle, error); ret = sev_bind_asid(kvm, start.handle, error);
if (ret) if (ret) {
sev_decommission(start.handle);
goto e_free_session; goto e_free_session;
}
/* return handle to userspace */ /* return handle to userspace */
params.handle = start.handle; params.handle = start.handle;
@@ -1103,10 +1113,9 @@ __sev_send_start_query_session_length(struct kvm *kvm, struct kvm_sev_cmd *argp,
struct sev_data_send_start data; struct sev_data_send_start data;
int ret; int ret;
memset(&data, 0, sizeof(data));
data.handle = sev->handle; data.handle = sev->handle;
ret = sev_issue_cmd(kvm, SEV_CMD_SEND_START, &data, &argp->error); ret = sev_issue_cmd(kvm, SEV_CMD_SEND_START, &data, &argp->error);
if (ret < 0)
return ret;
params->session_len = data.session_len; params->session_len = data.session_len;
if (copy_to_user((void __user *)(uintptr_t)argp->data, params, if (copy_to_user((void __user *)(uintptr_t)argp->data, params,
@@ -1215,10 +1224,9 @@ __sev_send_update_data_query_lengths(struct kvm *kvm, struct kvm_sev_cmd *argp,
struct sev_data_send_update_data data; struct sev_data_send_update_data data;
int ret; int ret;
memset(&data, 0, sizeof(data));
data.handle = sev->handle; data.handle = sev->handle;
ret = sev_issue_cmd(kvm, SEV_CMD_SEND_UPDATE_DATA, &data, &argp->error); ret = sev_issue_cmd(kvm, SEV_CMD_SEND_UPDATE_DATA, &data, &argp->error);
if (ret < 0)
return ret;
params->hdr_len = data.hdr_len; params->hdr_len = data.hdr_len;
params->trans_len = data.trans_len; params->trans_len = data.trans_len;

View File

@@ -1550,16 +1550,16 @@ TRACE_EVENT(kvm_nested_vmenter_failed,
TP_ARGS(msg, err), TP_ARGS(msg, err),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(const char *, msg) __string(msg, msg)
__field(u32, err) __field(u32, err)
), ),
TP_fast_assign( TP_fast_assign(
__entry->msg = msg; __assign_str(msg, msg);
__entry->err = err; __entry->err = err;
), ),
TP_printk("%s%s", __entry->msg, !__entry->err ? "" : TP_printk("%s%s", __get_str(msg), !__entry->err ? "" :
__print_symbolic(__entry->err, VMX_VMENTER_INSTRUCTION_ERRORS)) __print_symbolic(__entry->err, VMX_VMENTER_INSTRUCTION_ERRORS))
); );

View File

@@ -6247,6 +6247,7 @@ void vmx_set_virtual_apic_mode(struct kvm_vcpu *vcpu)
switch (kvm_get_apic_mode(vcpu)) { switch (kvm_get_apic_mode(vcpu)) {
case LAPIC_MODE_INVALID: case LAPIC_MODE_INVALID:
WARN_ONCE(true, "Invalid local APIC state"); WARN_ONCE(true, "Invalid local APIC state");
break;
case LAPIC_MODE_DISABLED: case LAPIC_MODE_DISABLED:
break; break;
case LAPIC_MODE_XAPIC: case LAPIC_MODE_XAPIC:

View File

@@ -3072,6 +3072,19 @@ static void kvm_vcpu_flush_tlb_all(struct kvm_vcpu *vcpu)
static void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu) static void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu)
{ {
++vcpu->stat.tlb_flush; ++vcpu->stat.tlb_flush;
if (!tdp_enabled) {
/*
* A TLB flush on behalf of the guest is equivalent to
* INVPCID(all), toggling CR4.PGE, etc., which requires
* a forced sync of the shadow page tables. Unload the
* entire MMU here and the subsequent load will sync the
* shadow page tables, and also flush the TLB.
*/
kvm_mmu_unload(vcpu);
return;
}
static_call(kvm_x86_tlb_flush_guest)(vcpu); static_call(kvm_x86_tlb_flush_guest)(vcpu);
} }
@@ -3101,9 +3114,11 @@ static void record_steal_time(struct kvm_vcpu *vcpu)
* expensive IPIs. * expensive IPIs.
*/ */
if (guest_pv_has(vcpu, KVM_FEATURE_PV_TLB_FLUSH)) { if (guest_pv_has(vcpu, KVM_FEATURE_PV_TLB_FLUSH)) {
u8 st_preempted = xchg(&st->preempted, 0);
trace_kvm_pv_tlb_flush(vcpu->vcpu_id, trace_kvm_pv_tlb_flush(vcpu->vcpu_id,
st->preempted & KVM_VCPU_FLUSH_TLB); st_preempted & KVM_VCPU_FLUSH_TLB);
if (xchg(&st->preempted, 0) & KVM_VCPU_FLUSH_TLB) if (st_preempted & KVM_VCPU_FLUSH_TLB)
kvm_vcpu_flush_tlb_guest(vcpu); kvm_vcpu_flush_tlb_guest(vcpu);
} else { } else {
st->preempted = 0; st->preempted = 0;
@@ -7091,7 +7106,10 @@ static unsigned emulator_get_hflags(struct x86_emulate_ctxt *ctxt)
static void emulator_set_hflags(struct x86_emulate_ctxt *ctxt, unsigned emul_flags) static void emulator_set_hflags(struct x86_emulate_ctxt *ctxt, unsigned emul_flags)
{ {
emul_to_vcpu(ctxt)->arch.hflags = emul_flags; struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
vcpu->arch.hflags = emul_flags;
kvm_mmu_reset_context(vcpu);
} }
static int emulator_pre_leave_smm(struct x86_emulate_ctxt *ctxt, static int emulator_pre_leave_smm(struct x86_emulate_ctxt *ctxt,
@@ -8243,6 +8261,7 @@ void kvm_arch_exit(void)
kvm_x86_ops.hardware_enable = NULL; kvm_x86_ops.hardware_enable = NULL;
kvm_mmu_module_exit(); kvm_mmu_module_exit();
free_percpu(user_return_msrs); free_percpu(user_return_msrs);
kmem_cache_destroy(x86_emulator_cache);
kmem_cache_destroy(x86_fpu_cache); kmem_cache_destroy(x86_fpu_cache);
#ifdef CONFIG_KVM_XEN #ifdef CONFIG_KVM_XEN
static_key_deferred_flush(&kvm_xen_enabled); static_key_deferred_flush(&kvm_xen_enabled);

View File

@@ -836,7 +836,7 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
if (si_code == SEGV_PKUERR) if (si_code == SEGV_PKUERR)
force_sig_pkuerr((void __user *)address, pkey); force_sig_pkuerr((void __user *)address, pkey);
else
force_sig_fault(SIGSEGV, si_code, (void __user *)address); force_sig_fault(SIGSEGV, si_code, (void __user *)address);
local_irq_disable(); local_irq_disable();

View File

@@ -118,7 +118,9 @@ static void __ioremap_check_other(resource_size_t addr, struct ioremap_desc *des
if (!IS_ENABLED(CONFIG_EFI)) if (!IS_ENABLED(CONFIG_EFI))
return; return;
if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA) if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA ||
(efi_mem_type(addr) == EFI_BOOT_SERVICES_DATA &&
efi_mem_attributes(addr) & EFI_MEMORY_RUNTIME))
desc->flags |= IORES_MAP_ENCRYPTED; desc->flags |= IORES_MAP_ENCRYPTED;
} }

View File

@@ -504,10 +504,6 @@ void __init sme_enable(struct boot_params *bp)
#define AMD_SME_BIT BIT(0) #define AMD_SME_BIT BIT(0)
#define AMD_SEV_BIT BIT(1) #define AMD_SEV_BIT BIT(1)
/* Check the SEV MSR whether SEV or SME is enabled */
sev_status = __rdmsr(MSR_AMD64_SEV);
feature_mask = (sev_status & MSR_AMD64_SEV_ENABLED) ? AMD_SEV_BIT : AMD_SME_BIT;
/* /*
* Check for the SME/SEV feature: * Check for the SME/SEV feature:
* CPUID Fn8000_001F[EAX] * CPUID Fn8000_001F[EAX]
@@ -519,11 +515,16 @@ void __init sme_enable(struct boot_params *bp)
eax = 0x8000001f; eax = 0x8000001f;
ecx = 0; ecx = 0;
native_cpuid(&eax, &ebx, &ecx, &edx); native_cpuid(&eax, &ebx, &ecx, &edx);
if (!(eax & feature_mask)) /* Check whether SEV or SME is supported */
if (!(eax & (AMD_SEV_BIT | AMD_SME_BIT)))
return; return;
me_mask = 1UL << (ebx & 0x3f); me_mask = 1UL << (ebx & 0x3f);
/* Check the SEV MSR whether SEV or SME is enabled */
sev_status = __rdmsr(MSR_AMD64_SEV);
feature_mask = (sev_status & MSR_AMD64_SEV_ENABLED) ? AMD_SEV_BIT : AMD_SME_BIT;
/* Check if memory encryption is enabled */ /* Check if memory encryption is enabled */
if (feature_mask == AMD_SME_BIT) { if (feature_mask == AMD_SME_BIT) {
/* /*

View File

@@ -254,7 +254,13 @@ int __init numa_cleanup_meminfo(struct numa_meminfo *mi)
/* make sure all non-reserved blocks are inside the limits */ /* make sure all non-reserved blocks are inside the limits */
bi->start = max(bi->start, low); bi->start = max(bi->start, low);
bi->end = min(bi->end, high);
/* preserve info for non-RAM areas above 'max_pfn': */
if (bi->end > high) {
numa_add_memblk_to(bi->nid, high, bi->end,
&numa_reserved_meminfo);
bi->end = high;
}
/* and there's no empty block */ /* and there's no empty block */
if (bi->start >= bi->end) if (bi->start >= bi->end)

View File

@@ -779,4 +779,48 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar); DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar); DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar);
#define RS690_LOWER_TOP_OF_DRAM2 0x30
#define RS690_LOWER_TOP_OF_DRAM2_VALID 0x1
#define RS690_UPPER_TOP_OF_DRAM2 0x31
#define RS690_HTIU_NB_INDEX 0xA8
#define RS690_HTIU_NB_INDEX_WR_ENABLE 0x100
#define RS690_HTIU_NB_DATA 0xAC
/*
* Some BIOS implementations support RAM above 4GB, but do not configure the
* PCI host to respond to bus master accesses for these addresses. These
* implementations set the TOP_OF_DRAM_SLOT1 register correctly, so PCI DMA
* works as expected for addresses below 4GB.
*
* Reference: "AMD RS690 ASIC Family Register Reference Guide" (pg. 2-57)
* https://www.amd.com/system/files/TechDocs/43372_rs690_rrg_3.00o.pdf
*/
static void rs690_fix_64bit_dma(struct pci_dev *pdev)
{
u32 val = 0;
phys_addr_t top_of_dram = __pa(high_memory - 1) + 1;
if (top_of_dram <= (1ULL << 32))
return;
pci_write_config_dword(pdev, RS690_HTIU_NB_INDEX,
RS690_LOWER_TOP_OF_DRAM2);
pci_read_config_dword(pdev, RS690_HTIU_NB_DATA, &val);
if (val)
return;
pci_info(pdev, "Adjusting top of DRAM to %pa for 64-bit DMA support\n", &top_of_dram);
pci_write_config_dword(pdev, RS690_HTIU_NB_INDEX,
RS690_UPPER_TOP_OF_DRAM2 | RS690_HTIU_NB_INDEX_WR_ENABLE);
pci_write_config_dword(pdev, RS690_HTIU_NB_DATA, top_of_dram >> 32);
pci_write_config_dword(pdev, RS690_HTIU_NB_INDEX,
RS690_LOWER_TOP_OF_DRAM2 | RS690_HTIU_NB_INDEX_WR_ENABLE);
pci_write_config_dword(pdev, RS690_HTIU_NB_DATA,
top_of_dram | RS690_LOWER_TOP_OF_DRAM2_VALID);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7910, rs690_fix_64bit_dma);
#endif #endif

View File

@@ -450,6 +450,18 @@ void __init efi_free_boot_services(void)
size -= rm_size; size -= rm_size;
} }
/*
* Don't free memory under 1M for two reasons:
* - BIOS might clobber it
* - Crash kernel needs it to be reserved
*/
if (start + size < SZ_1M)
continue;
if (start < SZ_1M) {
size -= (SZ_1M - start);
start = SZ_1M;
}
memblock_free_late(start, size); memblock_free_late(start, size);
} }

Some files were not shown because too many files have changed in this diff Show More