18 Jan, 2021
22 commits
-
memfds are not available for use in modules. Switch to dma_buf based
interface instead.Bug: 117221195
Change-Id: I4665ce58ea26606ab696bcb8b82b144574770bc1
Signed-off-by: Matthew Maurer -
While 'uint' and 'ulong' are defined in , in Linux kernel
code they're used far less often than 'unsigned int' and 'unsigned
long'. So replace these types with the standard ones.In the process, remove some unnecessary casts to these types:
- Don't cast to uint to print u32 or smaller with %u. It's not needed.
- Don't cast to uint to print size_t; instead just use %zu.
Change-Id: I53e405f9f40d8e935f1f68e0549125859ab78ca5
Signed-off-by: Eric Biggers -
Reject service names longer than 256 bytes (including terminating null)
rather than silently truncate them.Otherwise it may be impossible to increase the maximum supported length
in the future because userspace could start relying on the truncation.Change-Id: I681a3cf4ae07afa81ecd7cea315ef6e40f0e42d2
Signed-off-by: Eric Biggers -
In recent kernels, implementations of file_operations::poll() are
supposed to return __poll_t and use the EPOLL* constants, not POLL*.This fixes the following 'sparse' warning:
drivers/trusty/trusty-ipc.c:1564:27: warning: incorrect type in initializer (different base types)
drivers/trusty/trusty-ipc.c:1564:27: expected restricted __poll_t ( *poll )( ... )
drivers/trusty/trusty-ipc.c:1564:27: got unsigned int ( * )( ... )Also, on some architectures the EPOLL* constants are different from the
POLL* ones; see upstream commit a9a08845e9ac ("vfs: do bulk POLL* ->
EPOLL* replacement").Change-Id: Ie014a57a0b1405b7f69cb4936a2962fea084c78c
Signed-off-by: Eric Biggers -
checkpatch warns about BUG_ON() because it is discouraged these days.
Instead, whenever possible the problem should be recovered from instead
(e.g. by returning an error code).Change-Id: I21aff5e0349666c5de6ec003f1979b30d6ca0a75
Signed-off-by: Eric Biggers -
Drivers are supposed to use dev_*() instead of pr_*(), since
the former includes the device in the message.Change-Id: Ie5b72669659fc4a1a5990fcde889a1fee493b9a1
Signed-off-by: Eric Biggers -
Developers can use ftrace if they want function entry logging.
Change-Id: Ie6336aabe0643339c738315c489c6b0e446882e8
Signed-off-by: Eric Biggers -
Change-Id: I176f1f744bbadb404485337c48f27b302b59e1d9
Signed-off-by: Eric Biggers -
Static and global data that is never modified should be const.
Change-Id: I9bb498bdec02d0c67de02f755223e8059f0ce3d3
Signed-off-by: Eric Biggers -
- Make tipc_compat_ioctl() call tipc_ioctl(), to avoid code duplication
as more ioctls get added. This follows the way that .compat_ioctl()
is typically implemented in drivers; e.g. see ext4_compat_ioctl().- Fix error code for "unrecognized ioctl".
- Remove user-triggable warning and error messages, or downgrade them to
debug level. Kernel convention is to be quiet; userspace can handle
failures the way it wants to.- Remove check for _IOC_TYPE() which is redundant because only specific
ioctl numbers are handled.- Move compat ioctl definition to internal file, as it doesn't belong in
the UAPI header.Change-Id: Ic69db9dbeef823f415cc4be05faf0386e638696f
Signed-off-by: Eric Biggers -
Fix the following warning:
drivers/trusty/trusty-ipc.c: In function ‘dn_share_fd’:
drivers/trusty/trusty-ipc.c:1154:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
1154 | dev_dbg(dev, "shmem_getpage(%d) failed: %d\n", pg_idx,Change-Id: I1fc45d877239ba7ead42b876db794dc14e57ebc1
Signed-off-by: Eric Biggers -
Add 'static' to functions and data that are only used in the same file.
Change-Id: I755816cc242b347e3f09ed0b261b425aa04829ab
Signed-off-by: Eric Biggers -
* Adds ability to send memfds over a tipc channel
Missing:
* COMPAT support for 32-bit ioctls
* Receiving shared memoryBug: 117221195
Test: tipc-test -t send-fd
Change-Id: I1bb6c9f1c2ce8ab3e73de3666916a89f872909c9
Signed-off-by: Matthew Maurer -
Previously, these were just replicated in userspace by exact number.
Export them explicitly through uapi rather than manually keeping them in
sync.Bug: 117221195
Signed-off-by: Matthew Maurer
Change-Id: I77bb8d4fcc919bed23eb7a02489a867b06870a27 -
Follow the recommended kernel coding style.
See https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arraysTest: trusty/vendor/google/aosp/scripts/build.py qemu-generic-arm64-test-debug
Change-Id: I435731f8148a9efad57dbe70327f8395ab9c99c4
Signed-off-by: Eric Biggers -
Fix instances of the following checkpatch warnings:
WARNING: quoted string split across lines
WARNING: char * array declaration might be better as static const
WARNING: else is not generally useful after a break or return
WARNING: braces {} are not necessary for single statement blocks
WARNING: Missing a blank line after declarations
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Possible unnecessary 'out of memory' message
WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP
WARNING: Symbolic permissions 'S_IRUSR' are not preferred. Consider using octal permissions '0400'.
WARNING: space prohibited between function name and open parenthesis '('Test: trusty/vendor/google/aosp/scripts/build.py qemu-generic-arm64-test-debug
Change-Id: If470fe558206c4a689323db7c6d787db82b9aa86
Signed-off-by: Eric BiggersConflicts:
arch/arm64/kernel/smp.cChange-Id: I68e4d85f1b0f73b6c158a4d37c07e0301c6cc7d7
-
This fixes several instances of the following checkpatch warning:
WARNING: Missing or malformed SPDX-License-Identifier tag
This doesn't change the actual licenses.
Test: trusty/vendor/google/aosp/scripts/build.py qemu-generic-arm64-test-debug
Change-Id: I611721ef5af4ead7a33e402b618ad5de1ffa730e
Signed-off-by: Eric Biggers -
The current implementation only supports contiguous regions and uses the
physical address as the id.includes: Remove trusty_call32_mem_buf
It is no longer used.
includes: Set dma_mask
Set dma_mask to 48 bits. This is the current limit of our encoded page
information. Allow sharing memory above 4GB with trusty on platforms
where the default dma_mask is 32 bits.Bug: 128698138
Change-Id: Ib0801a0d67032bdf35cea4c27e27663bf68b2aa1
Signed-off-by: Arve Hjønnevåg
Signed-off-by: Tri Vo -
Will be used later to give the other side write access to the buffer.
Bug: 128698138
Change-Id: I5719b37b8d5e5ff8336ab78a4f70ce25ca5394a6
Signed-off-by: Arve Hjønnevåg -
Prepare for later change where we need to pass a shared memory id
instead of a physical address.Bug: 128698138
Change-Id: I90257d91d947b2ca04749523a75d6e8402a941b6
Signed-off-by: Arve Hjønnevåg -
This will simplify tracking shared memory regions.
Bug: 128698138
Change-Id: I843e5ee8e1e1ae1b06f198c4fcef5e1c1986bd4f
Signed-off-by: Arve Hjønnevåg -
Trusty IPC driver provides message passing interface
between non-secure side (Linux) and secure side running
Trusty. It is handling a set of trusty IPC virtio devices
instantiated and configured by trusty-virtio driver based
on device description retrieved from secure side.* Updated for 4.19 VirtIO API (mmaurer@google.com)
includes: Rework tipc_chan_destroy
It seems unnecessary to dynamically detach vds pointer in
tipc_chan_destroy. Instead, it is cleaner to keep it around
until channel object itself is actually freed. This eliminates
the need to dynamically check presence of that pointer as it
is should always be present if tipc_chan exists.includes: Fix a race condition in tipc_release
Under certain conditions it is possible that an instance of
tipc_dn_chan structure will be freed in context of tipc_release
call while still be referenced and in use by corresponding
instance of tipc_chan struct. In order to fix that, we will need
to make sure that corresponding tipc_chan struct is not in use
before freeing tipc_dn_chan struct. This CL introduces and
implements a new callback in tipc_chan_ops struct, called
handle_release, that when specified will be called while an
instance of tipc_chan object is getting destroyed. This is
only possible when the last reference to tipc_chan struct
goes away so it is not in use anymore.includes: Fix off by one error in idr allocation.
The driver is configured to support 4 devices, but only the first 3
worked.Change-Id: I81288aa458675996cbc93e73baf3c41d735d5429
Signed-off-by: Michael Ryleev
Signed-off-by: Matthew Maurer
Signed-off-by: Arve Hjønnevåg
Signed-off-by: Tri Vo