Commit Graph

1053512 Commits

Author SHA1 Message Date
Nick Desaulniers
14f39157c9 ANDROID: build.config: set NDK_TRIPLE
In order to support CONFIG_UAPI_HEADER_TEST=y with a bionic sysroot
using prebuilt bionic from the NDK, we need to set a different target
triple for USERCFLAGS than what's used when cross compiling the kernel
(so that the correct headers and libc.{a|so} are found+used).

Bug: 190019968
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: Ib3e60c41b862cda9f79ff8d2c812aaa8bfb571af
2022-04-05 17:31:51 -07:00
Nick Desaulniers
7321041909 ANDROID: disable SAMPLES and BPFILTER for allmodconfigs
These aren't portable yet when building with a Bionic based sysroot.

Disable building them for now so that we can land support for
UAPI_HEADER_TEST.

Bug: 190019968
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: Ice3d3c55bbf79dd08265f168e49e2058231c181d
2022-04-05 17:31:51 -07:00
Nick Desaulniers
51a926e914 FROMLIST: net, uapi: remove inclusion of arpa/inet.h
In include/uapi/linux/tipc_config.h, there's a comment that it includes
arpa/inet.h for ntohs; but ntohs is not defined in any UAPI header. For
now, reuse the definitions from include/linux/byteorder/generic.h, since
the various conversion functions do exist in UAPI headers:
include/uapi/linux/byteorder/big_endian.h
include/uapi/linux/byteorder/little_endian.h

We would like to get to the point where we can build UAPI header tests
with -nostdinc, meaning that kernel UAPI headers should not have a
circular dependency on libc headers.

Link: https://android-review.googlesource.com/c/platform/bionic/+/2048127
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/netdev/20220404175448.46200-1-ndesaulniers@google.com/
Bug: 190019968
Change-Id: I5c45248fb88f03024da809b503ff3b9cd4ed66a9
2022-04-05 17:31:51 -07:00
Masahiro Yamada
e6cb41be83 UPSTREAM: kbuild: add --target to correctly cross-compile UAPI headers with Clang
When you compile-test UAPI headers (CONFIG_UAPI_HEADER_TEST=y) with
Clang, they are currently compiled for the host target (likely x86_64)
regardless of the given ARCH=.

In fact, some exported headers include libc headers. For example,
include/uapi/linux/agpgart.h includes <stdlib.h> after being exported.
The header search paths should match to the target we are compiling
them for.

Pick up the --target triple from KBUILD_CFLAGS in the same ways as
commit 7f58b487e9 ("kbuild: make Clang build userprogs for target
architecture").

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Bug: 190019968
Change-Id: I9f4867b4fc1d0c4cf1af2bb3d6f53c3a8a8f4437
(cherry picked from commit 9fbed27a7a1101c926718dfa9b49aff1d04477b5)
2022-04-05 17:31:51 -07:00
Shiraz Hashim
d9f210a14d ANDROID: kunit: Provision kunit as a vendor module
'kunit_test' member variable in task_struct is defined
under CONFIG_KUNIT. Besides there are supportive functions
in slub and kasan which gets conditionally compiled out.

Allow kunit to be build as vendor module by removing
compile time dependencies.

Bug: 215096354
Change-Id: If57b1df6e479aa0388aabc53af5ae10e20a844b2
Signed-off-by: Shiraz Hashim <quic_shashim@quicinc.com>
2022-04-05 16:52:37 +00:00
David Brazdil
e8bca85bc1 ANDROID: Update the ABI symbol list
Leaf changes summary: 2 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

2 Added functions:

  [A] 'function int pkvm_iommu_finalize()'
  [A] 'function int pkvm_iommu_sysmmu_sync_register(device*, phys_addr_t, device*)'

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: Ibc7bf50b9b68c0334ea786b603f40c04b8ccea5b
2022-04-05 12:56:22 +01:00
David Brazdil
6c8043376f ANDROID: Add new pkvm_iommu_* functions to aarch64 ABI
Add two new symbols to aarch64 kernel ABI:
  * pkvm_iommu_sysmmu_sync_register
  * pkvm_iommu_finalize

The former allows vendor modules to register a SYSMMU_SYNC device with
the hypervisor, and the latter tells the hypervisor to stop acception
new device registrations.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I6c6948d94cb6494f07d52b4e2b7e91db40e2fcd6
2022-04-05 11:37:29 +01:00
David Brazdil
d2e71e529b ANDROID: KVM: arm64: iommu: Add pkvm_iommu_finalize
Add new hypercall that the host can use to inform the hypervisor that
all hypervisor-controlled IOMMUs have been registered and no new
registrations should be allowed. This will typically be called at the
end of kernel module initialization phase.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I8c175310d5b262a67947443c5a0154056a8ebf3e
2022-04-05 11:37:28 +01:00
David Brazdil
2c05ff981a ANDROID: KVM: arm64: iommu: No powered check in DABT handler
The IOMMU DABT handler currently checks if the device is considered
powered by hyp before resolving the request. If the power tracking does
not reflect reality, the IOMMU may trigger issues in the host but the
incorrect state prevents it from diagnosing the issue.

Drop the powered check from the generic IOMMU code. The host accessing
the device's SFR means that it assumes it is powered, and individual
drivers can choose to reject that DABT request.

Bug: 224891559
Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I1c132c4030a61a90be4675867c9658e3bc696118
2022-04-05 11:37:16 +01:00
David Brazdil
611c9a2a4a ANDROID: KVM: arm64: s2mpu: Create SysMMU_SYNC driver
SysMMU_SYNC devices expose an interface to start a sync counter and
poll its SFR until the device signals that all memory transactions in
flight at the start have drained. This gives the hypervisor a reliable
indicator that S2MPU invalidation has fully completed and all new
transactions will use the new MPTs.

Add a new pKVM IOMMU driver that the host can use to register
SysMMU_SYNCs. Each device is expected to be a supplier to exactly one
S2MPU (parent), but multiple SYNCs can supply a single S2MPU.

To keep things simple, the SYNCs do not implement suspend/resume and are
assumed to follow the power transitions of their parent.

Following an invalidation, the S2MPU driver iterates over its children
and waits for each SYNC to signal that its transactions have drained.
The algorithm currently waits on each SYNC in turn. If latency proves to
be an issue, this could be optimized to initiate a SYNC on all powered
devices before starting to poll.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I45b832fd11d76b65987935c8548e2a214ee2fa2a
2022-04-05 11:37:16 +01:00
David Brazdil
d5bc119656 ANDROID: KVM: arm64: iommu: Create parent/child relation
In preparation for adding new IOMMU devices that act as suppliers to
others, add the notion of a parent IOMMU device. Such device must be
registered after its parent and the driver of the parent device must
validate the addition.

The relation has no generic implications, it is up to drivers to make
use of it.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I4ee3675e5529bb73ad4546fa32380f237f054177
2022-04-05 11:37:16 +01:00
David Brazdil
db89d65f69 ANDROID: KVM: arm64: iommu: Run validate() on struct pkvm_iommu
In preparation for needing to validate more aspects of a device that is
about to be registered, change the callback to accept the to-be-added
'struct pkvm_iommu' rather than individual inputs.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I3fb911e4280c220ddd779cf6a5fc9c302a5617f7
2022-04-05 11:36:55 +01:00
David Brazdil
c690c2e305 ANDROID: KVM: arm64: iommu: Create private mapping last
Private EL2 mappings currently cannot be removed. Move the creation of
IOMMU device mappings at the end of the registration function so that
other errors do not result in unnecessary mappings.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I3139e9af3345f157295eb72441a7cf3cc055116d
2022-04-05 11:36:49 +01:00
David Brazdil
597558ad5b ANDROID: KVM: arm64: iommu: Free memory on registration error
Memory for IOMMU device entries gets allocated from a pool donated by
the host. It is possible for pkvm_iommu_register() to allocate the
memory and then fail, in which case the memory remains unused but not
freed.

Refactor the code such that the host lock covers the entire section
where the memory is allocated. This way we can return the memory back to
the linear allocator if an error is returned.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I8c1650ba3e545741144d793de506e93c4066896f
2022-04-05 11:36:43 +01:00
David Brazdil
0c292fa8d6 ANDROID: KVM: arm64: iommu: Harden __pkvm_iommu_pm_notify
Currently __pkvm_iommu_pm_notify always changes the value of
dev->powered following a suspend/resume attempt. This could potentially
be abused to force the hypervisor to stop issuing updates to an S2MPU
and preserving an old/invalid state.

Modify to only update the power state if suspend/resume was successful.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I285fc822e9fc926c49b9b5e69446790e1edccafb
2022-04-05 11:34:42 +01:00
Pradeep P V K
5de2ef69b6 FROMLIST: fuse: give wakeup hints to the scheduler
The synchronous wakeup interface is available only for the
interruptible wakeup. Add it for normal wakeup and use this
synchronous wakeup interface to wakeup the userspace daemon.
Scheduler can make use of this hint to find a better CPU for
the waker task.

With this change the performance numbers for compress, decompress
and copy use-cases on /sdcard path has improved by ~30%.

Use-case details:
1. copy 10000 files of each 4k size into /sdcard path
2. use any File explorer application that has compress/decompress
support
3. start compress/decompress and capture the time.

-------------------------------------------------
| Default   | wakeup support | Improvement/Diff |
-------------------------------------------------
| 13.8 sec  | 9.9 sec        | 3.9 sec (28.26%) |
-------------------------------------------------

Co-developed-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>

Bug: 216261533
Link: https://lore.kernel.org/lkml/1638780405-38026-1-git-send-email-quic_pragalla@quicinc.com/
Change-Id: I9ac89064e34b1e0605064bf4d2d3a310679cb605
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>
Signed-off-by: Alessio Balsini <balsini@google.com>
2022-04-04 10:18:55 +00:00
Shengjiu Wang
754bb029c8 FROMGIT: ASoC: soc-generic-dmaengine-pcm: separate max_buffer_size assignment
The config->pcm_hardware may be NULL when config->prealloc_buffer_size
is not zero, so it is better to move max_buffer_size assignment under
a separate condition.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1642646642-15908-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 226635564
(cherry picked from commit 88c62b16281e5fe748f22f44da3def8a91fb1c34
 https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next)
Change-Id: Ib5c5540afcb79665bb0daf684954365747439ad8
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
2022-04-01 19:10:09 +00:00
Sugar Zhang
cd54a8bad4 UPSTREAM: ASoC: dmaengine: Introduce module option prealloc_buffer_size_kbytes
Currently, The fixed 512KB prealloc buffer size is too larger for
tiny memory kernel (such as 16MB memory). This patch adds the module
option "prealloc_buffer_size_kbytes" to specify prealloc buffer size.

It's suitable for cards which use the generic dmaengine pcm driver
with no config.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Link: https://lore.kernel.org/r/1632394246-59341-1-git-send-email-sugar.zhang@rock-chips.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Bug: 226673331
Change-Id: I13e4e65502e8e9625577e9a9bb9f3e02154f31f4
(cherry picked from commit b0e3b0a7078d71455747025e7deee766d4d43432)
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
2022-04-01 19:09:45 +00:00
Jeson Gao
97a290b0e5 ANDROID: thermal: Add vendor hook to check power range
For SoC's skin temperature, we have to use more stringent temperature
control to make IPA can monitor and mitigate temperature control earlier
and faster, so add it to meet platform thermal requirement.

Bug: 211564753

Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Signed-off-by: Di Shen <di.shen@unisoc.com>
Change-Id: Iaef87287eef93d6fdbc3c58c93f70c1525e38296
(cherry picked from commit 6709f523251f77dc1e9ea643668c630db1f7db80)
2022-04-01 17:16:02 +00:00
Alistair Delva
60cddd3d15 ANDROID: GKI: Update virtual_device symbol list
Add necessary symbols for vkms and e1000 drivers.
Update the ABI representation as well.

Leaf changes summary: 29 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 29 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

29 Added functions:

  [A] 'function int ___pskb_trim(sk_buff*, unsigned int)'
  [A] 'function void __drm_gem_destroy_shadow_plane_state(drm_shadow_plane_state*)'
  [A] 'function void __drm_gem_duplicate_shadow_plane_state(drm_plane*, drm_shadow_plane_state*)'
  [A] 'function void __drm_gem_reset_shadow_plane(drm_plane*, drm_shadow_plane_state*)'
  [A] 'function void* __drmm_universal_plane_alloc(drm_device*, size_t, size_t, uint32_t, const drm_plane_funcs*, const uint32_t*, unsigned int, const uint64_t*, drm_plane_type, const char*, ...)'
  [A] 'function void* __netdev_alloc_frag_align(unsigned int, unsigned int)'
  [A] 'function void* devres_open_group(device*, void*, gfp_t)'
  [A] 'function int devres_release_group(device*, void*)'
  [A] 'function void drm_calc_timestamping_constants(drm_crtc*, const drm_display_mode*)'
  [A] 'function u64 drm_crtc_accurate_vblank_count(drm_crtc*)'
  [A] 'function int drm_crtc_add_crc_entry(drm_crtc*, bool, uint32_t, uint32_t*)'
  [A] 'function void drm_gem_cleanup_shadow_fb(drm_plane*, drm_plane_state*)'
  [A] 'function int drm_gem_fb_vmap(drm_framebuffer*, dma_buf_map*, dma_buf_map*)'
  [A] 'function void drm_gem_fb_vunmap(drm_framebuffer*, dma_buf_map*)'
  [A] 'function int drm_gem_prepare_shadow_fb(drm_plane*, drm_plane_state*)'
  [A] 'function int drm_gem_shmem_dumb_create(drm_file*, drm_device*, drm_mode_create_dumb*)'
  [A] 'function drm_gem_object* drm_gem_shmem_prime_import_sg_table(drm_device*, dma_buf_attachment*, sg_table*)'
  [A] 'function void ethtool_convert_legacy_u32_to_link_mode(unsigned long int*, u32)'
  [A] 'function bool ethtool_convert_link_mode_to_legacy_u32(u32*, const unsigned long int*)'
  [A] 'function sk_buff* napi_get_frags(napi_struct*)'
  [A] 'function gro_result_t napi_gro_frags(napi_struct*)'
  [A] 'function void page_frag_free(void*)'
  [A] 'function void pci_clear_mwi(pci_dev*)'
  [A] 'function int pci_enable_device_mem(pci_dev*)'
  [A] 'function void* pci_ioremap_bar(pci_dev*, int)'
  [A] 'function int pci_select_bars(pci_dev*, unsigned long int)'
  [A] 'function int pci_set_mwi(pci_dev*)'
  [A] 'function int pcix_get_mmrbc(pci_dev*)'
  [A] 'function int pcix_set_mmrbc(pci_dev*, int)'

Bug: 219525285
Change-Id: I78a679bdb6761167f5cb5fcb45e0461a3d0b9cbb
Signed-off-by: Alistair Delva <adelva@google.com>
2022-04-01 17:13:53 +00:00
Xuewen Yan
c6fb9f6636 ANDROID: Add vendor hook to the effective_cpu_util
android_rvh_effective_cpu_util:
	To perform vendor-specific cpu util, it is used in EAS/schedutil/thermal.

The effective_cpu_util would be called when thermal calc the dynamic power,
it's non-atomic context, so set the hook be restricted.

Bug: 226686099
Test: build pass

Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
Change-Id: I6fd77f44ca4328f5ef37d96989aa2e08d65e29bb
2022-04-01 17:12:18 +00:00
Keir Fraser
59a389919e UPSTREAM: virtio: pci: check bar values read from virtio config space
virtio pci config structures may in future have non-standard bar
values in the bar field. We should anticipate this by skipping any
structures containing such a reserved value.

The bar value should never change: check for harmful modified values
we re-read it from the config space in vp_modern_map_capability().

Also clean up an existing check to consistently use PCI_STD_NUM_BARS.

Signed-off-by: Keir Fraser <keirf@google.com>
Link: https://lore.kernel.org/r/20220323140727.3499235-1-keirf@google.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 3f63a1d7f6f500b6891b1003cec3e23ea4996a2e)
Bug: 222232623
Signed-off-by: Keir Fraser <keirf@google.com>
Change-Id: Idbba48154a051cf173b9cb0bd40c77fcf02902a4
2022-04-01 15:02:16 +00:00
Jason Wang
51919aeb09 UPSTREAM: Revert "virtio_pci: harden MSI-X interrupts"
This reverts commit 9e35276a5344f74d4a3600fc4100b3dd251d5c56. Issue
were reported for the drivers that are using affinity managed IRQ
where manually toggling IRQ status is not expected. And we forget to
enable the interrupts in the restore path as well.

In the future, we will rework on the interrupt hardening.

Fixes: 9e35276a5344 ("virtio_pci: harden MSI-X interrupts")
Reported-by: Marc Zyngier <maz@kernel.org>
Reported-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20220323031524.6555-2-jasowang@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit eb4cecb453a19b34d5454b49532e09e9cb0c1529)
Bug: 196772804
Signed-off-by: Keir Fraser <keirf@google.com>
Change-Id: I05264d9e61d558522a8a20cf87399aa3578b3a6e
2022-04-01 10:17:31 +00:00
Jason Wang
b1c4b56bc3 UPSTREAM: Revert "virtio-pci: harden INTX interrupts"
This reverts commit 080cd7c3ac8701081d143a15ba17dd9475313188. Since
the MSI-X interrupts hardening will be reverted in the next patch. We
will rework the interrupt hardening in the future.

