Hi,
This is to announce that the morello/next branch has been rebased from
5.18 to
6.1. Make sure to reset/rebase any local branch tracking next.
morello/master will also move to 6.1 (aligning with next) within the
next few
weeks. The final 5.18-based commit has been tagged morello-last-5.18.
Some important notes for all users and developers:
- HWCAP2_MORELLO is now `1ul << 63` instead of `1ul << 31` (the lower 32
bits
of HWCAP2 are now fully allocated, and new hwcaps are being allocated
in the
upper 32 bits).
- When running on the Morello board, make sure to use the latest
firmware, for
instance from [0.1], as an issue present in older firmware versions
may prevent
the kernel from booting.
- When running on FVP, make sure to use the latest FVP build [0.2].
Older builds
may cause random failures while running the kernel or userspace.
[0.1] https://git.morello-project.org/morello/board-firmware
[0.2] https://developer.arm.com/downloads/-/arm-ecosystem-fvps
The rest of this email is a changelog for the rebased patches.
-----------------
Noteworthy changes:
- "arm64: morello: Disable trapping early and unconditionally" fixed not to
skip the initialisation of SCTLR_EL1 in init_kernel_el(). The original
patch (on 5.10) was correct, but I didn't notice that the automatic
merge went
wrong when rebasing on 5.18, and somehow that only started causing trouble
when rebasing the patch again on 6.1.
- "arm64: uaccess: Support capabilities in __uaccess_mask_ptr()" needed
to be
rewritten due to [1]. The new implementation is similar to the
original, but
now diverges from the !PCuABI case. See commit message for details.
- New patch addressing a Clang issue that the rebase on 6.1 revealed:
"vmlinux.lds.h: Work around Clang issue when targeting PCuABI"
(see commit message for details and link to CHERI-LLVM issue).
- Removed setting of KSFT_KHDR_INSTALL in "kselftests/arm64: Add build
support
for the C testing environment", as this functionality was removed by [2].
make headers_install now needs to be run manually before building the
kselftests.
- A lot of io_uring development has happened since 5.18, the most obvious
change being that fs/io_uring.c has been split into dozens of files under
io_uring/*. Due to this and other changes/additions:
* The following patches have been updated in consequence:
- "io_uring: Fix __capability annotations in PCuABI",
- "io_uring: Fix user pointer downcast"
* New patches:
- "io_uring/net: Make io_recvmsg_prep_multishot() PCuABI-friendly"
(addresses build issues with a new functionality)
- "io_uring: Enlarge struct io_cmd_data in PCuABI"
(addresses an issue revealed by a new assertion, approach agreed with
Tudor)
* Patch dropped as it is no longer needed thanks to some refactoring
upstream:
- "fs/io_uring: Fix usage of err.h macros with user pointers"
- Due to the cross-arch <asm/compat.h> refactoring from [3.1], where many
definitions moved to the asm-generic header:
* "arm64: compat: Fix structs for compat64" is narrowed down to
"asm-generic: Fix struct compat_shmid64_ds for compat64", and a new
patch
"arm64: compat: Only define compat_mode_t as u16 in compat32" is
added to
take care of struct compat_ipc64_perm in a less invasive way.
* "arm64: compat: Fix structs compat_semid64_ds/compat_msqid64_ds" becomes
"asm-generic: Fix structs compat_{semid64,msqid64}_ds for compat64"
(same
diff but in asm-generic instead).
* "arm64: compat: update compat defines to 64-bits" was split in a few
separate patches. See Téo's new version on the list ("[PATCH v5 0/2]
arm64:
compat: update compat defines to 64-bits" and follow-ups).
Other changes:
- "arm64: morello: System register definitions" aligned with the new sysreg
macro generation scheme (arch/arm64/tools/sysreg). Some macro names
changed
as a result, the following commits were adjusted accordingly.
- "lib: Fix user pointer downcasts", "iov_iter: Handle struct iovec and
struct
kvec separately" updated in line with changes to lib/iov_iter.c,
notably the
introduction of ITER_UBUF in [4.1]. [5] also added
iov_iter_aligned_iovec(),
so the second patch was extended to add its counterpart
iov_iter_aligned_kvec() (added my Co-developed-by to that patch).
- "arm64: morello: Add support for TLS as capabilities" updated in line
with [6]
(the prototype of copy_thread() no longer needs changing as it gets
passed a
pointer to the whole struct kernel_clone_args). Added my
Co-developed-by to
that patch too.
- "uaccess: Add tag-preserving routines" updated in line with [7].
- New patch "tracing: Fix signature of unlocked_ioctl callback" to fix a new
ioctl handler (posted by Zachary on the list).
- "arm64: configs: Add Morello transitional PCuABI defconfig" updated as per
make savedefconfig.
- Fixed whitespace errors in a few patches.
Dropped patches:
- "drm/komeda - Fix handling of pending crtc state commit to avoid lock-up"
(alternative fix made it upstream, the rest of the patches in that
series are
also upstream)
- "fs/proc/vmcore: Segregate the user and kernel buffers" (superseded by
[8])
- "arm64/efi: morello: Provide EFI stub version for memcpy/memmove"
(no longer needed thanks to [9])
- "uapi/asm-generic/unistd.h: Use compat_sys_ptrace()" (fixed upstream
by [3.2])
- 6 various cherry-picks from mainline that are present in 6.1, including
Vincenzo's "security/keys: Remove inconsistent __user annotation".
Relevant patch series that landed upstream between 5.18 and 6.1: [3], [4]
[1]
https://lore.kernel.org/all/20220922151053.3520750-1-mark.rutland@arm.com/
[2]
https://lore.kernel.org/all/cover.1657296695.git.guillaume.tucker@collabora…
[3] https://lore.kernel.org/all/20220405071314.3225832-1-guoren@kernel.org/
[3.1]
https://lore.kernel.org/all/20220405071314.3225832-7-guoren@kernel.org/
[3.2]
https://lore.kernel.org/all/20220405071314.3225832-8-guoren@kernel.org/
[4] https://lore.kernel.org/all/YrKWRCOOWXPHRCKg@ZenIV/
[4.1]
https://lore.kernel.org/all/20220622041552.737754-9-viro@zeniv.linux.org.uk/
[5] https://lore.kernel.org/all/20220610195830.3574005-9-kbusch@fb.com/
[6]
https://lore.kernel.org/all/20220506141512.516114-2-ebiederm@xmission.com/
[7] https://lore.kernel.org/all/20220915150417.722975-4-glider@google.com/
[8]
https://lore.kernel.org/all/20211213000636.2932569-4-willy@infradead.org/
[9] https://lore.kernel.org/all/20220910081152.2238369-4-ardb@kernel.org/
Cheers,
Kevin
preadv, pwritev and their variants (preadv2/pwritev2) do have compat
handlers defined in generic code. However, these handlers are
completely specific to 32-bit, as they expect the offset to be
passed in two consecutive 32-bit integers.
Since the compat handlers do not perform any other conversion, we
can simply use the native handlers instead in compat64.
Note that using the 64-suffixed compat handlers (e.g.
compat_sys_preadv64) would not be any better, and in fact would not
work in the case of preadv2/pwritev2. Indeed, these syscalls accept
another argument after the offset, but
compat_sys_{preadv64v2,pwrite64v2} take just one 64-bit integer as
offset. This is incompatible with the prototype of native handlers,
as they take two 64-bit integers for the offset and ignore the
second one.
Signed-off-by: Kevin Brodsky <kevin.brodsky(a)arm.com>
---
arch/arm64/kernel/sys_compat64.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/kernel/sys_compat64.c b/arch/arm64/kernel/sys_compat64.c
index b3c4cf9f3af8..41d72554907a 100644
--- a/arch/arm64/kernel/sys_compat64.c
+++ b/arch/arm64/kernel/sys_compat64.c
@@ -29,6 +29,16 @@
#define __arm64_compatentry_compat_sys_readahead __arm64_compatentry_sys_readahead
#define __arm64_compatentry_compat_sys_fadvise64_64 __arm64_compatentry_sys_fadvise64_64
+/*
+ * The compat_sys_{preadv,pwritev}{,2} handlers are not appropriate for 64-bit
+ * tasks, as they expect the offset to be split in two 32-bit integers. The
+ * native handlers work fine in 64-bit compat too so just use those instead.
+ */
+#define __arm64_compatentry_compat_sys_preadv __arm64_compatentry_sys_preadv
+#define __arm64_compatentry_compat_sys_preadv2 __arm64_compatentry_sys_preadv2
+#define __arm64_compatentry_compat_sys_pwritev __arm64_compatentry_sys_pwritev
+#define __arm64_compatentry_compat_sys_pwritev2 __arm64_compatentry_sys_pwritev2
+
/*
* 64-bit tasks use mmap (not mmap2).
*/
--
2.38.1
A subtle ABI change was introduced in compat64 by "clone: Alter
clone to accept capabilities". Indeed, since there is no compat
handler for clone, the native one is also used for compat, including
64-bit compat (compat64). This is where the way we convert compat64
syscall arguments to native (PCuABI) is showing its limits: if a
syscall wrapper expects a capability-sized argument, compat_ptr() is
used to convert the user-provided 64-bit value to a capability.
In general, this is what we want, and in fact it is the case for the
parent_tidptr and child_tidptr arguments of clone, which are
ordinary pointers to user data. However, the newsp and tls arguments
are special: they specify the value to set registers to. We should
not alter these values in any way: in arm64/PCuABI, they are
capabilities and we set CSP/CTPIDR accordingly, but in hybrid, they
are still 64-bit values and we should only set the lower 64 bits of
CSP/CTPIDR. This is not the case in compat64 as compat_ptr() is
called to turn these 64-bit values into capabilities.
The most correct solution would be to introduce a compat clone
wrapper, but this is rather painful as clone has 4 possible
prototypes depending on the architecture. The approach taken here is
a middle ground, narrowing down the stack / TLS pointer arguments
in the native handler if we got called from compat. This effectively
cancels out the automatic creation of capabilities in the compat
syscall wrapper, which is not ideal but considered acceptable in
this very particular situation.
Fixes: ("clone: Alter clone to accept capabilities")
Co-developed-by: Beata Michalska <beata.michalska(a)arm.com>
Signed-off-by: Kevin Brodsky <kevin.brodsky(a)arm.com>
---
kernel/fork.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kernel/fork.c b/kernel/fork.c
index 94777ac4d455..73fe97ad471e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2743,14 +2743,19 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, user_uintptr_t, newsp,
user_uintptr_t, tls)
#endif
{
+ bool compat_mode = in_compat_syscall();
struct kernel_clone_args args = {
.flags = (lower_32_bits(clone_flags) & ~CSIGNAL),
.pidfd = parent_tidptr,
.child_tid = child_tidptr,
.parent_tid = parent_tidptr,
.exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
- .stack = newsp,
- .tls = tls,
+ .stack = (compat_mode ?
+ (user_uintptr_t)(compat_ulong_t)newsp :
+ newsp),
+ .tls = (compat_mode ?
+ (user_uintptr_t)(compat_ulong_t)tls :
+ tls),
};
return kernel_clone(&args);
--
2.38.1
A subtle ABI change was introduced in compat64 by "clone: Alter
clone to accept capabilities". Indeed, since there is no compat
handler for clone, the native one is also used for compat64. This is
where the way we convert compat64 syscall arguments to native is
showing its limits: if a syscall wrapper expects a capability-sized
argument, compat_ptr() is used to convert the user-provided 64-bit
value to a capability.
In general, this is what we want, and in fact it is the case for the
parent_tidptr and child_tidptr arguments of clone, which are
ordinary pointers to user data. However, the newsp and tls arguments
are special: they specify the value to set registers to. We should
not alter these values in any way: in PCuABI, they are capabilities
and we set CSP/CTPIDR accordingly, but in hybrid, they are still
64-bit values and we should only set the lower 64 bits of
CSP/CTPIDR. This is not the case in compat64 as compat_ptr() is
called to turn these 64-bit values into capabilities.
The most correct solution would be to introduce a generic compat
clone wrapper, but this is rather painful as clone has 4 possible
prototypes depending on the architecture. Given that the issue is
completely specific to the hybrid ABI, overriding the compat64
syscall wrapper in sys_compat64.c feels like a reasonable
compromise.
Signed-off-by: Kevin Brodsky <kevin.brodsky(a)arm.com>
---
I've realised this inconsistency while thinking about the initialisation
of capability registers ("New CHERI API and separation root
capabilities" series), as well as reviewing the clone3 series. We are
already doing the right thing for clone3, time to align clone.
arch/arm64/kernel/sys_compat64.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/arch/arm64/kernel/sys_compat64.c b/arch/arm64/kernel/sys_compat64.c
index 819b895ec21d..b3c4cf9f3af8 100644
--- a/arch/arm64/kernel/sys_compat64.c
+++ b/arch/arm64/kernel/sys_compat64.c
@@ -9,6 +9,7 @@
#include <linux/compat.h>
#include <linux/compiler.h>
+#include <linux/sched/task.h>
#include <linux/syscalls.h>
#include <asm/syscall.h>
@@ -83,6 +84,33 @@
#define __arm64_compatentry_compat_sys_setitimer __arm64_compatentry_sys_setitimer
#define __arm64_compatentry_compat_sys_getrusage __arm64_compatentry_sys_getrusage
+/*
+ * This is exactly the same definition as the native clone, except that newsp
+ * and tls are defined as unsigned long, not user_uintptr_t. When the native ABI
+ * is PCuABI, this prevents capabilities from being implicitly created for the
+ * stack/TLS in compat64 by the syscall wrapper. This ensures alignment with the
+ * hybrid ABI (i.e. CSP/CTPIDR are set to the 64-bit values passed to clone()).
+ */
+COMPAT_SYSCALL_DEFINE5(arm64_clone, unsigned long, clone_flags, unsigned long, newsp,
+ int __user *, parent_tidptr,
+ unsigned long, tls,
+ int __user *, child_tidptr)
+{
+ struct kernel_clone_args args = {
+ .flags = (lower_32_bits(clone_flags) & ~CSIGNAL),
+ .pidfd = parent_tidptr,
+ .child_tid = child_tidptr,
+ .parent_tid = parent_tidptr,
+ .exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
+ .stack = newsp,
+ .tls = tls,
+ };
+
+ return kernel_clone(&args);
+}
+
+#define __arm64_compatentry_sys_clone __arm64_compatentry_compat_sys_arm64_clone
+
asmlinkage long sys_ni_syscall(void);
asmlinkage long __arm64_compatentry_sys_ni_syscall(const struct pt_regs *__unused)
--
2.38.1
From: Carsten Haitzler <carsten.haitzler(a)foss.arm.com>
In one case the arg is actually just an int passed into the arg and
was being casted from ptr -> long -> int. Now goes through user_intptr_t.
Signed-off-by: Carsten Haitzler <Carsten.Haitzler(a)arm.com>
---
drivers/input/evdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index ea4dab2a53f7..066dd1d8cfe4 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -1074,7 +1074,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
return 0;
case EVIOCRMFF:
- return input_ff_erase(dev, (int)(unsigned long) p, file);
+ return input_ff_erase(dev, (int)(user_intptr_t) p, file);
case EVIOCGEFFECTS:
i = test_bit(EV_FF, dev->evbit) ?
--
2.25.1
Enable the required config options to run panfrost/komeda in the
default defconfig for Morello Transitional PureCap User ABI (PCuABI)
(morello_transitional_pcuabi_defconfig).
Note: The series was verified only by CI and at framebuffer level.
Further testing is required to exercise all the components.
To simplify future testing of this series the complete patch set
applied on top of recent morello kernel can be found at [1].
[1] https://git.morello-project.org/vincenzo/linux morello/drm/v1
Co-developed-by: Kevin Brodsky <kevin.brodsky(a)arm.com>
Co-developed-by: Carsten Haitzler <Carsten.Haitzler(a)arm.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino(a)arm.com>
Liviu Dudau (1):
drm/komeda: Fix handling of atomic commits in the atomic_commit_tail
hook
Vincenzo Frascino (9):
morello: dt: Add support for the FVP, SoC
Revert "drm/komeda - Fix handling of pending crtc state commit to
avoid lock-up"
drm: drm_legacy: Fix CONFIG_DRM_LEGACY guards in drm_legacy.h
media: cec: Use proper type to represent user pointers
fbdev: Use proper typecast for capability type
drm: i2c: Include hdmi-codec definitions only when required
rtc: Use proper type to represent user pointers
morello: Enable GPU/DPU in defconfig
morello: Enable RTC support
arch/arm64/boot/dts/arm/Makefile | 1 +
arch/arm64/boot/dts/arm/morello-fvp.dts | 171 +++++++++++
arch/arm64/boot/dts/arm/morello-soc.dts | 278 ++++++++++++++++++
arch/arm64/boot/dts/arm/morello.dtsi | 124 ++++++++
.../morello_transitional_pcuabi_defconfig | 11 +
.../gpu/drm/arm/display/komeda/komeda_crtc.c | 14 +-
.../gpu/drm/arm/display/komeda/komeda_kms.c | 40 +--
.../gpu/drm/arm/display/komeda/komeda_kms.h | 5 +-
drivers/gpu/drm/drm_legacy.h | 2 +-
drivers/gpu/drm/i2c/tda998x_drv.c | 13 +
drivers/media/cec/core/cec-api.c | 4 +-
drivers/rtc/dev.c | 4 +-
drivers/video/fbdev/core/fbmem.c | 7 +-
13 files changed, 633 insertions(+), 41 deletions(-)
create mode 100644 arch/arm64/boot/dts/arm/morello-fvp.dts
create mode 100644 arch/arm64/boot/dts/arm/morello-soc.dts
create mode 100644 arch/arm64/boot/dts/arm/morello.dtsi
--
2.39.0