* RE: [PATCH] tty: serial: samsung: add dedicated compatible for exynosauto SoCs
From: Alim Akhtar @ 2026-04-26 17:18 UTC (permalink / raw)
To: 'Krzysztof Kozlowski', gregkh, jirislaby
Cc: linux-serial, linux-samsung-soc, linux-kernel
In-Reply-To: <6916bf87-4c40-42c5-988f-92a57a6fc658@kernel.org>
Hi Krzysztof
> -----Original Message-----
> From: Krzysztof Kozlowski <krzk@kernel.org>
> Sent: Friday, April 24, 2026 9:42 PM
> To: Alim Akhtar <alim.akhtar@samsung.com>; gregkh@linuxfoundation.org;
> jirislaby@kernel.org
> Cc: linux-serial@vger.kernel.org; linux-samsung-soc@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH] tty: serial: samsung: add dedicated compatible for
> exynosauto SoCs
>
> On 24/04/2026 12:18, Alim Akhtar wrote:
> > Currently Exynosautov-{9,920} getting probed based on exynos850
> > fallback. It is recommended to have a dedicated compatible for proper
> > driver binding.
>
> Unfortunately it is not. Dedicated compatible you have. However you are not
> adding dedicated compatible. You added dedicated driver match entry and
> we, and especially me, gave reviews many times that it is *not
> recommended* to have dedicated driver match entry.
>
Ok, I might have missed your earlier comments on *not* having a dedicated driver match entry, fair enough.
> Entire reasoning for doing this patch is wrong. And patch itself is NOOP (at
> least by quick look).
Thanks for a quick review, Can you please check the part of the patch which adds OF_EARLYCON_DECLARE
to add earlycon support?
>
> Best regards,
> Krzysztof
^ permalink raw reply
* [PATCH v2] serial: mxs-auart: replace hardcoded 1 with predefined macro GPIO_LINE_DIRECTION_IN
From: Nikola Z. Ivanov @ 2026-04-26 21:42 UTC (permalink / raw)
To: gregkh, jirislaby, Frank.Li, s.hauer, kernel, festevam
Cc: linux-kernel, linux-serial, imx, linux-arm-kernel,
Nikola Z. Ivanov
The GPIO_LINE_DIRECTION_* definitions have just recently been exposed to
gpio consumers.h by breaking them out in a separate defs.h file.
Use this to validate the gpio direction instead of the hard-coded literal.
Signed-off-by: Nikola Z. Ivanov <zlatistiv@gmail.com>
---
Changes since v1:
- Commit title change
https://lore.kernel.org/all/26cd0656-ca76-4cb7-9f1e-b8c042a7e2cb@gmail.com/
drivers/tty/serial/mxs-auart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 693b491f1e75..697318dbb146 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -1520,7 +1520,7 @@ static int mxs_auart_init_gpios(struct mxs_auart_port *s, struct device *dev)
for (i = 0; i < UART_GPIO_MAX; i++) {
gpiod = mctrl_gpio_to_gpiod(s->gpios, i);
- if (gpiod && (gpiod_get_direction(gpiod) == 1))
+ if (gpiod && (gpiod_get_direction(gpiod) == GPIO_LINE_DIRECTION_IN))
s->gpio_irq[i] = gpiod_to_irq(gpiod);
else
s->gpio_irq[i] = -EINVAL;
--
2.53.0
^ permalink raw reply related
* [PATCH v2] dt-bindings: qcom: geni-se-qup: Add compatible for SA8797P SoC
From: Shawn Guo @ 2026-04-27 0:59 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Praveen Talari,
Konrad Dybcio, Dmitry Baryshkov, Bartosz Golaszewski,
Deepti Jaggi, linux-serial, devicetree, linux-arm-msm,
linux-kernel, Shawn Guo
From: Deepti Jaggi <deepti.jaggi@oss.qualcomm.com>
Document GENI Serial Engine QUP Wrapper Controller on Nord SA8797P SoC
which is compatible with SA8255P one.
Signed-off-by: Deepti Jaggi <deepti.jaggi@oss.qualcomm.com>
Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
---
Changes in v2:
- Fix indentation warnings reported by yamllint
- Use 'sa8797p' instead of 'nord-auto' in compatibles, also update
subject and commit log accordingly
- Add missing I2C and SPI compatibles
- Link to v1: https://lore.kernel.org/all/20260420064401.1248833-1-shengchao.guo@oss.qualcomm.com/
.../soc/qcom/qcom,sa8255p-geni-se-qup.yaml | 31 +++++++++++++++----
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml
index 352af3426d34..9c38ba59662b 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml
@@ -19,7 +19,11 @@ description:
properties:
compatible:
- const: qcom,sa8255p-geni-se-qup
+ oneOf:
+ - const: qcom,sa8255p-geni-se-qup
+ - items:
+ - const: qcom,sa8797p-geni-se-qup
+ - const: qcom,sa8255p-geni-se-qup
reg:
description: QUP wrapper common register address and length.
@@ -49,7 +53,11 @@ patternProperties:
properties:
compatible:
- const: qcom,sa8255p-geni-spi
+ oneOf:
+ - const: qcom,sa8255p-geni-spi
+ - items:
+ - const: qcom,sa8797p-geni-spi
+ - const: qcom,sa8255p-geni-spi
"i2c@[0-9a-f]+$":
type: object
@@ -58,7 +66,11 @@ patternProperties:
properties:
compatible:
- const: qcom,sa8255p-geni-i2c
+ oneOf:
+ - const: qcom,sa8255p-geni-i2c
+ - items:
+ - const: qcom,sa8797p-geni-i2c
+ - const: qcom,sa8255p-geni-i2c
"serial@[0-9a-f]+$":
type: object
@@ -67,9 +79,16 @@ patternProperties:
properties:
compatible:
- enum:
- - qcom,sa8255p-geni-uart
- - qcom,sa8255p-geni-debug-uart
+ oneOf:
+ - enum:
+ - qcom,sa8255p-geni-uart
+ - qcom,sa8255p-geni-debug-uart
+ - items:
+ - const: qcom,sa8797p-geni-uart
+ - const: qcom,sa8255p-geni-uart
+ - items:
+ - const: qcom,sa8797p-geni-debug-uart
+ - const: qcom,sa8255p-geni-debug-uart
required:
- compatible
--
2.43.0
^ permalink raw reply related
* [PATCH v2] dt-bindings: serial: Add compatible for Qualcomm SA8797P SoC
From: Shawn Guo @ 2026-04-27 1:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Praveen Talari,
Konrad Dybcio, Dmitry Baryshkov, Bartosz Golaszewski,
Deepti Jaggi, linux-serial, devicetree, linux-arm-msm,
linux-kernel, Krzysztof Kozlowski, Shawn Guo
From: Deepti Jaggi <deepti.jaggi@oss.qualcomm.com>
Document QUP GENI UART controller on Qualcomm Nord SA8797P SoC which is
compatible with SA8255P controller.
Signed-off-by: Deepti Jaggi <deepti.jaggi@oss.qualcomm.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
---
Changes in v2:
- Use 'sa8797p' instead of 'nord-auto' in compatibles
- Update subject and commit log accordingly
- Link to v1: https://lore.kernel.org/all/20260420060524.1248432-1-shengchao.guo@oss.qualcomm.com/
.../bindings/serial/qcom,sa8255p-geni-uart.yaml | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml b/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
index c8f01923cb25..8496f822dfa5 100644
--- a/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
+++ b/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
@@ -14,9 +14,16 @@ allOf:
properties:
compatible:
- enum:
- - qcom,sa8255p-geni-uart
- - qcom,sa8255p-geni-debug-uart
+ oneOf:
+ - enum:
+ - qcom,sa8255p-geni-uart
+ - qcom,sa8255p-geni-debug-uart
+ - items:
+ - const: qcom,sa8797p-geni-uart
+ - const: qcom,sa8255p-geni-uart
+ - items:
+ - const: qcom,sa8797p-geni-debug-uart
+ - const: qcom,sa8255p-geni-debug-uart
reg:
maxItems: 1
--
2.43.0
^ permalink raw reply related
* Re: [PATCH v4 1/4] serial: 8250_dwlib: move DesignWare register definitions to header
From: Jia Wang @ 2026-04-27 2:31 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jia Wang, Ilpo Järvinen, Greg Kroah-Hartman, Jiri Slaby,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-kernel,
linux-serial, linux-riscv, devicetree
In-Reply-To: <aes_zx9GdaXnDNqG@ashevche-desk.local>
On 2026-04-24 13:02 +0300, Andy Shevchenko wrote:
> On Fri, Apr 24, 2026 at 01:39:28PM +0800, Jia Wang wrote:
> > Move the DW_UART_* register offsets and CPR bit/field definitions from
> > 8250_dwlib.c into 8250_dwlib.h so they can be shared by 8250_dw and
> > 8250_dwlib users.
> >
> > Add an include guard for 8250_dwlib.h.
>
> ...
>
> > -/* DesignWare specific register fields */
> > -#define DW_UART_IIR_IID GENMASK(3, 0)
> > -
> > -#define DW_UART_MCR_SIRE BIT(6)
> > -
> > -#define DW_UART_USR_BUSY BIT(0)
> > -
>
> One nit-pick, though, these three need the similar comments in the header and a
> blank line between them.
>
Thanks.
Will add comments and blank lines in v5.
> ...
>
> > +/* Offsets for the DesignWare specific registers */
> > +#define DW_UART_USR 0x1f /* UART Status Register */
> > +#define DW_UART_DMASA 0xa8 /* DMA Software Ack */
> > +#define DW_UART_TCR 0xac /* Transceiver Control Register (RS485) */
> > +#define DW_UART_DE_EN 0xb0 /* Driver Output Enable Register */
> > +#define DW_UART_RE_EN 0xb4 /* Receiver Output Enable Register */
> > +#define DW_UART_DLF 0xc0 /* Divisor Latch Fraction Register */
> > +#define DW_UART_RAR 0xc4 /* Receive Address Register */
> > +#define DW_UART_TAR 0xc8 /* Transmit Address Register */
> > +#define DW_UART_LCR_EXT 0xcc /* Line Extended Control Register */
> > +#define DW_UART_CPR 0xf4 /* Component Parameter Register */
> > +#define DW_UART_UCV 0xf8 /* UART Component Version */
> > +
> > +/* Receive / Transmit Address Register bits */
> > +#define DW_UART_ADDR_MASK GENMASK(7, 0)
>
> > +/* Line Status Register bits */
> > +#define DW_UART_LSR_ADDR_RCVD BIT(8)
>
> Like this one, the IIR. MCR, and USR bits should be commented. Also preserve
> the sorting by the register offset, so the groups of bits follow the above list
> of registers, where USR bits, for example, should go before TCR.
>
Will add comments to IIR, MCR, and USR bits and reorder the groups by
register offset in v5.
> > +/* Transceiver Control Register bits */
> > +#define DW_UART_TCR_RS485_EN BIT(0)
> > +#define DW_UART_TCR_RE_POL BIT(1)
> > +#define DW_UART_TCR_DE_POL BIT(2)
> > +#define DW_UART_TCR_XFER_MODE GENMASK(4, 3)
> > +#define DW_UART_TCR_XFER_MODE_DE_DURING_RE FIELD_PREP(DW_UART_TCR_XFER_MODE, 0)
> > +#define DW_UART_TCR_XFER_MODE_SW_DE_OR_RE FIELD_PREP(DW_UART_TCR_XFER_MODE, 1)
> > +#define DW_UART_TCR_XFER_MODE_DE_OR_RE FIELD_PREP(DW_UART_TCR_XFER_MODE, 2)
> > +
> > +/* Line Extended Control Register bits */
> > +#define DW_UART_LCR_EXT_DLS_E BIT(0)
> > +#define DW_UART_LCR_EXT_ADDR_MATCH BIT(1)
> > +#define DW_UART_LCR_EXT_SEND_ADDR BIT(2)
> > +#define DW_UART_LCR_EXT_TRANSMIT_MODE BIT(3)
> > +
> > +/* Component Parameter Register bits */
> > +#define DW_UART_CPR_ABP_DATA_WIDTH GENMASK(1, 0)
> > +#define DW_UART_CPR_AFCE_MODE BIT(4)
> > +#define DW_UART_CPR_THRE_MODE BIT(5)
> > +#define DW_UART_CPR_SIR_MODE BIT(6)
> > +#define DW_UART_CPR_SIR_LP_MODE BIT(7)
> > +#define DW_UART_CPR_ADDITIONAL_FEATURES BIT(8)
> > +#define DW_UART_CPR_FIFO_ACCESS BIT(9)
> > +#define DW_UART_CPR_FIFO_STAT BIT(10)
> > +#define DW_UART_CPR_SHADOW BIT(11)
> > +#define DW_UART_CPR_ENCODED_PARMS BIT(12)
> > +#define DW_UART_CPR_DMA_EXTRA BIT(13)
> > +#define DW_UART_CPR_FIFO_MODE GENMASK(23, 16)
>
> > +/* DesignWare specific register fields */
> > +#define DW_UART_IIR_IID GENMASK(3, 0)
> > +#define DW_UART_MCR_SIRE BIT(6)
> > +#define DW_UART_USR_BUSY BIT(0)
>
> I.o.w. uncouple these as per above.
>
Will do in v5. I'll move them to their respective register-offset
groups with comments and blank lines as suggested.
> --
> With Best Regards,
> Andy Shevchenko
>
>
>
Best Regards,
Jia Wang
^ permalink raw reply
* Re: [PATCH 4/4] Revert "drivers: convert sbd_duart.map_guard from atomic_t to refcount_t"
From: Greg Kroah-Hartman @ 2026-04-26 20:45 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Thomas Bogendoerfer, Jiri Slaby, Elena Reshetova, David Windsor,
Kees Cook, Hans Liljestrand, linux-mips, linux-serial,
linux-kernel
In-Reply-To: <alpine.DEB.2.21.2604130416440.29980@angie.orcam.me.uk>
On Mon, Apr 13, 2026 at 04:28:53AM +0100, Maciej W. Rozycki wrote:
> Revert commit 22a33651a56f ("drivers: convert sbd_duart.map_guard from
> atomic_t to refcount_t"), which broke perfectly valid code:
>
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 1 at lib/refcount.c:114 sbd_request_port+0x54/0x140
> refcount_t: increment on 0; use-after-free.
> CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.11.0-rc2+ #34
> Stack : 0000000014001fe0 0000000000000000 ffffffff80830000 0000000000000000
> ffffffff8127bc7a ffffffff8016fe08 ffffffff808d0000 ffffffff808d0000
> ffffffff807aa828 ffffffff80822337 ffffffff808ce188 a8000001860b0000
> 0000000000000001 0000000000000001 00000000000001c8 ffffffff808a3090
> 00000000000000bb ffffffff801b09d4 a80000018609bb68 ffffffff801231cc
> ffffffff812a0000 ffffffff80171388 0000000000001000 ffffffff807aa828
> 0000000000000001 0000000000000001 0000000000000000 0000000000000000
> 0000000000000000 a80000018609bab0 0000000000000000 ffffffff803c47cc
> 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> ffffffff807cb648 ffffffff8010bff8 0000000014001fe1 ffffffff803c47cc
> ...
> Call Trace:
> [<ffffffff8010bff8>] show_stack+0x28/0x88
> [<ffffffff803c47cc>] dump_stack+0x8c/0xc0
> [<ffffffff801aff5c>] __warn+0xe0/0x114
> [<ffffffff801233f0>] warn_slowpath_fmt+0x40/0x50
> [<ffffffff80455bcc>] sbd_request_port+0x54/0x140
> [<ffffffff804563a4>] sbd_config_port+0x2c/0x68
> ---[ end trace f666d696412caa3e ]---
>
> (report at the offending commit) -- sbd_request_port() is called twice
> per DUART instance, to reserve a resource holding the control register
> block shared between the two channels, so there's no slightest chance
> for an overflow. Also this doesn't stop the driver from working and
> it's just the reservation that is missing as a result, i.e.:
>
> 10060100-100601ff : sb1250-duart
> 10060200-100602ff : sb1250-duart
>
> as from the offending change, vs:
>
> 10060100-100601ff : sb1250-duart
> 10060200-100602ff : sb1250-duart
> 10060300-100603ff : sb1250-duart
>
> beforehand, which is surely why the breakage has gone so long unnoticed.
>
> "If it ain't broke, don't fix it," so just revert the broken commit.
How about fix this up to work properly with a refcount? having "open
coded" atomic variables like this is ripe for problems, like it seems
this driver is abusing.
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH] tty: serial: samsung: add dedicated compatible for exynosauto SoCs
From: Krzysztof Kozlowski @ 2026-04-27 6:40 UTC (permalink / raw)
To: Alim Akhtar, gregkh, jirislaby
Cc: linux-serial, linux-samsung-soc, linux-kernel
In-Reply-To: <324e01dcd5a0$a53d3d90$efb7b8b0$@samsung.com>
On 26/04/2026 19:18, Alim Akhtar wrote:
> Hi Krzysztof
>
>> -----Original Message-----
>> From: Krzysztof Kozlowski <krzk@kernel.org>
>> Sent: Friday, April 24, 2026 9:42 PM
>> To: Alim Akhtar <alim.akhtar@samsung.com>; gregkh@linuxfoundation.org;
>> jirislaby@kernel.org
>> Cc: linux-serial@vger.kernel.org; linux-samsung-soc@vger.kernel.org; linux-
>> kernel@vger.kernel.org
>> Subject: Re: [PATCH] tty: serial: samsung: add dedicated compatible for
>> exynosauto SoCs
>>
>> On 24/04/2026 12:18, Alim Akhtar wrote:
>>> Currently Exynosautov-{9,920} getting probed based on exynos850
>>> fallback. It is recommended to have a dedicated compatible for proper
>>> driver binding.
>>
>> Unfortunately it is not. Dedicated compatible you have. However you are not
>> adding dedicated compatible. You added dedicated driver match entry and
>> we, and especially me, gave reviews many times that it is *not
>> recommended* to have dedicated driver match entry.
>>
> Ok, I might have missed your earlier comments on *not* having a dedicated driver match entry, fair enough.
>
>> Entire reasoning for doing this patch is wrong. And patch itself is NOOP (at
>> least by quick look).
> Thanks for a quick review, Can you please check the part of the patch which adds OF_EARLYCON_DECLARE
> to add earlycon support?
>
It also feels unnecessary - existing compatible will be used for
earlycon, no? If matching by existing compatible does not work, commit
msg should explain that.
Best regards,
Krzysztof
^ permalink raw reply
* Re: [PATCH v6 1/6] dt-bindings: arm: zte: Add D-Link DWR932M board based on zx297520v3 SoC
From: Krzysztof Kozlowski @ 2026-04-27 6:50 UTC (permalink / raw)
To: Stefan Dösinger
Cc: Jonathan Corbet, Shuah Khan, Russell King, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
Alexandre Belloni, Linus Walleij, Drew Fustini,
Greg Kroah-Hartman, Jiri Slaby, linux-doc, linux-kernel,
linux-arm-kernel, devicetree, soc, linux-serial
In-Reply-To: <20260426-send-v6-1-d49efa72bb09@gmail.com>
On Sun, Apr 26, 2026 at 02:54:14PM +0300, Stefan Dösinger wrote:
> This adds a new binding file for ZTE, containing their zx297520v3 SoC
> and one board (D-Link DWR-932M) based on it.
>
> Signed-off-by: Stefan Dösinger <stefandoesinger@gmail.com>
>
> ---
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Best regards,
Krzysztof
^ permalink raw reply
* Re: [PATCH v6 2/6] ARM: zte: Add zx297520v3 platform support
From: Krzysztof Kozlowski @ 2026-04-27 6:53 UTC (permalink / raw)
To: Stefan Dösinger
Cc: Jonathan Corbet, Shuah Khan, Russell King, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
Alexandre Belloni, Linus Walleij, Drew Fustini,
Greg Kroah-Hartman, Jiri Slaby, linux-doc, linux-kernel,
linux-arm-kernel, devicetree, soc, linux-serial
In-Reply-To: <20260426-send-v6-2-d49efa72bb09@gmail.com>
On Sun, Apr 26, 2026 at 02:54:15PM +0300, Stefan Dösinger wrote:
> diff --git a/arch/arm/mach-zte/Kconfig b/arch/arm/mach-zte/Kconfig
> new file mode 100644
> index 000000000000..2e3abee94994
> --- /dev/null
> +++ b/arch/arm/mach-zte/Kconfig
> @@ -0,0 +1,26 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +menuconfig ARCH_ZTE
> + bool "ZTE zx family"
> + depends on ARCH_MULTI_V7
> + help
> + Support for ZTE zx-based family of processors.
> +
> +if ARCH_ZTE
> +
> +config SOC_ZX297520V3
> + default y if ARCH_ZTE
> + bool "zx297520v3"
"bool" should be the first line in the entry.
Also say something a bit more useful, e.g. "zx297520v3 SoC" becuase
unfortunately the model number looks too close to random set of
characters.
Rest seems fine:
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Best regards,
Krzysztof
^ permalink raw reply
* [PATCH] serial: qcom: Unify user-visible "Qualcomm" name
From: Krzysztof Kozlowski @ 2026-04-27 7:00 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial
Cc: =Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
Krzysztof Kozlowski
Various names for Qualcomm as a company are used in user-visible config
options: QCOM, Qualcomm and Qualcomm Technologies. Switch to unified
"Qualcomm" so it will be easier for users to identify the options when
for example running menuconfig.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
And "Qualcomm Technologies" has even variations over the tree:
Qualcomm Technologies
Qualcomm Technologies Inc.
Qualcomm Technologies, Inc.
I am doing this tree wide:
https://lore.kernel.org/all/?q=f%3Akrzysztof+s%3A%22Unify+user-visible%22+s%3AQualcomm
---
drivers/tty/serial/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 9aa61c93d7bc..3e519d001e02 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -913,13 +913,13 @@ config SERIAL_MSM_CONSOLE
select SERIAL_EARLYCON
config SERIAL_QCOM_GENI
- tristate "QCOM on-chip GENI based serial port support"
+ tristate "Qualcomm on-chip GENI based serial port support"
depends on ARCH_QCOM || COMPILE_TEST
depends on QCOM_GENI_SE
select SERIAL_CORE
config SERIAL_QCOM_GENI_CONSOLE
- bool "QCOM GENI Serial Console support"
+ bool "Qualcomm GENI Serial Console support"
depends on SERIAL_QCOM_GENI
select SERIAL_CORE_CONSOLE
select SERIAL_EARLYCON
--
2.51.0
^ permalink raw reply related
* Re: [PATCH] serial: 8250_dw: Clean up register macros and error handling
From: Andy Shevchenko @ 2026-04-27 7:02 UTC (permalink / raw)
To: Artem Shimko
Cc: sashal, miquel.raynal, phil.edworthy, Ilpo Järvinen,
Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial
In-Reply-To: <20260424210525.1574497-1-a.shimko.dev@gmail.com>
On Sat, Apr 25, 2026 at 12:05:24AM +0300, Artem Shimko wrote:
> Align register offset definitions for DW_UART_USR, DW_UART_DMASA,
> OCTEON_UART_USR, RZN1_UART_TDMACR and RZN1_UART_RDMACR to improve
> readability. Replace raw shift with FIELD_PREP() and GENMASK() for
> RZN1_UART_xDMACR burst field definitions — this documents that the
> field occupies bits [2:1] and prevents accidental overflow when new
> burst values are added.
>
> Simplify ENXIO handling in dw8250_probe(): instead of explicitly
> zeroing 'err' and then checking it, use a single conditional that
> allows -ENXIO (no interrupt, fall back to polling) while treating
> any other error as fatal. No functional change intended.
There is real patch series in-flight which we want to apply.
This one may wait till that happen. You may also help reviewing that
in a way that this patch won't be needed at all (or be minimal).
https://lore.kernel.org/linux-serial/20260424-ultrarisc-serial-v4-0-1765a0b4c4a0@ultrarisc.com/
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v4 2/4] serial: 8250_dw: build Renesas RZN1 CPR value from DW_UART_CPR_* definitions
From: Jia Wang @ 2026-04-27 7:32 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Ilpo Järvinen, Jia Wang, Greg Kroah-Hartman, Jiri Slaby,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, LKML,
linux-serial, linux-riscv, devicetree
In-Reply-To: <aeuJTMqADw8J0x0u@ashevche-desk.local>
On 2026-04-24 18:16 +0300, Andy Shevchenko wrote:
> On Fri, Apr 24, 2026 at 05:09:46PM +0300, Ilpo Järvinen wrote:
> > On Fri, 24 Apr 2026, Andy Shevchenko wrote:
> > > On Fri, Apr 24, 2026 at 02:38:56PM +0300, Ilpo Järvinen wrote:
> > > > On Fri, 24 Apr 2026, Jia Wang wrote:
>
> ...
>
> > > > Hmm, maybe there should also be macro also for this one which takes the
> > > > fifosize as input and converts it to CPR field vlaue (effectively, the
> > > > macro is an inverse of DW_UART_CPR_FIFO_SIZE()). It would be more readable
> > > > than the literal.
> > >
> > > But this can be done separately, right?
> >
> > It's logically part of the cpr_value literal to defines conversion (of
> > course one could introduce it in own patch without users but I don't see
> > much benefit from that).
>
> No objections.
>
> > > > Also include BUILD_BUG_ON(!IS_ALIGNED(fifosize, 16) + bounds checks)
> > > > inside that macro to catch invalid fifo sizes (+ don't forget the
> > > > necessary headers for those two new things).
> > >
> > > Hmm... Some devices may have FIFO = 8 or 4 bytes (Intel Quark IIRC has less
> > > than 16 and it's DW IP).
> >
> > Perhaps but according the DW databook I've at hand, there are no values in
> > FIFO_MODE field for such FIFO sizes. So what would CPR contain in those
> > cases for FIFO_MODE field?
>
> On real HW it returns 0s for all registers above 0x07 (multiplied by 4 as
> a stride). But I also checked the values of xmit_fifo_size and it shows 16.
> What 8 is it is the DMA max_burst. Hence the proposed assertion should work.
>
Thanks for the discussion and clarification. I'll add the macro
DW_UART_CPR_FIFO_MODE_FROM_SIZE() in 8250_dwlib.h (in patch 2) with the
suggested build‑time checks (using BUILD_BUG_ON_ZERO for bounds validation),
and update patch 4 to use it.
> --
> With Best Regards,
> Andy Shevchenko
>
>
>
Best Regards,
Jia Wang
^ permalink raw reply
* Re: [PATCH v4 0/4] serial: 8250_dw: Add support for UltraRISC DP1000 UART
From: Jia Wang @ 2026-04-27 7:34 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jia Wang, Ilpo Järvinen, Greg Kroah-Hartman, Jiri Slaby,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-kernel,
linux-serial, linux-riscv, devicetree, Conor Dooley
In-Reply-To: <aes-qdaT_9wMbTsm@ashevche-desk.local>
On 2026-04-24 12:58 +0300, Andy Shevchenko wrote:
> On Fri, Apr 24, 2026 at 01:39:27PM +0800, Jia Wang wrote:
> > This patch series adds support for the UltraRISC DP1000 UART controller.
> >
> > The series includes four patches. The first two are preparatory cleanups;
> > the last two add the DP1000 compatible and fixed CPR handling.
> >
> > The patches have been tested on an UltraRISC DP1000 development board with
> > Linux v7.0-rc7, verifying basic UART functionality.
>
> Now it looks good to me, thanks!
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> (except DT bindings, not an expert, no tag)
>
Thanks for the review, Andy. I need to rework patches 1, 2 and 4, so
I won't add your Reviewed-by tag yet. Could you please have another
look at the updated patches in v5?
> --
> With Best Regards,
> Andy Shevchenko
>
>
>
Best Regards,
Jia Wang
^ permalink raw reply
* Re: [PATCH v4 0/4] serial: 8250_dw: Add support for UltraRISC DP1000 UART
From: Andy Shevchenko @ 2026-04-27 7:39 UTC (permalink / raw)
To: Jia Wang
Cc: Ilpo Järvinen, Greg Kroah-Hartman, Jiri Slaby, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-kernel, linux-serial,
linux-riscv, devicetree, Conor Dooley
In-Reply-To: <177727526561.1796253.1521989195994870860.b4-reply@b4>
On Mon, Apr 27, 2026 at 03:34:25PM +0800, Jia Wang wrote:
> On 2026-04-24 12:58 +0300, Andy Shevchenko wrote:
> > On Fri, Apr 24, 2026 at 01:39:27PM +0800, Jia Wang wrote:
> > > This patch series adds support for the UltraRISC DP1000 UART controller.
> > >
> > > The series includes four patches. The first two are preparatory cleanups;
> > > the last two add the DP1000 compatible and fixed CPR handling.
> > >
> > > The patches have been tested on an UltraRISC DP1000 development board with
> > > Linux v7.0-rc7, verifying basic UART functionality.
> >
> > Now it looks good to me, thanks!
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > (except DT bindings, not an expert, no tag)
> >
>
> Thanks for the review, Andy. I need to rework patches 1, 2 and 4, so
> I won't add your Reviewed-by tag yet. Could you please have another
> look at the updated patches in v5?
Sure, whenever it will be available in the mailing lists/my mailbox.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v1] serial: qcom-geni: Avoid probing debug console UART without console support
From: Praveen Talari @ 2026-04-27 9:18 UTC (permalink / raw)
To: Aniket Randive, gregkh, jirislaby, linux-arm-msm, linux-kernel,
linux-serial, anup.kulkarni, dmitry.baryshkov, viken.dadhaniya
In-Reply-To: <20260413072501.263871-1-aniket.randive@oss.qualcomm.com>
On 13-04-2026 12:55, Aniket Randive wrote:
> When CONFIG_SERIAL_QCOM_GENI_CONSOLE is disabled, the driver still
> advertises the debug UART compatible strings ("qcom,geni-debug-uart"
> and "qcom,sa8255p-geni-debug-uart") in its of_match table. This lets the
> driver match and probe console UART DT nodes even though console
> support is not built. As a result, the console port is never registered
> with the UART core and uart_add_one_port() fails with -EINVAL.
>
> Fix this by only including the debug UART compatible entries in the
> match table when CONFIG_SERIAL_QCOM_GENI_CONSOLE is enabled, preventing
> the driver from probing console UART nodes when console support is
> absent.
>
> Signed-off-by: Aniket Randive <aniket.randive@oss.qualcomm.com>
> ---
> drivers/tty/serial/qcom_geni_serial.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 9854bb2406e3..b756e0c07c16 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -2039,6 +2039,7 @@ static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
> };
>
> static const struct of_device_id qcom_geni_serial_match_table[] = {
> +#if IS_ENABLED(CONFIG_SERIAL_QCOM_GENI_CONSOLE)
> {
> .compatible = "qcom,geni-debug-uart",
> .data = &qcom_geni_console_data,
> @@ -2047,6 +2048,7 @@ static const struct of_device_id qcom_geni_serial_match_table[] = {
> .compatible = "qcom,sa8255p-geni-debug-uart",
> .data = &sa8255p_qcom_geni_console_data,
> },
> +#endif
> {
> .compatible = "qcom,geni-uart",
> .data = &qcom_geni_uart_data,
Reviewed-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
Thanks,
Praveen Talari
^ permalink raw reply
* RE: [PATCH] tty: serial: samsung: add dedicated compatible for exynosauto SoCs
From: Alim Akhtar @ 2026-04-27 10:26 UTC (permalink / raw)
To: 'Krzysztof Kozlowski', gregkh, jirislaby
Cc: linux-serial, linux-samsung-soc, linux-kernel
In-Reply-To: <8998d2ae-cb6e-458d-8551-6b44f81b1c60@kernel.org>
Hi Krzysztof,
> -----Original Message-----
> From: Krzysztof Kozlowski <krzk@kernel.org>
> Sent: Monday, April 27, 2026 12:10 PM
> To: Alim Akhtar <alim.akhtar@samsung.com>; gregkh@linuxfoundation.org;
> jirislaby@kernel.org
> Cc: linux-serial@vger.kernel.org; linux-samsung-soc@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH] tty: serial: samsung: add dedicated compatible for
> exynosauto SoCs
> >
.
.
.
> >> Entire reasoning for doing this patch is wrong. And patch itself is
> >> NOOP (at least by quick look).
> > Thanks for a quick review, Can you please check the part of the patch
> > which adds OF_EARLYCON_DECLARE to add earlycon support?
> >
>
> It also feels unnecessary - existing compatible will be used for earlycon, no?
> If matching by existing compatible does not work, commit msg should explain
> that.
>
Yes, it fall back to exynos850 and earlycon does work with fallback compatible, Thanks!
> Best regards,
> Krzysztof
^ permalink raw reply
* Re: [PATCH 2/9] serial: core: use uart_iotype_*() to simplify code
From: Hugo Villeneuve @ 2026-04-27 13:46 UTC (permalink / raw)
To: Hugo Villeneuve
Cc: Ilpo Järvinen, Greg Kroah-Hartman, Jiri Slaby, LKML,
linux-serial, Hugo Villeneuve
In-Reply-To: <20260424113046.f792a805ef0507638e95b963@hugovil.com>
On Fri, 24 Apr 2026 11:30:46 -0400
Hugo Villeneuve <hugo@hugovil.com> wrote:
> On Fri, 24 Apr 2026 14:13:02 +0300 (EEST)
> Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:
>
> > On Thu, 23 Apr 2026, Hugo Villeneuve wrote:
> >
> > > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > >
> > > Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io()
> > > to simplify and improve code readability.
> > >
> > > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > > ---
> > > drivers/tty/serial/serial_core.c | 24 +++++++++---------------
> > > 1 file changed, 9 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> > > index b1cf45a8fc854cd97e349ff077d83b42e3ef8b16..fc273f8f9e75de89dca1ac1aca3589567bcf8a18 100644
> > > --- a/drivers/tty/serial/serial_core.c
> > > +++ b/drivers/tty/serial/serial_core.c
> > > @@ -3221,23 +3221,17 @@ bool uart_match_port(const struct uart_port *port1,
> > > {
> > > if (port1->iotype != port2->iotype)
> > > return false;
> > > -
> > > - switch (port1->iotype) {
> > > - case UPIO_PORT:
> > > - return port1->iobase == port2->iobase;
> > > - case UPIO_HUB6:
> > > - return port1->iobase == port2->iobase &&
> > > - port1->hub6 == port2->hub6;
> > > - case UPIO_MEM:
> > > - case UPIO_MEM16:
> > > - case UPIO_MEM32:
> > > - case UPIO_MEM32BE:
> > > - case UPIO_AU:
> > > - case UPIO_TSI:
> > > + else if (uart_iotype_mmio(port1->iotype))
> > > return port1->mapbase == port2->mapbase;
> > > - default:
> > > + else if (uart_iotype_legacy_io(port1->iotype))
> > > + if (port1->iobase != port2->iobase)
> > > + return false;
> > > + else if (port1->iotype == UPIO_HUB6 && port1->hub6 != port2->hub6)
> >
> > I suggest placing the entire hub6 related check (including the iobase
> > check) into own function in 8250_hub6.c and add a stub for the case when
> > hub6 code is not even built into kernel into 8250.h.
>
> Neat. I will make a separate commit for that in V2. This
> simplifies uart_match_port() even more...
I implemented it, the only thing I am not sure about is the include of
"8250/8250.h" in serial_core.c?
Hugo.
> >
> > > + return false;
> > > + else
> > > + return true;
> > > + else
> > > return false;
> > > - }
> > > }
> > > EXPORT_SYMBOL(uart_match_port);
> > >
> > >
> > >
> >
> > --
> > i.
> >
> >
>
>
> --
> Hugo Villeneuve
>
>
--
Hugo Villeneuve
^ permalink raw reply
* Re: [PATCH 4/4] Revert "drivers: convert sbd_duart.map_guard from atomic_t to refcount_t"
From: Maciej W. Rozycki @ 2026-04-27 14:13 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Thomas Bogendoerfer, Jiri Slaby, Elena Reshetova, David Windsor,
Kees Cook, Hans Liljestrand, linux-mips, linux-serial,
linux-kernel
In-Reply-To: <2026042630-diaphragm-reactor-7cfe@gregkh>
On Sun, 26 Apr 2026, Greg Kroah-Hartman wrote:
> > Revert commit 22a33651a56f ("drivers: convert sbd_duart.map_guard from
> > atomic_t to refcount_t"), which broke perfectly valid code:
> >
> > ------------[ cut here ]------------
> > WARNING: CPU: 1 PID: 1 at lib/refcount.c:114 sbd_request_port+0x54/0x140
> > refcount_t: increment on 0; use-after-free.
> > CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.11.0-rc2+ #34
> > Stack : 0000000014001fe0 0000000000000000 ffffffff80830000 0000000000000000
> > ffffffff8127bc7a ffffffff8016fe08 ffffffff808d0000 ffffffff808d0000
> > ffffffff807aa828 ffffffff80822337 ffffffff808ce188 a8000001860b0000
> > 0000000000000001 0000000000000001 00000000000001c8 ffffffff808a3090
> > 00000000000000bb ffffffff801b09d4 a80000018609bb68 ffffffff801231cc
> > ffffffff812a0000 ffffffff80171388 0000000000001000 ffffffff807aa828
> > 0000000000000001 0000000000000001 0000000000000000 0000000000000000
> > 0000000000000000 a80000018609bab0 0000000000000000 ffffffff803c47cc
> > 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> > ffffffff807cb648 ffffffff8010bff8 0000000014001fe1 ffffffff803c47cc
> > ...
> > Call Trace:
> > [<ffffffff8010bff8>] show_stack+0x28/0x88
> > [<ffffffff803c47cc>] dump_stack+0x8c/0xc0
> > [<ffffffff801aff5c>] __warn+0xe0/0x114
> > [<ffffffff801233f0>] warn_slowpath_fmt+0x40/0x50
> > [<ffffffff80455bcc>] sbd_request_port+0x54/0x140
> > [<ffffffff804563a4>] sbd_config_port+0x2c/0x68
> > ---[ end trace f666d696412caa3e ]---
> >
> > (report at the offending commit) -- sbd_request_port() is called twice
> > per DUART instance, to reserve a resource holding the control register
> > block shared between the two channels, so there's no slightest chance
> > for an overflow. Also this doesn't stop the driver from working and
> > it's just the reservation that is missing as a result, i.e.:
> >
> > 10060100-100601ff : sb1250-duart
> > 10060200-100602ff : sb1250-duart
> >
> > as from the offending change, vs:
> >
> > 10060100-100601ff : sb1250-duart
> > 10060200-100602ff : sb1250-duart
> > 10060300-100603ff : sb1250-duart
> >
> > beforehand, which is surely why the breakage has gone so long unnoticed.
> >
> > "If it ain't broke, don't fix it," so just revert the broken commit.
>
> How about fix this up to work properly with a refcount? having "open
> coded" atomic variables like this is ripe for problems, like it seems
> this driver is abusing.
Clearly refcount has odd semantics for this use case, as the failed
attempt to "fix" this code has shown.
The natural values for `map_guard' are 0 and 1 (FALSE and TRUE), for the
resource not taken and taken respectively, however refcount code complains
about this arrangement as indicated by the report quoted.
I suppose I can bend backwards and adopt other values, which I'll have to
figure out from the API somehow, but it's not clear to me how it would
cause less confusion than original straightforward code, the whole point
of which is to prevent the resource from being requested again for the
second port in a DUART.
Or I could use an ordinary variable, possibly of the `bool' type, guarded
by a spinlock, but that would be even more of an overkill IMO.
Maciej
^ permalink raw reply
* Re: [PATCH 2/9] serial: core: use uart_iotype_*() to simplify code
From: Ilpo Järvinen @ 2026-04-27 14:16 UTC (permalink / raw)
To: Hugo Villeneuve
Cc: Greg Kroah-Hartman, Jiri Slaby, LKML, linux-serial,
Hugo Villeneuve
In-Reply-To: <20260427094639.73a7e27709e466fda2356a4d@hugovil.com>
[-- Attachment #1: Type: text/plain, Size: 2659 bytes --]
On Mon, 27 Apr 2026, Hugo Villeneuve wrote:
> On Fri, 24 Apr 2026 11:30:46 -0400
> Hugo Villeneuve <hugo@hugovil.com> wrote:
>
> > On Fri, 24 Apr 2026 14:13:02 +0300 (EEST)
> > Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:
> >
> > > On Thu, 23 Apr 2026, Hugo Villeneuve wrote:
> > >
> > > > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > > >
> > > > Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io()
> > > > to simplify and improve code readability.
> > > >
> > > > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > > > ---
> > > > drivers/tty/serial/serial_core.c | 24 +++++++++---------------
> > > > 1 file changed, 9 insertions(+), 15 deletions(-)
> > > >
> > > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> > > > index b1cf45a8fc854cd97e349ff077d83b42e3ef8b16..fc273f8f9e75de89dca1ac1aca3589567bcf8a18 100644
> > > > --- a/drivers/tty/serial/serial_core.c
> > > > +++ b/drivers/tty/serial/serial_core.c
> > > > @@ -3221,23 +3221,17 @@ bool uart_match_port(const struct uart_port *port1,
> > > > {
> > > > if (port1->iotype != port2->iotype)
> > > > return false;
> > > > -
> > > > - switch (port1->iotype) {
> > > > - case UPIO_PORT:
> > > > - return port1->iobase == port2->iobase;
> > > > - case UPIO_HUB6:
> > > > - return port1->iobase == port2->iobase &&
> > > > - port1->hub6 == port2->hub6;
> > > > - case UPIO_MEM:
> > > > - case UPIO_MEM16:
> > > > - case UPIO_MEM32:
> > > > - case UPIO_MEM32BE:
> > > > - case UPIO_AU:
> > > > - case UPIO_TSI:
> > > > + else if (uart_iotype_mmio(port1->iotype))
> > > > return port1->mapbase == port2->mapbase;
> > > > - default:
> > > > + else if (uart_iotype_legacy_io(port1->iotype))
> > > > + if (port1->iobase != port2->iobase)
> > > > + return false;
> > > > + else if (port1->iotype == UPIO_HUB6 && port1->hub6 != port2->hub6)
> > >
> > > I suggest placing the entire hub6 related check (including the iobase
> > > check) into own function in 8250_hub6.c and add a stub for the case when
> > > hub6 code is not even built into kernel into 8250.h.
> >
> > Neat. I will make a separate commit for that in V2. This
> > simplifies uart_match_port() even more...
>
> I implemented it, the only thing I am not sure about is the include of
> "8250/8250.h" in serial_core.c?
I'd just include it and add comment before it that it's included because
of UPIO_HUB6 port matching.
The more generic alternative would be to make the matcher a callback but
that feels overkill for some legacy iotype trick, IMO.
--
i.
^ permalink raw reply
* Re: [PATCH 2/9] serial: core: use uart_iotype_*() to simplify code
From: Hugo Villeneuve @ 2026-04-27 14:18 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: Greg Kroah-Hartman, Jiri Slaby, LKML, linux-serial,
Hugo Villeneuve
In-Reply-To: <abe6c6b3-7e9a-b9bc-80e9-2f5294f2095c@linux.intel.com>
On Mon, 27 Apr 2026 17:16:11 +0300 (EEST)
Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:
> On Mon, 27 Apr 2026, Hugo Villeneuve wrote:
>
> > On Fri, 24 Apr 2026 11:30:46 -0400
> > Hugo Villeneuve <hugo@hugovil.com> wrote:
> >
> > > On Fri, 24 Apr 2026 14:13:02 +0300 (EEST)
> > > Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:
> > >
> > > > On Thu, 23 Apr 2026, Hugo Villeneuve wrote:
> > > >
> > > > > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > > > >
> > > > > Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io()
> > > > > to simplify and improve code readability.
> > > > >
> > > > > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > > > > ---
> > > > > drivers/tty/serial/serial_core.c | 24 +++++++++---------------
> > > > > 1 file changed, 9 insertions(+), 15 deletions(-)
> > > > >
> > > > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> > > > > index b1cf45a8fc854cd97e349ff077d83b42e3ef8b16..fc273f8f9e75de89dca1ac1aca3589567bcf8a18 100644
> > > > > --- a/drivers/tty/serial/serial_core.c
> > > > > +++ b/drivers/tty/serial/serial_core.c
> > > > > @@ -3221,23 +3221,17 @@ bool uart_match_port(const struct uart_port *port1,
> > > > > {
> > > > > if (port1->iotype != port2->iotype)
> > > > > return false;
> > > > > -
> > > > > - switch (port1->iotype) {
> > > > > - case UPIO_PORT:
> > > > > - return port1->iobase == port2->iobase;
> > > > > - case UPIO_HUB6:
> > > > > - return port1->iobase == port2->iobase &&
> > > > > - port1->hub6 == port2->hub6;
> > > > > - case UPIO_MEM:
> > > > > - case UPIO_MEM16:
> > > > > - case UPIO_MEM32:
> > > > > - case UPIO_MEM32BE:
> > > > > - case UPIO_AU:
> > > > > - case UPIO_TSI:
> > > > > + else if (uart_iotype_mmio(port1->iotype))
> > > > > return port1->mapbase == port2->mapbase;
> > > > > - default:
> > > > > + else if (uart_iotype_legacy_io(port1->iotype))
> > > > > + if (port1->iobase != port2->iobase)
> > > > > + return false;
> > > > > + else if (port1->iotype == UPIO_HUB6 && port1->hub6 != port2->hub6)
> > > >
> > > > I suggest placing the entire hub6 related check (including the iobase
> > > > check) into own function in 8250_hub6.c and add a stub for the case when
> > > > hub6 code is not even built into kernel into 8250.h.
> > >
> > > Neat. I will make a separate commit for that in V2. This
> > > simplifies uart_match_port() even more...
> >
> > I implemented it, the only thing I am not sure about is the include of
> > "8250/8250.h" in serial_core.c?
>
> I'd just include it and add comment before it that it's included because
> of UPIO_HUB6 port matching.
>
> The more generic alternative would be to make the matcher a callback but
> that feels overkill for some legacy iotype trick, IMO.
Great, I will submit v2 then with the include and the associated
comment.
Thank you,
Hugo.
^ permalink raw reply
* Re: [PATCH 4/4] Revert "drivers: convert sbd_duart.map_guard from atomic_t to refcount_t"
From: Greg Kroah-Hartman @ 2026-04-27 16:31 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Thomas Bogendoerfer, Jiri Slaby, Elena Reshetova, David Windsor,
Kees Cook, Hans Liljestrand, linux-mips, linux-serial,
linux-kernel
In-Reply-To: <alpine.DEB.2.21.2604271435070.28583@angie.orcam.me.uk>
On Mon, Apr 27, 2026 at 03:13:55PM +0100, Maciej W. Rozycki wrote:
> On Sun, 26 Apr 2026, Greg Kroah-Hartman wrote:
>
> > > Revert commit 22a33651a56f ("drivers: convert sbd_duart.map_guard from
> > > atomic_t to refcount_t"), which broke perfectly valid code:
> > >
> > > ------------[ cut here ]------------
> > > WARNING: CPU: 1 PID: 1 at lib/refcount.c:114 sbd_request_port+0x54/0x140
> > > refcount_t: increment on 0; use-after-free.
> > > CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.11.0-rc2+ #34
> > > Stack : 0000000014001fe0 0000000000000000 ffffffff80830000 0000000000000000
> > > ffffffff8127bc7a ffffffff8016fe08 ffffffff808d0000 ffffffff808d0000
> > > ffffffff807aa828 ffffffff80822337 ffffffff808ce188 a8000001860b0000
> > > 0000000000000001 0000000000000001 00000000000001c8 ffffffff808a3090
> > > 00000000000000bb ffffffff801b09d4 a80000018609bb68 ffffffff801231cc
> > > ffffffff812a0000 ffffffff80171388 0000000000001000 ffffffff807aa828
> > > 0000000000000001 0000000000000001 0000000000000000 0000000000000000
> > > 0000000000000000 a80000018609bab0 0000000000000000 ffffffff803c47cc
> > > 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> > > ffffffff807cb648 ffffffff8010bff8 0000000014001fe1 ffffffff803c47cc
> > > ...
> > > Call Trace:
> > > [<ffffffff8010bff8>] show_stack+0x28/0x88
> > > [<ffffffff803c47cc>] dump_stack+0x8c/0xc0
> > > [<ffffffff801aff5c>] __warn+0xe0/0x114
> > > [<ffffffff801233f0>] warn_slowpath_fmt+0x40/0x50
> > > [<ffffffff80455bcc>] sbd_request_port+0x54/0x140
> > > [<ffffffff804563a4>] sbd_config_port+0x2c/0x68
> > > ---[ end trace f666d696412caa3e ]---
> > >
> > > (report at the offending commit) -- sbd_request_port() is called twice
> > > per DUART instance, to reserve a resource holding the control register
> > > block shared between the two channels, so there's no slightest chance
> > > for an overflow. Also this doesn't stop the driver from working and
> > > it's just the reservation that is missing as a result, i.e.:
> > >
> > > 10060100-100601ff : sb1250-duart
> > > 10060200-100602ff : sb1250-duart
> > >
> > > as from the offending change, vs:
> > >
> > > 10060100-100601ff : sb1250-duart
> > > 10060200-100602ff : sb1250-duart
> > > 10060300-100603ff : sb1250-duart
> > >
> > > beforehand, which is surely why the breakage has gone so long unnoticed.
> > >
> > > "If it ain't broke, don't fix it," so just revert the broken commit.
> >
> > How about fix this up to work properly with a refcount? having "open
> > coded" atomic variables like this is ripe for problems, like it seems
> > this driver is abusing.
>
> Clearly refcount has odd semantics for this use case, as the failed
> attempt to "fix" this code has shown.
>
> The natural values for `map_guard' are 0 and 1 (FALSE and TRUE), for the
> resource not taken and taken respectively, however refcount code complains
> about this arrangement as indicated by the report quoted.
>
> I suppose I can bend backwards and adopt other values, which I'll have to
> figure out from the API somehow, but it's not clear to me how it would
> cause less confusion than original straightforward code, the whole point
> of which is to prevent the resource from being requested again for the
> second port in a DUART.
>
> Or I could use an ordinary variable, possibly of the `bool' type, guarded
> by a spinlock, but that would be even more of an overkill IMO.
No, that would be best because using an atomic is the same end result,
but it confuses us humans who are the ones responsible for maintaining
the code over time.
So a bool would be great, thanks!
greg k-h
^ permalink raw reply
* [RFC PATCH v1 0/9] uaccess: Convert small fixed size copy_{to/from}_user() to scoped user access
From: Christophe Leroy (CS GROUP) @ 2026-04-27 17:13 UTC (permalink / raw)
To: Yury Norov, Andrew Morton, Linus Torvalds, David Laight,
Thomas Gleixner
Cc: Christophe Leroy (CS GROUP), linux-alpha, linux-kernel,
linux-snps-arc, linux-arm-kernel, linux-mips, linuxppc-dev, kvm,
linux-riscv, linux-s390, sparclinux, linux-um, dmaengine,
linux-efi, linux-fsi, amd-gfx, dri-devel, intel-gfx, linux-wpan,
netdev, linux-wireless, linux-spi, linux-media, linux-staging,
linux-serial, linux-usb, xen-devel, linux-fsdevel, ocfs2-devel,
bpf, kasan-dev, linux-mm, linux-x25, rust-for-linux, linux-sound,
sound-open-firmware, linux-csky, linux-hexagon, loongarch,
linux-m68k, linux-openrisc, linux-parisc, linux-sh, linux-arch
A lot of copy_from_user() and copy_to_user() perform copies of small
fixed size pieces of data between kernel and userspace, and don't
care about partial copies.
copy_from_user() and copy_to_user() are big functions optimised for
copying large amount of data, with cache management, etc ... This is
often overkill for small copies that could just be inlined instead.
What makes things a bit more tricky is that those copy functions
are designed to handle partial copies in case of page fault. But among
the 6000 callers of those functions, only 2% really care about the
quantity of no-copied data that those functions return. All other ones
fails as soon as the returned value is not 0, returning -EACCESS.
So first step in this series is to introduce variants called
copy_from_user_partial() and copy_to_user_partial() which will be
called by the 2% users that care about the partial copy, then the
original copy_from_user() and copy_to_user() are changed to return
-EFAULT when the copy fails.
Then the second step is to implement copy of small fixed-size data
with scoped user access instead of calling the arch specific heavy
user copy functions.
Patch 5, can be split in different patches for each archicture or
subsystem, but let's get a first feedback and agree on the principle.
Christophe Leroy (CS GROUP) (9):
uaccess: Split check_zeroed_user() out of usercopy.c
uaccess: Convert INLINE_COPY_{TO/FROM}_USER to kconfig and reduce
ifdefery
x86/umip: Be stricter in fixup_umip_exception()
uaccess: Introduce copy_{to/from}_user_partial()
uaccess: Switch to copy_{to/from}_user_partial() when relevant
uaccess: Change copy_{to/from}_user to return -EFAULT
x86: Add unsafe_copy_from_user()
arm64: Add unsafe_copy_from_user()
uaccess: Convert small fixed size copy_{to/from}_user() to scoped user
access
arch/alpha/Kconfig | 1 +
arch/alpha/kernel/osf_sys.c | 4 +-
arch/alpha/kernel/termios.c | 2 +-
arch/arc/include/asm/uaccess.h | 3 -
arch/arc/kernel/disasm.c | 2 +-
arch/arm/include/asm/uaccess.h | 2 -
arch/arm64/include/asm/gcs.h | 2 +-
arch/arm64/include/asm/uaccess.h | 30 +++--
arch/arm64/kernel/signal32.c | 2 +-
arch/csky/Kconfig | 1 +
arch/hexagon/include/asm/uaccess.h | 3 -
arch/loongarch/include/asm/uaccess.h | 3 -
arch/m68k/include/asm/uaccess.h | 3 -
arch/microblaze/include/asm/uaccess.h | 2 -
arch/mips/include/asm/uaccess.h | 3 -
arch/mips/kernel/rtlx.c | 8 +-
arch/mips/kernel/vpe.c | 2 +-
arch/nios2/include/asm/uaccess.h | 2 -
arch/openrisc/include/asm/uaccess.h | 2 -
arch/parisc/include/asm/uaccess.h | 3 -
arch/powerpc/Kconfig | 1 +
arch/powerpc/kvm/book3s_64_mmu_hv.c | 4 +-
arch/powerpc/kvm/book3s_64_mmu_radix.c | 4 +-
arch/powerpc/kvm/book3s_hv.c | 2 +-
arch/riscv/Kconfig | 1 +
arch/riscv/kernel/signal.c | 2 +-
arch/s390/include/asm/idals.h | 8 +-
arch/s390/include/asm/uaccess.h | 3 -
arch/sh/include/asm/uaccess.h | 2 -
arch/sparc/include/asm/uaccess_32.h | 3 -
arch/sparc/include/asm/uaccess_64.h | 2 -
arch/sparc/kernel/termios.c | 2 +-
arch/um/include/asm/uaccess.h | 3 -
arch/um/kernel/process.c | 2 +-
arch/x86/Kconfig | 1 +
arch/x86/include/asm/uaccess.h | 29 ++++-
arch/x86/kernel/umip.c | 2 +-
arch/x86/lib/insn-eval.c | 2 +-
arch/x86/um/signal.c | 2 +-
arch/xtensa/include/asm/uaccess.h | 2 -
drivers/android/binder_alloc.c | 2 +-
drivers/comedi/comedi_fops.c | 4 +-
drivers/dma/idxd/cdev.c | 2 +-
drivers/firmware/efi/test/efi_test.c | 2 +-
drivers/fsi/fsi-scom.c | 2 +-
.../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +-
drivers/gpu/drm/i915/gt/intel_sseu.c | 4 +-
drivers/gpu/drm/i915/i915_gem.c | 4 +-
drivers/hwtracing/intel_th/msu.c | 2 +-
drivers/misc/ibmvmc.c | 2 +-
drivers/misc/vmw_vmci/vmci_host.c | 2 +-
drivers/most/most_cdev.c | 2 +-
drivers/net/ieee802154/ca8210.c | 4 +-
drivers/net/wireless/ath/wil6210/debugfs.c | 2 +-
.../intel/iwlwifi/pcie/gen1_2/trans.c | 2 +-
drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
drivers/ps3/ps3-lpm.c | 2 +-
drivers/s390/crypto/zcrypt_api.h | 4 +-
drivers/spi/spidev.c | 2 +-
.../staging/media/atomisp/pci/atomisp_cmd.c | 8 +-
drivers/tty/tty_ioctl.c | 14 +--
drivers/tty/vt/vc_screen.c | 4 +-
drivers/usb/gadget/function/f_hid.c | 4 +-
drivers/usb/gadget/function/f_printer.c | 2 +-
drivers/vfio/vfio_iommu_type1.c | 4 +-
drivers/xen/xenbus/xenbus_dev_frontend.c | 2 +-
fs/namespace.c | 2 +-
fs/ocfs2/dlmfs/dlmfs.c | 2 +-
fs/proc/base.c | 4 +-
include/asm-generic/uaccess.h | 2 -
include/linux/bpfptr.h | 2 +-
include/linux/sockptr.h | 4 +-
include/linux/uaccess.h | 107 ++++++++++++++----
ipc/msg.c | 8 +-
ipc/sem.c | 8 +-
ipc/shm.c | 18 +--
kernel/regset.c | 2 +-
kernel/sys.c | 4 +-
lib/Kconfig | 3 +
lib/Makefile | 4 +-
lib/kfifo.c | 8 +-
lib/{usercopy.c => usercheck.c} | 22 ----
lib/usercopy.c | 66 -----------
mm/kasan/kasan_test_c.c | 4 +-
mm/memory.c | 2 +-
net/x25/af_x25.c | 2 +-
rust/helpers/uaccess.c | 6 +-
sound/pci/emu10k1/emufx.c | 4 +-
sound/pci/rme9652/hdsp.c | 6 +-
sound/soc/intel/avs/probes.c | 6 +-
sound/soc/sof/compress.c | 12 +-
sound/soc/sof/sof-client-probes.c | 6 +-
92 files changed, 269 insertions(+), 288 deletions(-)
copy lib/{usercopy.c => usercheck.c} (73%)
--
2.49.0
^ permalink raw reply
* [RFC PATCH v1 1/9] uaccess: Split check_zeroed_user() out of usercopy.c
From: Christophe Leroy (CS GROUP) @ 2026-04-27 17:13 UTC (permalink / raw)
To: Yury Norov, Andrew Morton, Linus Torvalds, David Laight,
Thomas Gleixner
Cc: Christophe Leroy (CS GROUP), linux-alpha, linux-kernel,
linux-snps-arc, linux-arm-kernel, linux-mips, linuxppc-dev, kvm,
linux-riscv, linux-s390, sparclinux, linux-um, dmaengine,
linux-efi, linux-fsi, amd-gfx, dri-devel, intel-gfx, linux-wpan,
netdev, linux-wireless, linux-spi, linux-media, linux-staging,
linux-serial, linux-usb, xen-devel, linux-fsdevel, ocfs2-devel,
bpf, kasan-dev, linux-mm, linux-x25, rust-for-linux, linux-sound,
sound-open-firmware, linux-csky, linux-hexagon, loongarch,
linux-m68k, linux-openrisc, linux-parisc, linux-sh, linux-arch
In-Reply-To: <cover.1777306795.git.chleroy@kernel.org>
Until commit f5a1a536fa14 ("lib: introduce copy_struct_from_user()
helper"), lib/usercopy.c was containing only the out-line version
of user copy fonctions.
That commit added function check_zeroed_user() into the same file.
Move that function into a new file named usercheck.c, so that next
patch can change usercopy.c build to a conditional build.
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
---
lib/Makefile | 1 +
lib/{usercopy.c => usercheck.c} | 22 ------------
lib/usercopy.c | 62 ---------------------------------
3 files changed, 1 insertion(+), 84 deletions(-)
copy lib/{usercopy.c => usercheck.c} (73%)
diff --git a/lib/Makefile b/lib/Makefile
index f33a24bf1c19..7c0334d7675b 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -59,6 +59,7 @@ obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \
percpu-refcount.o rhashtable.o base64.o \
once.o refcount.o rcuref.o usercopy.o errseq.o bucket_locks.o \
generic-radix-tree.o bitmap-str.o
+obj-y += usercheck.o
obj-y += string_helpers.o
obj-y += hexdump.o
obj-$(CONFIG_TEST_HEXDUMP) += test_hexdump.o
diff --git a/lib/usercopy.c b/lib/usercheck.c
similarity index 73%
copy from lib/usercopy.c
copy to lib/usercheck.c
index b00a3a957de6..15b0d9a18435 100644
--- a/lib/usercopy.c
+++ b/lib/usercheck.c
@@ -2,32 +2,10 @@
#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/export.h>
-#include <linux/fault-inject-usercopy.h>
-#include <linux/instrumented.h>
#include <linux/kernel.h>
-#include <linux/nospec.h>
-#include <linux/string.h>
#include <linux/uaccess.h>
#include <linux/wordpart.h>
-/* out-of-line parts */
-
-#if !defined(INLINE_COPY_FROM_USER)
-unsigned long _copy_from_user(void *to, const void __user *from, unsigned long n)
-{
- return _inline_copy_from_user(to, from, n);
-}
-EXPORT_SYMBOL(_copy_from_user);
-#endif
-
-#if !defined(INLINE_COPY_TO_USER)
-unsigned long _copy_to_user(void __user *to, const void *from, unsigned long n)
-{
- return _inline_copy_to_user(to, from, n);
-}
-EXPORT_SYMBOL(_copy_to_user);
-#endif
-
/**
* check_zeroed_user: check if a userspace buffer only contains zero bytes
* @from: Source address, in userspace.
diff --git a/lib/usercopy.c b/lib/usercopy.c
index b00a3a957de6..7a93f56d81dd 100644
--- a/lib/usercopy.c
+++ b/lib/usercopy.c
@@ -1,14 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
-#include <linux/compiler.h>
-#include <linux/errno.h>
#include <linux/export.h>
-#include <linux/fault-inject-usercopy.h>
-#include <linux/instrumented.h>
-#include <linux/kernel.h>
-#include <linux/nospec.h>
-#include <linux/string.h>
#include <linux/uaccess.h>
-#include <linux/wordpart.h>
/* out-of-line parts */
@@ -27,57 +19,3 @@ unsigned long _copy_to_user(void __user *to, const void *from, unsigned long n)
}
EXPORT_SYMBOL(_copy_to_user);
#endif
-
-/**
- * check_zeroed_user: check if a userspace buffer only contains zero bytes
- * @from: Source address, in userspace.
- * @size: Size of buffer.
- *
- * This is effectively shorthand for "memchr_inv(from, 0, size) == NULL" for
- * userspace addresses (and is more efficient because we don't care where the
- * first non-zero byte is).
- *
- * Returns:
- * * 0: There were non-zero bytes present in the buffer.
- * * 1: The buffer was full of zero bytes.
- * * -EFAULT: access to userspace failed.
- */
-int check_zeroed_user(const void __user *from, size_t size)
-{
- unsigned long val;
- uintptr_t align = (uintptr_t) from % sizeof(unsigned long);
-
- if (unlikely(size == 0))
- return 1;
-
- from -= align;
- size += align;
-
- if (!user_read_access_begin(from, size))
- return -EFAULT;
-
- unsafe_get_user(val, (unsigned long __user *) from, err_fault);
- if (align)
- val &= ~aligned_byte_mask(align);
-
- while (size > sizeof(unsigned long)) {
- if (unlikely(val))
- goto done;
-
- from += sizeof(unsigned long);
- size -= sizeof(unsigned long);
-
- unsafe_get_user(val, (unsigned long __user *) from, err_fault);
- }
-
- if (size < sizeof(unsigned long))
- val &= aligned_byte_mask(size);
-
-done:
- user_read_access_end();
- return (val == 0);
-err_fault:
- user_read_access_end();
- return -EFAULT;
-}
-EXPORT_SYMBOL(check_zeroed_user);
--
2.49.0
^ permalink raw reply related
* [RFC PATCH v1 2/9] uaccess: Convert INLINE_COPY_{TO/FROM}_USER to kconfig and reduce ifdefery
From: Christophe Leroy (CS GROUP) @ 2026-04-27 17:13 UTC (permalink / raw)
To: Yury Norov, Andrew Morton, Linus Torvalds, David Laight,
Thomas Gleixner
Cc: Christophe Leroy (CS GROUP), linux-alpha, linux-kernel,
linux-snps-arc, linux-arm-kernel, linux-mips, linuxppc-dev, kvm,
linux-riscv, linux-s390, sparclinux, linux-um, dmaengine,
linux-efi, linux-fsi, amd-gfx, dri-devel, intel-gfx, linux-wpan,
netdev, linux-wireless, linux-spi, linux-media, linux-staging,
linux-serial, linux-usb, xen-devel, linux-fsdevel, ocfs2-devel,
bpf, kasan-dev, linux-mm, linux-x25, rust-for-linux, linux-sound,
sound-open-firmware, linux-csky, linux-hexagon, loongarch,
linux-m68k, linux-openrisc, linux-parisc, linux-sh, linux-arch
In-Reply-To: <cover.1777306795.git.chleroy@kernel.org>
Among the 21 architectures supported by the kernel, 16 define both
INLINE_COPY_TO_USER and INLINE_COPY_FROM_USER while the 5 other ones
don't define any of the two.
To simplify and reduce risk of mistakes, convert them to a single
kconfig item named CONFIG_ARCH_WANTS_NOINLINE_COPY which will be
selected by the 5 architectures that don't want inlined copy.
To minimise complication in a later patch, also remove
ifdefery and replace it with IS_ENABLED().
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
---
arch/alpha/Kconfig | 1 +
arch/arc/include/asm/uaccess.h | 3 ---
arch/arm/include/asm/uaccess.h | 2 --
arch/arm64/include/asm/uaccess.h | 3 ---
arch/csky/Kconfig | 1 +
arch/hexagon/include/asm/uaccess.h | 3 ---
arch/loongarch/include/asm/uaccess.h | 3 ---
arch/m68k/include/asm/uaccess.h | 3 ---
arch/microblaze/include/asm/uaccess.h | 2 --
arch/mips/include/asm/uaccess.h | 3 ---
arch/nios2/include/asm/uaccess.h | 2 --
arch/openrisc/include/asm/uaccess.h | 2 --
arch/parisc/include/asm/uaccess.h | 3 ---
arch/powerpc/Kconfig | 1 +
arch/riscv/Kconfig | 1 +
arch/s390/include/asm/uaccess.h | 3 ---
arch/sh/include/asm/uaccess.h | 2 --
arch/sparc/include/asm/uaccess_32.h | 3 ---
arch/sparc/include/asm/uaccess_64.h | 2 --
arch/um/include/asm/uaccess.h | 3 ---
arch/x86/Kconfig | 1 +
arch/xtensa/include/asm/uaccess.h | 2 --
include/asm-generic/uaccess.h | 2 --
include/linux/uaccess.h | 32 ++++++++++++---------------
lib/Kconfig | 3 +++
lib/Makefile | 3 ++-
lib/usercopy.c | 4 ----
rust/helpers/uaccess.c | 2 +-
28 files changed, 25 insertions(+), 70 deletions(-)
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 7b7dafe7d9df..65e533cead6b 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -11,6 +11,7 @@ config ALPHA
select ARCH_NO_PREEMPT
select ARCH_NO_SG_CHAIN
select ARCH_USE_CMPXCHG_LOCKREF
+ select ARCH_WANTS_NOINLINE_COPY_USER
select FORCE_PCI
select PCI_DOMAINS if PCI
select PCI_SYSCALL if PCI
diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h
index 1e8809ea000a..e8b161b37a03 100644
--- a/arch/arc/include/asm/uaccess.h
+++ b/arch/arc/include/asm/uaccess.h
@@ -628,9 +628,6 @@ static inline unsigned long __clear_user(void __user *to, unsigned long n)
return res;
}
-#define INLINE_COPY_TO_USER
-#define INLINE_COPY_FROM_USER
-
#define __clear_user __clear_user
#include <asm-generic/uaccess.h>
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index d6ae80b5df36..7280c162bb71 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -616,8 +616,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
}
#define __clear_user(addr, n) (memset((void __force *)addr, 0, n), 0)
#endif
-#define INLINE_COPY_TO_USER
-#define INLINE_COPY_FROM_USER
static inline unsigned long __must_check clear_user(void __user *to, unsigned long n)
{
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
index b0c83a08dda9..1e20ec91b56f 100644
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@ -456,9 +456,6 @@ do { \
unsafe_copy_loop(__ucu_dst, __ucu_src, __ucu_len, u8, label); \
} while (0)
-#define INLINE_COPY_TO_USER
-#define INLINE_COPY_FROM_USER
-
extern unsigned long __must_check __arch_clear_user(void __user *to, unsigned long n);
static inline unsigned long __must_check __clear_user(void __user *to, unsigned long n)
{
diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig
index 4331313a42ff..d010d7eb47bf 100644
--- a/arch/csky/Kconfig
+++ b/arch/csky/Kconfig
@@ -40,6 +40,7 @@ config CSKY
select ARCH_NEED_CMPXCHG_1_EMU
select ARCH_WANT_FRAME_POINTERS if !CPU_CK610 && $(cc-option,-mbacktrace)
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
+ select ARCH_WANTS_NOINLINE_COPY_USER
select COMMON_CLK
select CLKSRC_MMIO
select CSKY_MPINTC if CPU_CK860
diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h
index bff77efc0d9a..4bf863217636 100644
--- a/arch/hexagon/include/asm/uaccess.h
+++ b/arch/hexagon/include/asm/uaccess.h
@@ -26,9 +26,6 @@ unsigned long raw_copy_from_user(void *to, const void __user *from,
unsigned long n);
unsigned long raw_copy_to_user(void __user *to, const void *from,
unsigned long n);
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
-
__kernel_size_t __clear_user_hexagon(void __user *dest, unsigned long count);
#define __clear_user(a, s) __clear_user_hexagon((a), (s))
diff --git a/arch/loongarch/include/asm/uaccess.h b/arch/loongarch/include/asm/uaccess.h
index 438269313e78..72a04ac88549 100644
--- a/arch/loongarch/include/asm/uaccess.h
+++ b/arch/loongarch/include/asm/uaccess.h
@@ -292,9 +292,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
return __copy_user((__force void *)to, from, n);
}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
-
/*
* __clear_user: - Zero a block of memory in user space, with less checking.
* @addr: Destination address, in user space.
diff --git a/arch/m68k/include/asm/uaccess.h b/arch/m68k/include/asm/uaccess.h
index 64914872a5c9..20e249a6ad07 100644
--- a/arch/m68k/include/asm/uaccess.h
+++ b/arch/m68k/include/asm/uaccess.h
@@ -377,9 +377,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
return __constant_copy_to_user(to, from, n);
return __generic_copy_to_user(to, from, n);
}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
-
#define __get_kernel_nofault(dst, src, type, err_label) \
do { \
type *__gk_dst = (type *)(dst); \
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index 3aab2f17e046..3355f541e12a 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -250,8 +250,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
{
return __copy_tofrom_user(to, (__force const void __user *)from, n);
}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
/*
* Copy a null terminated string from userspace.
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index c0cede273c7c..8714caefbac8 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -433,9 +433,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
return __cu_len_r;
}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
-
extern __kernel_size_t __bzero(void __user *addr, __kernel_size_t size);
/*
diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h
index 6ccc9a232c23..46d7312a1c96 100644
--- a/arch/nios2/include/asm/uaccess.h
+++ b/arch/nios2/include/asm/uaccess.h
@@ -57,8 +57,6 @@ extern unsigned long
raw_copy_from_user(void *to, const void __user *from, unsigned long n);
extern unsigned long
raw_copy_to_user(void __user *to, const void *from, unsigned long n);
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
extern long strncpy_from_user(char *__to, const char __user *__from,
long __len);
diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h
index d6500a374e18..c84effde867a 100644
--- a/arch/openrisc/include/asm/uaccess.h
+++ b/arch/openrisc/include/asm/uaccess.h
@@ -218,8 +218,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long size)
{
return __copy_tofrom_user((__force void *)to, from, size);
}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
extern unsigned long __clear_user(void __user *addr, unsigned long size);
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h
index 6c531d2c847e..1dd6a1dd653f 100644
--- a/arch/parisc/include/asm/uaccess.h
+++ b/arch/parisc/include/asm/uaccess.h
@@ -197,7 +197,4 @@ unsigned long __must_check raw_copy_to_user(void __user *dst, const void *src,
unsigned long len);
unsigned long __must_check raw_copy_from_user(void *dst, const void __user *src,
unsigned long len);
-#define INLINE_COPY_TO_USER
-#define INLINE_COPY_FROM_USER
-
#endif /* __PARISC_UACCESS_H */
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index e93df95b79e7..6816f402fe3d 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -187,6 +187,7 @@ config PPC
select ARCH_WANT_LD_ORPHAN_WARN
select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP if PPC_RADIX_MMU
select ARCH_WANTS_MODULES_DATA_IN_VMALLOC if PPC_BOOK3S_32 || PPC_8xx
+ select ARCH_WANTS_NOINLINE_COPY_USER
select ARCH_WEAK_RELEASE_ACQUIRE
select AUDIT_ARCH_COMPAT_GENERIC
select BINFMT_ELF
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index d235396c4514..492b920c1a51 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -88,6 +88,7 @@ config RISCV
select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
select ARCH_WANTS_NO_INSTR
+ select ARCH_WANTS_NOINLINE_COPY_USER if MMU
select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
select ARCH_WEAK_RELEASE_ACQUIRE if ARCH_USE_QUEUED_SPINLOCKS
select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
index dff035372601..2e0472c20da0 100644
--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -30,9 +30,6 @@ void debug_user_asce(int exit);
#define uaccess_kmsan_or_inline __always_inline
#endif
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
-
static uaccess_kmsan_or_inline __must_check unsigned long
raw_copy_from_user(void *to, const void __user *from, unsigned long size)
{
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h
index a79609eb14be..0cd75308e6d3 100644
--- a/arch/sh/include/asm/uaccess.h
+++ b/arch/sh/include/asm/uaccess.h
@@ -95,8 +95,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
{
return __copy_user((__force void *)to, from, n);
}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
/*
* Clear the area and return remaining number of bytes
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h
index 43284b6ec46a..e01f43c6421c 100644
--- a/arch/sparc/include/asm/uaccess_32.h
+++ b/arch/sparc/include/asm/uaccess_32.h
@@ -190,9 +190,6 @@ static inline unsigned long raw_copy_from_user(void *to, const void __user *from
return __copy_user((__force void __user *) to, from, n);
}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
-
static inline unsigned long __clear_user(void __user *addr, unsigned long size)
{
unsigned long ret;
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index b825a5dd0210..62ee0b074fec 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -231,8 +231,6 @@ unsigned long __must_check raw_copy_from_user(void *to,
unsigned long __must_check raw_copy_to_user(void __user *to,
const void *from,
unsigned long size);
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
unsigned long __must_check raw_copy_in_user(void __user *to,
const void __user *from,
diff --git a/arch/um/include/asm/uaccess.h b/arch/um/include/asm/uaccess.h
index 0df9ea4abda8..1e14260c7f0f 100644
--- a/arch/um/include/asm/uaccess.h
+++ b/arch/um/include/asm/uaccess.h
@@ -27,9 +27,6 @@ static inline int __access_ok(const void __user *ptr, unsigned long size);
#define __access_ok __access_ok
#define __clear_user __clear_user
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
-
#include <asm-generic/uaccess.h>
static inline int __access_ok(const void __user *ptr, unsigned long size)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f3f7cb01d69d..c1e58d8c6864 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -143,6 +143,7 @@ config X86
select ARCH_WANTS_CLOCKSOURCE_READ_INLINE if X86_64
select ARCH_WANTS_DYNAMIC_TASK_STRUCT
select ARCH_WANTS_NO_INSTR
+ select ARCH_WANTS_NOINLINE_COPY_USER
select ARCH_WANT_GENERAL_HUGETLB
select ARCH_WANT_HUGE_PMD_SHARE if X86_64
select ARCH_WANT_LD_ORPHAN_WARN
diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h
index 56aec6d504fe..f9e1623a7be9 100644
--- a/arch/xtensa/include/asm/uaccess.h
+++ b/arch/xtensa/include/asm/uaccess.h
@@ -237,8 +237,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
prefetch(from);
return __xtensa_copy_user((__force void *)to, from, n);
}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
/*
* We need to return the number of bytes not cleared. Our memset()
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index b276f783494c..fb33a71fd24e 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -91,8 +91,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
memcpy((void __force *)to, from, n);
return 0;
}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
#endif /* CONFIG_UACCESS_MEMCPY */
/*
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 56328601218c..bd1201c81d94 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -83,8 +83,8 @@
* with that. They should not be used directly; they are used to implement
* the 6 functions (copy_{to,from}_user(), __copy_{to,from}_user_inatomic())
* that are used instead. Out of those, __... ones are inlined. Plain
- * copy_{to,from}_user() might or might not be inlined. If you want them
- * inlined, have asm/uaccess.h define INLINE_COPY_{TO,FROM}_USER.
+ * copy_{to,from}_user() might or might not be inlined. If you don't want them
+ * inlined, select CONFIG_ARCH_WANTS_NOINLINE_COPY_USER.
*
* NOTE: only copy_from_user() zero-pads the destination in case of short copy.
* Neither __copy_from_user() nor __copy_from_user_inatomic() zero anything
@@ -157,8 +157,8 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
}
/*
- * Architectures that #define INLINE_COPY_TO_USER use this function
- * directly in the normal copy_to/from_user(), the other ones go
+ * Architectures that don't select CONFIG_ARCH_WANTS_NOINLINE_COPY_USER use
+ * this function directly in the normal copy_to/from_user(), the other ones go
* through an extern _copy_to/from_user(), which expands the same code
* here.
*/
@@ -190,10 +190,9 @@ _inline_copy_from_user(void *to, const void __user *from, unsigned long n)
memset(to + (n - res), 0, res);
return res;
}
-#ifndef INLINE_COPY_FROM_USER
+
extern __must_check unsigned long
_copy_from_user(void *, const void __user *, unsigned long);
-#endif
static inline __must_check unsigned long
_inline_copy_to_user(void __user *to, const void *from, unsigned long n)
@@ -207,21 +206,19 @@ _inline_copy_to_user(void __user *to, const void *from, unsigned long n)
}
return n;
}
-#ifndef INLINE_COPY_TO_USER
+
extern __must_check unsigned long
_copy_to_user(void __user *, const void *, unsigned long);
-#endif
static __always_inline unsigned long __must_check
copy_from_user(void *to, const void __user *from, unsigned long n)
{
if (!check_copy_size(to, n, false))
return n;
-#ifdef INLINE_COPY_FROM_USER
- return _inline_copy_from_user(to, from, n);
-#else
- return _copy_from_user(to, from, n);
-#endif
+ if (IS_ENABLED(ARCH_WANTS_NOINLINE_COPY_USER))
+ return _copy_from_user(to, from, n);
+ else
+ return _inline_copy_from_user(to, from, n);
}
static __always_inline unsigned long __must_check
@@ -230,11 +227,10 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
if (!check_copy_size(from, n, true))
return n;
-#ifdef INLINE_COPY_TO_USER
- return _inline_copy_to_user(to, from, n);
-#else
- return _copy_to_user(to, from, n);
-#endif
+ if (IS_ENABLED(ARCH_WANTS_NOINLINE_COPY_USER))
+ return _copy_to_user(to, from, n);
+ else
+ return _inline_copy_to_user(to, from, n);
}
#ifndef copy_mc_to_kernel
diff --git a/lib/Kconfig b/lib/Kconfig
index 00a9509636c1..a2e07d4dd2bf 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -68,6 +68,9 @@ config ARCH_HAS_STRNCPY_FROM_USER
config ARCH_HAS_STRNLEN_USER
bool
+config ARCH_WANTS_NOINLINE_COPY_USER
+ bool
+
config GENERIC_STRNCPY_FROM_USER
def_bool !ARCH_HAS_STRNCPY_FROM_USER
diff --git a/lib/Makefile b/lib/Makefile
index 7c0334d7675b..f4d577910671 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -57,9 +57,10 @@ obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \
list_sort.o uuid.o iov_iter.o clz_ctz.o \
bsearch.o find_bit.o llist.o lwq.o memweight.o kfifo.o \
percpu-refcount.o rhashtable.o base64.o \
- once.o refcount.o rcuref.o usercopy.o errseq.o bucket_locks.o \
+ once.o refcount.o rcuref.o errseq.o bucket_locks.o \
generic-radix-tree.o bitmap-str.o
obj-y += usercheck.o
+obj-$(CONFIG_ARCH_WANTS_NOINLINE_COPY_USER) += usercopy.o
obj-y += string_helpers.o
obj-y += hexdump.o
obj-$(CONFIG_TEST_HEXDUMP) += test_hexdump.o
diff --git a/lib/usercopy.c b/lib/usercopy.c
index 7a93f56d81dd..d2deb4b0a3c5 100644
--- a/lib/usercopy.c
+++ b/lib/usercopy.c
@@ -4,18 +4,14 @@
/* out-of-line parts */
-#if !defined(INLINE_COPY_FROM_USER)
unsigned long _copy_from_user(void *to, const void __user *from, unsigned long n)
{
return _inline_copy_from_user(to, from, n);
}
EXPORT_SYMBOL(_copy_from_user);
-#endif
-#if !defined(INLINE_COPY_TO_USER)
unsigned long _copy_to_user(void __user *to, const void *from, unsigned long n)
{
return _inline_copy_to_user(to, from, n);
}
EXPORT_SYMBOL(_copy_to_user);
-#endif
diff --git a/rust/helpers/uaccess.c b/rust/helpers/uaccess.c
index d9625b9ee046..01de4fbbcc84 100644
--- a/rust/helpers/uaccess.c
+++ b/rust/helpers/uaccess.c
@@ -14,7 +14,7 @@ rust_helper_copy_to_user(void __user *to, const void *from, unsigned long n)
return copy_to_user(to, from, n);
}
-#ifdef INLINE_COPY_FROM_USER
+#ifndef CONFIG_ARCH_WANTS_NOINLINE_COPY_USER
__rust_helper
unsigned long rust_helper__copy_from_user(void *to, const void __user *from, unsigned long n)
{
--
2.49.0
^ permalink raw reply related
* [RFC PATCH v1 3/9] x86/umip: Be stricter in fixup_umip_exception()
From: Christophe Leroy (CS GROUP) @ 2026-04-27 17:13 UTC (permalink / raw)
To: Yury Norov, Andrew Morton, Linus Torvalds, David Laight,
Thomas Gleixner
Cc: Christophe Leroy (CS GROUP), linux-alpha, linux-kernel,
linux-snps-arc, linux-arm-kernel, linux-mips, linuxppc-dev, kvm,
linux-riscv, linux-s390, sparclinux, linux-um, dmaengine,
linux-efi, linux-fsi, amd-gfx, dri-devel, intel-gfx, linux-wpan,
netdev, linux-wireless, linux-spi, linux-media, linux-staging,
linux-serial, linux-usb, xen-devel, linux-fsdevel, ocfs2-devel,
bpf, kasan-dev, linux-mm, linux-x25, rust-for-linux, linux-sound,
sound-open-firmware, linux-csky, linux-hexagon, loongarch,
linux-m68k, linux-openrisc, linux-parisc, linux-sh, linux-arch
In-Reply-To: <cover.1777306795.git.chleroy@kernel.org>
fixup_umip_exception() calls copy_to_user() and checks whether
the returned value is strictly positive.
A subsequent patch will change the return of copy_to_user() to
return -EFAULT in case of error.
Change the test to checking that the result is not 0.
At the time being copy_to_user() return an unsigned value so
'strictly positive' is the same as 'not 0'.
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
---
arch/x86/kernel/umip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/umip.c b/arch/x86/kernel/umip.c
index 3ce99cbcf187..dfff28ea1dea 100644
--- a/arch/x86/kernel/umip.c
+++ b/arch/x86/kernel/umip.c
@@ -409,7 +409,7 @@ bool fixup_umip_exception(struct pt_regs *regs)
return false;
nr_copied = copy_to_user(uaddr, dummy_data, dummy_data_size);
- if (nr_copied > 0) {
+ if (nr_copied) {
/*
* If copy fails, send a signal and tell caller that
* fault was fixed up.
--
2.49.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox