Merge branch 'android12-5.10' 'android12-5.10-lts'
Sync up with android12-5.10 for the following commits:fbf19aeacc
gki_config: Disable CONFIG_DEBUG_STACK_USAGEb44e46bb04
FROMGIT: mm: improve mprotect(R|W) efficiency on pages referenced once54e7412d4f
FROMGIT: mm: slub: move sysfs slab alloc/free interfaces to debugfs45d0c6c5aa
ANDROID: gki - CONFIG_NET_SCH_FQ=y79f44ef795
ANDROID: GKI: Kconfig.gki: Add GKI_HIDDEN_ETHERNET_CONFIGS79258e28eb
FROMLIST: media: Kconfig: Fix DVB_CORE can't be selected as module0451e8af91
ANDROID: Update ABI and symbol list1ac622485e
Revert "net: usb: cdc_ncm: don't spew notifications"9e08e97ec6
Merge 5.10.43 into android12-5.10b9ae3287e3
ANDROID: Fips 140: move fips symbols entirely in own list3871aa16fd
ANDROID: core of xt_IDLETIMER send_nl_msg supportb4355a880a
ANDROID: start to re-add xt_IDLETIMER send_nl_msg supporta11dacedd6
ANDROID: add fips140.ko symbols to module ABI868be244bb
ANDROID: inject correct HMAC digest into fips140.ko at build time6be141eb36
ANDROID: crypto: fips140 - perform load time integrity check0672a69424
FROMLIST: crypto: shash - stop comparing function pointers to avoid breaking CFI254da9ba36
ANDROID: arm64: module: preserve RELA sections for FIPS140 integrity selfcheck15f0fc91e1
ANDROID: arm64: simd: omit capability check in may_use_simd()6772dcc141
ANDROID: kbuild: lto: permit the use of .a archives in LTO modulesddea30c684
ANDROID: arm64: only permit certain alternatives in the FIPS140 module9c556792b7
ANDROID: crypto: lib/aes - add vendor hooks for AES library routines7a689ebc67
ANDROID: crypto: lib/sha256 - add vendor hook for sha256() routine4190dbd6ad
UPSTREAM: KVM: arm64: Mark the host stage-2 memory pools static6288fa47f4
UPSTREAM: arm64: mm: don't use CON and BLK mapping if KFENCE is enablede44e1f38be
UPSTREAM: x86/build: Fix location of '-plugin-opt=' flags5df654d642
UPSTREAM: binder: Return EFAULT if we fail BINDER_ENABLE_ONEWAY_SPAM_DETECTION2aee873ab2
UPSTREAM: usb: dwc3: imx8mp: fix error return code in dwc3_imx8mp_probe()ff1eb3fcd0
UPSTREAM: usb: dwc3: core: Add missing GHWPARAMS9 doc52ce94e8bf
UPSTREAM: KVM: arm64: Fix error return code in init_hyp_mode()67d005b0ac
UPSTREAM: KVM: arm64: Support PREL/PLT relocs in EL2 codec04f2026cf
UPSTREAM: iommu/mediatek: Always enable the clk on resumec46f002566
UPSTREAM: mm: page_alloc: ignore init_on_free=1 for debug_pagealloc=1282faf9977
UPSTREAM: dt-bindings: iommu: mediatek: update mediatek,iommu.yaml referencesdb8e491a1b
UPSTREAM: media: mtk: fix mtk-smi dependencydef7a8e7d7
UPSTREAM: software node: Allow node addition to already existing deviced0db984f3e
UPSTREAM: coresight: etm-perf: Fix define build issue when built as module3ddee7b2ee
UPSTREAM: kbuild: lto: Merge module sections if and only if CONFIG_LTO_CLANG is enabled94cf2b2d1d
UPSTREAM: kunit: tool: Disable PAGE_POISONING under --alltestsa1cc08d515
UPSTREAM: gpiolib: Fix error return code in gpiolib_dev_init()5f7ec0f4c3
UPSTREAM: memblock: fix section mismatch warning96fd9e07c0
UPSTREAM: software node: Fix device_add_software_node()4378c305d9
UPSTREAM: gpio: fix NULL-deref-on-deregistration regression2fc5237198
BACKPORT: kbuild: fix UNUSED_KSYMS_WHITELIST for Clang LTOf107d073ce
UPSTREAM: kbuild: lto: add _mcount to list of used symbols9bf26f0ace
UPSTREAM: arm64: Add missing ISB after invalidating TLB in enter_vheb1843022a9
UPSTREAM: kbuild: Move .thinlto-cache removal to 'make clean'4150d73816
UPSTREAM: parisc: select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRYe11b323bca
UPSTREAM: kbuild: prevent CC_FLAGS_LTO self-bloating on recursive rebuilds631b4dba04
UPSTREAM: regulator: qcom-rpmh: fix build after QCOM_COMMAND_DB is tristate4e0d16b049
UPSTREAM: dma-buf: cma_heap: Include linux/vmalloc.h to fix build failures on MIPS4fef0d39b8
UPSTREAM: signal/parisc: Remove parisc specific definition of __ARCH_UAPI_SA_FLAGS259e0a28b9
UPSTREAM: nl80211: fix kernel-doc warning in the new SAE attribute8cc6bf3aaf
ANDROID: abi_gki_aarch64_qcom: Add cpuidle_psci and gic_resume symbols5fd82d3115
ANDROID: gic-v3: Export gic_resume() for vendor GIC enhancementsfb49b843af
ANDROID: cpuidle-psci: Add vendor hook for cpuidle psci enter and exit6227516eed
FROMGIT: usb: typec: mux: Fix copy-paste mistake in typec_mux_match623c68fc85
FROMGIT: usb: typec: ucsi: Clear PPM capability data in ucsi_init() error patha685bf3fce
ANDROID: export cpuset_cpus_allowed()for GKI purpose.12be942aad
ANDROID: GKI: Update abi_gki_aarch64_qcom list for shmem reclaim951358a824
Linux 5.10.43d17d47da59
neighbour: allow NUD_NOARP entries to be forced GCed6b53db8c4c
xen-netback: take a reference to the RX task thread316de9a88c
netfilter: nf_tables: missing error reporting for not selected expressionseddf2d9f76
i2c: qcom-geni: Suspend and resume the bus during SYSTEM_SLEEP_PM opsf20eef4d06
lib/lz4: explicitly support in-place decompression334c59d58d
x86/kvm: Disable all PV features on crash3b0becf8b1
x86/kvm: Disable kvmclock on all CPUs on shutdown38b858da1c
x86/kvm: Teardown PV features on boot CPU as wellb327c97747
KVM: arm64: Fix debug register indexingb3ee3f50ab
KVM: SVM: Truncate GPR value for DR and CR accesses in !64-bit modefe910d20e2
btrfs: fix unmountable seed device after fstrim05e41f6f1c
drm/msm/dpu: always use mdp device to scale bandwidth2eb4ec9c2c
mm, hugetlb: fix simple resv_huge_pages underflow on UFFDIO_COPYbaa6763123
btrfs: fix deadlock when cloning inline extents and low on available space0df50d47d1
btrfs: abort in rename_exchange if we fail to insert the second ref48568f3944
btrfs: fixup error handling in fixup_inode_link_counts466d83fdbb
btrfs: return errors from btrfs_del_csums in cleanup_ref_head5a89982fa2
btrfs: fix error handling in btrfs_del_csumsb547a16b24
btrfs: mark ordered extent and inode with error if we fail to finish5e5e63bacb
powerpc/kprobes: Fix validation of prefixed instructions across page boundary42f75a4381
x86/apic: Mark _all_ legacy interrupts when IO/APIC is missing3a6b69221f
drm/amdgpu: make sure we unpin the UVD BO58da0b509e
drm/amdgpu: Don't query CE and UE errors48ee0db61c
nfc: fix NULL ptr dereference in llcp_sock_getname() after failed connect445477e927
x86/sev: Check SME/SEV support in CPUID first942c5864de
x86/cpufeatures: Force disable X86_FEATURE_ENQCMD and remove update_pasid()68dcd32b32
mm/page_alloc: fix counting of free pages after take off from buddy5f2e1e818e
mm/debug_vm_pgtable: fix alignment for pmd/pud_advanced_tests()c8d5faee46
ocfs2: fix data corruption by fallocate7178be006d
pid: take a reference when initializing `cad_pid`a4ed12f5ed
usb: dwc2: Fix build in periphal-only mode3b713aafa7
ext4: fix accessing uninit percpu counter variable with fast_commit2050c6e5b1
ext4: fix memory leak in ext4_mb_init_backend on error path.fb86acc623
ext4: fix fast commit alignment issuesd3b668b96a
ext4: fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed01d349a481
ext4: fix memory leak in ext4_fill_superb2057d138f
ARM: dts: imx6q-dhcom: Add PU,VDD1P1,VDD2P5 regulators623603e255
ARM: dts: imx6dl-yapp4: Fix RGMII connection to QCA8334 switch846848c052
ALSA: hda: update the power_state during the direct-completecfbb57fcb1
ALSA: hda: Fix for mute key LED for HP Pavilion 15-CK0xx029c06103e
ALSA: timer: Fix master timer notificationd11e5b96ef
gfs2: fix scheduling while atomic bug in glocks127f25be2f
HID: multitouch: require Finger field to mark Win8 reports as MTb5d013c4c7
HID: magicmouse: fix NULL-deref on disconnecta5e554f789
HID: i2c-hid: Skip ELAN power-on command after reset46403c1f80
net: caif: fix memory leak in cfusbl_device_notifyaf2806345a
net: caif: fix memory leak in caif_device_notifyd6db727457
net: caif: add proper error handlingdac53568c6
net: caif: added cfserl_release functiondf3b45f6d1
wireguard: allowedips: free empty intermediate nodes when removing single nodec5155c741a
wireguard: allowedips: allocate nodes in kmem_cache70a9a71ab3
wireguard: allowedips: remove nodes in O(1)42a667715b
wireguard: allowedips: initialize list head in selftest842c21d6a0
wireguard: selftests: make sure rp_filter is disabled on vethcb8d72ac1f2
wireguard: selftests: remove old conntrack kconfig valuef74da2c254
wireguard: use synchronize_net rather than synchronize_rcud4275889ac
wireguard: peer: allocate in kmem_cached64fdbaec0
wireguard: do not use -O374caf718cc
Bluetooth: use correct lock to prevent UAF of hdev object3795007c8d
Bluetooth: fix the erroneous flush_work() order7fa8ee00b5
drm/amdgpu/jpeg3: add cancel_delayed_work_sync before power gatec129465480
drm/amdgpu/jpeg2.5: add cancel_delayed_work_sync before power gate58f4d45d8d
drm/amdgpu/vcn3: add cancel_delayed_work_sync before power gateec72cb50c1
io_uring: use better types for cflags0b2a990e5d
io_uring: fix link timeout refs3c23e23c7a
riscv: vdso: fix and clean-up Makefile282c9eeda6
serial: stm32: fix threaded interrupt handlingfdf1e5eec3
tipc: fix unique bearer names sanity checke31ae45ed1
tipc: add extack messages for bearer/media failure0d83aec6e0
bus: ti-sysc: Fix flakey idling of uarts and stop using swsup_sidle_act5592731e13
ARM: dts: imx: emcon-avari: Fix nxp,pca8574 #gpio-cells67ae12a57b
ARM: dts: imx7d-pico: Fix the 'tuning-step' propertya776ea1eca
ARM: dts: imx7d-meerkat96: Fix the 'tuning-step' property8aa4700de5
arm64: dts: freescale: sl28: var4: fix RGMII clock and voltage4f323ce68e
arm64: dts: zii-ultra: fix 12V_MAIN voltagea3716c1933
arm64: dts: ls1028a: fix memory noded551b8e857
bus: ti-sysc: Fix am335x resume hang for usb otg module426ba49ec5
optee: use export_uuid() to copy client UUIDd866a6e61a
arm64: dts: ti: j7200-main: Mark Main NAVSS as dma-coherenta1bf16616d
ixgbe: add correct exception tracing for XDPe369db6cde
ixgbe: optimize for XDP_REDIRECT in xsk pathad505705bb
ice: add correct exception tracing for XDP9e1eb42884
ice: optimize for XDP_REDIRECT in xsk path7bd82b73d5
ice: simplify ice_run_xdp274d6eeaaf
i40e: add correct exception tracing for XDPfbae1a97ce
i40e: optimize for XDP_REDIRECT in xsk path1958a31c03
cxgb4: avoid link re-train during TC-MQPRIO configuration21d494d444
i2c: qcom-geni: Add shutdown callback for i2cc4b796f20c
ice: Allow all LLDP packets from PF to Tx68db78345f
ice: report supported and advertised autoneg using PHY capabilities8726b9e81b
ice: handle the VF VSI rebuild failurea79883ce1e
ice: Fix VFR issues for AVF drivers that expect ATQLEN clearedb94580b055
ice: Fix allowing VF to request more/less queues via virtchnl0987023582
ipv6: Fix KASAN: slab-out-of-bounds Read in fib6_nh_flush_exceptions1dcf3d435b
cxgb4: fix regression with HASH tc prio value update8067da9049
ixgbevf: add correct exception tracing for XDPe0b61cda5f
igb: add correct exception tracing for XDPe513d88962
ieee802154: fix error return code in ieee802154_llsec_getparams()2a0ba0125c
ieee802154: fix error return code in ieee802154_add_iface()ff5039ec75
bpf, lockdown, audit: Fix buggy SELinux lockdown permission checkscdf3f6db1a
bpf: Simplify cases in bpf_base_func_proto4cf297ef59
drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest()8d614eebc0
netfilter: nfnetlink_cthelper: hit EBUSY on updates if size mismatches5f3429c05e
netfilter: nft_ct: skip expectations for confirmed conntrackc440cd0807
nvmet: fix freeing unallocated p2pmem2a8cda3867
net/mlx5: DR, Create multi-destination flow table with level less than 64c8972cf28e
net/mlx5e: Check for needed capability for cvlan matching7307003375
net/mlx5: Check firmware sync reset requested is set before trying to abort itc1ea8c0e71
net/mlx5e: Fix incompatible castingf1d4184f12
net/tls: Fix use-after-free after the TLS device goes down and up874ece252e
net/tls: Replace TLS_RX_SYNC_RUNNING with RCUa5de17bb91
net: sock: fix in-kernel mark setting09fdb6747b
net: dsa: tag_8021q: fix the VLAN IDs used for encoding sub-VLANs091283e3d5
perf probe: Fix NULL pointer dereference in convert_variable_location()100c872c75
ACPICA: Clean up context mutex during object deletiondf7c913f90
nvme-rdma: fix in-casule data send for chained sglsb198f77a36
mptcp: always parse mptcp options for MPC reqskbe0d850726
net/sched: act_ct: Fix ct template allocation for zone 0f07c548314
net/sched: act_ct: Offload connections with commit action4f00f9c169
devlink: Correct VIRTUAL port to not have phys_port attributes56c45ab00a
HID: i2c-hid: fix format string mismatch744db828d6
HID: pidff: fix error return code in hid_pidff_init()39b92726a3
HID: logitech-hidpp: initialize level variable4b1aba6536
ipvs: ignore IP_VS_SVC_F_HASHED flag when adding service46ae882bb1
vfio/platform: fix module_put call in error flow2adb0313b1
samples: vfio-mdev: fix error handing in mdpy_fb_probe()c25454a4f4
vfio/pci: zap_vma_ptes() needs MMUc303db1211
vfio/pci: Fix error return code in vfio_ecap_init()8d27efbb0e
efi: cper: fix snprintf() use in cper_dimm_err_location()951f8ef71d
efi/libstub: prevent read overflow in find_file_option()b828601c75
efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared5148066edb
efi/fdt: fix panic when no valid fdt found39a909a972
netfilter: conntrack: unregister ipv4 sockopts on error unwind46e6506179
hwmon: (pmbus/isl68137) remove READ_TEMPERATURE_3 for RAA2282280d0df2e532
hwmon: (dell-smm-hwmon) Fix index values70df000fb8
net: usb: cdc_ncm: don't spew notifications1d62b7ac83
btrfs: tree-checker: do not error out if extent ref hash doesn't match Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Iec4213b0df8a7d7e04c480e99c62e197f4f58ef9
This commit is contained in:
@@ -63,7 +63,7 @@ Required properties (DMA function blocks):
|
||||
- larb: Should contain a phandle pointing to the local arbiter device as defined
|
||||
in Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
|
||||
- iommus: Should point to the respective IOMMU block with master port as
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
|
||||
for details.
|
||||
|
||||
Examples:
|
||||
|
@@ -19,7 +19,7 @@ Required properties:
|
||||
Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
|
||||
for details.
|
||||
- iommus: should point to the respective IOMMU block with master port as
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
|
||||
for details.
|
||||
|
||||
Example:
|
||||
|
@@ -17,7 +17,7 @@ Required properties:
|
||||
Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
|
||||
for details.
|
||||
- iommus: should point to the respective IOMMU block with master port as
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
|
||||
for details.
|
||||
|
||||
Example:
|
||||
|
@@ -25,7 +25,7 @@ Required properties (DMA function blocks, child node):
|
||||
"mediatek,mt8173-mdp-wdma"
|
||||
"mediatek,mt8173-mdp-wrot"
|
||||
- iommus: should point to the respective IOMMU block with master port as
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
|
||||
for details.
|
||||
- mediatek,larb: must contain the local arbiters in the current Socs, see
|
||||
Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
|
||||
|
@@ -18,7 +18,7 @@ Required properties:
|
||||
"univpll_d2", "clk_cci400_sel", "vdec_sel", "vdecpll", "vencpll",
|
||||
"venc_lt_sel", "vdec_bus_clk_src".
|
||||
- iommus : should point to the respective IOMMU block with master port as
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
|
||||
for details.
|
||||
One of the two following nodes:
|
||||
- mediatek,vpu : the node of the video processor unit, if using VPU.
|
||||
|
10
Makefile
10
Makefile
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
VERSION = 5
|
||||
PATCHLEVEL = 10
|
||||
SUBLEVEL = 42
|
||||
SUBLEVEL = 43
|
||||
EXTRAVERSION =
|
||||
NAME = Dare mighty things
|
||||
|
||||
@@ -917,10 +917,10 @@ endif
|
||||
|
||||
ifdef CONFIG_LTO_CLANG
|
||||
ifdef CONFIG_LTO_CLANG_THIN
|
||||
CC_FLAGS_LTO += -flto=thin -fsplit-lto-unit
|
||||
CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
|
||||
KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod-prefix).thinlto-cache
|
||||
else
|
||||
CC_FLAGS_LTO += -flto
|
||||
CC_FLAGS_LTO := -flto
|
||||
endif
|
||||
|
||||
ifeq ($(SRCARCH),x86)
|
||||
@@ -1568,7 +1568,7 @@ endif # CONFIG_MODULES
|
||||
# Directories & files removed with 'make clean'
|
||||
CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
|
||||
modules.builtin modules.builtin.modinfo modules.nsdeps \
|
||||
compile_commands.json
|
||||
compile_commands.json .thinlto-cache
|
||||
|
||||
# Directories & files removed with 'make mrproper'
|
||||
MRPROPER_FILES += include/config include/generated \
|
||||
@@ -1582,7 +1582,7 @@ MRPROPER_FILES += include/config include/generated \
|
||||
*.spec
|
||||
|
||||
# Directories & files removed with 'make distclean'
|
||||
DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS .thinlto-cache
|
||||
DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
|
||||
|
||||
# clean - Delete most, but leave enough to build external modules
|
||||
#
|
||||
|
File diff suppressed because it is too large
Load Diff
149
android/abi_gki_aarch64_fips140
Normal file
149
android/abi_gki_aarch64_fips140
Normal file
@@ -0,0 +1,149 @@
|
||||
[abi_symbol_list]
|
||||
|
||||
# required by fips140.ko
|
||||
add_random_ready_callback
|
||||
aead_register_instance
|
||||
bcmp
|
||||
cancel_work_sync
|
||||
__cfi_slowpath
|
||||
cpu_have_feature
|
||||
crypto_aead_decrypt
|
||||
crypto_aead_encrypt
|
||||
crypto_aead_setauthsize
|
||||
crypto_aead_setkey
|
||||
crypto_ahash_finup
|
||||
crypto_ahash_setkey
|
||||
crypto_alg_list
|
||||
crypto_alg_mod_lookup
|
||||
crypto_alg_sem
|
||||
crypto_alloc_base
|
||||
crypto_alloc_rng
|
||||
crypto_alloc_shash
|
||||
crypto_attr_alg_name
|
||||
crypto_check_attr_type
|
||||
crypto_cipher_encrypt_one
|
||||
crypto_cipher_setkey
|
||||
crypto_destroy_tfm
|
||||
crypto_drop_spawn
|
||||
crypto_get_default_null_skcipher
|
||||
crypto_grab_aead
|
||||
crypto_grab_ahash
|
||||
crypto_grab_shash
|
||||
crypto_grab_skcipher
|
||||
crypto_inst_setname
|
||||
crypto_put_default_null_skcipher
|
||||
crypto_register_aead
|
||||
crypto_register_alg
|
||||
crypto_register_rngs
|
||||
crypto_register_shash
|
||||
crypto_register_shashes
|
||||
crypto_register_skciphers
|
||||
crypto_register_template
|
||||
crypto_register_templates
|
||||
crypto_remove_final
|
||||
crypto_remove_spawns
|
||||
crypto_req_done
|
||||
crypto_shash_alg_has_setkey
|
||||
crypto_shash_digest
|
||||
crypto_shash_final
|
||||
crypto_shash_finup
|
||||
crypto_shash_setkey
|
||||
crypto_shash_tfm_digest
|
||||
crypto_shash_update
|
||||
crypto_skcipher_decrypt
|
||||
crypto_skcipher_encrypt
|
||||
crypto_skcipher_setkey
|
||||
crypto_spawn_tfm2
|
||||
crypto_unregister_aead
|
||||
crypto_unregister_alg
|
||||
crypto_unregister_rngs
|
||||
crypto_unregister_shash
|
||||
crypto_unregister_shashes
|
||||
crypto_unregister_skciphers
|
||||
crypto_unregister_template
|
||||
crypto_unregister_templates
|
||||
del_random_ready_callback
|
||||
down_write
|
||||
fpsimd_context_busy
|
||||
get_random_bytes
|
||||
__init_swait_queue_head
|
||||
irq_stat
|
||||
kasan_flag_enabled
|
||||
kernel_neon_begin
|
||||
kernel_neon_end
|
||||
kfree
|
||||
kfree_sensitive
|
||||
__kmalloc
|
||||
kmalloc_caches
|
||||
kmalloc_order_trace
|
||||
kmem_cache_alloc_trace
|
||||
__list_add_valid
|
||||
__list_del_entry_valid
|
||||
memcpy
|
||||
memset
|
||||
__mutex_init
|
||||
mutex_lock
|
||||
mutex_unlock
|
||||
panic
|
||||
preempt_schedule
|
||||
preempt_schedule_notrace
|
||||
printk
|
||||
queue_work_on
|
||||
scatterwalk_ffwd
|
||||
scatterwalk_map_and_copy
|
||||
sg_init_one
|
||||
sg_init_table
|
||||
sg_next
|
||||
shash_free_singlespawn_instance
|
||||
shash_register_instance
|
||||
skcipher_alloc_instance_simple
|
||||
skcipher_register_instance
|
||||
skcipher_walk_aead_decrypt
|
||||
skcipher_walk_aead_encrypt
|
||||
skcipher_walk_done
|
||||
skcipher_walk_virt
|
||||
snprintf
|
||||
__stack_chk_fail
|
||||
__stack_chk_guard
|
||||
strcmp
|
||||
strlcat
|
||||
strlcpy
|
||||
strlen
|
||||
strncmp
|
||||
synchronize_rcu_tasks
|
||||
system_wq
|
||||
__traceiter_android_vh_aes_decrypt
|
||||
__traceiter_android_vh_aes_encrypt
|
||||
__traceiter_android_vh_aes_expandkey
|
||||
__traceiter_android_vh_sha256
|
||||
__tracepoint_android_vh_aes_decrypt
|
||||
__tracepoint_android_vh_aes_encrypt
|
||||
__tracepoint_android_vh_aes_expandkey
|
||||
__tracepoint_android_vh_sha256
|
||||
tracepoint_probe_register
|
||||
up_write
|
||||
wait_for_completion
|
||||
|
||||
# needed by fips140.ko but not identified by the tooling
|
||||
# TODO(b/189327973): [GKI: ABI] Build of fips140.ko module fails to identify some symbols
|
||||
__crypto_memneq
|
||||
__crypto_xor
|
||||
aes_decrypt
|
||||
aes_encrypt
|
||||
aes_expandkey
|
||||
ce_aes_expandkey
|
||||
crypto_aes_inv_sbox
|
||||
crypto_aes_sbox
|
||||
crypto_aes_set_key
|
||||
crypto_ft_tab
|
||||
crypto_inc
|
||||
crypto_it_tab
|
||||
crypto_sha1_finup
|
||||
crypto_sha1_update
|
||||
gf128mul_lle
|
||||
sha1_transform
|
||||
sha224_final
|
||||
sha256
|
||||
sha256_block_data_order
|
||||
sha256_final
|
||||
sha256_update
|
@@ -726,6 +726,7 @@
|
||||
extcon_set_property
|
||||
extcon_set_property_capability
|
||||
extcon_set_state_sync
|
||||
extcon_unregister_notifier
|
||||
failure_tracking
|
||||
fasync_helper
|
||||
__fdget
|
||||
@@ -1836,6 +1837,7 @@
|
||||
trace_handle_return
|
||||
__traceiter_android_rvh_cgroup_force_kthread_migration
|
||||
__traceiter_android_rvh_check_preempt_wakeup
|
||||
__traceiter_android_rvh_cpu_cgroup_online
|
||||
__traceiter_android_rvh_cpu_overutilized
|
||||
__traceiter_android_rvh_dequeue_task
|
||||
__traceiter_android_rvh_find_energy_efficient_cpu
|
||||
@@ -1857,6 +1859,7 @@
|
||||
__traceiter_android_vh_cpu_idle_exit
|
||||
__traceiter_android_vh_enable_thermal_genl_check
|
||||
__traceiter_android_vh_ep_create_wakeup_source
|
||||
__traceiter_android_vh_finish_update_load_avg_se
|
||||
__traceiter_android_vh_ipi_stop
|
||||
__traceiter_android_vh_meminfo_proc_show
|
||||
__traceiter_android_vh_of_i2c_get_board_info
|
||||
@@ -1901,6 +1904,7 @@
|
||||
trace_output_call
|
||||
__tracepoint_android_rvh_cgroup_force_kthread_migration
|
||||
__tracepoint_android_rvh_check_preempt_wakeup
|
||||
__tracepoint_android_rvh_cpu_cgroup_online
|
||||
__tracepoint_android_rvh_cpu_overutilized
|
||||
__tracepoint_android_rvh_dequeue_task
|
||||
__tracepoint_android_rvh_find_energy_efficient_cpu
|
||||
@@ -1922,6 +1926,7 @@
|
||||
__tracepoint_android_vh_cpu_idle_exit
|
||||
__tracepoint_android_vh_enable_thermal_genl_check
|
||||
__tracepoint_android_vh_ep_create_wakeup_source
|
||||
__tracepoint_android_vh_finish_update_load_avg_se
|
||||
__tracepoint_android_vh_ipi_stop
|
||||
__tracepoint_android_vh_meminfo_proc_show
|
||||
__tracepoint_android_vh_of_i2c_get_board_info
|
||||
|
@@ -985,6 +985,7 @@
|
||||
get_zeroed_page
|
||||
gfp_zone
|
||||
gic_nonsecure_priorities
|
||||
gic_resume
|
||||
gov_attr_set_init
|
||||
gov_attr_set_put
|
||||
governor_sysfs_ops
|
||||
@@ -2128,6 +2129,7 @@
|
||||
sg_pcopy_from_buffer
|
||||
sg_pcopy_to_buffer
|
||||
sg_scsi_ioctl
|
||||
shmem_mark_page_lazyfree
|
||||
shmem_truncate_range
|
||||
show_rcu_gp_kthreads
|
||||
show_regs
|
||||
@@ -2468,6 +2470,8 @@
|
||||
__traceiter_android_vh_binder_wakeup_ilocked
|
||||
__traceiter_android_vh_cpu_idle_enter
|
||||
__traceiter_android_vh_cpu_idle_exit
|
||||
__traceiter_android_vh_cpuidle_psci_enter
|
||||
__traceiter_android_vh_cpuidle_psci_exit
|
||||
__traceiter_android_vh_dump_throttled_rt_tasks
|
||||
__traceiter_android_vh_force_compatible_post
|
||||
__traceiter_android_vh_force_compatible_pre
|
||||
@@ -2477,6 +2481,7 @@
|
||||
__traceiter_android_vh_ftrace_oops_enter
|
||||
__traceiter_android_vh_ftrace_oops_exit
|
||||
__traceiter_android_vh_ftrace_size_check
|
||||
__traceiter_android_vh_gic_resume
|
||||
__traceiter_android_vh_gpio_block_read
|
||||
__traceiter_android_vh_iommu_setup_dma_ops
|
||||
__traceiter_android_vh_ipi_stop
|
||||
@@ -2560,6 +2565,8 @@
|
||||
__tracepoint_android_vh_check_uninterruptible_tasks_dn
|
||||
__tracepoint_android_vh_cpu_idle_enter
|
||||
__tracepoint_android_vh_cpu_idle_exit
|
||||
__tracepoint_android_vh_cpuidle_psci_enter
|
||||
__tracepoint_android_vh_cpuidle_psci_exit
|
||||
__tracepoint_android_vh_dump_throttled_rt_tasks
|
||||
__tracepoint_android_vh_force_compatible_post
|
||||
__tracepoint_android_vh_force_compatible_pre
|
||||
@@ -2569,6 +2576,7 @@
|
||||
__tracepoint_android_vh_ftrace_oops_enter
|
||||
__tracepoint_android_vh_ftrace_oops_exit
|
||||
__tracepoint_android_vh_ftrace_size_check
|
||||
__tracepoint_android_vh_gic_resume
|
||||
__tracepoint_android_vh_gpio_block_read
|
||||
__tracepoint_android_vh_iommu_setup_dma_ops
|
||||
__tracepoint_android_vh_ipi_stop
|
||||
|
1
android/gki_aarch64_fips140_modules
Normal file
1
android/gki_aarch64_fips140_modules
Normal file
@@ -0,0 +1 @@
|
||||
crypto/fips140.ko
|
@@ -105,9 +105,13 @@
|
||||
phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
|
||||
phy-reset-duration = <20>;
|
||||
phy-supply = <&sw2_reg>;
|
||||
phy-handle = <ðphy0>;
|
||||
status = "okay";
|
||||
|
||||
fixed-link {
|
||||
speed = <1000>;
|
||||
full-duplex;
|
||||
};
|
||||
|
||||
mdio {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
@@ -406,6 +406,18 @@
|
||||
vin-supply = <&sw1_reg>;
|
||||
};
|
||||
|
||||
®_pu {
|
||||
vin-supply = <&sw1_reg>;
|
||||
};
|
||||
|
||||
®_vdd1p1 {
|
||||
vin-supply = <&sw2_reg>;
|
||||
};
|
||||
|
||||
®_vdd2p5 {
|
||||
vin-supply = <&sw2_reg>;
|
||||
};
|
||||
|
||||
&uart1 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_uart1>;
|
||||
|
@@ -126,7 +126,7 @@
|
||||
compatible = "nxp,pca8574";
|
||||
reg = <0x3a>;
|
||||
gpio-controller;
|
||||
#gpio-cells = <1>;
|
||||
#gpio-cells = <2>;
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -193,7 +193,7 @@
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_usdhc1>;
|
||||
keep-power-in-suspend;
|
||||
tuning-step = <2>;
|
||||
fsl,tuning-step = <2>;
|
||||
vmmc-supply = <®_3p3v>;
|
||||
no-1-8-v;
|
||||
broken-cd;
|
||||
|
@@ -351,7 +351,7 @@
|
||||
pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
|
||||
cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
|
||||
bus-width = <4>;
|
||||
tuning-step = <2>;
|
||||
fsl,tuning-step = <2>;
|
||||
vmmc-supply = <®_3p3v>;
|
||||
wakeup-source;
|
||||
no-1-8-v;
|
||||
|
38
arch/arm64/Makefile.postlink
Normal file
38
arch/arm64/Makefile.postlink
Normal file
@@ -0,0 +1,38 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#
|
||||
# This file is included by the generic Kbuild makefile to permit the
|
||||
# architecture to perform postlink actions on vmlinux and any .ko module file.
|
||||
# In this case, we only need it for fips140.ko, which needs a HMAC digest to be
|
||||
# injected into it. All other targets are NOPs.
|
||||
#
|
||||
|
||||
PHONY := __archpost
|
||||
__archpost:
|
||||
|
||||
-include include/config/auto.conf
|
||||
include scripts/Kbuild.include
|
||||
|
||||
CMD_FIPS140_GEN_HMAC = crypto/fips140_gen_hmac
|
||||
quiet_cmd_gen_hmac = HMAC $@
|
||||
cmd_gen_hmac = $(CMD_FIPS140_GEN_HMAC) $@
|
||||
|
||||
# `@true` prevents complaints when there is nothing to be done
|
||||
|
||||
vmlinux: FORCE
|
||||
@true
|
||||
|
||||
$(objtree)/crypto/fips140.ko: FORCE
|
||||
$(call cmd,gen_hmac)
|
||||
|
||||
%.ko: FORCE
|
||||
@true
|
||||
|
||||
clean:
|
||||
@true
|
||||
|
||||
PHONY += FORCE clean
|
||||
|
||||
FORCE:
|
||||
|
||||
.PHONY: $(PHONY)
|
@@ -31,11 +31,10 @@
|
||||
reg = <0x4>;
|
||||
eee-broken-1000t;
|
||||
eee-broken-100tx;
|
||||
|
||||
qca,clk-out-frequency = <125000000>;
|
||||
qca,clk-out-strength = <AR803X_STRENGTH_FULL>;
|
||||
|
||||
vddio-supply = <&vddh>;
|
||||
qca,keep-pll-enabled;
|
||||
vddio-supply = <&vddio>;
|
||||
|
||||
vddio: vddio-regulator {
|
||||
regulator-name = "VDDIO";
|
||||
|
@@ -192,8 +192,8 @@
|
||||
ddr: memory-controller@1080000 {
|
||||
compatible = "fsl,qoriq-memory-controller";
|
||||
reg = <0x0 0x1080000 0x0 0x1000>;
|
||||
interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>;
|
||||
big-endian;
|
||||
interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
|
||||
little-endian;
|
||||
};
|
||||
|
||||
dcfg: syscon@1e00000 {
|
||||
|
@@ -45,8 +45,8 @@
|
||||
reg_12p0_main: regulator-12p0-main {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "12V_MAIN";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
regulator-min-microvolt = <12000000>;
|
||||
regulator-max-microvolt = <12000000>;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
|
@@ -78,6 +78,8 @@
|
||||
#size-cells = <2>;
|
||||
ranges = <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>;
|
||||
ti,sci-dev-id = <199>;
|
||||
dma-coherent;
|
||||
dma-ranges;
|
||||
|
||||
main_navss_intr: interrupt-controller1 {
|
||||
compatible = "ti,sci-intr";
|
||||
|
1
arch/arm64/configs/fips140_gki.fragment
Normal file
1
arch/arm64/configs/fips140_gki.fragment
Normal file
@@ -0,0 +1 @@
|
||||
CONFIG_CRYPTO_FIPS140_MOD=y
|
@@ -233,6 +233,7 @@ CONFIG_NET_SCH_TBF=y
|
||||
CONFIG_NET_SCH_NETEM=y
|
||||
CONFIG_NET_SCH_CODEL=y
|
||||
CONFIG_NET_SCH_FQ_CODEL=y
|
||||
CONFIG_NET_SCH_FQ=y
|
||||
CONFIG_NET_SCH_INGRESS=y
|
||||
CONFIG_NET_CLS_BASIC=y
|
||||
CONFIG_NET_CLS_TCINDEX=y
|
||||
@@ -314,7 +315,6 @@ CONFIG_WIREGUARD=y
|
||||
CONFIG_IFB=y
|
||||
CONFIG_TUN=y
|
||||
CONFIG_VETH=y
|
||||
CONFIG_PHYLIB=y
|
||||
CONFIG_PPP=y
|
||||
CONFIG_PPP_BSDCOMP=y
|
||||
CONFIG_PPP_DEFLATE=y
|
||||
@@ -665,7 +665,6 @@ CONFIG_UBSAN_LOCAL_BOUNDS=y
|
||||
# CONFIG_UBSAN_MISC is not set
|
||||
CONFIG_PAGE_OWNER=y
|
||||
CONFIG_PAGE_PINNER=y
|
||||
CONFIG_DEBUG_STACK_USAGE=y
|
||||
CONFIG_DEBUG_MEMORY_INIT=y
|
||||
CONFIG_KASAN=y
|
||||
CONFIG_KASAN_HW_TAGS=y
|
||||
|
44
arch/arm64/crypto/Kbuild.fips140
Normal file
44
arch/arm64/crypto/Kbuild.fips140
Normal file
@@ -0,0 +1,44 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Create a separate FIPS archive that duplicates the modules that are relevant
|
||||
# for FIPS 140 certification as builtin objects
|
||||
#
|
||||
|
||||
sha1-ce-y := sha1-ce-glue.o sha1-ce-core.o
|
||||
sha2-ce-y := sha2-ce-glue.o sha2-ce-core.o
|
||||
sha512-ce-y := sha512-ce-glue.o sha512-ce-core.o
|
||||
ghash-ce-y := ghash-ce-glue.o ghash-ce-core.o
|
||||
aes-ce-cipher-y := aes-ce-core.o aes-ce-glue.o
|
||||
aes-ce-blk-y := aes-glue-ce.o aes-ce.o
|
||||
aes-neon-blk-y := aes-glue-neon.o aes-neon.o
|
||||
sha256-arm64-y := sha256-glue.o sha256-core.o
|
||||
sha512-arm64-y := sha512-glue.o sha512-core.o
|
||||
aes-arm64-y := aes-cipher-core.o aes-cipher-glue.o
|
||||
aes-neon-bs-y := aes-neonbs-core.o aes-neonbs-glue.o
|
||||
|
||||
crypto-arm64-fips-src := $(srctree)/arch/arm64/crypto/
|
||||
crypto-arm64-fips-modules := sha1-ce.o sha2-ce.o sha512-ce.o ghash-ce.o \
|
||||
aes-ce-cipher.o aes-ce-blk.o aes-neon-blk.o \
|
||||
sha256-arm64.o sha512-arm64.o aes-arm64.o \
|
||||
aes-neon-bs.o
|
||||
|
||||
crypto-fips-objs += $(foreach o,$(crypto-arm64-fips-modules),$($(o:.o=-y):.o=-fips-arch.o))
|
||||
|
||||
CFLAGS_aes-glue-ce-fips-arch.o := -DUSE_V8_CRYPTO_EXTENSIONS
|
||||
|
||||
$(obj)/aes-glue-%-fips-arch.o: KBUILD_CFLAGS += $(FIPS140_CFLAGS)
|
||||
$(obj)/aes-glue-%-fips-arch.o: $(crypto-arm64-fips-src)/aes-glue.c FORCE
|
||||
$(call if_changed_rule,cc_o_c)
|
||||
|
||||
$(obj)/%-fips-arch.o: KBUILD_CFLAGS += $(FIPS140_CFLAGS)
|
||||
$(obj)/%-fips-arch.o: $(crypto-arm64-fips-src)/%.c FORCE
|
||||
$(call if_changed_rule,cc_o_c)
|
||||
|
||||
$(obj)/%-fips-arch.o: $(crypto-arm64-fips-src)/%.S FORCE
|
||||
$(call if_changed_rule,as_o_S)
|
||||
|
||||
$(obj)/%: $(crypto-arm64-fips-src)/%_shipped
|
||||
$(call cmd,shipped)
|
||||
|
||||
$(obj)/%-fips-arch.o: $(obj)/%.S FORCE
|
||||
$(call if_changed_rule,as_o_S)
|
@@ -9,6 +9,7 @@
|
||||
/* A64 instructions are always 32 bits. */
|
||||
#define AARCH64_INSN_SIZE 4
|
||||
|
||||
#ifndef BUILD_FIPS140_KO
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/stringify.h>
|
||||
@@ -214,4 +215,33 @@ alternative_endif
|
||||
#define ALTERNATIVE(oldinstr, newinstr, ...) \
|
||||
_ALTERNATIVE_CFG(oldinstr, newinstr, __VA_ARGS__, 1)
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* The FIPS140 module does not support alternatives patching, as this
|
||||
* invalidates the HMAC digest of the .text section. However, some alternatives
|
||||
* are known to be irrelevant so we can tolerate them in the FIPS140 module, as
|
||||
* they will never be applied in the first place in the use cases that the
|
||||
* FIPS140 module targets (Android running on a production phone). Any other
|
||||
* uses of alternatives should be avoided, as it is not safe in the general
|
||||
* case to simply use the default sequence in one place (the fips module) and
|
||||
* the alternative sequence everywhere else.
|
||||
*
|
||||
* Below is an allowlist of features that we can ignore, by simply taking the
|
||||
* safe default instruction sequence. Note that this implies that the FIPS140
|
||||
* module is not compatible with VHE, or with pseudo-NMI support.
|
||||
*/
|
||||
|
||||
#define __ALT_ARM64_HAS_LDAPR 0,
|
||||
#define __ALT_ARM64_HAS_VIRT_HOST_EXTN 0,
|
||||
#define __ALT_ARM64_HAS_IRQ_PRIO_MASKING 0,
|
||||
|
||||
#define ALTERNATIVE(oldinstr, newinstr, feature, ...) \
|
||||
_ALTERNATIVE(oldinstr, __ALT_ ## feature, #feature)
|
||||
|
||||
#define _ALTERNATIVE(oldinstr, feature, feature_str) \
|
||||
__take_second_arg(feature oldinstr, \
|
||||
".err Feature " feature_str " not supported in fips140 module")
|
||||
|
||||
#endif /* BUILD_FIPS140_KO */
|
||||
#endif /* __ASM_ALTERNATIVE_MACROS_H */
|
||||
|
@@ -3,5 +3,34 @@ SECTIONS {
|
||||
.plt 0 (NOLOAD) : { BYTE(0) }
|
||||
.init.plt 0 (NOLOAD) : { BYTE(0) }
|
||||
.text.ftrace_trampoline 0 (NOLOAD) : { BYTE(0) }
|
||||
|
||||
#ifdef CONFIG_CRYPTO_FIPS140
|
||||
/*
|
||||
* The FIPS140 module incorporates copies of builtin code, which gets
|
||||
* integrity checked at module load time, and registered in a way that
|
||||
* ensures that the integrity checked versions supersede the builtin
|
||||
* ones. These objects are compiled as builtin code, and so their init
|
||||
* hooks will be exported from the binary in the same way as builtin
|
||||
* initcalls are, i.e., annotated with a level that defines the order
|
||||
* in which the hooks are expected to be invoked.
|
||||
*/
|
||||
#define INIT_CALLS_LEVEL(level) \
|
||||
KEEP(*(.initcall##level##.init*)) \
|
||||
KEEP(*(.initcall##level##s.init*))
|
||||
|
||||
.initcalls : {
|
||||
*(.initcalls._start)
|
||||
INIT_CALLS_LEVEL(0)
|
||||
INIT_CALLS_LEVEL(1)
|
||||
INIT_CALLS_LEVEL(2)
|
||||
INIT_CALLS_LEVEL(3)
|
||||
INIT_CALLS_LEVEL(4)
|
||||
INIT_CALLS_LEVEL(5)
|
||||
INIT_CALLS_LEVEL(rootfs)
|
||||
INIT_CALLS_LEVEL(6)
|
||||
INIT_CALLS_LEVEL(7)
|
||||
*(.initcalls._end)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@@ -35,9 +35,7 @@ static __must_check inline bool may_use_simd(void)
|
||||
* migrated, and if it's clear we cannot be migrated to a CPU
|
||||
* where it is set.
|
||||
*/
|
||||
return !WARN_ON(!system_capabilities_finalized()) &&
|
||||
system_supports_fpsimd() &&
|
||||
!in_irq() && !irqs_disabled() && !in_nmi() &&
|
||||
return !in_irq() && !irqs_disabled() && !in_nmi() &&
|
||||
!this_cpu_read(fpsimd_context_busy);
|
||||
}
|
||||
|
||||
|
@@ -153,6 +153,7 @@ SYM_CODE_START_LOCAL(enter_vhe)
|
||||
// Invalidate TLBs before enabling the MMU
|
||||
tlbi vmalle1
|
||||
dsb nsh
|
||||
isb
|
||||
|
||||
// Enable the EL2 S1 MMU, as set up from EL1
|
||||
mrs_s x0, SYS_SCTLR_EL12
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include <linux/ftrace.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/sort.h>
|
||||
|
||||
static struct plt_entry __get_adrp_add_pair(u64 dst, u64 pc,
|
||||
@@ -290,6 +291,7 @@ static int partition_branch_plt_relas(Elf64_Sym *syms, Elf64_Rela *rela,
|
||||
int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
|
||||
char *secstrings, struct module *mod)
|
||||
{
|
||||
bool copy_rela_for_fips140 = false;
|
||||
unsigned long core_plts = 0;
|
||||
unsigned long init_plts = 0;
|
||||
Elf64_Sym *syms = NULL;
|
||||
@@ -321,6 +323,10 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_CRYPTO_FIPS140) &&
|
||||
!strcmp(mod->name, "fips140"))
|
||||
copy_rela_for_fips140 = true;
|
||||
|
||||
for (i = 0; i < ehdr->e_shnum; i++) {
|
||||
Elf64_Rela *rels = (void *)ehdr + sechdrs[i].sh_offset;
|
||||
int nents, numrels = sechdrs[i].sh_size / sizeof(Elf64_Rela);
|
||||
@@ -329,10 +335,38 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
|
||||
if (sechdrs[i].sh_type != SHT_RELA)
|
||||
continue;
|
||||
|
||||
#ifdef CONFIG_CRYPTO_FIPS140
|
||||
if (copy_rela_for_fips140 &&
|
||||
!strcmp(secstrings + dstsec->sh_name, ".rodata")) {
|
||||
void *p = kmemdup(rels, numrels * sizeof(Elf64_Rela),
|
||||
GFP_KERNEL);
|
||||
if (!p) {
|
||||
pr_err("fips140: failed to allocate .rodata RELA buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
mod->arch.rodata_relocations = p;
|
||||
mod->arch.num_rodata_relocations = numrels;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ignore relocations that operate on non-exec sections */
|
||||
if (!(dstsec->sh_flags & SHF_EXECINSTR))
|
||||
continue;
|
||||
|
||||
#ifdef CONFIG_CRYPTO_FIPS140
|
||||
if (copy_rela_for_fips140 &&
|
||||
!strcmp(secstrings + dstsec->sh_name, ".text")) {
|
||||
void *p = kmemdup(rels, numrels * sizeof(Elf64_Rela),
|
||||
GFP_KERNEL);
|
||||
if (!p) {
|
||||
pr_err("fips140: failed to allocate .text RELA buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
mod->arch.text_relocations = p;
|
||||
mod->arch.num_text_relocations = numrels;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* sort branch relocations requiring a PLT by type, symbol index
|
||||
* and addend
|
||||
|
@@ -1888,8 +1888,10 @@ static int init_hyp_mode(void)
|
||||
if (is_protected_kvm_enabled()) {
|
||||
init_cpu_logical_map();
|
||||
|
||||
if (!init_psci_relay())
|
||||
if (!init_psci_relay()) {
|
||||
err = -ENODEV;
|
||||
goto out_err;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_protected_kvm_enabled()) {
|
||||
|
@@ -50,6 +50,18 @@
|
||||
#ifndef R_AARCH64_ABS64
|
||||
#define R_AARCH64_ABS64 257
|
||||
#endif
|
||||
#ifndef R_AARCH64_PREL64
|
||||
#define R_AARCH64_PREL64 260
|
||||
#endif
|
||||
#ifndef R_AARCH64_PREL32
|
||||
#define R_AARCH64_PREL32 261
|
||||
#endif
|
||||
#ifndef R_AARCH64_PREL16
|
||||
#define R_AARCH64_PREL16 262
|
||||
#endif
|
||||
#ifndef R_AARCH64_PLT32
|
||||
#define R_AARCH64_PLT32 314
|
||||
#endif
|
||||
#ifndef R_AARCH64_LD_PREL_LO19
|
||||
#define R_AARCH64_LD_PREL_LO19 273
|
||||
#endif
|
||||
@@ -371,6 +383,12 @@ static void emit_rela_section(Elf64_Shdr *sh_rela)
|
||||
case R_AARCH64_ABS64:
|
||||
emit_rela_abs64(rela, sh_orig_name);
|
||||
break;
|
||||
/* Allow position-relative data relocations. */
|
||||
case R_AARCH64_PREL64:
|
||||
case R_AARCH64_PREL32:
|
||||
case R_AARCH64_PREL16:
|
||||
case R_AARCH64_PLT32:
|
||||
break;
|
||||
/* Allow relocations to generate PC-relative addressing. */
|
||||
case R_AARCH64_LD_PREL_LO19:
|
||||
case R_AARCH64_ADR_PREL_LO21:
|
||||
|
@@ -23,8 +23,8 @@
|
||||
extern unsigned long hyp_nr_cpus;
|
||||
struct host_kvm host_kvm;
|
||||
|
||||
struct hyp_pool host_s2_mem;
|
||||
struct hyp_pool host_s2_dev;
|
||||
static struct hyp_pool host_s2_mem;
|
||||
static struct hyp_pool host_s2_dev;
|
||||
|
||||
/*
|
||||
* Copies of the host's CPU features registers holding sanitized values.
|
||||
|
@@ -399,14 +399,14 @@ static bool trap_bvr(struct kvm_vcpu *vcpu,
|
||||
struct sys_reg_params *p,
|
||||
const struct sys_reg_desc *rd)
|
||||
{
|
||||
u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg];
|
||||
u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm];
|
||||
|
||||
if (p->is_write)
|
||||
reg_to_dbg(vcpu, p, rd, dbg_reg);
|
||||
else
|
||||
dbg_to_reg(vcpu, p, rd, dbg_reg);
|
||||
|
||||
trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg);
|
||||
trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ static bool trap_bvr(struct kvm_vcpu *vcpu,
|
||||
static int set_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
const struct kvm_one_reg *reg, void __user *uaddr)
|
||||
{
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg];
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm];
|
||||
|
||||
if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0)
|
||||
return -EFAULT;
|
||||
@@ -424,7 +424,7 @@ static int set_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
static int get_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
const struct kvm_one_reg *reg, void __user *uaddr)
|
||||
{
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg];
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm];
|
||||
|
||||
if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0)
|
||||
return -EFAULT;
|
||||
@@ -434,21 +434,21 @@ static int get_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
static void reset_bvr(struct kvm_vcpu *vcpu,
|
||||
const struct sys_reg_desc *rd)
|
||||
{
|
||||
vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg] = rd->val;
|
||||
vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm] = rd->val;
|
||||
}
|
||||
|
||||
static bool trap_bcr(struct kvm_vcpu *vcpu,
|
||||
struct sys_reg_params *p,
|
||||
const struct sys_reg_desc *rd)
|
||||
{
|
||||
u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg];
|
||||
u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm];
|
||||
|
||||
if (p->is_write)
|
||||
reg_to_dbg(vcpu, p, rd, dbg_reg);
|
||||
else
|
||||
dbg_to_reg(vcpu, p, rd, dbg_reg);
|
||||
|
||||
trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg);
|
||||
trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -456,7 +456,7 @@ static bool trap_bcr(struct kvm_vcpu *vcpu,
|
||||
static int set_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
const struct kvm_one_reg *reg, void __user *uaddr)
|
||||
{
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg];
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm];
|
||||
|
||||
if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0)
|
||||
return -EFAULT;
|
||||
@@ -467,7 +467,7 @@ static int set_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
static int get_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
const struct kvm_one_reg *reg, void __user *uaddr)
|
||||
{
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg];
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm];
|
||||
|
||||
if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0)
|
||||
return -EFAULT;
|
||||
@@ -477,22 +477,22 @@ static int get_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
static void reset_bcr(struct kvm_vcpu *vcpu,
|
||||
const struct sys_reg_desc *rd)
|
||||
{
|
||||
vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg] = rd->val;
|
||||
vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm] = rd->val;
|
||||
}
|
||||
|
||||
static bool trap_wvr(struct kvm_vcpu *vcpu,
|
||||
struct sys_reg_params *p,
|
||||
const struct sys_reg_desc *rd)
|
||||
{
|
||||
u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg];
|
||||
u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm];
|
||||
|
||||
if (p->is_write)
|
||||
reg_to_dbg(vcpu, p, rd, dbg_reg);
|
||||
else
|
||||
dbg_to_reg(vcpu, p, rd, dbg_reg);
|
||||
|
||||
trace_trap_reg(__func__, rd->reg, p->is_write,
|
||||
vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg]);
|
||||
trace_trap_reg(__func__, rd->CRm, p->is_write,
|
||||
vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -500,7 +500,7 @@ static bool trap_wvr(struct kvm_vcpu *vcpu,
|
||||
static int set_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
const struct kvm_one_reg *reg, void __user *uaddr)
|
||||
{
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg];
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm];
|
||||
|
||||
if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0)
|
||||
return -EFAULT;
|
||||
@@ -510,7 +510,7 @@ static int set_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
static int get_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
const struct kvm_one_reg *reg, void __user *uaddr)
|
||||
{
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg];
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm];
|
||||
|
||||
if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0)
|
||||
return -EFAULT;
|
||||
@@ -520,21 +520,21 @@ static int get_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
static void reset_wvr(struct kvm_vcpu *vcpu,
|
||||
const struct sys_reg_desc *rd)
|
||||
{
|
||||
vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg] = rd->val;
|
||||
vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm] = rd->val;
|
||||
}
|
||||
|
||||
static bool trap_wcr(struct kvm_vcpu *vcpu,
|
||||
struct sys_reg_params *p,
|
||||
const struct sys_reg_desc *rd)
|
||||
{
|
||||
u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg];
|
||||
u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm];
|
||||
|
||||
if (p->is_write)
|
||||
reg_to_dbg(vcpu, p, rd, dbg_reg);
|
||||
else
|
||||
dbg_to_reg(vcpu, p, rd, dbg_reg);
|
||||
|
||||
trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg);
|
||||
trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -542,7 +542,7 @@ static bool trap_wcr(struct kvm_vcpu *vcpu,
|
||||
static int set_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
const struct kvm_one_reg *reg, void __user *uaddr)
|
||||
{
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg];
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm];
|
||||
|
||||
if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0)
|
||||
return -EFAULT;
|
||||
@@ -552,7 +552,7 @@ static int set_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
static int get_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
const struct kvm_one_reg *reg, void __user *uaddr)
|
||||
{
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg];
|
||||
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm];
|
||||
|
||||
if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0)
|
||||
return -EFAULT;
|
||||
@@ -562,7 +562,7 @@ static int get_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
|
||||
static void reset_wcr(struct kvm_vcpu *vcpu,
|
||||
const struct sys_reg_desc *rd)
|
||||
{
|
||||
vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg] = rd->val;
|
||||
vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm] = rd->val;
|
||||
}
|
||||
|
||||
static void reset_amair_el1(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
|
||||
|
@@ -477,7 +477,8 @@ static void __init map_mem(pgd_t *pgdp)
|
||||
int flags = 0;
|
||||
u64 i;
|
||||
|
||||
if (rodata_full || debug_pagealloc_enabled())
|
||||
if (rodata_full || debug_pagealloc_enabled() ||
|
||||
IS_ENABLED(CONFIG_KFENCE))
|
||||
flags = NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS;
|
||||
|
||||
/*
|
||||
|
@@ -61,6 +61,7 @@ config PARISC
|
||||
select HAVE_KRETPROBES
|
||||
select HAVE_DYNAMIC_FTRACE if $(cc-option,-fpatchable-function-entry=1,1)
|
||||
select HAVE_FTRACE_MCOUNT_RECORD if HAVE_DYNAMIC_FTRACE
|
||||
select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE
|
||||
select HAVE_KPROBES_ON_FTRACE
|
||||
select HAVE_DYNAMIC_FTRACE_WITH_REGS
|
||||
select SET_FS
|
||||
|
@@ -21,8 +21,6 @@ typedef struct {
|
||||
unsigned long sig[_NSIG_WORDS];
|
||||
} sigset_t;
|
||||
|
||||
#define __ARCH_UAPI_SA_FLAGS _SA_SIGGFAULT
|
||||
|
||||
#include <asm/sigcontext.h>
|
||||
|
||||
#endif /* !__ASSEMBLY */
|
||||
|
@@ -108,7 +108,6 @@ int arch_prepare_kprobe(struct kprobe *p)
|
||||
int ret = 0;
|
||||
struct kprobe *prev;
|
||||
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) {
|
||||
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)) {
|
||||
printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n");
|
||||
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");
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ ifneq ($(c-gettimeofday-y),)
|
||||
endif
|
||||
|
||||
# Build rules
|
||||
targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o
|
||||
targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-syms.S
|
||||
obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
|
||||
|
||||
obj-y += vdso.o vdso-syms.o
|
||||
@@ -41,7 +41,7 @@ KASAN_SANITIZE := n
|
||||
$(obj)/vdso.o: $(obj)/vdso.so
|
||||
|
||||
# link rule for the .so file, .lds has to be first
|
||||
$(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
|
||||
$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
|
||||
$(call if_changed,vdsold)
|
||||
LDFLAGS_vdso.so.dbg = -shared -s -soname=linux-vdso.so.1 \
|
||||
--build-id=sha1 --hash-style=both --eh-frame-hdr
|
||||
|
@@ -177,11 +177,6 @@ ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1)
|
||||
KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,)
|
||||
endif
|
||||
|
||||
ifdef CONFIG_LTO_CLANG
|
||||
KBUILD_LDFLAGS += -plugin-opt=-code-model=kernel \
|
||||
-plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
|
||||
endif
|
||||
|
||||
# Workaround for a gcc prelease that unfortunately was shipped in a suse release
|
||||
KBUILD_CFLAGS += -Wno-sign-compare
|
||||
#
|
||||
@@ -201,7 +196,12 @@ ifdef CONFIG_RETPOLINE
|
||||
endif
|
||||
endif
|
||||
|
||||
KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE)
|
||||
KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE)
|
||||
|
||||
ifdef CONFIG_LTO_CLANG
|
||||
KBUILD_LDFLAGS += -plugin-opt=-code-model=kernel \
|
||||
-plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
|
||||
endif
|
||||
|
||||
ifdef CONFIG_X86_NEED_RELOCS
|
||||
LDFLAGS_vmlinux := --emit-relocs --discard-none
|
||||
|
@@ -210,6 +210,7 @@ CONFIG_NET_SCH_TBF=y
|
||||
CONFIG_NET_SCH_NETEM=y
|
||||
CONFIG_NET_SCH_CODEL=y
|
||||
CONFIG_NET_SCH_FQ_CODEL=y
|
||||
CONFIG_NET_SCH_FQ=y
|
||||
CONFIG_NET_SCH_INGRESS=y
|
||||
CONFIG_NET_CLS_BASIC=y
|
||||
CONFIG_NET_CLS_TCINDEX=y
|
||||
@@ -287,7 +288,6 @@ CONFIG_WIREGUARD=y
|
||||
CONFIG_IFB=y
|
||||
CONFIG_TUN=y
|
||||
CONFIG_VETH=y
|
||||
CONFIG_PHYLIB=y
|
||||
CONFIG_PPP=y
|
||||
CONFIG_PPP_BSDCOMP=y
|
||||
CONFIG_PPP_DEFLATE=y
|
||||
@@ -601,7 +601,6 @@ CONFIG_UBSAN_LOCAL_BOUNDS=y
|
||||
# CONFIG_UBSAN_MISC is not set
|
||||
CONFIG_PAGE_OWNER=y
|
||||
CONFIG_PAGE_PINNER=y
|
||||
CONFIG_DEBUG_STACK_USAGE=y
|
||||
CONFIG_DEBUG_MEMORY_INIT=y
|
||||
CONFIG_KFENCE=y
|
||||
CONFIG_KFENCE_SAMPLE_INTERVAL=500
|
||||
|
@@ -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 void lapic_assign_system_vectors(void);
|
||||
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_offline(void);
|
||||
extern bool apic_needs_pit(void);
|
||||
|
@@ -56,11 +56,8 @@
|
||||
# define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31))
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IOMMU_SUPPORT
|
||||
# define DISABLE_ENQCMD 0
|
||||
#else
|
||||
# define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
|
||||
#endif
|
||||
/* Force disable because it's broken beyond repair */
|
||||
#define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
|
||||
|
||||
/*
|
||||
* Make sure to add features to the correct mask
|
||||
|
@@ -79,10 +79,6 @@ extern int cpu_has_xfeatures(u64 xfeatures_mask, const char **feature_name);
|
||||
*/
|
||||
#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) { }
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_X86_FPU_API_H */
|
||||
|
@@ -584,13 +584,6 @@ static inline void switch_fpu_finish(struct fpu *new_fpu)
|
||||
pkru_val = pk->pkru;
|
||||
}
|
||||
__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 */
|
||||
|
@@ -7,8 +7,6 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <uapi/asm/kvm_para.h>
|
||||
|
||||
extern void kvmclock_init(void);
|
||||
|
||||
#ifdef CONFIG_KVM_GUEST
|
||||
bool kvm_check_and_clear_guest_paused(void);
|
||||
#else
|
||||
@@ -86,13 +84,14 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KVM_GUEST
|
||||
void kvmclock_init(void);
|
||||
void kvmclock_disable(void);
|
||||
bool kvm_para_available(void);
|
||||
unsigned int kvm_arch_para_features(void);
|
||||
unsigned int kvm_arch_para_hints(void);
|
||||
void kvm_async_pf_task_wait_schedule(u32 token);
|
||||
void kvm_async_pf_task_wake(u32 token);
|
||||
u32 kvm_read_and_reset_apf_flags(void);
|
||||
void kvm_disable_steal_time(void);
|
||||
bool __kvm_handle_async_pf(struct pt_regs *regs, u32 token);
|
||||
|
||||
DECLARE_STATIC_KEY_FALSE(kvm_async_pf_enabled);
|
||||
@@ -137,11 +136,6 @@ static inline u32 kvm_read_and_reset_apf_flags(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void kvm_disable_steal_time(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static __always_inline bool kvm_handle_async_pf(struct pt_regs *regs, u32 token)
|
||||
{
|
||||
return false;
|
||||
|
@@ -2539,6 +2539,7 @@ static void __init apic_bsp_setup(bool upmode)
|
||||
end_local_APIC_setup();
|
||||
irq_remap_enable_fault_handling();
|
||||
setup_IO_APIC();
|
||||
lapic_update_legacy_vectors();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UP_LATE_INIT
|
||||
|
@@ -687,6 +687,26 @@ void lapic_assign_legacy_vector(unsigned int irq, bool 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)
|
||||
{
|
||||
unsigned int i, vector = 0;
|
||||
|
@@ -1402,60 +1402,3 @@ int proc_pid_arch_status(struct seq_file *m, struct pid_namespace *ns,
|
||||
return 0;
|
||||
}
|
||||
#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 = ¤t->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 */
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <linux/kprobes.h>
|
||||
#include <linux/nmi.h>
|
||||
#include <linux/swait.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
#include <asm/timer.h>
|
||||
#include <asm/cpu.h>
|
||||
#include <asm/traps.h>
|
||||
@@ -37,6 +38,7 @@
|
||||
#include <asm/tlb.h>
|
||||
#include <asm/cpuidle_haltpoll.h>
|
||||
#include <asm/ptrace.h>
|
||||
#include <asm/reboot.h>
|
||||
#include <asm/svm.h>
|
||||
|
||||
DEFINE_STATIC_KEY_FALSE(kvm_async_pf_enabled);
|
||||
@@ -374,6 +376,14 @@ static void kvm_pv_disable_apf(void)
|
||||
pr_info("Unregister pv shared memory for cpu %d\n", smp_processor_id());
|
||||
}
|
||||
|
||||
static void kvm_disable_steal_time(void)
|
||||
{
|
||||
if (!has_steal_clock)
|
||||
return;
|
||||
|
||||
wrmsr(MSR_KVM_STEAL_TIME, 0, 0);
|
||||
}
|
||||
|
||||
static void kvm_pv_guest_cpu_reboot(void *unused)
|
||||
{
|
||||
/*
|
||||
@@ -416,14 +426,6 @@ static u64 kvm_steal_clock(int cpu)
|
||||
return steal;
|
||||
}
|
||||
|
||||
void kvm_disable_steal_time(void)
|
||||
{
|
||||
if (!has_steal_clock)
|
||||
return;
|
||||
|
||||
wrmsr(MSR_KVM_STEAL_TIME, 0, 0);
|
||||
}
|
||||
|
||||
static inline void __set_percpu_decrypted(void *ptr, unsigned long size)
|
||||
{
|
||||
early_set_memory_decrypted((unsigned long) ptr, size);
|
||||
@@ -460,6 +462,27 @@ static bool pv_tlb_flush_supported(void)
|
||||
|
||||
static DEFINE_PER_CPU(cpumask_var_t, __pv_cpu_mask);
|
||||
|
||||
static void kvm_guest_cpu_offline(bool shutdown)
|
||||
{
|
||||
kvm_disable_steal_time();
|
||||
if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
|
||||
wrmsrl(MSR_KVM_PV_EOI_EN, 0);
|
||||
kvm_pv_disable_apf();
|
||||
if (!shutdown)
|
||||
apf_task_wake_all();
|
||||
kvmclock_disable();
|
||||
}
|
||||
|
||||
static int kvm_cpu_online(unsigned int cpu)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
local_irq_save(flags);
|
||||
kvm_guest_cpu_init();
|
||||
local_irq_restore(flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
static bool pv_ipi_supported(void)
|
||||
@@ -587,30 +610,47 @@ static void __init kvm_smp_prepare_boot_cpu(void)
|
||||
kvm_spinlock_init();
|
||||
}
|
||||
|
||||
static void kvm_guest_cpu_offline(void)
|
||||
{
|
||||
kvm_disable_steal_time();
|
||||
if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
|
||||
wrmsrl(MSR_KVM_PV_EOI_EN, 0);
|
||||
kvm_pv_disable_apf();
|
||||
apf_task_wake_all();
|
||||
}
|
||||
|
||||
static int kvm_cpu_online(unsigned int cpu)
|
||||
{
|
||||
local_irq_disable();
|
||||
kvm_guest_cpu_init();
|
||||
local_irq_enable();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kvm_cpu_down_prepare(unsigned int cpu)
|
||||
{
|
||||
local_irq_disable();
|
||||
kvm_guest_cpu_offline();
|
||||
local_irq_enable();
|
||||
unsigned long flags;
|
||||
|
||||
local_irq_save(flags);
|
||||
kvm_guest_cpu_offline(false);
|
||||
local_irq_restore(flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int kvm_suspend(void)
|
||||
{
|
||||
kvm_guest_cpu_offline(false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void kvm_resume(void)
|
||||
{
|
||||
kvm_cpu_online(raw_smp_processor_id());
|
||||
}
|
||||
|
||||
static struct syscore_ops kvm_syscore_ops = {
|
||||
.suspend = kvm_suspend,
|
||||
.resume = kvm_resume,
|
||||
};
|
||||
|
||||
/*
|
||||
* After a PV feature is registered, the host will keep writing to the
|
||||
* registered memory location. If the guest happens to shutdown, this memory
|
||||
* won't be valid. In cases like kexec, in which you install a new kernel, this
|
||||
* means a random memory location will be kept being written.
|
||||
*/
|
||||
#ifdef CONFIG_KEXEC_CORE
|
||||
static void kvm_crash_shutdown(struct pt_regs *regs)
|
||||
{
|
||||
kvm_guest_cpu_offline(true);
|
||||
native_machine_crash_shutdown(regs);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void kvm_flush_tlb_others(const struct cpumask *cpumask,
|
||||
@@ -681,6 +721,12 @@ static void __init kvm_guest_init(void)
|
||||
kvm_guest_cpu_init();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KEXEC_CORE
|
||||
machine_ops.crash_shutdown = kvm_crash_shutdown;
|
||||
#endif
|
||||
|
||||
register_syscore_ops(&kvm_syscore_ops);
|
||||
|
||||
/*
|
||||
* Hard lockup detection is enabled by default. Disable it, as guests
|
||||
* can get false positives too easily, for example if the host is
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include <asm/hypervisor.h>
|
||||
#include <asm/mem_encrypt.h>
|
||||
#include <asm/x86_init.h>
|
||||
#include <asm/reboot.h>
|
||||
#include <asm/kvmclock.h>
|
||||
|
||||
static int kvmclock __initdata = 1;
|
||||
@@ -204,28 +203,9 @@ static void kvm_setup_secondary_clock(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* After the clock is registered, the host will keep writing to the
|
||||
* registered memory location. If the guest happens to shutdown, this memory
|
||||
* won't be valid. In cases like kexec, in which you install a new kernel, this
|
||||
* means a random memory location will be kept being written. So before any
|
||||
* kind of shutdown from our side, we unregister the clock by writing anything
|
||||
* that does not have the 'enable' bit set in the msr
|
||||
*/
|
||||
#ifdef CONFIG_KEXEC_CORE
|
||||
static void kvm_crash_shutdown(struct pt_regs *regs)
|
||||
void kvmclock_disable(void)
|
||||
{
|
||||
native_write_msr(msr_kvm_system_time, 0, 0);
|
||||
kvm_disable_steal_time();
|
||||
native_machine_crash_shutdown(regs);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void kvm_shutdown(void)
|
||||
{
|
||||
native_write_msr(msr_kvm_system_time, 0, 0);
|
||||
kvm_disable_steal_time();
|
||||
native_machine_shutdown();
|
||||
}
|
||||
|
||||
static void __init kvmclock_init_mem(void)
|
||||
@@ -352,10 +332,6 @@ void __init kvmclock_init(void)
|
||||
#endif
|
||||
x86_platform.save_sched_clock_state = kvm_save_sched_clock_state;
|
||||
x86_platform.restore_sched_clock_state = kvm_restore_sched_clock_state;
|
||||
machine_ops.shutdown = kvm_shutdown;
|
||||
#ifdef CONFIG_KEXEC_CORE
|
||||
machine_ops.crash_shutdown = kvm_crash_shutdown;
|
||||
#endif
|
||||
kvm_get_preset_lpj();
|
||||
|
||||
/*
|
||||
|
@@ -2362,7 +2362,7 @@ static int cr_interception(struct vcpu_svm *svm)
|
||||
err = 0;
|
||||
if (cr >= 16) { /* mov to cr */
|
||||
cr -= 16;
|
||||
val = kvm_register_read(&svm->vcpu, reg);
|
||||
val = kvm_register_readl(&svm->vcpu, reg);
|
||||
trace_kvm_cr_write(cr, val);
|
||||
switch (cr) {
|
||||
case 0:
|
||||
@@ -2408,7 +2408,7 @@ static int cr_interception(struct vcpu_svm *svm)
|
||||
kvm_queue_exception(&svm->vcpu, UD_VECTOR);
|
||||
return 1;
|
||||
}
|
||||
kvm_register_write(&svm->vcpu, reg, val);
|
||||
kvm_register_writel(&svm->vcpu, reg, val);
|
||||
trace_kvm_cr_read(cr, val);
|
||||
}
|
||||
return kvm_complete_insn_gp(&svm->vcpu, err);
|
||||
@@ -2439,13 +2439,13 @@ static int dr_interception(struct vcpu_svm *svm)
|
||||
if (dr >= 16) { /* mov to DRn */
|
||||
if (!kvm_require_dr(&svm->vcpu, dr - 16))
|
||||
return 1;
|
||||
val = kvm_register_read(&svm->vcpu, reg);
|
||||
val = kvm_register_readl(&svm->vcpu, reg);
|
||||
kvm_set_dr(&svm->vcpu, dr - 16, val);
|
||||
} else {
|
||||
if (!kvm_require_dr(&svm->vcpu, dr))
|
||||
return 1;
|
||||
kvm_get_dr(&svm->vcpu, dr, &val);
|
||||
kvm_register_write(&svm->vcpu, reg, val);
|
||||
kvm_register_writel(&svm->vcpu, reg, val);
|
||||
}
|
||||
|
||||
return kvm_skip_emulated_instruction(&svm->vcpu);
|
||||
|
@@ -504,10 +504,6 @@ void __init sme_enable(struct boot_params *bp)
|
||||
#define AMD_SME_BIT BIT(0)
|
||||
#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:
|
||||
* CPUID Fn8000_001F[EAX]
|
||||
@@ -519,11 +515,16 @@ void __init sme_enable(struct boot_params *bp)
|
||||
eax = 0x8000001f;
|
||||
ecx = 0;
|
||||
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;
|
||||
|
||||
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 */
|
||||
if (feature_mask == AMD_SME_BIT) {
|
||||
/*
|
||||
|
@@ -18,6 +18,7 @@ android/abi_gki_aarch64_generic
|
||||
android/abi_gki_aarch64_exynos
|
||||
android/abi_gki_aarch64_mtk
|
||||
android/abi_gki_aarch64_xiaomi
|
||||
android/abi_gki_aarch64_fips140
|
||||
"
|
||||
|
||||
FILES="${FILES}
|
||||
|
17
build.config.gki.aarch64.fips140
Normal file
17
build.config.gki.aarch64.fips140
Normal file
@@ -0,0 +1,17 @@
|
||||
. ${ROOT_DIR}/${KERNEL_DIR}/build.config.gki.aarch64
|
||||
|
||||
FILES="${FILES}
|
||||
crypto/fips140.ko
|
||||
"
|
||||
|
||||
if [ "${LTO}" = "none" ]; then
|
||||
echo "The FIPS140 module needs LTO to be enabled."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MODULES_ORDER=android/gki_aarch64_fips140_modules
|
||||
|
||||
DEFCONFIG=fips140_gki_defconfig
|
||||
KMI_SYMBOL_LIST=android/abi_gki_aarch64_fips140
|
||||
PRE_DEFCONFIG_CMDS="cat ${ROOT_DIR}/${KERNEL_DIR}/arch/arm64/configs/gki_defconfig ${ROOT_DIR}/${KERNEL_DIR}/arch/arm64/configs/fips140_gki.fragment > ${ROOT_DIR}/${KERNEL_DIR}/arch/arm64/configs/${DEFCONFIG};"
|
||||
POST_DEFCONFIG_CMDS="rm ${ROOT_DIR}/${KERNEL_DIR}/arch/arm64/configs/${DEFCONFIG}"
|
@@ -32,6 +32,14 @@ config CRYPTO_FIPS
|
||||
certification. You should say no unless you know what
|
||||
this is.
|
||||
|
||||
config CRYPTO_FIPS140
|
||||
def_bool y
|
||||
depends on MODULES && ARM64 && ARM64_MODULE_PLTS
|
||||
|
||||
config CRYPTO_FIPS140_MOD
|
||||
bool "Enable FIPS140 integrity self-checked loadable module"
|
||||
depends on LTO_CLANG && CRYPTO_FIPS140
|
||||
|
||||
config CRYPTO_ALGAPI
|
||||
tristate
|
||||
select CRYPTO_ALGAPI2
|
||||
|
@@ -197,3 +197,43 @@ obj-$(CONFIG_ASYMMETRIC_KEY_TYPE) += asymmetric_keys/
|
||||
obj-$(CONFIG_CRYPTO_HASH_INFO) += hash_info.o
|
||||
crypto_simd-y := simd.o
|
||||
obj-$(CONFIG_CRYPTO_SIMD) += crypto_simd.o
|
||||
|
||||
ifneq ($(CONFIG_CRYPTO_FIPS140_MOD),)
|
||||
|
||||
FIPS140_CFLAGS := -D__DISABLE_EXPORTS -DBUILD_FIPS140_KO
|
||||
|
||||
#
|
||||
# Create a separate FIPS archive containing a duplicate of each builtin generic
|
||||
# module that is in scope for FIPS 140-2 certification
|
||||
#
|
||||
crypto-fips-objs := drbg.o ecb.o cbc.o ctr.o gcm.o xts.o hmac.o memneq.o \
|
||||
gf128mul.o aes_generic.o lib-crypto-aes.o \
|
||||
sha1_generic.o sha256_generic.o sha512_generic.o \
|
||||
lib-sha1.o lib-crypto-sha256.o
|
||||
crypto-fips-objs := $(foreach o,$(crypto-fips-objs),$(o:.o=-fips.o))
|
||||
|
||||
# get the arch to add its objects to $(crypto-fips-objs)
|
||||
include $(srctree)/arch/$(ARCH)/crypto/Kbuild.fips140
|
||||
|
||||
extra-$(CONFIG_CRYPTO_FIPS140_MOD) += crypto-fips.a
|
||||
|
||||
$(obj)/%-fips.o: KBUILD_CFLAGS += $(FIPS140_CFLAGS)
|
||||
$(obj)/%-fips.o: $(src)/%.c FORCE
|
||||
$(call if_changed_rule,cc_o_c)
|
||||
$(obj)/lib-%-fips.o: $(srctree)/lib/%.c FORCE
|
||||
$(call if_changed_rule,cc_o_c)
|
||||
$(obj)/lib-crypto-%-fips.o: $(srctree)/lib/crypto/%.c FORCE
|
||||
$(call if_changed_rule,cc_o_c)
|
||||
|
||||
$(obj)/crypto-fips.a: $(addprefix $(obj)/,$(crypto-fips-objs)) FORCE
|
||||
$(call if_changed,ar_and_symver)
|
||||
|
||||
fips140-objs := fips140-module.o crypto-fips.a
|
||||
obj-m += fips140.o
|
||||
|
||||
CFLAGS_fips140-module.o += $(FIPS140_CFLAGS)
|
||||
|
||||
hostprogs-always-y := fips140_gen_hmac
|
||||
HOSTLDLIBS_fips140_gen_hmac := -lcrypto -lelf
|
||||
|
||||
endif
|
||||
|
630
crypto/fips140-module.c
Normal file
630
crypto/fips140-module.c
Normal file
@@ -0,0 +1,630 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
* Author: Ard Biesheuvel <ardb@google.com>
|
||||
*
|
||||
* This file is the core of the fips140.ko, which carries a number of crypto
|
||||
* algorithms and chaining mode templates that are also built into vmlinux.
|
||||
* This modules performs a load time integrity check, as mandated by FIPS 140,
|
||||
* and replaces registered crypto algorithms that appear on the FIPS 140 list
|
||||
* with ones provided by this module. This meets the FIPS 140 requirements for
|
||||
* a cryptographic software module.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "fips140: " fmt
|
||||
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/module.h>
|
||||
#include <crypto/aead.h>
|
||||
#include <crypto/aes.h>
|
||||
#include <crypto/hash.h>
|
||||
#include <crypto/sha.h>
|
||||
#include <crypto/skcipher.h>
|
||||
#include <crypto/rng.h>
|
||||
#include <trace/hooks/fips140.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/*
|
||||
* FIPS 140-2 prefers the use of HMAC with a public key over a plain hash.
|
||||
*/
|
||||
u8 __initdata fips140_integ_hmac_key[] = "The quick brown fox jumps over the lazy dog";
|
||||
|
||||
/* this is populated by the build tool */
|
||||
u8 __initdata fips140_integ_hmac_digest[SHA256_DIGEST_SIZE];
|
||||
|
||||
const u32 __initcall_start_marker __section(".initcalls._start");
|
||||
const u32 __initcall_end_marker __section(".initcalls._end");
|
||||
|
||||
const u8 __fips140_text_start __section(".text.._start");
|
||||
const u8 __fips140_text_end __section(".text.._end");
|
||||
|
||||
const u8 __fips140_rodata_start __section(".rodata.._start");
|
||||
const u8 __fips140_rodata_end __section(".rodata.._end");
|
||||
|
||||
/*
|
||||
* We need this little detour to prevent Clang from detecting out of bounds
|
||||
* accesses to __fips140_text_start and __fips140_rodata_start, which only exist
|
||||
* to delineate the section, and so their sizes are not relevant to us.
|
||||
*/
|
||||
const u32 *__initcall_start = &__initcall_start_marker;
|
||||
|
||||
const u8 *__text_start = &__fips140_text_start;
|
||||
const u8 *__rodata_start = &__fips140_rodata_start;
|
||||
|
||||
static const char fips140_algorithms[][22] __initconst = {
|
||||
"aes",
|
||||
|
||||
"gcm(aes)",
|
||||
|
||||
"ecb(aes)",
|
||||
"cbc(aes)",
|
||||
"ctr(aes)",
|
||||
"xts(aes)",
|
||||
|
||||
"hmac(sha1)",
|
||||
"hmac(sha224)",
|
||||
"hmac(sha256)",
|
||||
"hmac(sha384)",
|
||||
"hmac(sha512)",
|
||||
"sha1",
|
||||
"sha224",
|
||||
"sha256",
|
||||
"sha384",
|
||||
"sha512",
|
||||
|
||||
"drbg_nopr_ctr_aes256",
|
||||
"drbg_nopr_ctr_aes192",
|
||||
"drbg_nopr_ctr_aes128",
|
||||
"drbg_nopr_hmac_sha512",
|
||||
"drbg_nopr_hmac_sha384",
|
||||
"drbg_nopr_hmac_sha256",
|
||||
"drbg_nopr_hmac_sha1",
|
||||
"drbg_nopr_sha512",
|
||||
"drbg_nopr_sha384",
|
||||
"drbg_nopr_sha256",
|
||||
"drbg_nopr_sha1",
|
||||
"drbg_pr_ctr_aes256",
|
||||
"drbg_pr_ctr_aes192",
|
||||
"drbg_pr_ctr_aes128",
|
||||
"drbg_pr_hmac_sha512",
|
||||
"drbg_pr_hmac_sha384",
|
||||
"drbg_pr_hmac_sha256",
|
||||
"drbg_pr_hmac_sha1",
|
||||
"drbg_pr_sha512",
|
||||
"drbg_pr_sha384",
|
||||
"drbg_pr_sha256",
|
||||
"drbg_pr_sha1",
|
||||
};
|
||||
|
||||
static bool __init is_fips140_algo(struct crypto_alg *alg)
|
||||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* All software algorithms are synchronous, hardware algorithms must
|
||||
* be covered by their own FIPS 140 certification.
|
||||
*/
|
||||
if (alg->cra_flags & CRYPTO_ALG_ASYNC)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(fips140_algorithms); i++)
|
||||
if (!strcmp(alg->cra_name, fips140_algorithms[i]))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static LIST_HEAD(unchecked_fips140_algos);
|
||||
|
||||
static void __init unregister_existing_fips140_algos(void)
|
||||
{
|
||||
struct crypto_alg *alg, *tmp;
|
||||
LIST_HEAD(remove_list);
|
||||
LIST_HEAD(spawns);
|
||||
|
||||
down_write(&crypto_alg_sem);
|
||||
|
||||
/*
|
||||
* Find all registered algorithms that we care about, and move them to
|
||||
* a private list so that they are no longer exposed via the algo
|
||||
* lookup API. Subsequently, we will unregister them if they are not in
|
||||
* active use. If they are, we cannot simply remove them but we can
|
||||
* adapt them later to use our integrity checked backing code.
|
||||
*/
|
||||
list_for_each_entry_safe(alg, tmp, &crypto_alg_list, cra_list) {
|
||||
if (is_fips140_algo(alg)) {
|
||||
if (refcount_read(&alg->cra_refcnt) == 1) {
|
||||
/*
|
||||
* This algorithm is not currently in use, but
|
||||
* there may be template instances holding
|
||||
* references to it via spawns. So let's tear
|
||||
* it down like crypto_unregister_alg() would,
|
||||
* but without releasing the lock, to prevent
|
||||
* races with concurrent TFM allocations.
|
||||
*/
|
||||
alg->cra_flags |= CRYPTO_ALG_DEAD;
|
||||
list_move(&alg->cra_list, &remove_list);
|
||||
crypto_remove_spawns(alg, &spawns, NULL);
|
||||
} else {
|
||||
/*
|
||||
* This algorithm is live, i.e., there are TFMs
|
||||
* allocated that rely on it for its crypto
|
||||
* transformations. We will swap these out
|
||||
* later with integrity checked versions.
|
||||
*/
|
||||
list_move(&alg->cra_list,
|
||||
&unchecked_fips140_algos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We haven't taken a reference to the algorithms on the remove_list,
|
||||
* so technically, we may be competing with a concurrent invocation of
|
||||
* crypto_unregister_alg() here. Fortunately, crypto_unregister_alg()
|
||||
* just gives up with a warning if the algo that is being unregistered
|
||||
* has already disappeared, so this happens to be safe. That does mean
|
||||
* we need to hold on to the lock, to ensure that the algo is either on
|
||||
* the list or it is not, and not in some limbo state.
|
||||
*/
|
||||
crypto_remove_final(&remove_list);
|
||||
crypto_remove_final(&spawns);
|
||||
|
||||
up_write(&crypto_alg_sem);
|
||||
}
|
||||
|
||||
static void __init unapply_text_relocations(void *section, int section_size,
|
||||
const Elf64_Rela *rela, int numrels)
|
||||
{
|
||||
while (numrels--) {
|
||||
u32 *place = (u32 *)(section + rela->r_offset);
|
||||
|
||||
BUG_ON(rela->r_offset >= section_size);
|
||||
|
||||
switch (ELF64_R_TYPE(rela->r_info)) {
|
||||
#ifdef CONFIG_ARM64
|
||||
case R_AARCH64_JUMP26:
|
||||
case R_AARCH64_CALL26:
|
||||
*place &= ~GENMASK(25, 0);
|
||||
break;
|
||||
|
||||
case R_AARCH64_ADR_PREL_LO21:
|
||||
case R_AARCH64_ADR_PREL_PG_HI21:
|
||||
case R_AARCH64_ADR_PREL_PG_HI21_NC:
|
||||
*place &= ~(GENMASK(30, 29) | GENMASK(23, 5));
|
||||
break;
|
||||
|
||||
case R_AARCH64_ADD_ABS_LO12_NC:
|
||||
case R_AARCH64_LDST8_ABS_LO12_NC:
|
||||
case R_AARCH64_LDST16_ABS_LO12_NC:
|
||||
case R_AARCH64_LDST32_ABS_LO12_NC:
|
||||
case R_AARCH64_LDST64_ABS_LO12_NC:
|
||||
case R_AARCH64_LDST128_ABS_LO12_NC:
|
||||
*place &= ~GENMASK(21, 10);
|
||||
break;
|
||||
default:
|
||||
pr_err("unhandled relocation type %llu\n",
|
||||
ELF64_R_TYPE(rela->r_info));
|
||||
BUG();
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
}
|
||||
rela++;
|
||||
}
|
||||
}
|
||||
|
||||
static void __init unapply_rodata_relocations(void *section, int section_size,
|
||||
const Elf64_Rela *rela, int numrels)
|
||||
{
|
||||
while (numrels--) {
|
||||
void *place = section + rela->r_offset;
|
||||
|
||||
BUG_ON(rela->r_offset >= section_size);
|
||||
|
||||
switch (ELF64_R_TYPE(rela->r_info)) {
|
||||
#ifdef CONFIG_ARM64
|
||||
case R_AARCH64_ABS64:
|
||||
*(u64 *)place = 0;
|
||||
break;
|
||||
default:
|
||||
pr_err("unhandled relocation type %llu\n",
|
||||
ELF64_R_TYPE(rela->r_info));
|
||||
BUG();
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
}
|
||||
rela++;
|
||||
}
|
||||
}
|
||||
|
||||
static bool __init check_fips140_module_hmac(void)
|
||||
{
|
||||
SHASH_DESC_ON_STACK(desc, dontcare);
|
||||
u8 digest[SHA256_DIGEST_SIZE];
|
||||
void *textcopy, *rodatacopy;
|
||||
int textsize, rodatasize;
|
||||
int err;
|
||||
|
||||
textsize = &__fips140_text_end - &__fips140_text_start;
|
||||
rodatasize = &__fips140_rodata_end - &__fips140_rodata_start;
|
||||
|
||||
pr_warn("text size : 0x%x\n", textsize);
|
||||
pr_warn("rodata size: 0x%x\n", rodatasize);
|
||||
|
||||
textcopy = kmalloc(textsize + rodatasize, GFP_KERNEL);
|
||||
if (!textcopy) {
|
||||
pr_err("Failed to allocate memory for copy of .text\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
rodatacopy = textcopy + textsize;
|
||||
|
||||
memcpy(textcopy, __text_start, textsize);
|
||||
memcpy(rodatacopy, __rodata_start, rodatasize);
|
||||
|
||||
// apply the relocations in reverse on the copies of .text and .rodata
|
||||
unapply_text_relocations(textcopy, textsize,
|
||||
__this_module.arch.text_relocations,
|
||||
__this_module.arch.num_text_relocations);
|
||||
|
||||
unapply_rodata_relocations(rodatacopy, rodatasize,
|
||||
__this_module.arch.rodata_relocations,
|
||||
__this_module.arch.num_rodata_relocations);
|
||||
|
||||
kfree(__this_module.arch.text_relocations);
|
||||
kfree(__this_module.arch.rodata_relocations);
|
||||
|
||||
desc->tfm = crypto_alloc_shash("hmac(sha256)", 0, 0);
|
||||
if (IS_ERR(desc->tfm)) {
|
||||
pr_err("failed to allocate hmac tfm (%ld)\n", PTR_ERR(desc->tfm));
|
||||
kfree(textcopy);
|
||||
return false;
|
||||
}
|
||||
|
||||
pr_warn("using '%s' for integrity check\n",
|
||||
crypto_shash_driver_name(desc->tfm));
|
||||
|
||||
err = crypto_shash_setkey(desc->tfm, fips140_integ_hmac_key,
|
||||
strlen(fips140_integ_hmac_key)) ?:
|
||||
crypto_shash_init(desc) ?:
|
||||
crypto_shash_update(desc, textcopy, textsize) ?:
|
||||
crypto_shash_finup(desc, rodatacopy, rodatasize, digest);
|
||||
|
||||
crypto_free_shash(desc->tfm);
|
||||
kfree(textcopy);
|
||||
|
||||
if (err) {
|
||||
pr_err("failed to calculate hmac shash (%d)\n", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (memcmp(digest, fips140_integ_hmac_digest, sizeof(digest))) {
|
||||
pr_err("provided_digest : %*phN\n", (int)sizeof(digest),
|
||||
fips140_integ_hmac_digest);
|
||||
|
||||
pr_err("calculated digest: %*phN\n", (int)sizeof(digest),
|
||||
digest);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool __init update_live_fips140_algos(void)
|
||||
{
|
||||
struct crypto_alg *alg, *new_alg, *tmp;
|
||||
|
||||
/*
|
||||
* Find all algorithms that we could not unregister the last time
|
||||
* around, due to the fact that they were already in use.
|
||||
*/
|
||||
down_write(&crypto_alg_sem);
|
||||
list_for_each_entry_safe(alg, tmp, &unchecked_fips140_algos, cra_list) {
|
||||
|
||||
/*
|
||||
* Take this algo off the list before releasing the lock. This
|
||||
* ensures that a concurrent invocation of
|
||||
* crypto_unregister_alg() observes a consistent state, i.e.,
|
||||
* the algo is still on the list, and crypto_unregister_alg()
|
||||
* will release it, or it is not, and crypto_unregister_alg()
|
||||
* will issue a warning but ignore this condition otherwise.
|
||||
*/
|
||||
list_del_init(&alg->cra_list);
|
||||
up_write(&crypto_alg_sem);
|
||||
|
||||
/*
|
||||
* Grab the algo that will replace the live one.
|
||||
* Note that this will instantiate template based instances as
|
||||
* well, as long as their driver name uses the conventional
|
||||
* pattern of "template(algo)". In this case, we are relying on
|
||||
* the fact that the templates carried by this module will
|
||||
* supersede the builtin ones, due to the fact that they were
|
||||
* registered later, and therefore appear first in the linked
|
||||
* list. For example, "hmac(sha1-ce)" constructed using the
|
||||
* builtin hmac template and the builtin SHA1 driver will be
|
||||
* superseded by the integrity checked versions of HMAC and
|
||||
* SHA1-ce carried in this module.
|
||||
*
|
||||
* Note that this takes a reference to the new algorithm which
|
||||
* will never get released. This is intentional: once we copy
|
||||
* the function pointers from the new algo into the old one, we
|
||||
* cannot drop the new algo unless we are sure that the old one
|
||||
* has been released, and this is someting we don't keep track
|
||||
* of at the moment.
|
||||
*/
|
||||
new_alg = crypto_alg_mod_lookup(alg->cra_driver_name,
|
||||
alg->cra_flags & CRYPTO_ALG_TYPE_MASK,
|
||||
CRYPTO_ALG_TYPE_MASK | CRYPTO_NOLOAD);
|
||||
|
||||
if (IS_ERR(new_alg)) {
|
||||
pr_crit("Failed to allocate '%s' for updating live algo (%ld)\n",
|
||||
alg->cra_driver_name, PTR_ERR(new_alg));
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* The FIPS module's algorithms are expected to be built from
|
||||
* the same source code as the in-kernel ones so that they are
|
||||
* fully compatible. In general, there's no way to verify full
|
||||
* compatibility at runtime, but we can at least verify that
|
||||
* the algorithm properties match.
|
||||
*/
|
||||
if (alg->cra_ctxsize != new_alg->cra_ctxsize ||
|
||||
alg->cra_alignmask != new_alg->cra_alignmask) {
|
||||
pr_crit("Failed to update live algo '%s' due to mismatch:\n"
|
||||
"cra_ctxsize : %u vs %u\n"
|
||||
"cra_alignmask : 0x%x vs 0x%x\n",
|
||||
alg->cra_driver_name,
|
||||
alg->cra_ctxsize, new_alg->cra_ctxsize,
|
||||
alg->cra_alignmask, new_alg->cra_alignmask);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the name and priority so the algorithm stands out as
|
||||
* one that was updated in order to comply with FIPS140, and
|
||||
* that it is not the preferred version for further use.
|
||||
*/
|
||||
strlcat(alg->cra_name, "+orig", CRYPTO_MAX_ALG_NAME);
|
||||
alg->cra_priority = 0;
|
||||
|
||||
switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) {
|
||||
struct aead_alg *old_aead, *new_aead;
|
||||
struct skcipher_alg *old_skcipher, *new_skcipher;
|
||||
struct shash_alg *old_shash, *new_shash;
|
||||
struct rng_alg *old_rng, *new_rng;
|
||||
|
||||
case CRYPTO_ALG_TYPE_CIPHER:
|
||||
alg->cra_u.cipher = new_alg->cra_u.cipher;
|
||||
break;
|
||||
|
||||
case CRYPTO_ALG_TYPE_AEAD:
|
||||
old_aead = container_of(alg, struct aead_alg, base);
|
||||
new_aead = container_of(new_alg, struct aead_alg, base);
|
||||
|
||||
old_aead->setkey = new_aead->setkey;
|
||||
old_aead->setauthsize = new_aead->setauthsize;
|
||||
old_aead->encrypt = new_aead->encrypt;
|
||||
old_aead->decrypt = new_aead->decrypt;
|
||||
old_aead->init = new_aead->init;
|
||||
old_aead->exit = new_aead->exit;
|
||||
break;
|
||||
|
||||
case CRYPTO_ALG_TYPE_SKCIPHER:
|
||||
old_skcipher = container_of(alg, struct skcipher_alg, base);
|
||||
new_skcipher = container_of(new_alg, struct skcipher_alg, base);
|
||||
|
||||
old_skcipher->setkey = new_skcipher->setkey;
|
||||
old_skcipher->encrypt = new_skcipher->encrypt;
|
||||
old_skcipher->decrypt = new_skcipher->decrypt;
|
||||
old_skcipher->init = new_skcipher->init;
|
||||
old_skcipher->exit = new_skcipher->exit;
|
||||
break;
|
||||
|
||||
case CRYPTO_ALG_TYPE_SHASH:
|
||||
old_shash = container_of(alg, struct shash_alg, base);
|
||||
new_shash = container_of(new_alg, struct shash_alg, base);
|
||||
|
||||
old_shash->init = new_shash->init;
|
||||
old_shash->update = new_shash->update;
|
||||
old_shash->final = new_shash->final;
|
||||
old_shash->finup = new_shash->finup;
|
||||
old_shash->digest = new_shash->digest;
|
||||
old_shash->export = new_shash->export;
|
||||
old_shash->import = new_shash->import;
|
||||
old_shash->setkey = new_shash->setkey;
|
||||
old_shash->init_tfm = new_shash->init_tfm;
|
||||
old_shash->exit_tfm = new_shash->exit_tfm;
|
||||
break;
|
||||
|
||||
case CRYPTO_ALG_TYPE_RNG:
|
||||
old_rng = container_of(alg, struct rng_alg, base);
|
||||
new_rng = container_of(new_alg, struct rng_alg, base);
|
||||
|
||||
old_rng->generate = new_rng->generate;
|
||||
old_rng->seed = new_rng->seed;
|
||||
old_rng->set_ent = new_rng->set_ent;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* This should never happen: every item on the
|
||||
* fips140_algorithms list should match one of the
|
||||
* cases above, so if we end up here, something is
|
||||
* definitely wrong.
|
||||
*/
|
||||
pr_crit("Unexpected type %u for algo %s, giving up ...\n",
|
||||
alg->cra_flags & CRYPTO_ALG_TYPE_MASK,
|
||||
alg->cra_driver_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Move the algorithm back to the algorithm list, so it is
|
||||
* visible in /proc/crypto et al.
|
||||
*/
|
||||
down_write(&crypto_alg_sem);
|
||||
list_add_tail(&alg->cra_list, &crypto_alg_list);
|
||||
}
|
||||
up_write(&crypto_alg_sem);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void fips140_sha256(void *p, const u8 *data, unsigned int len, u8 *out,
|
||||
int *hook_inuse)
|
||||
{
|
||||
sha256(data, len, out);
|
||||
*hook_inuse = 1;
|
||||
}
|
||||
|
||||
static void fips140_aes_expandkey(void *p, struct crypto_aes_ctx *ctx,
|
||||
const u8 *in_key, unsigned int key_len,
|
||||
int *err)
|
||||
{
|
||||
*err = aes_expandkey(ctx, in_key, key_len);
|
||||
}
|
||||
|
||||
static void fips140_aes_encrypt(void *priv, const struct crypto_aes_ctx *ctx,
|
||||
u8 *out, const u8 *in, int *hook_inuse)
|
||||
{
|
||||
aes_encrypt(ctx, out, in);
|
||||
*hook_inuse = 1;
|
||||
}
|
||||
|
||||
static void fips140_aes_decrypt(void *priv, const struct crypto_aes_ctx *ctx,
|
||||
u8 *out, const u8 *in, int *hook_inuse)
|
||||
{
|
||||
aes_decrypt(ctx, out, in);
|
||||
*hook_inuse = 1;
|
||||
}
|
||||
|
||||
static bool update_fips140_library_routines(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = register_trace_android_vh_sha256(fips140_sha256, NULL) ?:
|
||||
register_trace_android_vh_aes_expandkey(fips140_aes_expandkey, NULL) ?:
|
||||
register_trace_android_vh_aes_encrypt(fips140_aes_encrypt, NULL) ?:
|
||||
register_trace_android_vh_aes_decrypt(fips140_aes_decrypt, NULL);
|
||||
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the FIPS 140 module.
|
||||
*
|
||||
* Note: this routine iterates over the contents of the initcall section, which
|
||||
* consists of an array of function pointers that was emitted by the linker
|
||||
* rather than the compiler. This means that these function pointers lack the
|
||||
* usual CFI stubs that the compiler emits when CFI codegen is enabled. So
|
||||
* let's disable CFI locally when handling the initcall array, to avoid
|
||||
* surpises.
|
||||
*/
|
||||
int __init __attribute__((__no_sanitize__("cfi"))) fips140_init(void)
|
||||
{
|
||||
const u32 *initcall;
|
||||
|
||||
pr_info("Loading FIPS 140 module\n");
|
||||
|
||||
unregister_existing_fips140_algos();
|
||||
|
||||
/* iterate over all init routines present in this module and call them */
|
||||
for (initcall = __initcall_start + 1;
|
||||
initcall < &__initcall_end_marker;
|
||||
initcall++) {
|
||||
int (*init)(void) = offset_to_ptr(initcall);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
if (!update_live_fips140_algos())
|
||||
goto panic;
|
||||
|
||||
if (!update_fips140_library_routines())
|
||||
goto panic;
|
||||
|
||||
/*
|
||||
* Wait until all tasks have at least been scheduled once and preempted
|
||||
* voluntarily. This ensures that none of the superseded algorithms that
|
||||
* were already in use will still be live.
|
||||
*/
|
||||
synchronize_rcu_tasks();
|
||||
|
||||
/* insert self tests here */
|
||||
|
||||
/*
|
||||
* It may seem backward to perform the integrity check last, but this
|
||||
* is intentional: the check itself uses hmac(sha256) which is one of
|
||||
* the algorithms that are replaced with versions from this module, and
|
||||
* the integrity check must use the replacement version.
|
||||
*/
|
||||
|
||||
if (!check_fips140_module_hmac()) {
|
||||
pr_crit("FIPS 140 integrity check failed -- giving up!\n");
|
||||
goto panic;
|
||||
}
|
||||
|
||||
pr_info("FIPS 140 integrity check successful\n");
|
||||
pr_info("FIPS 140 module successfully loaded\n");
|
||||
return 0;
|
||||
|
||||
panic:
|
||||
panic("FIPS 140 module load failure");
|
||||
}
|
||||
|
||||
module_init(fips140_init);
|
||||
|
||||
MODULE_IMPORT_NS(CRYPTO_INTERNAL);
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
||||
/*
|
||||
* Crypto-related helper functions, reproduced here so that they will be
|
||||
* covered by the FIPS 140 integrity check.
|
||||
*
|
||||
* Non-cryptographic helper functions such as memcpy() can be excluded from the
|
||||
* FIPS module, but there is ambiguity about other helper functions like
|
||||
* __crypto_xor() and crypto_inc() which aren't cryptographic by themselves,
|
||||
* but are more closely associated with cryptography than e.g. memcpy(). To
|
||||
* err on the side of caution, we include copies of these in the FIPS module.
|
||||
*/
|
||||
void __crypto_xor(u8 *dst, const u8 *src1, const u8 *src2, unsigned int len)
|
||||
{
|
||||
while (len >= 8) {
|
||||
*(u64 *)dst = *(u64 *)src1 ^ *(u64 *)src2;
|
||||
dst += 8;
|
||||
src1 += 8;
|
||||
src2 += 8;
|
||||
len -= 8;
|
||||
}
|
||||
|
||||
while (len >= 4) {
|
||||
*(u32 *)dst = *(u32 *)src1 ^ *(u32 *)src2;
|
||||
dst += 4;
|
||||
src1 += 4;
|
||||
src2 += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
while (len >= 2) {
|
||||
*(u16 *)dst = *(u16 *)src1 ^ *(u16 *)src2;
|
||||
dst += 2;
|
||||
src1 += 2;
|
||||
src2 += 2;
|
||||
len -= 2;
|
||||
}
|
||||
|
||||
while (len--)
|
||||
*dst++ = *src1++ ^ *src2++;
|
||||
}
|
||||
|
||||
void crypto_inc(u8 *a, unsigned int size)
|
||||
{
|
||||
a += size;
|
||||
|
||||
while (size--)
|
||||
if (++*--a)
|
||||
break;
|
||||
}
|
129
crypto/fips140_gen_hmac.c
Normal file
129
crypto/fips140_gen_hmac.c
Normal file
@@ -0,0 +1,129 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (C) 2021 - Google LLC
|
||||
* Author: Ard Biesheuvel <ardb@google.com>
|
||||
*
|
||||
* This is a host tool that is intended to be used to take the HMAC digest of
|
||||
* the .text and .rodata sections of the fips140.ko module, and store it inside
|
||||
* the module. The module will perform an integrity selfcheck at module_init()
|
||||
* time, by recalculating the digest and comparing it with the value calculated
|
||||
* here.
|
||||
*
|
||||
* Note that the peculiar way an HMAC is being used as a digest with a public
|
||||
* key rather than as a symmetric key signature is mandated by FIPS 140-2.
|
||||
*/
|
||||
|
||||
#include <elf.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <openssl/hmac.h>
|
||||
|
||||
static Elf64_Ehdr *ehdr;
|
||||
static Elf64_Shdr *shdr;
|
||||
static int num_shdr;
|
||||
static const char *strtab;
|
||||
static Elf64_Sym *syms;
|
||||
static int num_syms;
|
||||
|
||||
static Elf64_Shdr *find_symtab_section(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_shdr; i++)
|
||||
if (shdr[i].sh_type == SHT_SYMTAB)
|
||||
return &shdr[i];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *get_sym_addr(const char *sym_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_syms; i++)
|
||||
if (!strcmp(strtab + syms[i].st_name, sym_name))
|
||||
return (void *)ehdr + shdr[syms[i].st_shndx].sh_offset +
|
||||
syms[i].st_value;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void hmac_section(HMAC_CTX *hmac, const char *start, const char *end)
|
||||
{
|
||||
void *start_addr = get_sym_addr(start);
|
||||
void *end_addr = get_sym_addr(end);
|
||||
|
||||
HMAC_Update(hmac, start_addr, end_addr - start_addr);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Elf64_Shdr *symtab_shdr;
|
||||
const char *hmac_key;
|
||||
unsigned char *dg;
|
||||
unsigned int dglen;
|
||||
struct stat stat;
|
||||
HMAC_CTX *hmac;
|
||||
int fd, ret;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "file argument missing\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_RDWR);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "failed to open %s\n", argv[1]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ret = fstat(fd, &stat);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "failed to stat() %s\n", argv[1]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
ehdr = mmap(0, stat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (ehdr == MAP_FAILED) {
|
||||
fprintf(stderr, "failed to mmap() %s\n", argv[1]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
shdr = (void *)ehdr + ehdr->e_shoff;
|
||||
num_shdr = ehdr->e_shnum;
|
||||
|
||||
symtab_shdr = find_symtab_section();
|
||||
|
||||
syms = (void *)ehdr + symtab_shdr->sh_offset;
|
||||
num_syms = symtab_shdr->sh_size / sizeof(Elf64_Sym);
|
||||
|
||||
strtab = (void *)ehdr + shdr[symtab_shdr->sh_link].sh_offset;
|
||||
|
||||
hmac_key = get_sym_addr("fips140_integ_hmac_key");
|
||||
if (!hmac_key) {
|
||||
fprintf(stderr, "failed to locate HMAC key in binary\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
dg = get_sym_addr("fips140_integ_hmac_digest");
|
||||
if (!dg) {
|
||||
fprintf(stderr, "failed to locate HMAC digest in binary\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
hmac = HMAC_CTX_new();
|
||||
HMAC_Init_ex(hmac, hmac_key, strlen(hmac_key), EVP_sha256(), NULL);
|
||||
|
||||
hmac_section(hmac, "__fips140_text_start", "__fips140_text_end");
|
||||
hmac_section(hmac, "__fips140_rodata_start", "__fips140_rodata_end");
|
||||
|
||||
HMAC_Final(hmac, dg, &dglen);
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
@@ -20,12 +20,24 @@
|
||||
|
||||
static const struct crypto_type crypto_shash_type;
|
||||
|
||||
int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
|
||||
unsigned int keylen)
|
||||
static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
|
||||
unsigned int keylen)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(shash_no_setkey);
|
||||
|
||||
/*
|
||||
* Check whether an shash algorithm has a setkey function.
|
||||
*
|
||||
* For CFI compatibility, this must not be an inline function. This is because
|
||||
* when CFI is enabled, modules won't get the same address for shash_no_setkey
|
||||
* (if it were exported, which inlining would require) as the core kernel will.
|
||||
*/
|
||||
bool crypto_shash_alg_has_setkey(struct shash_alg *alg)
|
||||
{
|
||||
return alg->setkey != shash_no_setkey;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_shash_alg_has_setkey);
|
||||
|
||||
static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key,
|
||||
unsigned int keylen)
|
||||
|
@@ -285,6 +285,14 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
||||
"***** Address handler %p\n", object));
|
||||
|
||||
acpi_os_delete_mutex(object->address_space.context_mutex);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
|
@@ -5046,7 +5046,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
uint32_t enable;
|
||||
|
||||
if (copy_from_user(&enable, ubuf, sizeof(enable))) {
|
||||
ret = -EINVAL;
|
||||
ret = -EFAULT;
|
||||
goto err;
|
||||
}
|
||||
binder_inner_proc_lock(proc);
|
||||
|
@@ -61,6 +61,8 @@
|
||||
#include <trace/hooks/v4l2mc.h>
|
||||
#include <trace/hooks/scmi.h>
|
||||
#include <trace/hooks/user.h>
|
||||
#include <trace/hooks/cpuidle_psci.h>
|
||||
#include <trace/hooks/fips140.h>
|
||||
|
||||
/*
|
||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||
@@ -318,3 +320,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_force_compatible_post);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_uid);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_user);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_balance_anon_file_reclaim);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_enter);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_exit);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sha256);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_expandkey);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_encrypt);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_decrypt);
|
||||
|
@@ -866,25 +866,34 @@ EXPORT_SYMBOL_GPL(fwnode_remove_software_node);
|
||||
/**
|
||||
* device_add_software_node - Assign software node to a device
|
||||
* @dev: The device the software node is meant for.
|
||||
* @swnode: The software node.
|
||||
* @node: The software node.
|
||||
*
|
||||
* This function will register @swnode and make it the secondary firmware node
|
||||
* pointer of @dev. If @dev has no primary node, then @swnode will become the primary
|
||||
* node.
|
||||
* This function will make @node the secondary firmware node pointer of @dev. If
|
||||
* @dev has no primary node, then @node will become the primary node. The
|
||||
* function will register @node automatically if it wasn't already registered.
|
||||
*/
|
||||
int device_add_software_node(struct device *dev, const struct software_node *swnode)
|
||||
int device_add_software_node(struct device *dev, const struct software_node *node)
|
||||
{
|
||||
struct swnode *swnode;
|
||||
int ret;
|
||||
|
||||
/* Only one software node per device. */
|
||||
if (dev_to_swnode(dev))
|
||||
return -EBUSY;
|
||||
|
||||
ret = software_node_register(swnode);
|
||||
if (ret)
|
||||
return ret;
|
||||
swnode = software_node_to_swnode(node);
|
||||
if (swnode) {
|
||||
kobject_get(&swnode->kobj);
|
||||
} else {
|
||||
ret = software_node_register(node);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
set_secondary_fwnode(dev, software_node_fwnode(swnode));
|
||||
swnode = software_node_to_swnode(node);
|
||||
}
|
||||
|
||||
set_secondary_fwnode(dev, &swnode->fwnode);
|
||||
software_node_notify(dev, KOBJ_ADD);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -921,8 +930,8 @@ int software_node_notify(struct device *dev, unsigned long action)
|
||||
|
||||
switch (action) {
|
||||
case KOBJ_ADD:
|
||||
ret = sysfs_create_link(&dev->kobj, &swnode->kobj,
|
||||
"software_node");
|
||||
ret = sysfs_create_link_nowarn(&dev->kobj, &swnode->kobj,
|
||||
"software_node");
|
||||
if (ret)
|
||||
break;
|
||||
|
||||
|
@@ -1330,6 +1330,34 @@ err_allow_idle:
|
||||
return error;
|
||||
}
|
||||
|
||||
static int sysc_reinit_module(struct sysc *ddata, bool leave_enabled)
|
||||
{
|
||||
struct device *dev = ddata->dev;
|
||||
int error;
|
||||
|
||||
/* Disable target module if it is enabled */
|
||||
if (ddata->enabled) {
|
||||
error = sysc_runtime_suspend(dev);
|
||||
if (error)
|
||||
dev_warn(dev, "reinit suspend failed: %i\n", error);
|
||||
}
|
||||
|
||||
/* Enable target module */
|
||||
error = sysc_runtime_resume(dev);
|
||||
if (error)
|
||||
dev_warn(dev, "reinit resume failed: %i\n", error);
|
||||
|
||||
if (leave_enabled)
|
||||
return error;
|
||||
|
||||
/* Disable target module if no leave_enabled was set */
|
||||
error = sysc_runtime_suspend(dev);
|
||||
if (error)
|
||||
dev_warn(dev, "reinit suspend failed: %i\n", error);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static int __maybe_unused sysc_noirq_suspend(struct device *dev)
|
||||
{
|
||||
struct sysc *ddata;
|
||||
@@ -1340,12 +1368,18 @@ static int __maybe_unused sysc_noirq_suspend(struct device *dev)
|
||||
(SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE))
|
||||
return 0;
|
||||
|
||||
return pm_runtime_force_suspend(dev);
|
||||
if (!ddata->enabled)
|
||||
return 0;
|
||||
|
||||
ddata->needs_resume = 1;
|
||||
|
||||
return sysc_runtime_suspend(dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused sysc_noirq_resume(struct device *dev)
|
||||
{
|
||||
struct sysc *ddata;
|
||||
int error = 0;
|
||||
|
||||
ddata = dev_get_drvdata(dev);
|
||||
|
||||
@@ -1353,7 +1387,19 @@ static int __maybe_unused sysc_noirq_resume(struct device *dev)
|
||||
(SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE))
|
||||
return 0;
|
||||
|
||||
return pm_runtime_force_resume(dev);
|
||||
if (ddata->cfg.quirks & SYSC_QUIRK_REINIT_ON_RESUME) {
|
||||
error = sysc_reinit_module(ddata, ddata->needs_resume);
|
||||
if (error)
|
||||
dev_warn(dev, "noirq_resume failed: %i\n", error);
|
||||
} else if (ddata->needs_resume) {
|
||||
error = sysc_runtime_resume(dev);
|
||||
if (error)
|
||||
dev_warn(dev, "noirq_resume failed: %i\n", error);
|
||||
}
|
||||
|
||||
ddata->needs_resume = 0;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops sysc_pm_ops = {
|
||||
@@ -1404,9 +1450,9 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
|
||||
SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
|
||||
/* Uarts on omap4 and later */
|
||||
SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffff00ff,
|
||||
SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
|
||||
SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
|
||||
SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47422e03, 0xffffffff,
|
||||
SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
|
||||
SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
|
||||
|
||||
/* Quirks that need to be set based on the module address */
|
||||
SYSC_QUIRK("mcpdm", 0x40132000, 0, 0x10, -ENODEV, 0x50000800, 0xffffffff,
|
||||
@@ -1462,7 +1508,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
|
||||
SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050,
|
||||
0xffffffff, SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY),
|
||||
SYSC_QUIRK("usb_otg_hs", 0, 0, 0x10, -ENODEV, 0x4ea2080d, 0xffffffff,
|
||||
SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY),
|
||||
SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY |
|
||||
SYSC_QUIRK_REINIT_ON_RESUME),
|
||||
SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0,
|
||||
SYSC_MODULE_QUIRK_WDT),
|
||||
/* PRUSS on am3, am4 and am5 */
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <linux/string.h>
|
||||
|
||||
#include <asm/cpuidle.h>
|
||||
#include <trace/hooks/cpuidle_psci.h>
|
||||
|
||||
#include "cpuidle-psci.h"
|
||||
#include "dt_idle_states.h"
|
||||
@@ -67,6 +68,8 @@ static int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
|
||||
if (ret)
|
||||
return -1;
|
||||
|
||||
trace_android_vh_cpuidle_psci_enter(dev, s2idle);
|
||||
|
||||
/* Do runtime PM to manage a hierarchical CPU toplogy. */
|
||||
rcu_irq_enter_irqson();
|
||||
if (s2idle)
|
||||
@@ -88,6 +91,8 @@ static int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
|
||||
pm_runtime_get_sync(pd_dev);
|
||||
rcu_irq_exit_irqson();
|
||||
|
||||
trace_android_vh_cpuidle_psci_exit(dev, s2idle);
|
||||
|
||||
cpu_pm_exit();
|
||||
|
||||
/* Clear the domain state to start fresh when back from idle. */
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
|
||||
struct cma_heap {
|
||||
|
@@ -276,8 +276,7 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg)
|
||||
if (!msg || !(mem->validation_bits & CPER_MEM_VALID_MODULE_HANDLE))
|
||||
return 0;
|
||||
|
||||
n = 0;
|
||||
len = CPER_REC_LEN - 1;
|
||||
len = CPER_REC_LEN;
|
||||
dmi_memdev_name(mem->mem_dev_handle, &bank, &device);
|
||||
if (bank && device)
|
||||
n = snprintf(msg, len, "DIMM location: %s %s ", bank, device);
|
||||
@@ -286,7 +285,6 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg)
|
||||
"DIMM location: not present. DMI handle: 0x%.4x ",
|
||||
mem->mem_dev_handle);
|
||||
|
||||
msg[n] = '\0';
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@@ -98,6 +98,9 @@ u64 __init efi_get_fdt_params(struct efi_memory_map_data *mm)
|
||||
BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(name));
|
||||
BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(dt_params[0].params));
|
||||
|
||||
if (!fdt)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dt_params); i++) {
|
||||
node = fdt_path_offset(fdt, dt_params[i].path);
|
||||
if (node < 0)
|
||||
|
@@ -103,7 +103,7 @@ static int find_file_option(const efi_char16_t *cmdline, int cmdline_len,
|
||||
return 0;
|
||||
|
||||
/* Skip any leading slashes */
|
||||
while (cmdline[i] == L'/' || cmdline[i] == L'\\')
|
||||
while (i < cmdline_len && (cmdline[i] == L'/' || cmdline[i] == L'\\'))
|
||||
i++;
|
||||
|
||||
while (--result_len > 0 && i < cmdline_len) {
|
||||
|
@@ -67,11 +67,6 @@ static bool entry_is_valid(const efi_memory_desc_t *in, efi_memory_desc_t *out)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(in->attribute & (EFI_MEMORY_RO | EFI_MEMORY_XP))) {
|
||||
pr_warn("Entry attributes invalid: RO and XP bits both cleared\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (PAGE_SIZE > EFI_PAGE_SIZE &&
|
||||
(!PAGE_ALIGNED(in->phys_addr) ||
|
||||
!PAGE_ALIGNED(in->num_pages << EFI_PAGE_SHIFT))) {
|
||||
|
@@ -471,7 +471,7 @@ EXPORT_SYMBOL_GPL(gpiochip_line_is_valid);
|
||||
|
||||
static void gpiodevice_release(struct device *dev)
|
||||
{
|
||||
struct gpio_device *gdev = dev_get_drvdata(dev);
|
||||
struct gpio_device *gdev = container_of(dev, struct gpio_device, dev);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&gpio_lock, flags);
|
||||
@@ -614,7 +614,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
|
||||
goto err_free_ida;
|
||||
|
||||
device_initialize(&gdev->dev);
|
||||
dev_set_drvdata(&gdev->dev, gdev);
|
||||
if (gc->parent && gc->parent->driver)
|
||||
gdev->owner = gc->parent->driver->owner;
|
||||
else if (gc->owner)
|
||||
@@ -4397,7 +4396,8 @@ static int __init gpiolib_dev_init(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (driver_register(&gpio_stub_drv) < 0) {
|
||||
ret = driver_register(&gpio_stub_drv);
|
||||
if (ret < 0) {
|
||||
pr_err("gpiolib: could not register GPIO stub driver\n");
|
||||
bus_unregister(&gpio_bus_type);
|
||||
return ret;
|
||||
|
@@ -337,7 +337,6 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,
|
||||
{
|
||||
struct amdgpu_ctx *ctx;
|
||||
struct amdgpu_ctx_mgr *mgr;
|
||||
unsigned long ras_counter;
|
||||
|
||||
if (!fpriv)
|
||||
return -EINVAL;
|
||||
@@ -362,21 +361,6 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,
|
||||
if (atomic_read(&ctx->guilty))
|
||||
out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_GUILTY;
|
||||
|
||||
/*query ue count*/
|
||||
ras_counter = amdgpu_ras_query_error_count(adev, false);
|
||||
/*ras counter is monotonic increasing*/
|
||||
if (ras_counter != ctx->ras_counter_ue) {
|
||||
out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_RAS_UE;
|
||||
ctx->ras_counter_ue = ras_counter;
|
||||
}
|
||||
|
||||
/*query ce count*/
|
||||
ras_counter = amdgpu_ras_query_error_count(adev, true);
|
||||
if (ras_counter != ctx->ras_counter_ce) {
|
||||
out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_RAS_CE;
|
||||
ctx->ras_counter_ce = ras_counter;
|
||||
}
|
||||
|
||||
mutex_unlock(&mgr->lock);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -187,14 +187,14 @@ static int jpeg_v2_5_hw_init(void *handle)
|
||||
static int jpeg_v2_5_hw_fini(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct amdgpu_ring *ring;
|
||||
int i;
|
||||
|
||||
cancel_delayed_work_sync(&adev->vcn.idle_work);
|
||||
|
||||
for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) {
|
||||
if (adev->jpeg.harvest_config & (1 << i))
|
||||
continue;
|
||||
|
||||
ring = &adev->jpeg.inst[i].ring_dec;
|
||||
if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
|
||||
RREG32_SOC15(JPEG, i, mmUVD_JRBC_STATUS))
|
||||
jpeg_v2_5_set_powergating_state(adev, AMD_PG_STATE_GATE);
|
||||
|
@@ -159,9 +159,9 @@ static int jpeg_v3_0_hw_init(void *handle)
|
||||
static int jpeg_v3_0_hw_fini(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct amdgpu_ring *ring;
|
||||
|
||||
ring = &adev->jpeg.inst->ring_dec;
|
||||
cancel_delayed_work_sync(&adev->vcn.idle_work);
|
||||
|
||||
if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
|
||||
RREG32_SOC15(JPEG, 0, mmUVD_JRBC_STATUS))
|
||||
jpeg_v3_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
|
||||
|
@@ -356,6 +356,7 @@ static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
|
||||
|
||||
error:
|
||||
dma_fence_put(fence);
|
||||
amdgpu_bo_unpin(bo);
|
||||
amdgpu_bo_unreserve(bo);
|
||||
amdgpu_bo_unref(&bo);
|
||||
return r;
|
||||
|
@@ -345,15 +345,14 @@ done:
|
||||
static int vcn_v3_0_hw_fini(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct amdgpu_ring *ring;
|
||||
int i;
|
||||
|
||||
cancel_delayed_work_sync(&adev->vcn.idle_work);
|
||||
|
||||
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
|
||||
if (adev->vcn.harvest_config & (1 << i))
|
||||
continue;
|
||||
|
||||
ring = &adev->vcn.inst[i].ring_dec;
|
||||
|
||||
if (!amdgpu_sriov_vf(adev)) {
|
||||
if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
|
||||
(adev->vcn.cur_state != AMD_PG_STATE_GATE &&
|
||||
|
@@ -1391,8 +1391,8 @@ static int live_breadcrumbs_smoketest(void *arg)
|
||||
|
||||
for (n = 0; n < smoke[0].ncontexts; n++) {
|
||||
smoke[0].contexts[n] = live_context(i915, file);
|
||||
if (!smoke[0].contexts[n]) {
|
||||
ret = -ENOMEM;
|
||||
if (IS_ERR(smoke[0].contexts[n])) {
|
||||
ret = PTR_ERR(smoke[0].contexts[n]);
|
||||
goto out_contexts;
|
||||
}
|
||||
}
|
||||
|
@@ -931,8 +931,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
|
||||
DPU_DEBUG("REG_DMA is not defined");
|
||||
}
|
||||
|
||||
if (of_device_is_compatible(dev->dev->of_node, "qcom,sc7180-mdss"))
|
||||
dpu_kms_parse_data_bus_icc_path(dpu_kms);
|
||||
dpu_kms_parse_data_bus_icc_path(dpu_kms);
|
||||
|
||||
pm_runtime_get_sync(&dpu_kms->pdev->dev);
|
||||
|
||||
|
@@ -31,40 +31,8 @@ struct dpu_mdss {
|
||||
void __iomem *mmio;
|
||||
struct dss_module_power mp;
|
||||
struct dpu_irq_controller irq_controller;
|
||||
struct icc_path *path[2];
|
||||
u32 num_paths;
|
||||
};
|
||||
|
||||
static int dpu_mdss_parse_data_bus_icc_path(struct drm_device *dev,
|
||||
struct dpu_mdss *dpu_mdss)
|
||||
{
|
||||
struct icc_path *path0 = of_icc_get(dev->dev, "mdp0-mem");
|
||||
struct icc_path *path1 = of_icc_get(dev->dev, "mdp1-mem");
|
||||
|
||||
if (IS_ERR_OR_NULL(path0))
|
||||
return PTR_ERR_OR_ZERO(path0);
|
||||
|
||||
dpu_mdss->path[0] = path0;
|
||||
dpu_mdss->num_paths = 1;
|
||||
|
||||
if (!IS_ERR_OR_NULL(path1)) {
|
||||
dpu_mdss->path[1] = path1;
|
||||
dpu_mdss->num_paths++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dpu_mdss_icc_request_bw(struct msm_mdss *mdss)
|
||||
{
|
||||
struct dpu_mdss *dpu_mdss = to_dpu_mdss(mdss);
|
||||
int i;
|
||||
u64 avg_bw = dpu_mdss->num_paths ? MAX_BW / dpu_mdss->num_paths : 0;
|
||||
|
||||
for (i = 0; i < dpu_mdss->num_paths; i++)
|
||||
icc_set_bw(dpu_mdss->path[i], avg_bw, kBps_to_icc(MAX_BW));
|
||||
}
|
||||
|
||||
static void dpu_mdss_irq(struct irq_desc *desc)
|
||||
{
|
||||
struct dpu_mdss *dpu_mdss = irq_desc_get_handler_data(desc);
|
||||
@@ -178,8 +146,6 @@ static int dpu_mdss_enable(struct msm_mdss *mdss)
|
||||
struct dss_module_power *mp = &dpu_mdss->mp;
|
||||
int ret;
|
||||
|
||||
dpu_mdss_icc_request_bw(mdss);
|
||||
|
||||
ret = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true);
|
||||
if (ret) {
|
||||
DPU_ERROR("clock enable failed, ret:%d\n", ret);
|
||||
@@ -213,15 +179,12 @@ static int dpu_mdss_disable(struct msm_mdss *mdss)
|
||||
{
|
||||
struct dpu_mdss *dpu_mdss = to_dpu_mdss(mdss);
|
||||
struct dss_module_power *mp = &dpu_mdss->mp;
|
||||
int ret, i;
|
||||
int ret;
|
||||
|
||||
ret = msm_dss_enable_clk(mp->clk_config, mp->num_clk, false);
|
||||
if (ret)
|
||||
DPU_ERROR("clock disable failed, ret:%d\n", ret);
|
||||
|
||||
for (i = 0; i < dpu_mdss->num_paths; i++)
|
||||
icc_set_bw(dpu_mdss->path[i], 0, 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -232,7 +195,6 @@ static void dpu_mdss_destroy(struct drm_device *dev)
|
||||
struct dpu_mdss *dpu_mdss = to_dpu_mdss(priv->mdss);
|
||||
struct dss_module_power *mp = &dpu_mdss->mp;
|
||||
int irq;
|
||||
int i;
|
||||
|
||||
pm_runtime_suspend(dev->dev);
|
||||
pm_runtime_disable(dev->dev);
|
||||
@@ -242,9 +204,6 @@ static void dpu_mdss_destroy(struct drm_device *dev)
|
||||
msm_dss_put_clk(mp->clk_config, mp->num_clk);
|
||||
devm_kfree(&pdev->dev, mp->clk_config);
|
||||
|
||||
for (i = 0; i < dpu_mdss->num_paths; i++)
|
||||
icc_put(dpu_mdss->path[i]);
|
||||
|
||||
if (dpu_mdss->mmio)
|
||||
devm_iounmap(&pdev->dev, dpu_mdss->mmio);
|
||||
dpu_mdss->mmio = NULL;
|
||||
@@ -276,12 +235,6 @@ int dpu_mdss_init(struct drm_device *dev)
|
||||
|
||||
DRM_DEBUG("mapped mdss address space @%pK\n", dpu_mdss->mmio);
|
||||
|
||||
if (!of_device_is_compatible(dev->dev->of_node, "qcom,sc7180-mdss")) {
|
||||
ret = dpu_mdss_parse_data_bus_icc_path(dev, dpu_mdss);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
mp = &dpu_mdss->mp;
|
||||
ret = msm_dss_parse_clock(pdev, mp);
|
||||
if (ret) {
|
||||
@@ -307,8 +260,6 @@ int dpu_mdss_init(struct drm_device *dev)
|
||||
|
||||
pm_runtime_enable(dev->dev);
|
||||
|
||||
dpu_mdss_icc_request_bw(priv->mdss);
|
||||
|
||||
return ret;
|
||||
|
||||
irq_error:
|
||||
|
@@ -1259,6 +1259,7 @@ static int hidpp20_battery_map_status_voltage(u8 data[3], int *voltage,
|
||||
int status;
|
||||
|
||||
long flags = (long) data[2];
|
||||
*level = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN;
|
||||
|
||||
if (flags & 0x80)
|
||||
switch (flags & 0x07) {
|
||||
|
@@ -597,7 +597,7 @@ static int magicmouse_probe(struct hid_device *hdev,
|
||||
if (id->vendor == USB_VENDOR_ID_APPLE &&
|
||||
id->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 &&
|
||||
hdev->type != HID_TYPE_USBMOUSE)
|
||||
return 0;
|
||||
return -ENODEV;
|
||||
|
||||
msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL);
|
||||
if (msc == NULL) {
|
||||
|
@@ -604,9 +604,13 @@ static struct mt_report_data *mt_allocate_report_data(struct mt_device *td,
|
||||
if (!(HID_MAIN_ITEM_VARIABLE & field->flags))
|
||||
continue;
|
||||
|
||||
for (n = 0; n < field->report_count; n++) {
|
||||
if (field->usage[n].hid == HID_DG_CONTACTID)
|
||||
rdata->is_mt_collection = true;
|
||||
if (field->logical == HID_DG_FINGER || td->hdev->group != HID_GROUP_MULTITOUCH_WIN_8) {
|
||||
for (n = 0; n < field->report_count; n++) {
|
||||
if (field->usage[n].hid == HID_DG_CONTACTID) {
|
||||
rdata->is_mt_collection = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -50,6 +50,7 @@
|
||||
#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4)
|
||||
#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5)
|
||||
#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6)
|
||||
#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(7)
|
||||
|
||||
|
||||
/* flags */
|
||||
@@ -183,6 +184,11 @@ static const struct i2c_hid_quirks {
|
||||
I2C_HID_QUIRK_RESET_ON_RESUME },
|
||||
{ USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
|
||||
I2C_HID_QUIRK_BAD_INPUT_SIZE },
|
||||
/*
|
||||
* Sending the wakeup after reset actually break ELAN touchscreen controller
|
||||
*/
|
||||
{ USB_VENDOR_ID_ELAN, HID_ANY_ID,
|
||||
I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
@@ -466,7 +472,8 @@ static int i2c_hid_hwreset(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* At least some SIS devices need this after reset */
|
||||
ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
|
||||
if (!(ihid->quirks & I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET))
|
||||
ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&ihid->reset_lock);
|
||||
@@ -1131,8 +1138,8 @@ static int i2c_hid_probe(struct i2c_client *client,
|
||||
hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
|
||||
hid->product = le16_to_cpu(ihid->hdesc.wProductID);
|
||||
|
||||
snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX",
|
||||
client->name, hid->vendor, hid->product);
|
||||
snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X",
|
||||
client->name, (u16)hid->vendor, (u16)hid->product);
|
||||
strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));
|
||||
|
||||
ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product);
|
||||
|
@@ -1292,6 +1292,7 @@ int hid_pidff_init(struct hid_device *hid)
|
||||
|
||||
if (pidff->pool[PID_DEVICE_MANAGED_POOL].value &&
|
||||
pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) {
|
||||
error = -EPERM;
|
||||
hid_notice(hid,
|
||||
"device does not support device managed pool\n");
|
||||
goto fail;
|
||||
|
@@ -838,10 +838,10 @@ static struct attribute *i8k_attrs[] = {
|
||||
static umode_t i8k_is_visible(struct kobject *kobj, struct attribute *attr,
|
||||
int index)
|
||||
{
|
||||
if (disallow_fan_support && index >= 8)
|
||||
if (disallow_fan_support && index >= 20)
|
||||
return 0;
|
||||
if (disallow_fan_type_call &&
|
||||
(index == 9 || index == 12 || index == 15))
|
||||
(index == 21 || index == 25 || index == 28))
|
||||
return 0;
|
||||
if (index >= 0 && index <= 1 &&
|
||||
!(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP1))
|
||||
|
@@ -244,8 +244,8 @@ static int isl68137_probe(struct i2c_client *client)
|
||||
info->read_word_data = raa_dmpvr2_read_word_data;
|
||||
break;
|
||||
case raa_dmpvr2_2rail_nontc:
|
||||
info->func[0] &= ~PMBUS_HAVE_TEMP;
|
||||
info->func[1] &= ~PMBUS_HAVE_TEMP;
|
||||
info->func[0] &= ~PMBUS_HAVE_TEMP3;
|
||||
info->func[1] &= ~PMBUS_HAVE_TEMP3;
|
||||
fallthrough;
|
||||
case raa_dmpvr2_2rail:
|
||||
info->pages = 2;
|
||||
|
@@ -71,7 +71,7 @@ static ssize_t format_attr_contextid_show(struct device *dev,
|
||||
{
|
||||
int pid_fmt = ETM_OPT_CTXTID;
|
||||
|
||||
#if defined(CONFIG_CORESIGHT_SOURCE_ETM4X)
|
||||
#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X)
|
||||
pid_fmt = is_kernel_in_hyp_mode() ? ETM_OPT_CTXTID2 : ETM_OPT_CTXTID;
|
||||
#endif
|
||||
return sprintf(page, "config:%d\n", pid_fmt);
|
||||
|
@@ -654,6 +654,14 @@ static int geni_i2c_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void geni_i2c_shutdown(struct platform_device *pdev)
|
||||
{
|
||||
struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev);
|
||||
|
||||
/* Make client i2c transfers start failing */
|
||||
i2c_mark_adapter_suspended(&gi2c->adap);
|
||||
}
|
||||
|
||||
static int __maybe_unused geni_i2c_runtime_suspend(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
@@ -694,6 +702,8 @@ static int __maybe_unused geni_i2c_suspend_noirq(struct device *dev)
|
||||
{
|
||||
struct geni_i2c_dev *gi2c = dev_get_drvdata(dev);
|
||||
|
||||
i2c_mark_adapter_suspended(&gi2c->adap);
|
||||
|
||||
if (!gi2c->suspended) {
|
||||
geni_i2c_runtime_suspend(dev);
|
||||
pm_runtime_disable(dev);
|
||||
@@ -703,8 +713,16 @@ static int __maybe_unused geni_i2c_suspend_noirq(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused geni_i2c_resume_noirq(struct device *dev)
|
||||
{
|
||||
struct geni_i2c_dev *gi2c = dev_get_drvdata(dev);
|
||||
|
||||
i2c_mark_adapter_resumed(&gi2c->adap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops geni_i2c_pm_ops = {
|
||||
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(geni_i2c_suspend_noirq, NULL)
|
||||
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(geni_i2c_suspend_noirq, geni_i2c_resume_noirq)
|
||||
SET_RUNTIME_PM_OPS(geni_i2c_runtime_suspend, geni_i2c_runtime_resume,
|
||||
NULL)
|
||||
};
|
||||
@@ -718,6 +736,7 @@ MODULE_DEVICE_TABLE(of, geni_i2c_dt_match);
|
||||
static struct platform_driver geni_i2c_driver = {
|
||||
.probe = geni_i2c_probe,
|
||||
.remove = geni_i2c_remove,
|
||||
.shutdown = geni_i2c_shutdown,
|
||||
.driver = {
|
||||
.name = "geni_i2c",
|
||||
.pm = &geni_i2c_pm_ops,
|
||||
|
@@ -688,13 +688,6 @@ static const struct iommu_ops mtk_iommu_ops = {
|
||||
static int mtk_iommu_hw_init(const struct mtk_iommu_data *data)
|
||||
{
|
||||
u32 regval;
|
||||
int ret;
|
||||
|
||||
ret = clk_prepare_enable(data->bclk);
|
||||
if (ret) {
|
||||
dev_err(data->dev, "Failed to enable iommu bclk(%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (data->plat_data->m4u_plat == M4U_MT8173) {
|
||||
regval = F_MMU_PREFETCH_RT_REPLACE_MOD |
|
||||
@@ -760,7 +753,6 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data)
|
||||
if (devm_request_irq(data->dev, data->irq, mtk_iommu_isr, 0,
|
||||
dev_name(data->dev), (void *)data)) {
|
||||
writel_relaxed(0, data->base + REG_MMU_PT_BASE_ADDR);
|
||||
clk_disable_unprepare(data->bclk);
|
||||
dev_err(data->dev, "Failed @ IRQ-%d Request\n", data->irq);
|
||||
return -ENODEV;
|
||||
}
|
||||
@@ -977,14 +969,19 @@ static int __maybe_unused mtk_iommu_runtime_resume(struct device *dev)
|
||||
void __iomem *base = data->base;
|
||||
int ret;
|
||||
|
||||
/* Avoid first resume to affect the default value of registers below. */
|
||||
if (!m4u_dom)
|
||||
return 0;
|
||||
ret = clk_prepare_enable(data->bclk);
|
||||
if (ret) {
|
||||
dev_err(data->dev, "Failed to enable clk(%d) in resume\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Uppon first resume, only enable the clk and return, since the values of the
|
||||
* registers are not yet set.
|
||||
*/
|
||||
if (!m4u_dom)
|
||||
return 0;
|
||||
|
||||
writel_relaxed(reg->wr_len_ctrl, base + REG_MMU_WR_LEN_CTRL);
|
||||
writel_relaxed(reg->misc_ctrl, base + REG_MMU_MISC_CTRL);
|
||||
writel_relaxed(reg->dcm_dis, base + REG_MMU_DCM_DIS);
|
||||
|
@@ -1267,10 +1267,11 @@ static inline void gic_cpu_pm_init(void) { }
|
||||
#endif /* CONFIG_CPU_PM */
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static void gic_resume(void)
|
||||
void gic_resume(void)
|
||||
{
|
||||
trace_android_vh_gic_resume(gic_data.domain, gic_data.dist_base);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gic_resume);
|
||||
|
||||
static struct syscore_ops gic_syscore_ops = {
|
||||
.resume = gic_resume,
|
||||
@@ -1283,6 +1284,7 @@ static void gic_syscore_init(void)
|
||||
|
||||
#else
|
||||
static inline void gic_syscore_init(void) { }
|
||||
void gic_resume(void) { }
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -87,7 +87,7 @@ config MEDIA_ANALOG_TV_SUPPORT
|
||||
will disable support for them.
|
||||
|
||||
config MEDIA_DIGITAL_TV_SUPPORT
|
||||
bool "Digital TV"
|
||||
tristate "Digital TV"
|
||||
default y if !MEDIA_SUPPORT_FILTER
|
||||
help
|
||||
Enable digital TV support.
|
||||
|
@@ -211,6 +211,7 @@ config VIDEO_MEDIATEK_JPEG
|
||||
depends on MTK_IOMMU_V1 || MTK_IOMMU || COMPILE_TEST
|
||||
depends on VIDEO_DEV && VIDEO_V4L2
|
||||
depends on ARCH_MEDIATEK || COMPILE_TEST
|
||||
depends on MTK_SMI || (COMPILE_TEST && MTK_SMI=n)
|
||||
select VIDEOBUF2_DMA_CONTIG
|
||||
select V4L2_MEM2MEM_DEV
|
||||
help
|
||||
@@ -238,6 +239,7 @@ config VIDEO_MEDIATEK_MDP
|
||||
depends on MTK_IOMMU || COMPILE_TEST
|
||||
depends on VIDEO_DEV && VIDEO_V4L2
|
||||
depends on ARCH_MEDIATEK || COMPILE_TEST
|
||||
depends on MTK_SMI || (COMPILE_TEST && MTK_SMI=n)
|
||||
select VIDEOBUF2_DMA_CONTIG
|
||||
select V4L2_MEM2MEM_DEV
|
||||
select VIDEO_MEDIATEK_VPU
|
||||
@@ -258,6 +260,7 @@ config VIDEO_MEDIATEK_VCODEC
|
||||
# our dependencies, to avoid missing symbols during link.
|
||||
depends on VIDEO_MEDIATEK_VPU || !VIDEO_MEDIATEK_VPU
|
||||
depends on MTK_SCP || !MTK_SCP
|
||||
depends on MTK_SMI || (COMPILE_TEST && MTK_SMI=n)
|
||||
select VIDEOBUF2_DMA_CONTIG
|
||||
select V4L2_MEM2MEM_DEV
|
||||
select VIDEO_MEDIATEK_VCODEC_VPU if VIDEO_MEDIATEK_VPU
|
||||
|
@@ -2177,8 +2177,6 @@ int cxgb4_update_mac_filt(struct port_info *pi, unsigned int viid,
|
||||
bool persistent, u8 *smt_idx);
|
||||
int cxgb4_get_msix_idx_from_bmap(struct adapter *adap);
|
||||
void cxgb4_free_msix_idx_in_bmap(struct adapter *adap, u32 msix_idx);
|
||||
int cxgb_open(struct net_device *dev);
|
||||
int cxgb_close(struct net_device *dev);
|
||||
void cxgb4_enable_rx(struct adapter *adap, struct sge_rspq *q);
|
||||
void cxgb4_quiesce_rx(struct sge_rspq *q);
|
||||
int cxgb4_port_mirror_alloc(struct net_device *dev);
|
||||
|
@@ -2834,7 +2834,7 @@ static void cxgb_down(struct adapter *adapter)
|
||||
/*
|
||||
* net_device operations
|
||||
*/
|
||||
int cxgb_open(struct net_device *dev)
|
||||
static int cxgb_open(struct net_device *dev)
|
||||
{
|
||||
struct port_info *pi = netdev_priv(dev);
|
||||
struct adapter *adapter = pi->adapter;
|
||||
@@ -2882,7 +2882,7 @@ out_unlock:
|
||||
return err;
|
||||
}
|
||||
|
||||
int cxgb_close(struct net_device *dev)
|
||||
static int cxgb_close(struct net_device *dev)
|
||||
{
|
||||
struct port_info *pi = netdev_priv(dev);
|
||||
struct adapter *adapter = pi->adapter;
|
||||
|
@@ -997,20 +997,16 @@ int cxgb4_tc_flower_destroy(struct net_device *dev,
|
||||
if (!ch_flower)
|
||||
return -ENOENT;
|
||||
|
||||
rhashtable_remove_fast(&adap->flower_tbl, &ch_flower->node,
|
||||
adap->flower_ht_params);
|
||||
|
||||
ret = cxgb4_flow_rule_destroy(dev, ch_flower->fs.tc_prio,
|
||||
&ch_flower->fs, ch_flower->filter_id);
|
||||
if (ret)
|
||||
goto err;
|
||||
netdev_err(dev, "Flow rule destroy failed for tid: %u, ret: %d",
|
||||
ch_flower->filter_id, ret);
|
||||
|
||||
ret = rhashtable_remove_fast(&adap->flower_tbl, &ch_flower->node,
|
||||
adap->flower_ht_params);
|
||||
if (ret) {
|
||||
netdev_err(dev, "Flow remove from rhashtable failed");
|
||||
goto err;
|
||||
}
|
||||
kfree_rcu(ch_flower, rcu);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -589,7 +589,8 @@ int cxgb4_setup_tc_mqprio(struct net_device *dev,
|
||||
* down before configuring tc params.
|
||||
*/
|
||||
if (netif_running(dev)) {
|
||||
cxgb_close(dev);
|
||||
netif_tx_stop_all_queues(dev);
|
||||
netif_carrier_off(dev);
|
||||
needs_bring_up = true;
|
||||
}
|
||||
|
||||
@@ -615,8 +616,10 @@ int cxgb4_setup_tc_mqprio(struct net_device *dev,
|
||||
}
|
||||
|
||||
out:
|
||||
if (needs_bring_up)
|
||||
cxgb_open(dev);
|
||||
if (needs_bring_up) {
|
||||
netif_tx_start_all_queues(dev);
|
||||
netif_carrier_on(dev);
|
||||
}
|
||||
|
||||
mutex_unlock(&adap->tc_mqprio->mqprio_mutex);
|
||||
return ret;
|
||||
|
@@ -2552,6 +2552,12 @@ int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc)
|
||||
if (!eosw_txq)
|
||||
return -ENOMEM;
|
||||
|
||||
if (!(adap->flags & CXGB4_FW_OK)) {
|
||||
/* Don't stall caller when access to FW is lost */
|
||||
complete(&eosw_txq->completion);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
skb = alloc_skb(len, GFP_KERNEL);
|
||||
if (!skb)
|
||||
return -ENOMEM;
|
||||
|
@@ -2205,15 +2205,20 @@ static int i40e_run_xdp(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
|
||||
case XDP_TX:
|
||||
xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index];
|
||||
result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring);
|
||||
if (result == I40E_XDP_CONSUMED)
|
||||
goto out_failure;
|
||||
break;
|
||||
case XDP_REDIRECT:
|
||||
err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
|
||||
result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED;
|
||||
if (err)
|
||||
goto out_failure;
|
||||
result = I40E_XDP_REDIR;
|
||||
break;
|
||||
default:
|
||||
bpf_warn_invalid_xdp_action(act);
|
||||
fallthrough;
|
||||
case XDP_ABORTED:
|
||||
out_failure:
|
||||
trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
|
||||
fallthrough; /* handle aborts by dropping packet */
|
||||
case XDP_DROP:
|
||||
|
@@ -159,21 +159,28 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
|
||||
xdp_prog = READ_ONCE(rx_ring->xdp_prog);
|
||||
act = bpf_prog_run_xdp(xdp_prog, xdp);
|
||||
|
||||
if (likely(act == XDP_REDIRECT)) {
|
||||
err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
|
||||
if (err)
|
||||
goto out_failure;
|
||||
rcu_read_unlock();
|
||||
return I40E_XDP_REDIR;
|
||||
}
|
||||
|
||||
switch (act) {
|
||||
case XDP_PASS:
|
||||
break;
|
||||
case XDP_TX:
|
||||
xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index];
|
||||
result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring);
|
||||
break;
|
||||
case XDP_REDIRECT:
|
||||
err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
|
||||
result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED;
|
||||
if (result == I40E_XDP_CONSUMED)
|
||||
goto out_failure;
|
||||
break;
|
||||
default:
|
||||
bpf_warn_invalid_xdp_action(act);
|
||||
fallthrough;
|
||||
case XDP_ABORTED:
|
||||
out_failure:
|
||||
trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
|
||||
fallthrough; /* handle aborts by dropping packet */
|
||||
case XDP_DROP:
|
||||
|
@@ -1797,49 +1797,6 @@ ice_phy_type_to_ethtool(struct net_device *netdev,
|
||||
ice_ethtool_advertise_link_mode(ICE_AQ_LINK_SPEED_100GB,
|
||||
100000baseKR4_Full);
|
||||
}
|
||||
|
||||
/* Autoneg PHY types */
|
||||
if (phy_types_low & ICE_PHY_TYPE_LOW_100BASE_TX ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_1000BASE_T ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_1000BASE_KX ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_2500BASE_T ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_2500BASE_KX ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_5GBASE_T ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_5GBASE_KR ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_10GBASE_T ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_10GBASE_KR_CR1 ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_T ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_CR ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_CR_S ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_CR1 ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_KR ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_KR_S ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_KR1 ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_40GBASE_CR4 ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_40GBASE_KR4) {
|
||||
ethtool_link_ksettings_add_link_mode(ks, supported,
|
||||
Autoneg);
|
||||
ethtool_link_ksettings_add_link_mode(ks, advertising,
|
||||
Autoneg);
|
||||
}
|
||||
if (phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_CR2 ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_KR2 ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_CP ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4) {
|
||||
ethtool_link_ksettings_add_link_mode(ks, supported,
|
||||
Autoneg);
|
||||
ethtool_link_ksettings_add_link_mode(ks, advertising,
|
||||
Autoneg);
|
||||
}
|
||||
if (phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_CR4 ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_KR4 ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_KR_PAM4 ||
|
||||
phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_CP2) {
|
||||
ethtool_link_ksettings_add_link_mode(ks, supported,
|
||||
Autoneg);
|
||||
ethtool_link_ksettings_add_link_mode(ks, advertising,
|
||||
Autoneg);
|
||||
}
|
||||
}
|
||||
|
||||
#define TEST_SET_BITS_TIMEOUT 50
|
||||
@@ -1996,9 +1953,7 @@ ice_get_link_ksettings(struct net_device *netdev,
|
||||
ks->base.port = PORT_TP;
|
||||
break;
|
||||
case ICE_MEDIA_BACKPLANE:
|
||||
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
|
||||
ethtool_link_ksettings_add_link_mode(ks, supported, Backplane);
|
||||
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
|
||||
ethtool_link_ksettings_add_link_mode(ks, advertising,
|
||||
Backplane);
|
||||
ks->base.port = PORT_NONE;
|
||||
@@ -2073,6 +2028,12 @@ ice_get_link_ksettings(struct net_device *netdev,
|
||||
if (caps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN)
|
||||
ethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);
|
||||
|
||||
/* Set supported and advertised autoneg */
|
||||
if (ice_is_phy_caps_an_enabled(caps)) {
|
||||
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
|
||||
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
|
||||
}
|
||||
|
||||
done:
|
||||
kfree(caps);
|
||||
return err;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user