Fixes: 080cd7c3ac87 ("virtio-pci: harden INTX interrupts")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20220323031524.6555-1-jasowang@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 7b79edfb862d6b1ecc66479419ae67a7db2d02e3)
Bug: 196772804
Signed-off-by: Keir Fraser <keirf@google.com>
Change-Id: I11ea35dcff3cfd43a535acf2033d7921f39c8be7
2022-04-01 10:07:43 +00:00
Quentin Perret
d10551c5fd ANDROID: KVM: arm64: Don't map host sections in pkvm
We no longer need to map the host's .rodata and .bss sections in the
pkvm hypervisor, so let's remove those mappings. This will avoid
creating dependencies at EL2 on host-controlled data-structures.

Signed-off-by: Quentin Perret <qperret@google.com>
Bug: 225169428
Change-Id: I0fcb0e1b34d3c7c0c226b3fd30cdec0e8d7bfb44
2022-04-01 08:21:51 +00:00
Quentin Perret
fa96b5be92 ANDROID: KVM: arm64: Explicitely map kvm_vgic_global_state at EL2
The pkvm hypervisor may need to read the kvm_vgic_global_state variable
at EL2. Make sure to explicitely map it in the its stage-1 page-table
rather than relying on mapping all of .rodata.

Signed-off-by: Quentin Perret <qperret@google.com>
Bug: 225169428
Change-Id: I72d1eba78fb6b7593d236539cd81269480856fdf
2022-04-01 08:21:46 +00:00
Quentin Perret
7670745758 ANDROID: KVM: arm64: Unmap kvm_arm_hyp_percpu_base from the host
In pKVM mode, we can't trust the host not to mess with the hypervisor
per-cpu offsets, so let's move the array containing them to the nVHE
code.

Signed-off-by: Quentin Perret <qperret@google.com>
Bug: 225169428
Change-Id: I9ef4175ce9cf00d6ff1c0e358551a565358f2408
2022-04-01 08:21:40 +00:00
Quentin Perret
e3d466ac29 ANDROID: KVM: arm64: pkvm: Don't access kvm_arm_hyp_percpu_base at EL1
The host KVM PMU code can currently index kvm_arm_hyp_percpu_base[]
through this_cpu_ptr_hyp_sym(), but will not actually dereference that
pointer when protected KVM is enabled. In preparation for making
kvm_arm_hyp_percpu_base[] unaccessible to the host, let's make sure the
indexing in hyp per-cpu pages is also done after the static key check to
avoid spurious accesses to EL2-private data from EL1.

Signed-off-by: Quentin Perret <qperret@google.com>
Bug: 225169428
Change-Id: I3f4e3f7ee789c31a1ae1f67e07edf8fb34f520b9
2022-04-01 08:21:35 +00:00
James Morse
558584da74 FROMGIT: arm64: head.S: Initialise MPAM EL2 registers and disable traps
Add code to head.S's el2_setup to detect MPAM and disable any EL2 traps.
This register resets to an unknown value, setting it to the default
parititons/pmg before we enable the MMU is the best thing to do.

Kexec/kdump will depend on this if the previous kernel left the CPU
configured with a restrictive configuration.

If linux is booted at the highest implemented exception level el2_setup
will clear the enable bit, disabling MPAM.

Signed-off-by: James Morse <james.morse@arm.com>

Bug: 221768437
(cherry picked from commit fa0ff38f06b397d8a92d88eb8083c2c5a20ac87f
 git://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git mpam/snapshot/v5.16)
Change-Id: I2758f7f7b236d09a207e13d1165efb6887e8611a
Signed-off-by: Valentin Schneider <Valentin.Schneider@arm.com>
[bm: amended commit msg, dropped config option and switched to named labels]
Signed-off-by: Beata Michalska <beata.michalska@arm.com>
2022-03-31 16:07:39 +00:00
Valentin Schneider
5bd796e994 ANDROID: arm64: Partial MPAM sysreg definition import
This is a partial cherry-pick of commit:

  7fe77616f156 ("arm64: cpufeature: discover CPU support for MPAM")

from git://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git

Bug: 221768437
Change-Id: I77101abb07f9b73dbc7cc2a53ac44fbf772f0b1d
Signed-off-by: Valentin Schneider <Valentin.Schneider@arm.com>
Signed-off-by: Beata Michalska <beata.michalska@arm.com>
2022-03-31 16:07:31 +00:00
Tadeusz Struk
c6d01c7aba ANDROID: selftests: incfs: Add stacked_mount_test
Bug: 211066171

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: Ie09d6c1b04e0da7787d371c1cec5c04783b576a7
2022-03-31 14:58:48 +00:00
Chanho Park
deef3f1bd7 ANDROID: arm64: restore start_backtrace() notrace and NOKPROBE_SYMBOL
While 5.15.27 LTS merge, the change of below patch might be omitted.
- 1921d1fd0e ("arm64: Mark start_backtrace() notrace and NOKPROBE_SYMBOL")

To correct the patch, we need to recover the NOKPROBE_SYMBOL macro along
with EXPORT_SYMBOL_GPL macro that was added by below patch.

- b7ca6bc390 ("ANDROID: arm64: stacktrace: export start_backtrace symbol")

Bug: 227151759
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Change-Id: I2e4cf0654c6bd65a8ad606709642a27cdc5b2f72
(recover commit from 1921d1fd0e)
2022-03-31 14:39:06 +00:00
Huang Jianan
3450010a05 UPSTREAM: erofs: add sysfs interface
Add sysfs interface to configure erofs related parameters later.

Link: https://lore.kernel.org/r/20211201145436.4357-1-huangjianan@oppo.com
Reviewed-by: Chao Yu <chao@kernel.org>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: David Anderson <dvander@google.com>
Change-Id: I1c6a5af906cdac3e49bd7fc94d3ca58d5f80c4a4
(cherry picked from commit 168e9a76200c54c584a23aa88c62c53c4b0edd66)
2022-03-30 22:53:39 +00:00
Tadeusz Struk
fb8ac7510f ANDROID: selftests: incfs: Add umount helper function
Bug: 211066171

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I3c8eebbce3079292fc85dad8984efe6382f22cac
2022-03-30 11:39:18 -07:00
Tadeusz Struk
bb06586f5a ANDROID: selftests: incfs: skip large_file_test test is not enough free space
Make the large_file_test check if there is at least 3GB of free disk
space and skip the test if there is not. This is to make the tests pass
on a VM with limited disk size, now all functional tests are passing.

TAP version 13
1..26
ok 1 basic_file_ops_test
ok 2 cant_touch_index_test
ok 3 dynamic_files_and_data_test
ok 4 concurrent_reads_and_writes_test
ok 5 attribute_test
ok 6 work_after_remount_test
ok 7 child_procs_waiting_for_data_test
ok 8 multiple_providers_test
ok 9 hash_tree_test
ok 10 read_log_test
ok 11 get_blocks_test
ok 12 get_hash_blocks_test
ok 13 large_file_test
ok 14 mapped_file_test
ok 15 compatibility_test
ok 16 data_block_count_test
ok 17 hash_block_count_test
ok 18 per_uid_read_timeouts_test
ok 19 inotify_test
ok 20 verity_test
ok 21 enable_verity_test
ok 22 mmap_test
ok 23 truncate_test
ok 24 stat_test
ok 25 sysfs_test
Error mounting fs.: File exists
Error mounting fs.: File exists
ok 26 sysfs_rename_test

Bug: 211066171

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I2260e2b314429251070d0163c70173f237f86476
2022-03-30 11:39:18 -07:00
Tadeusz Struk
27c354de03 ANDROID: selftests: incfs: Add -fno-omit-frame-pointer
Without it incfs/incfs_perf runtime fails in format_signature:

malloc(): invalid size (unsorted)
Aborted

When compiled with gcc version 11.2.0.

Also add check for NULL after the malloc, and remove unneeded
space for uint32_t in signing_section.

Bug: 211066171

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I62b775140e4b89f75335cbd65665cf6a3e0fe964
2022-03-30 11:39:18 -07:00
Tadeusz Struk
f545f0a2a0 ANDROID: incremental-fs: limit mount stack depth
Syzbot recently found a number of issues related to incremental-fs
(see bug numbers below). All have to do with the fact that incr-fs
allows mounts of the same source and target multiple times.
This is a design decision and the user space component "Data Loader"
expects this to work for app re-install use case.
The mounting depth needs to be controlled, however, and only allowed
to be two levels deep. In case of more than two mount attempts the
driver needs to return an error.
In case of the issues listed below the common pattern is that the
reproducer calls:

mount("./file0", "./file0", "incremental-fs", 0, NULL)

many times and then invokes a file operation like chmod, setxattr,
or open on the ./file0. This causes a recursive call for all the
mounted instances, which eventually causes a stack overflow and
a kernel crash:

BUG: stack guard page was hit at ffffc90000c0fff8
kernel stack overflow (double-fault): 0000 [#1] PREEMPT SMP KASAN

This change also cleans up the mount error path to properly clean
allocated resources and call deactivate_locked_super(), which
causes the incfs_kill_sb() to be called, where the sb is freed.

Bug: 211066171
Bug: 213140206
Bug: 213215835
Bug: 211914587
Bug: 211213635
Bug: 213137376
Bug: 211161296

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I08d9b545a2715423296bf4beb67bdbbed78d1be1
2022-03-30 11:38:30 -07:00
Sangmoon Kim
73a2a894a9 ANDROID: stacktrace: export stack_trace_save_tsk/regs
Export stack_trace_save_tsk and stack_trace_save_regs so that modules
can use it to get the stacktrace of specific tasks or pt_regs.

Bug: 220704805
Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I568e5d8c3e2474a0dce96da6adb4eec2583d45d2
(cherry picked from commit db42a16b80a073fdf3f6f3ee207395bba0c7219e)
2022-03-29 23:38:13 +00:00
Vijayanand Jitta
12972dd7bf ANDROID: mm: Export kswapd function
To support multiple kswap threads vendor modules need
access to kswapd function. So, export it.

Bug: 201263306
Change-Id: I442612710835f39836a295e9d1936f86826ab960
Signed-off-by: Vijayanand Jitta <quic_vjitta@quicinc.com>
2022-03-29 19:03:46 +00:00
Greg Kroah-Hartman
162cbdd807 Revert "ALSA: pcm: Fix races among concurrent hw_params and hw_free calls"
This reverts commit 33061d0fba.

It will come back after the next ABI break as it is needed to resolve
CVE-2022-1048.  But for now, while testing, it can be reverted in order
to preserve the ABI.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iebd89734d6d1b0bdb3aaa9e8b52fc07345377a64
2022-03-29 12:57:05 +02:00
Greg Kroah-Hartman
9f368dfefd Revert "ALSA: pcm: Fix races among concurrent read/write and buffer changes"
This reverts commit 47711ff10c.

It will come back after the next ABI break as it is needed to resolve
CVE-2022-1048.  But for now, while testing, it can be reverted in order
to preserve the ABI.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I5d4a52d443cffa34c8550b83c90d11a69da09cfc
2022-03-29 12:57:03 +02:00
Greg Kroah-Hartman
f9e40dc812 Revert "ALSA: pcm: Fix races among concurrent prepare and hw_params/hw_free calls"
This reverts commit cb6a39c5eb.

It will come back after the next ABI break as it is needed to resolve
CVE-2022-1048.  But for now, while testing, it can be reverted in order
to preserve the ABI.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I52c67352b87bc95efab566d76f95d5466a61da64
2022-03-29 12:57:01 +02:00
Greg Kroah-Hartman
07566786dc Revert "ALSA: pcm: Fix races among concurrent prealloc proc writes"
This reverts commit 51fce708ab.

It will come back after the next ABI break as it is needed to resolve
CVE-2022-1048.  But for now, while testing, it can be reverted in order
to preserve the ABI.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8fa7d4fd7200f76aeb02f0741c6508e86146c2a3
2022-03-29 12:56:52 +02:00
Greg Kroah-Hartman
3019c1326d Merge 5.15.32 into android13-5.15
Changes in 5.15.32
	nfc: st21nfca: Fix potential buffer overflows in EVT_TRANSACTION
	net: ipv6: fix skb_over_panic in __ip6_append_data
	tpm: Fix error handling in async work
	Bluetooth: btusb: Add another Realtek 8761BU
	llc: fix netdevice reference leaks in llc_ui_bind()
	ASoC: sti: Fix deadlock via snd_pcm_stop_xrun() call
	ALSA: oss: Fix PCM OSS buffer allocation overflow
	ALSA: usb-audio: add mapping for new Corsair Virtuoso SE
	ALSA: hda/realtek: Add quirk for Clevo NP70PNJ
	ALSA: hda/realtek: Add quirk for Clevo NP50PNJ
	ALSA: hda/realtek - Fix headset mic problem for a HP machine with alc671
	ALSA: hda/realtek: Add quirk for ASUS GA402
	ALSA: pcm: Fix races among concurrent hw_params and hw_free calls
	ALSA: pcm: Fix races among concurrent read/write and buffer changes
	ALSA: pcm: Fix races among concurrent prepare and hw_params/hw_free calls
	ALSA: pcm: Fix races among concurrent prealloc proc writes
	ALSA: pcm: Add stream lock during PCM reset ioctl operations
	ALSA: usb-audio: Add mute TLV for playback volumes on RODE NT-USB
	ALSA: cmipci: Restore aux vol on suspend/resume
	ALSA: pci: fix reading of swapped values from pcmreg in AC97 codec
	drivers: net: xgene: Fix regression in CRC stripping
	netfilter: nf_tables: initialize registers in nft_do_chain()
	netfilter: nf_tables: validate registers coming from userspace.
	ACPI / x86: Work around broken XSDT on Advantech DAC-BJ01 board
	ACPI: battery: Add device HID and quirk for Microsoft Surface Go 3
	ACPI: video: Force backlight native for Clevo NL5xRU and NL5xNU
	crypto: qat - disable registration of algorithms
	Bluetooth: btusb: Add one more Bluetooth part for the Realtek RTL8852AE
	Revert "ath: add support for special 0x0 regulatory domain"
	drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free()
	rcu: Don't deboost before reporting expedited quiescent state
	uaccess: fix integer overflow on access_ok()
	mac80211: fix potential double free on mesh join
	tpm: use try_get_ops() in tpm-space.c
	wcn36xx: Differentiate wcn3660 from wcn3620
	m68k: fix access_ok for coldfire
	nds32: fix access_ok() checks in get/put_user
	llc: only change llc->dev when bind() succeeds
	Linux 5.15.32

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3f78747142047de7aa26e2c81bc378d4d0aedaff
2022-03-29 12:52:53 +02:00
Will Deacon
3f5ffbd827 ANDROID: KVM: arm64: Drop FOLL_FORCE when pinning guest memory pages
Passing FOLL_FORCE when pinning guest memory pages was intended to allow
the VMM to map guest memory as PROT_NONE without prohibiting access from
the guest. As it turns out, crosvm doesn't implement this, and since
the host kernel will inject a signal into the VMM on a bad access
irrespective of the stage-1 permissions, we can drop the FOLL_FORCE flag
altogether.

Bug: 226564150
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: If21091b6adf3dbe4155c5c840753c912d283b159
2022-03-29 09:07:13 +01:00
Will Deacon
94bf7ff642 Revert "ANDROID: KVM: arm64: Add initial support for KVM_CAP_EXIT_HYPERCALL"
This reverts commit a1bd2a6b3c.

This capability is unused, so remove it to avoid UAPI divergence from
upstream.

Bug: 226564150
[willdeacon@: Also removed additional instance in arch/arm64/kvm/arm.c]
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Ib3e929a5fc81dc5c9c1ff8512d48f63bdda5c404
2022-03-29 09:07:13 +01:00
Will Deacon
68c3df5b39 Revert "ANDROID: KVM: arm64: Allow userspace to receive SHARE and UNSHARE notifications"
This reverts commit 0b7e337baf.

These notifications are unused by crosvm and are no longer required now
that the host takes care of injecting a SEGV on an illegal memory access
from userspace.

Bug: 226564150
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I22c3e49b4aa5f023961c8849b79e2e0a21ebf0c1
2022-03-29 09:07:13 +01:00
chihhao.chen
5f2c063b0e ANDROID: usb: export built-in tracepoint functions
Export these tracepoint functions to track USB data flow
for performance tuning.

Bug: 192512300

Signed-off-by: chihhao.chen <chihhao.chen@mediatek.com>
Change-Id: I37ae07e87b5b2d0fb24c1e0a2e83954ceb4aa4f9
(cherry picked from commit 5eb3930a32)
2022-03-29 05:40:00 +00:00
Xie Yongji
9f08c9b8e0 UPSTREAM: virtio-blk: Use blk_validate_block_size() to validate block size
The block layer can't support a block size larger than
page size yet. And a block size that's too small or
not a power of two won't work either. If a misconfigured
device presents an invalid block size in configuration space,
it will result in the kernel crash something like below:

[  506.154324] BUG: kernel NULL pointer dereference, address: 0000000000000008
[  506.160416] RIP: 0010:create_empty_buffers+0x24/0x100
[  506.174302] Call Trace:
[  506.174651]  create_page_buffers+0x4d/0x60
[  506.175207]  block_read_full_page+0x50/0x380
[  506.175798]  ? __mod_lruvec_page_state+0x60/0xa0
[  506.176412]  ? __add_to_page_cache_locked+0x1b2/0x390
[  506.177085]  ? blkdev_direct_IO+0x4a0/0x4a0
[  506.177644]  ? scan_shadow_nodes+0x30/0x30
[  506.178206]  ? lru_cache_add+0x42/0x60
[  506.178716]  do_read_cache_page+0x695/0x740
[  506.179278]  ? read_part_sector+0xe0/0xe0
[  506.179821]  read_part_sector+0x36/0xe0
[  506.180337]  adfspart_check_ICS+0x32/0x320
[  506.180890]  ? snprintf+0x45/0x70
[  506.181350]  ? read_part_sector+0xe0/0xe0
[  506.181906]  bdev_disk_changed+0x229/0x5c0
[  506.182483]  blkdev_get_whole+0x6d/0x90
[  506.183013]  blkdev_get_by_dev+0x122/0x2d0
[  506.183562]  device_add_disk+0x39e/0x3c0
[  506.184472]  virtblk_probe+0x3f8/0x79b [virtio_blk]
[  506.185461]  virtio_dev_probe+0x15e/0x1d0 [virtio]

So let's use a block layer helper to validate the block size.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/r/20211026144015.188-5-xieyongji@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 57a13a5b8157d9a8606490aaa1b805bafe6c37e1)
Bug: 226679849
Signed-off-by: Keir Fraser <keirf@google.com>
Change-Id: I78cde1101baf8da2f68d0b9f942a0f1ec89fb30e
2022-03-28 14:31:07 +00:00
Quentin Perret
2692f0f6f1 ANDROID: KVM: arm64: pkvm: Inject SIGSEGV on illegal accesses
The pKVM hypervisor will currently panic if the host tries to access
memory that it doesn't own (e.g. protected guest memory). Sadly, as
guest memory can still be mapped into the VMM's address space, userspace
can trivially crash the kernel/hypervisor by poking into guest memory.

To prevent this, inject the abort back in the host with S1PTW set in the
ESR, hence allowing the host to differentiate this abort from normal
userspace faults and inject a SIGSEGV cleanly.

Signed-off-by: Quentin Perret <qperret@google.com>
Bug: 215520143
Change-Id: I9636e71e2fe3eb49d2d7cddaab7774cd672cfcae
2022-03-28 11:15:10 +00:00