Linux Documentation
 help / color / mirror / Atom feed
* Re: [PATCH v3 1/2] dt-bindings: iio: dac: Add AD5529R
From: Nuno Sá @ 2026-06-22  9:07 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Jonathan Cameron, Janani Sunil, Rodrigo Alencar, Janani Sunil,
	Lars-Peter Clausen, Michael Hennerich, David Lechner,
	Nuno Sá, Andy Shevchenko, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Jonathan Corbet, Shuah Khan,
	linux-iio, devicetree, linux-kernel, linux-doc, Mark Brown
In-Reply-To: <20260621-nutmeg-coauthor-715189372230@spud>

On Sun, Jun 21, 2026 at 07:35:42PM +0100, Conor Dooley wrote:
> On Sun, Jun 21, 2026 at 03:33:40PM +0100, Jonathan Cameron wrote:
> > On Fri, 19 Jun 2026 16:54:11 +0100
> > Nuno Sá <noname.nuno@gmail.com> wrote:
> > 
> > > On Fri, Jun 19, 2026 at 03:12:07PM +0100, Conor Dooley wrote:
> > > > On Fri, Jun 19, 2026 at 02:01:08PM +0100, Nuno Sá wrote:  
> > > > > On Fri, Jun 19, 2026 at 12:40:54PM +0100, Conor Dooley wrote:  
> > > > > > On Fri, Jun 19, 2026 at 12:36:55PM +0100, Conor Dooley wrote:  
> > > > > > > On Fri, Jun 19, 2026 at 12:33:11PM +0200, Janani Sunil wrote:  
> > > > > > > > 
> > > > > > > > On 6/14/26 21:44, Jonathan Cameron wrote:  
> > > > > > > > > On Tue, 9 Jun 2026 16:47:23 +0200
> > > > > > > > > Janani Sunil <jan.sun97@gmail.com> wrote:
> > > > > > > > >   
> > > > > > > > > > On 5/26/26 15:11, Rodrigo Alencar wrote:  
> > > > > > > > > > > On 26/05/19 05:42PM, Janani Sunil wrote:  
> > > > > > > > > > > > Devicetree bindings for AD5529R 16 channel 12/16 bit high voltage,
> > > > > > > > > > > > buffered voltage output digital-to-analog converter (DAC) with an
> > > > > > > > > > > > integrated precision reference.  
> > > > > > > > > > > ...
> > > > > > > > > > > Probably others may comment on that, but...
> > > > > > > > > > > 
> > > > > > > > > > > This parent node may support device addressing for multi-device support through
> > > > > > > > > > > those ID pins. I suppose that each device may have its own power supplies or
> > > > > > > > > > > other resources like the toggle pins or reset and enable.
> > > > > > > > > > > 
> > > > > > > > > > > That way I suppose that an example would look like...  
> > > > > > > > > > > > +
> > > > > > > > > > > > +patternProperties:
> > > > > > > > > > > > +  "^channel@([0-9]|1[0-5])$":
> > > > > > > > > > > > +    type: object
> > > > > > > > > > > > +    description: Child nodes for individual channel configuration
> > > > > > > > > > > > +
> > > > > > > > > > > > +    properties:
> > > > > > > > > > > > +      reg:
> > > > > > > > > > > > +        description: Channel number.
> > > > > > > > > > > > +        minimum: 0
> > > > > > > > > > > > +        maximum: 15
> > > > > > > > > > > > +
> > > > > > > > > > > > +      adi,output-range-microvolt:
> > > > > > > > > > > > +        description: |
> > > > > > > > > > > > +          Output voltage range for this channel as [min, max] in microvolts.
> > > > > > > > > > > > +          If not specified, defaults to 0V to 5V range.
> > > > > > > > > > > > +        oneOf:
> > > > > > > > > > > > +          - items:
> > > > > > > > > > > > +              - const: 0
> > > > > > > > > > > > +              - enum: [5000000, 10000000, 20000000, 40000000]
> > > > > > > > > > > > +          - items:
> > > > > > > > > > > > +              - const: -5000000
> > > > > > > > > > > > +              - const: 5000000
> > > > > > > > > > > > +          - items:
> > > > > > > > > > > > +              - const: -10000000
> > > > > > > > > > > > +              - const: 10000000
> > > > > > > > > > > > +          - items:
> > > > > > > > > > > > +              - const: -15000000
> > > > > > > > > > > > +              - const: 15000000
> > > > > > > > > > > > +          - items:
> > > > > > > > > > > > +              - const: -20000000
> > > > > > > > > > > > +              - const: 20000000
> > > > > > > > > > > > +
> > > > > > > > > > > > +    required:
> > > > > > > > > > > > +      - reg
> > > > > > > > > > > > +
> > > > > > > > > > > > +    additionalProperties: false
> > > > > > > > > > > > +
> > > > > > > > > > > > +required:
> > > > > > > > > > > > +  - compatible
> > > > > > > > > > > > +  - reg
> > > > > > > > > > > > +  - vdd-supply
> > > > > > > > > > > > +  - avdd-supply
> > > > > > > > > > > > +  - hvdd-supply
> > > > > > > > > > > > +
> > > > > > > > > > > > +dependencies:
> > > > > > > > > > > > +  spi-cpha: [ spi-cpol ]
> > > > > > > > > > > > +  spi-cpol: [ spi-cpha ]
> > > > > > > > > > > > +
> > > > > > > > > > > > +allOf:
> > > > > > > > > > > > +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> > > > > > > > > > > > +
> > > > > > > > > > > > +unevaluatedProperties: false
> > > > > > > > > > > > +
> > > > > > > > > > > > +examples:
> > > > > > > > > > > > +  - |
> > > > > > > > > > > > +    #include <dt-bindings/gpio/gpio.h>
> > > > > > > > > > > > +
> > > > > > > > > > > > +    spi {
> > > > > > > > > > > > +        #address-cells = <1>;
> > > > > > > > > > > > +        #size-cells = <0>;
> > > > > > > > > > > > +
> > > > > > > > > > > > +        dac@0 {
> > > > > > > > > > > > +            compatible = "adi,ad5529r-16";
> > > > > > > > > > > > +            reg = <0>;
> > > > > > > > > > > > +            spi-max-frequency = <25000000>;
> > > > > > > > > > > > +
> > > > > > > > > > > > +            vdd-supply = <&vdd_regulator>;
> > > > > > > > > > > > +            avdd-supply = <&avdd_regulator>;
> > > > > > > > > > > > +            hvdd-supply = <&hvdd_regulator>;
> > > > > > > > > > > > +            hvss-supply = <&hvss_regulator>;
> > > > > > > > > > > > +
> > > > > > > > > > > > +            reset-gpios = <&gpio0 87 GPIO_ACTIVE_LOW>;
> > > > > > > > > > > > +
> > > > > > > > > > > > +            #address-cells = <1>;
> > > > > > > > > > > > +            #size-cells = <0>;
> > > > > > > > > > > > +
> > > > > > > > > > > > +            channel@0 {
> > > > > > > > > > > > +                reg = <0>;
> > > > > > > > > > > > +                adi,output-range-microvolt = <0 5000000>;
> > > > > > > > > > > > +            };
> > > > > > > > > > > > +
> > > > > > > > > > > > +            channel@1 {
> > > > > > > > > > > > +                reg = <1>;
> > > > > > > > > > > > +                adi,output-range-microvolt = <(-10000000) 10000000>;
> > > > > > > > > > > > +            };
> > > > > > > > > > > > +
> > > > > > > > > > > > +            channel@2 {
> > > > > > > > > > > > +                reg = <2>;
> > > > > > > > > > > > +                adi,output-range-microvolt = <0 40000000>;
> > > > > > > > > > > > +            };
> > > > > > > > > > > > +        };
> > > > > > > > > > > > +    };  
> > > > > > > > > > > ...
> > > > > > > > > > > 
> > > > > > > > > > > 	spi {
> > > > > > > > > > > 		#address-cells = <1>;
> > > > > > > > > > > 		#size-cells = <0>;
> > > > > > > > > > > 
> > > > > > > > > > > 		multi-dac@0 {
> > > > > > > > > > > 			compatible = "adi,ad5529r-16";
> > > > > > > > > > > 			reg = <0>;
> > > > > > > > > > > 			spi-max-frequency = <25000000>;
> > > > > > > > > > > 
> > > > > > > > > > > 			#address-cells = <1>;
> > > > > > > > > > > 			#size-cells = <0>;
> > > > > > > > > > > 
> > > > > > > > > > > 			dac@0 {
> > > > > > > > > > > 				reg = <0>;
> > > > > > > > > > > 				vdd-supply = <&vdd_regulator>;
> > > > > > > > > > > 				avdd-supply = <&avdd_regulator>;
> > > > > > > > > > > 				hvdd-supply = <&hvdd_regulator>;
> > > > > > > > > > > 				hvss-supply = <&hvss_regulator>;
> > > > > > > > > > > 
> > > > > > > > > > > 				reset-gpios = <&gpio0 87 GPIO_ACTIVE_LOW>;
> > > > > > > > > > > 
> > > > > > > > > > > 				#address-cells = <1>;
> > > > > > > > > > > 				#size-cells = <0>;
> > > > > > > > > > > 
> > > > > > > > > > > 				channel@0 {
> > > > > > > > > > > 					reg = <0>;
> > > > > > > > > > > 					adi,output-range-microvolt = <0 5000000>;
> > > > > > > > > > > 				};
> > > > > > > > > > > 
> > > > > > > > > > > 				channel@1 {
> > > > > > > > > > > 					reg = <1>;
> > > > > > > > > > > 					adi,output-range-microvolt = <(-10000000) 10000000>;
> > > > > > > > > > > 				};
> > > > > > > > > > > 
> > > > > > > > > > > 				channel@2 {
> > > > > > > > > > > 					reg = <2>;
> > > > > > > > > > > 					adi,output-range-microvolt = <0 40000000>;
> > > > > > > > > > > 				};
> > > > > > > > > > > 			}
> > > > > > > > > > > 
> > > > > > > > > > > 			dac@1 {
> > > > > > > > > > > 				reg = <1>;
> > > > > > > > > > > 				vdd-supply = <&vdd_regulator>;
> > > > > > > > > > > 				avdd-supply = <&avdd_regulator>;
> > > > > > > > > > > 				hvdd-supply = <&hvdd_regulator>;
> > > > > > > > > > > 				hvss-supply = <&hvss_regulator>;
> > > > > > > > > > > 
> > > > > > > > > > > 				reset-gpios = <&gpio0 88 GPIO_ACTIVE_LOW>;
> > > > > > > > > > > 
> > > > > > > > > > > 				#address-cells = <1>;
> > > > > > > > > > > 				#size-cells = <0>;
> > > > > > > > > > > 
> > > > > > > > > > > 				channel@0 {
> > > > > > > > > > > 					reg = <0>;
> > > > > > > > > > > 					adi,output-range-microvolt = <0 5000000>;
> > > > > > > > > > > 				};
> > > > > > > > > > > 
> > > > > > > > > > > 				channel@1 {
> > > > > > > > > > > 					reg = <1>;
> > > > > > > > > > > 					adi,output-range-microvolt = <(-10000000) 10000000>;
> > > > > > > > > > > 				};
> > > > > > > > > > > 			}
> > > > > > > > > > > 		};
> > > > > > > > > > > 	};
> > > > > > > > > > > 
> > > > > > > > > > > then you might need something like:
> > > > > > > > > > > 
> > > > > > > > > > > 	patternProperties:
> > > > > > > > > > > 		"^dac@[0-3]$":
> > > > > > > > > > > 
> > > > > > > > > > > and put most of the things under this node pattern.
> > > > > > > > > > > 
> > > > > > > > > > > So the main driver that you're putting together might need to handle up to four instances.
> > > > > > > > > > > Even if your current driver cannot handle this, the dt-bindings might need cover that.
> > > > > > > > > > > 
> > > > > > > > > > > Need to double check if each dac node needs a separate compatible, so you would maybe populate
> > > > > > > > > > > a platform data to be shared with the child nodes, which would be a separate driver.
> > > > > > > > > > > (not sure if it would make sense to mix and match ad5529r-16 and ad5529r-12).  
> > > > > > > > > > Hi Rodrigo,
> > > > > > > > > > 
> > > > > > > > > > Thank you for looking at this.
> > > > > > > > > > 
> > > > > > > > > > For now, I would prefer to keep the binding scoped to a single AD5529R device instance. The current
> > > > > > > > > > hardware/use case we have only needs one device node and the driver is written around that model as well.
> > > > > > > > > > While the device addressing pins could allow multi-device topology, we do not have an actual platform using
> > > > > > > > > > that configuration at the moment, so I would prefer not to introduce an extra parent/child binding structure
> > > > > > > > > > speculatively without a validating use case.  
> > > > > > > > > Interesting feature - kind of similar to address control on a typical i2c bus device, or
> > > > > > > > > looking at it another way a kind of distributed SPI mux.
> > > > > > > > > 
> > > > > > > > > Challenge of a binding is we need to anticipate the future.  So I think we do need something
> > > > > > > > > like Rodrigo is suggesting even if we only (for now) support a single instance in the driver.
> > > > > > > > > That would leave the path open to supporting the addressing at a later date.
> > > > > > > > > An alternative might be to look at it like a chained device setup. In those we pretend there
> > > > > > > > > is just one device with a lot of channels etc.  The snag is that here things are more loosely
> > > > > > > > > coupled whereas for those devices it tends to be you have to read / write the same register
> > > > > > > > > in all devices in the chain as one big SPI message.
> > > > > > > > > 
> > > > > > > > > +CC Mark Brown as he may know of some precedence for this feature. For his reference..
> > > > > > > > > - Each of these device has 2 ID pins.  The SPI transfers have to contain the 2 bit
> > > > > > > > > value that matches that or they are ignored.  Thus a single bus + 1 chip select can
> > > > > > > > > be used to talk to 4 devices.  Question is what that looks like in device tree + I guess
> > > > > > > > > longer term how to support it cleanly in SPI.  
> > > > > > > 
> > > > > > > I'd swear I have seen this before, from some Microchip devices. Let me
> > > > > > > see if I can find what I am thinking of...  
> > > > > > 
> > > > > > 
> > > > > > microchip,mcp3911 and microchip,mcp3564 both seem to do this with
> > > > > > slightly different properties.
> > > > > > 
> > > > > >   microchip,device-addr:
> > > > > >     description: Device address when multiple MCP3911 chips are present on the same SPI bus.
> > > > > >     $ref: /schemas/types.yaml#/definitions/uint32
> > > > > >     enum: [0, 1, 2, 3]
> > > > > >     default: 0
> > > > > > 
> > > > > > and
> > > > > > 
> > > > > > 
> > > > > >   microchip,hw-device-address:
> > > > > >     $ref: /schemas/types.yaml#/definitions/uint32
> > > > > >     minimum: 0
> > > > > >     maximum: 3
> > > > > >     description:
> > > > > >       The address is set on a per-device basis by fuses in the factory,
> > > > > >       configured on request. If not requested, the fuses are set for 0x1.
> > > > > >       The device address is part of the device markings to avoid
> > > > > >       potential confusion. This address is coded on two bits, so four possible
> > > > > >       addresses are available when multiple devices are present on the same
> > > > > >       SPI bus with only one Chip Select line for all devices.
> > > > > >       Each device communication starts by a CS falling edge, followed by the
> > > > > >       clocking of the device address (BITS[7:6] - top two bits of COMMAND BYTE
> > > > > >       which is first one on the wire).
> > > > > > 
> > > > > > This sounds exactly like the sort of feature that you're dealing with
> > > > > > here?
> > > > > >   
> > > > > 
> > > > > The core idea yes but for this chip, things are a bit more annoying (but
> > > > > Janani can correct me if I'm wrong). Here, each device can, in theory,
> > > > > have it's own supplies, pins and at the very least, channels with maybe
> > > > > different scales. That is why Janani is proposing dac nodes. Given I
> > > > > honestly don't like much of that "adi,ad5529r-bus" compatible I wondered
> > > > > about solving this at the spi level.
> > > > > 
> > > > > Ah and to make it more annoying, we can also mix 12 and 16 bits variants
> > > > > together in the same bus.  
> > > > 
> > > > I'm definitely missing something, because that property for the
> > > > microchip devices is not impacted what else is on the bus. AFAICT, you
> > > > could have an mcp3911 and an mcp3564 on the same bus even though both
> > > > are completely different devices with different drivers. They have
> > > > individual device nodes and their own supplies etc etc. These aren't
> > > > per-channel properties on an adc or dac, they're per child device on a
> > > > spi bus.  
> > > 
> > > Maybe I'm the one missing something :). IIRC, spi would not allow two
> > > devices on the same CS right? Because for this chip we would need
> > > something like:
> > > 
> > > spi {
> > > 	dac@0 {
> > > 		reg = <0>;
> > > 		adi,pin-id = <0>;
> > > 	};
> > > 
> > > 	dac@1 {
> > > 		reg = <0>; // which seems already problematic?
> > > 		adi,pin-id <1>;
> > > 	};
> > > 
> > > 	...
> > > 
> > > 	//up to 4
> > > };
> > Yeah. It's not clear to me how that works for the microchip devices
> > (I suspect it doesn't!)
> > 
> > Just thinking as I type, but could we do something a bit nasty with
> > a gpio mux that doesn't actually switch but represents the GPIO being
> > shared?  Given this is all tied to the spi bus that should all happen
> > under serializing locks. 
> > 
> > Agreed though that this would be nicer as an SPI thing that let
> > us specify that a single CS is share by multiple devices and their
> > is some other signal acting to select which one we are talking to.
> 
> Whether it works or not, I think it is the more correct approach. Messing
> with gpio muxes seems completely wrong, given the chip select may not be
> a gpio at all.
> 
> Why do you think the microchip devices won't work? Does the spi core
> reject multiple devices with the same chip select being registered or
> something like that?

Not sure how things work atm. But I'm fairly sure it used to be like
that. SPI would reject devices on the same controller and CS. Now that
we support more than one CS per controller, not sure how things work. 

Janani, maybe you can give it a try?

- Nuno Sá


^ permalink raw reply

* Re: [PATCH 0/2] tracing: Move trace_printk.h out of kernel.h
From: Peter Zijlstra @ 2026-06-22  8:34 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, linux-trace-kernel, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, Andrew Morton, Linus Torvalds,
	Sebastian Andrzej Siewior, John Ogness, Thomas Gleixner,
	Julia Lawall, Yury Norov, linux-doc, linux-kbuild, linuxppc-dev,
	dri-devel, linux-stm32, linux-arm-kernel, linux-rdma, linux-usb,
	linux-ext4, linux-nfs, kvm, intel-gfx
In-Reply-To: <20260621093430.264983361@kernel.org>

On Sun, Jun 21, 2026 at 05:34:30AM -0400, Steven Rostedt wrote:
> There's been complaints about trace_printk() being defined in kernel.h as it
> can increase the compilation time. As it is only used by some developers for
> debugging purposes, it should not be in kernel.h causing lots of wasted CPU
> cycles for those that do not ever care about it.
> 
> Instead, add a CONFIG_TRACE_PRINTK_DEBUGGING option that developers that do
> use it can set and not have to always remember to add #include <linux/trace_printk.h>
> to the files they add trace_printk() while debugging. It also means that
> those that do not have that config set will not have to worry about wasted
> CPU cycles as it is only include in the CFLAGS when the option is set, and
> its completely ignored otherwise.

Did you forget your C 101 class? If you use a function, you gotta
include the relevant header.

You don't see userspace saying: 'Hey, you know what, perhaps we should
add stdio.h to every other header, just in case someone wants to
printf()' either.

I really don't understand your argument. Yes, maybe someone will forget
and then either their editor (if they have a halfway modern setup with
LSP enabled) or their build will complain, but so what? This is all
trivial stuff, surely we have more pressing matters to concern outselves
with?

^ permalink raw reply

* Re: [PATCH 0/2] tracing: Move trace_printk.h out of kernel.h
From: Steven Rostedt @ 2026-06-22  8:53 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, linux-trace-kernel, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, Andrew Morton, Linus Torvalds,
	Sebastian Andrzej Siewior, John Ogness, Thomas Gleixner,
	Julia Lawall, Yury Norov, linux-doc, linux-kbuild, linuxppc-dev,
	dri-devel, linux-stm32, linux-arm-kernel, linux-rdma, linux-usb,
	linux-ext4, linux-nfs, kvm, intel-gfx
In-Reply-To: <20260622083440.GX49951@noisy.programming.kicks-ass.net>

On Mon, 22 Jun 2026 10:34:40 +0200
Peter Zijlstra <peterz@infradead.org> wrote:

> Did you forget your C 101 class? If you use a function, you gotta
> include the relevant header.

If this was the way it was back in 2009, yeah sure. But the header
wasn't need for 17 years. Now it suddenly will be.

-- Steve

^ permalink raw reply

* [PATCH v2 3/3] watchdog: npcm: add bootstatus support
From: Tomer Maimon @ 2026-06-22  8:30 UTC (permalink / raw)
  To: andrew, wim, linux, robh, krzk+dt, conor+dt
  Cc: openbmc, linux-watchdog, linux-doc, devicetree, linux-kernel,
	avifishman70, tmaimon77, tali.perry1, venture, yuenn,
	benjaminfair, corbet, skhan, joel
In-Reply-To: <20260622083046.3189603-1-tmaimon77@gmail.com>

The NPCM750 uses RESSR and the NPCM845 uses INTCR2 to latch reset
indications. Read those bits during probe and map them into watchdog
bootstatus flags.

For NPCM845, cache the sampled INTCR2 state in SCRPAD10 after the reset
status bits are cleared so later probes can report the same boot-time
state. Also report WDIOF_CARDRESET for the watchdog instance whose reset
bit is latched, while leaving WPCM450 behavior unchanged.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
 drivers/watchdog/npcm_wdt.c | 197 +++++++++++++++++++++++++++++++++++-
 1 file changed, 195 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index e62ea054bc61..98660419ec3f 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -7,14 +7,51 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/watchdog.h>
 
 #define NPCM_WTCR	0x1C
 
+/* NPCM GCR module */
+#define NPCM_RESSR_OFFSET		0x6C
+#define NPCM_INTCR2_OFFSET		0x60
+#define NPCM8XX_SCRPAD10_OFFSET		0xE28
+
+#define NPCM_PORST			BIT(31)
+#define NPCM_CORST			BIT(30)
+#define NPCM_WD0RST			BIT(29)
+#define NPCM_SWR1RST			BIT(28)
+#define NPCM_SWR2RST			BIT(27)
+#define NPCM_SWR3RST			BIT(26)
+#define NPCM_SWR4RST			BIT(25)
+#define NPCM_WD1RST			BIT(24)
+#define NPCM_WD2RST			BIT(23)
+#define NPCM8XX_RST			(GENMASK(31, 23) | GENMASK(15, 12))
+#define NPCM8XX_TIP_RESET		BIT(25) /* Replaces SWRST4 on NPCM8xx */
+
+/* Per-instance mapping of MMIO base address to its RESSR/INTCR2 reset bit. */
+struct npcm_wdt_rst_map {
+	phys_addr_t	base;
+	u32		rst_bit;
+};
+
+struct npcm_wdt_status_map {
+	u32	rst_bit;
+	u32	wdiof_flag;
+};
+
+struct npcm_wdt_data {
+	const struct npcm_wdt_rst_map		*rst_map;
+	unsigned int				rst_map_size;
+	const struct npcm_wdt_status_map	*status_map;
+	unsigned int				status_map_size;
+};
+
 #define NPCM_WTCLK	(BIT(10) | BIT(11))	/* Clock divider */
 #define NPCM_WTE	BIT(7)			/* Enable */
 #define NPCM_WTIE	BIT(6)			/* Enable irq */
@@ -47,6 +84,50 @@ struct npcm_wdt {
 	struct clk		*clk;
 };
 
+static const struct npcm_wdt_rst_map npcm750_rst_map[] = {
+	{ 0xf000801c, NPCM_WD0RST },
+	{ 0xf000901c, NPCM_WD1RST },
+	{ 0xf000a01c, NPCM_WD2RST },
+};
+
+static const struct npcm_wdt_status_map npcm750_status_map[] = {
+	{ NPCM_PORST,	WDIOF_OVERHEAT },
+	{ NPCM_CORST,	WDIOF_FANFAULT },
+	{ NPCM_SWR1RST,	WDIOF_EXTERN1 },
+	{ NPCM_SWR2RST,	WDIOF_EXTERN2 },
+	{ NPCM_SWR3RST,	WDIOF_POWERUNDER },
+	{ NPCM_SWR4RST,	WDIOF_POWEROVER },
+};
+
+static const struct npcm_wdt_data npcm750_data = {
+	.rst_map = npcm750_rst_map,
+	.rst_map_size = ARRAY_SIZE(npcm750_rst_map),
+	.status_map = npcm750_status_map,
+	.status_map_size = ARRAY_SIZE(npcm750_status_map),
+};
+
+static const struct npcm_wdt_rst_map npcm845_rst_map[] = {
+	{ 0xf000801c, NPCM_WD0RST },
+	{ 0xf000901c, NPCM_WD1RST },
+	{ 0xf000a01c, NPCM_WD2RST },
+};
+
+static const struct npcm_wdt_status_map npcm845_status_map[] = {
+	{ NPCM_PORST,		WDIOF_OVERHEAT },
+	{ NPCM_CORST,		WDIOF_FANFAULT },
+	{ NPCM_SWR1RST,		WDIOF_EXTERN1 },
+	{ NPCM_SWR2RST,		WDIOF_EXTERN2 },
+	{ NPCM_SWR3RST,		WDIOF_POWERUNDER },
+	{ NPCM8XX_TIP_RESET,	WDIOF_POWEROVER },
+};
+
+static const struct npcm_wdt_data npcm845_data = {
+	.rst_map = npcm845_rst_map,
+	.rst_map_size = ARRAY_SIZE(npcm845_rst_map),
+	.status_map = npcm845_status_map,
+	.status_map_size = ARRAY_SIZE(npcm845_status_map),
+};
+
 static inline struct npcm_wdt *to_npcm_wdt(struct watchdog_device *wdd)
 {
 	return container_of(wdd, struct npcm_wdt, wdd);
@@ -169,6 +250,92 @@ static bool npcm_is_running(struct watchdog_device *wdd)
 	return readl(wdt->reg) & NPCM_WTE;
 }
 
+static void npcm_get_reset_status(struct npcm_wdt *wdt, struct device *dev,
+				  const struct npcm_wdt_data *data,
+				  resource_size_t start)
+{
+	struct regmap *gcr_regmap;
+	u32 rstval = 0;
+	unsigned int i;
+	int ret;
+
+	if (!data)
+		return;
+
+	gcr_regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
+						     "nuvoton,sysgcr");
+	if (IS_ERR(gcr_regmap)) {
+		dev_warn(dev,
+			 "Failed to find nuvoton,sysgcr, WD reset status not supported\n");
+		return;
+	}
+
+	if (of_device_is_compatible(dev->of_node, "nuvoton,npcm845-wdt")) {
+		ret = regmap_read(gcr_regmap, NPCM_INTCR2_OFFSET, &rstval);
+		if (ret) {
+			dev_warn(dev, "Failed to read INTCR2 reset status: %d\n",
+				 ret);
+			return;
+		}
+
+		if (rstval & NPCM8XX_RST) {
+			ret = regmap_write(gcr_regmap, NPCM_INTCR2_OFFSET,
+					   rstval & ~NPCM8XX_RST);
+			if (ret) {
+				dev_warn(dev,
+					 "Failed to clear INTCR2 reset status: %d\n",
+					 ret);
+				return;
+			}
+
+			ret = regmap_write(gcr_regmap, NPCM8XX_SCRPAD10_OFFSET,
+					   rstval);
+			if (ret) {
+				dev_warn(dev,
+					 "Failed to cache reset status in SCRPAD10: %d\n",
+					 ret);
+				return;
+			}
+		} else {
+			ret = regmap_read(gcr_regmap, NPCM8XX_SCRPAD10_OFFSET,
+					  &rstval);
+			if (ret) {
+				dev_warn(dev,
+					 "Failed to read cached reset status from SCRPAD10: %d\n",
+					 ret);
+				return;
+			}
+		}
+	} else if (of_device_is_compatible(dev->of_node, "nuvoton,npcm750-wdt")) {
+		ret = regmap_read(gcr_regmap, NPCM_RESSR_OFFSET, &rstval);
+		if (ret) {
+			dev_warn(dev, "Failed to read RESSR reset status: %d\n",
+				 ret);
+			return;
+		}
+
+		ret = regmap_write(gcr_regmap, NPCM_RESSR_OFFSET, rstval);
+		if (ret) {
+			dev_warn(dev, "Failed to clear RESSR reset status: %d\n",
+				 ret);
+			return;
+		}
+	}
+
+	for (i = 0; i < data->status_map_size; i++) {
+		if (rstval & data->status_map[i].rst_bit)
+			wdt->wdd.bootstatus |= data->status_map[i].wdiof_flag;
+	}
+
+	for (i = 0; i < data->rst_map_size; i++) {
+		if (data->rst_map[i].base == start &&
+		    rstval & data->rst_map[i].rst_bit) {
+			wdt->wdd.bootstatus |= WDIOF_CARDRESET;
+			break;
+		}
+	}
+}
+
 static const struct watchdog_info npcm_wdt_info = {
 	.identity	= KBUILD_MODNAME,
 	.options	= WDIOF_SETTIMEOUT
@@ -176,6 +343,20 @@ static const struct watchdog_info npcm_wdt_info = {
 			| WDIOF_MAGICCLOSE,
 };
 
+static const struct watchdog_info npcm_wdt_rst_info = {
+	.identity	= KBUILD_MODNAME,
+	.options	= WDIOF_SETTIMEOUT
+			| WDIOF_KEEPALIVEPING
+			| WDIOF_MAGICCLOSE
+			| WDIOF_CARDRESET
+			| WDIOF_OVERHEAT
+			| WDIOF_FANFAULT
+			| WDIOF_EXTERN1
+			| WDIOF_EXTERN2
+			| WDIOF_POWERUNDER
+			| WDIOF_POWEROVER,
+};
+
 static const struct watchdog_ops npcm_wdt_ops = {
 	.owner = THIS_MODULE,
 	.start = npcm_wdt_start,
@@ -188,7 +369,10 @@ static const struct watchdog_ops npcm_wdt_ops = {
 static int npcm_wdt_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	const struct npcm_wdt_data *data = device_get_match_data(dev);
+	struct resource *res;
 	struct npcm_wdt *wdt;
+	resource_size_t start;
 	int irq;
 	int ret;
 
@@ -196,10 +380,16 @@ static int npcm_wdt_probe(struct platform_device *pdev)
 	if (!wdt)
 		return -ENOMEM;
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+
 	wdt->reg = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(wdt->reg))
 		return PTR_ERR(wdt->reg);
 
+	start = res->start;
+
 	wdt->clk = devm_clk_get_optional(&pdev->dev, NULL);
 	if (IS_ERR(wdt->clk))
 		return PTR_ERR(wdt->clk);
@@ -208,7 +398,7 @@ static int npcm_wdt_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	wdt->wdd.info = &npcm_wdt_info;
+	wdt->wdd.info = data ? &npcm_wdt_rst_info : &npcm_wdt_info;
 	wdt->wdd.ops = &npcm_wdt_ops;
 	wdt->wdd.min_timeout = 1;
 	wdt->wdd.max_timeout = 2750;
@@ -220,6 +410,8 @@ static int npcm_wdt_probe(struct platform_device *pdev)
 	/* Ensure timeout is able to be represented by the hardware */
 	npcm_wdt_set_timeout(&wdt->wdd, wdt->wdd.timeout);
 
+	npcm_get_reset_status(wdt, dev, data, start);
+
 	if (npcm_is_running(&wdt->wdd)) {
 		/* Restart with the default or device-tree specified timeout */
 		npcm_wdt_start(&wdt->wdd);
@@ -243,7 +435,8 @@ static int npcm_wdt_probe(struct platform_device *pdev)
 #ifdef CONFIG_OF
 static const struct of_device_id npcm_wdt_match[] = {
 	{.compatible = "nuvoton,wpcm450-wdt"},
-	{.compatible = "nuvoton,npcm750-wdt"},
+	{.compatible = "nuvoton,npcm750-wdt", .data = &npcm750_data},
+	{.compatible = "nuvoton,npcm845-wdt", .data = &npcm845_data},
 	{},
 };
 MODULE_DEVICE_TABLE(of, npcm_wdt_match);
-- 
2.34.1


^ permalink raw reply related

* [PATCH v2 2/3] docs: watchdog: npcm: Add reset status description
From: Tomer Maimon @ 2026-06-22  8:30 UTC (permalink / raw)
  To: andrew, wim, linux, robh, krzk+dt, conor+dt
  Cc: openbmc, linux-watchdog, linux-doc, devicetree, linux-kernel,
	avifishman70, tmaimon77, tali.perry1, venture, yuenn,
	benjaminfair, corbet, skhan, joel
In-Reply-To: <20260622083046.3189603-1-tmaimon77@gmail.com>

Add documentation describing how the NPCM watchdog driver reports reset
causes through bootstatus on NPCM750 and NPCM845 systems.

Document the reset flag mapping, the watchdog instance mapping for
WDIOF_CARDRESET, and the NPCM750/NPCM845 latch handling. Also mention
sysfs bootstatus reporting when watchdog sysfs support is enabled.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
 Documentation/watchdog/index.rst    |  1 +
 Documentation/watchdog/npcm_wdt.rst | 70 +++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)
 create mode 100644 Documentation/watchdog/npcm_wdt.rst

diff --git a/Documentation/watchdog/index.rst b/Documentation/watchdog/index.rst
index 1cea24681e6b..ef29e861e837 100644
--- a/Documentation/watchdog/index.rst
+++ b/Documentation/watchdog/index.rst
@@ -9,6 +9,7 @@ Watchdog Support
 
     hpwdt
     mlx-wdt
+    npcm_wdt
     pcwd-watchdog
     watchdog-api
     watchdog-kernel-api
diff --git a/Documentation/watchdog/npcm_wdt.rst b/Documentation/watchdog/npcm_wdt.rst
new file mode 100644
index 000000000000..48f0c7920c11
--- /dev/null
+++ b/Documentation/watchdog/npcm_wdt.rst
@@ -0,0 +1,70 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=============
+NPCM Watchdog
+=============
+
+The NPCM watchdog driver can report reset-cause information on
+``nuvoton,npcm750-wdt`` and ``nuvoton,npcm845-wdt`` systems.
+
+Userspace can read the latched reset cause through
+``WDIOC_GETBOOTSTATUS``. When ``CONFIG_WATCHDOG_SYSFS`` is enabled, the
+same value is also visible through ``/sys/class/watchdog/watchdogN/bootstatus``.
+
+The mapping is fixed in the driver. It exposes the SoC reset indications
+through the generic watchdog bootstatus flags and is not configurable from
+Device Tree.
+
+.. list-table:: Reset-cause mapping
+   :header-rows: 1
+
+   * - Platform
+     - Reset indication
+     - Bootstatus flag
+     - Reported meaning
+   * - NPCM750 and NPCM845
+     - ``PORST``
+     - ``WDIOF_OVERHEAT``
+     - power-on reset
+   * - NPCM750 and NPCM845
+     - ``CORST``
+     - ``WDIOF_FANFAULT``
+     - core reset
+   * - NPCM750 and NPCM845
+     - ``SWR1RST``
+     - ``WDIOF_EXTERN1``
+     - software reset source 1
+   * - NPCM750 and NPCM845
+     - ``SWR2RST``
+     - ``WDIOF_EXTERN2``
+     - software reset source 2
+   * - NPCM750 and NPCM845
+     - ``SWR3RST``
+     - ``WDIOF_POWERUNDER``
+     - software reset source 3
+   * - NPCM750
+     - ``SWR4RST``
+     - ``WDIOF_POWEROVER``
+     - software reset source 4
+   * - NPCM845
+     - ``TIP reset`` (``INTCR2[25]``)
+     - ``WDIOF_POWEROVER``
+     - TIP reset
+
+``WDIOF_CARDRESET`` is reported only for the watchdog instance whose own
+reset-status bit is latched. On systems with three watchdog instances, this
+maps ``WD0RST``, ``WD1RST``, and ``WD2RST`` to ``watchdog0``, ``watchdog1``,
+and ``watchdog2`` respectively.
+
+The driver may report ``WDIOF_CARDRESET`` together with one or more of the
+reset-cause flags listed above.
+
+On NPCM750, the driver samples ``RESSR`` and clears the latched reset bits
+after reading them.
+
+On NPCM845, the driver samples ``INTCR2``. When reset bits are still latched,
+it clears them and stores the sampled value in ``SCRPAD10`` so later watchdog
+probes can report the same boot-time state.
+
+The WPCM450 watchdog continues to operate without this reset-indication
+mapping.
-- 
2.34.1


^ permalink raw reply related

* [PATCH v2 1/3] dt-bindings: watchdog: npcm: add GCR syscon property
From: Tomer Maimon @ 2026-06-22  8:30 UTC (permalink / raw)
  To: andrew, wim, linux, robh, krzk+dt, conor+dt
  Cc: openbmc, linux-watchdog, linux-doc, devicetree, linux-kernel,
	avifishman70, tmaimon77, tali.perry1, venture, yuenn,
	benjaminfair, corbet, skhan, joel
In-Reply-To: <20260622083046.3189603-1-tmaimon77@gmail.com>

Describe syscon property that handles general control registers (GCR) in
Nuvoton BMC NPCM watchdog driver.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
 .../devicetree/bindings/watchdog/nuvoton,npcm750-wdt.yaml   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/nuvoton,npcm750-wdt.yaml b/Documentation/devicetree/bindings/watchdog/nuvoton,npcm750-wdt.yaml
index 7aa30f5b5c49..4f00f099b2d2 100644
--- a/Documentation/devicetree/bindings/watchdog/nuvoton,npcm750-wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/nuvoton,npcm750-wdt.yaml
@@ -40,6 +40,12 @@ properties:
   clock-frequency:
     description: Frequency in Hz of the clock that drives the NPCM timer.
 
+  nuvoton,sysgcr:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      a phandle to access GCR registers on NPCM750 and NPCM845 watchdog
+      instances.
+
 required:
   - compatible
   - reg
-- 
2.34.1


^ permalink raw reply related

* [PATCH v2 0/3] watchdog: npcm: Add reset status detection support
From: Tomer Maimon @ 2026-06-22  8:30 UTC (permalink / raw)
  To: andrew, wim, linux, robh, krzk+dt, conor+dt
  Cc: openbmc, linux-watchdog, linux-doc, devicetree, linux-kernel,
	avifishman70, tmaimon77, tali.perry1, venture, yuenn,
	benjaminfair, corbet, skhan, joel

This series documents and implements reset indication reporting for the
NPCM watchdog driver on NPCM7xx and NPCM8xx systems, and documents the
optional GCR syscon property used by that support.

Patch 1 updates the watchdog binding to allow the optional
``nuvoton,sysgcr`` property used for reset-cause reporting.
Patch 2 adds watchdog documentation that describes the bootstatus
mapping.
Patch 3 reads the SoC reset indication bits and maps them into the
existing watchdog bootstatus flags for NPCM750 and NPCM845, while
leaving WPCM450 unchanged.

Addressed comments from:
- Krzysztof Kozlowski: https://patchwork.ozlabs.org/project/openbmc/patch/20260210133843.1078463-2-tmaimon77@gmail.com/
- Guenter Roeck: https://patchwork.ozlabs.org/project/openbmc/patch/20260210133843.1078463-3-tmaimon77@gmail.com/

Changes since version 1:
- Modify reset detection handle in the watchodg.
- reword patch 1 to use the GCR syscon-property wording from the
  applied NPCM reset binding update and drop the optional property from
  the binding example.
- reword the patch subjects and commit message bodies to match current
  kernel dt-bindings, docs, and watchdog style.

Tomer Maimon (3):
  dt-bindings: watchdog: npcm: add GCR syscon property
  docs: watchdog: npcm: Add reset status description
  watchdog: npcm: add bootstatus support

 .../watchdog/nuvoton,npcm750-wdt.yaml         |   6 +
 Documentation/watchdog/index.rst              |   1 +
 Documentation/watchdog/npcm_wdt.rst           |  70 +++++++
 drivers/watchdog/npcm_wdt.c                   | 197 +++++++++++++++++-
 4 files changed, 272 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/watchdog/npcm_wdt.rst

-- 
2.34.1


^ permalink raw reply

* Re: [PATCH 0/2] tracing: Move trace_printk.h out of kernel.h
From: Christophe Leroy (CS GROUP) @ 2026-06-22  8:05 UTC (permalink / raw)
  To: Steven Rostedt, linux-kernel, linux-trace-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	Linus Torvalds, Sebastian Andrzej Siewior, John Ogness,
	Thomas Gleixner, Peter Zijlstra, Julia Lawall, Yury Norov,
	linux-doc, linux-kbuild, linuxppc-dev, dri-devel, linux-stm32,
	linux-arm-kernel, linux-rdma, linux-usb, linux-ext4, linux-nfs,
	kvm, intel-gfx
In-Reply-To: <20260621093430.264983361@kernel.org>



Le 21/06/2026 à 11:34, Steven Rostedt a écrit :
> There's been complaints about trace_printk() being defined in kernel.h as it
> can increase the compilation time. As it is only used by some developers for
> debugging purposes, it should not be in kernel.h causing lots of wasted CPU
> cycles for those that do not ever care about it.

Do we have a measurement of the increased compilation time ?

Christophe

> 
> Instead, add a CONFIG_TRACE_PRINTK_DEBUGGING option that developers that do
> use it can set and not have to always remember to add #include <linux/trace_printk.h>
> to the files they add trace_printk() while debugging. It also means that
> those that do not have that config set will not have to worry about wasted
> CPU cycles as it is only include in the CFLAGS when the option is set, and
> its completely ignored otherwise.
> 
> Steven Rostedt (2):
>        tracing: Move non-trace_printk prototypes back to kernel.h
>        tracing: Add CONFIG_TRACE_PRINTK_DEBUGGING to clean up kernel.h
> 
> ----
>   .../driver_development_debugging_guide.rst         |  2 +-
>   Makefile                                           |  5 +++++
>   arch/powerpc/kvm/book3s_xics.c                     |  1 +
>   drivers/gpu/drm/i915/gt/intel_gtt.h                |  1 +
>   drivers/gpu/drm/i915/i915_gem.h                    |  1 +
>   drivers/hwtracing/stm/dummy_stm.c                  |  4 ++++
>   drivers/infiniband/hw/hfi1/trace_dbg.h             |  1 +
>   drivers/usb/early/xhci-dbc.c                       |  1 +
>   fs/ext4/inline.c                                   |  1 +
>   include/linux/kernel.h                             | 19 ++++++++++++++++++-
>   include/linux/sunrpc/debug.h                       |  1 +
>   include/linux/trace_printk.h                       | 22 +++-------------------
>   kernel/trace/Kconfig                               | 10 ++++++++++
>   kernel/trace/ring_buffer_benchmark.c               |  1 +
>   kernel/trace/trace.h                               |  1 +
>   samples/fprobe/fprobe_example.c                    |  1 +
>   samples/ftrace/ftrace-direct-modify.c              |  1 +
>   samples/ftrace/ftrace-direct-multi-modify.c        |  1 +
>   samples/ftrace/ftrace-direct-multi.c               |  2 +-
>   samples/ftrace/ftrace-direct-too.c                 |  2 +-
>   samples/ftrace/ftrace-direct.c                     |  2 +-
>   21 files changed, 56 insertions(+), 24 deletions(-)
> 


^ permalink raw reply

* Re: [PATCH v8 23/46] KVM: TDX: Make source page optional for KVM_TDX_INIT_MEM_REGION
From: Yan Zhao @ 2026-06-22  7:18 UTC (permalink / raw)
  To: Fuad Tabba
  Cc: ackerleytng, aik, andrew.jones, binbin.wu, brauner, chao.p.peng,
	david, jmattson, jthoughton, michael.roth, oupton, pankaj.gupta,
	qperret, rick.p.edgecombe, rientjes, shivankg, steven.price,
	willy, wyihan, forkloop, pratyush, suzuki.poulose, aneesh.kumar,
	liam, Paolo Bonzini, Sean Christopherson, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
	Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
	Jonathan Corbet, Shuah Khan, Shuah Khan, Vishal Annapurve,
	Andrew Morton, Chris Li, Kairui Song, Kemeng Shi, Nhat Pham,
	Barry Song, Axel Rasmussen, Yuanchu Xie, Wei Xu, Youngjun Park,
	Qi Zheng, Shakeel Butt, Kiryl Shutsemau, Baoquan He,
	Jason Gunthorpe, Vlastimil Babka, kvm, linux-kernel,
	linux-trace-kernel, linux-doc, linux-kselftest, linux-mm,
	linux-coco
In-Reply-To: <CA+EHjTyj-JdW8H0ii2j3dayqnT2s3VV+brSG++p335=FGd2GXg@mail.gmail.com>

On Fri, Jun 19, 2026 at 12:09:54PM +0100, Fuad Tabba wrote:
> Sashiko flagged that when src_page = pfn_to_page(pfn),
> tdh_mem_page_add gets identical physical addresses for r8
> (destination) and r9 (source), reading with host KeyID and writing
> with TD KeyID on the same address.
This is allowed :)

See below description in the spec [1].

In-Place Add:
It is allowed to set the TD page HPA in R8 to the same address as the source
page HPA in R9. In this case the source page is converted to be a TD private
page.

[1] https://www.intel.com/content/www/us/en/content-details/853294/intel-trust-domain-extensions-intel-tdx-module-base-architecture-specification.html


^ permalink raw reply

* Re: [PATCH v8 23/46] KVM: TDX: Make source page optional for KVM_TDX_INIT_MEM_REGION
From: Yan Zhao @ 2026-06-22  6:57 UTC (permalink / raw)
  To: ackerleytng
  Cc: aik, andrew.jones, binbin.wu, brauner, chao.p.peng, david,
	jmattson, jthoughton, michael.roth, oupton, pankaj.gupta, qperret,
	rick.p.edgecombe, rientjes, shivankg, steven.price, tabba, willy,
	wyihan, forkloop, pratyush, suzuki.poulose, aneesh.kumar, liam,
	Paolo Bonzini, Sean Christopherson, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Steven Rostedt,
	Masami Hiramatsu, Mathieu Desnoyers, Jonathan Corbet, Shuah Khan,
	Shuah Khan, Vishal Annapurve, Andrew Morton, Chris Li,
	Kairui Song, Kemeng Shi, Nhat Pham, Barry Song, Axel Rasmussen,
	Yuanchu Xie, Wei Xu, Youngjun Park, Qi Zheng, Shakeel Butt,
	Kiryl Shutsemau, Baoquan He, Jason Gunthorpe, Vlastimil Babka,
	kvm, linux-kernel, linux-trace-kernel, linux-doc, linux-kselftest,
	linux-mm, linux-coco
In-Reply-To: <20260618-gmem-inplace-conversion-v8-23-9d2959357853@google.com>

On Thu, Jun 18, 2026 at 05:32:00PM -0700, Ackerley Tng via B4 Relay wrote:
> From: Ackerley Tng <ackerleytng@google.com>
> 
> Update tdx_gmem_post_populate() to handle cases where a source page is
> not explicitly provided. Instead of returning -EOPNOTSUPP when src_page
> is NULL, default to using the page associated with the destination PFN.
> 
> This change allows for in-place memory conversion where the data is
> already present in the target PFN, ensuring the TDX module has a valid
> source page reference for the TDH.MEM.PAGE.ADD operation.
> 
> Signed-off-by: Ackerley Tng <ackerleytng@google.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>  Documentation/virt/kvm/x86/intel-tdx.rst |  4 ++++
>  arch/x86/kvm/vmx/tdx.c                   | 11 ++++++++---
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/virt/kvm/x86/intel-tdx.rst b/Documentation/virt/kvm/x86/intel-tdx.rst
> index 6a222e9d09541..74357fe87f9ec 100644
> --- a/Documentation/virt/kvm/x86/intel-tdx.rst
> +++ b/Documentation/virt/kvm/x86/intel-tdx.rst
> @@ -158,6 +158,10 @@ KVM_TDX_INIT_MEM_REGION
>  Initialize @nr_pages TDX guest private memory starting from @gpa with userspace
>  provided data from @source_addr. @source_addr must be PAGE_SIZE-aligned.
>  
> +If guest_memfd in-place conversion is enabled, pass NULL for @source_addr to
> +initialize the memory region using memory contents already populated in
> +guest_memfd memory.
> +
>  Note, before calling this sub command, memory attribute of the range
>  [gpa, gpa + nr_pages] needs to be private.  Userspace can use
>  KVM_SET_MEMORY_ATTRIBUTES to set the attribute.
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index ffe9d0db58c59..56d10333c61a7 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -3198,8 +3198,12 @@ static int tdx_gmem_post_populate(struct kvm *kvm, gfn_t gfn, kvm_pfn_t pfn,
>  	if (KVM_BUG_ON(kvm_tdx->page_add_src, kvm))
>  		return -EIO;
>  
> -	if (!src_page)
> -		return -EOPNOTSUPP;
> +	if (!src_page) {
> +		if (!gmem_in_place_conversion)
When userspace turns on gmem_in_place_conversion while creating guest_memfd
without the MMAP flag, the absence of src_page should still be treated as an
error.

Additionally, to properly enable in-place copying for the TDX initial memory
region, userspace must not only specify source_addr to NULL, but also follow
a specific sequence (where steps 1/2/3/7 are required only for in-place copy):
1. create guest_memfd with MMAP flag
2. mmap the guest_memfd.
3. convert the initial memory range to shared.
4. copy initial content to the source page.
5. convert the initial memory range to private
6. invoke ioctl KVM_TDX_INIT_MEM_REGION.
7. do not unmap the source backend.

So, would it be reasonable to introduce a dedicated flag that allows userspace
to explicitly opt into the in-place copy functionality? e.g.,

diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
index 1585ec804066..d047a6efc728 100644
--- a/arch/x86/include/uapi/asm/kvm.h
+++ b/arch/x86/include/uapi/asm/kvm.h
@@ -1043,6 +1043,9 @@ struct kvm_tdx_init_vm {
 };

 #define KVM_TDX_MEASURE_MEMORY_REGION   _BITULL(0)
+#define KVM_TDX_IN_PLACE_COPY_INITIAL_MEMORY_REGION _BITULL(1)
+#define KVM_TDX_INIT_MEM_VALID_FLAGS (KVM_TDX_MEASURE_MEMORY_REGION | \
+                                     KVM_TDX_IN_PLACE_COPY_INITIAL_MEMORY_REGION)

 struct kvm_tdx_init_mem_region {
        __u64 source_addr;
diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index 56d10333c61a..6072b38ceb37 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -3190,6 +3190,7 @@ static int tdx_gmem_post_populate(struct kvm *kvm, gfn_t gfn, kvm_pfn_t pfn,
                                  struct page *src_page, void *_arg)
 {
        struct tdx_gmem_post_populate_arg *arg = _arg;
+       bool in_place_copy = arg->flags & KVM_TDX_IN_PLACE_COPY_INITIAL_MEMORY_REGION;
        struct kvm_tdx *kvm_tdx = to_kvm_tdx(kvm);
        u64 err, entry, level_state;
        gpa_t gpa = gfn_to_gpa(gfn);
@@ -3199,7 +3200,7 @@ static int tdx_gmem_post_populate(struct kvm *kvm, gfn_t gfn, kvm_pfn_t pfn,
                return -EIO;

        if (!src_page) {
-               if (!gmem_in_place_conversion)
+               if (!in_place_copy)
                        return -EOPNOTSUPP;

                src_page = pfn_to_page(pfn);
@@ -3245,7 +3246,7 @@ static int tdx_vcpu_init_mem_region(struct kvm_vcpu *vcpu, struct kvm_tdx_cmd *c
        if (kvm_tdx->state == TD_STATE_RUNNABLE)
                return -EINVAL;

-       if (cmd->flags & ~KVM_TDX_MEASURE_MEMORY_REGION)
+       if (cmd->flags & ~KVM_TDX_INIT_MEM_VALID_FLAGS)
                return -EINVAL;

> +			return -EOPNOTSUPP;
> +
> +		src_page = pfn_to_page(pfn);
> +	}
>  
>  	kvm_tdx->page_add_src = src_page;
>  	ret = kvm_tdp_mmu_map_private_pfn(arg->vcpu, gfn, pfn);
> @@ -3278,7 +3282,8 @@ static int tdx_vcpu_init_mem_region(struct kvm_vcpu *vcpu, struct kvm_tdx_cmd *c
>  			break;
>  		}
>  
> -		region.source_addr += PAGE_SIZE;
> +		if (region.source_addr)
> +			region.source_addr += PAGE_SIZE;
>  		region.gpa += PAGE_SIZE;
>  		region.nr_pages--;
>  
> 
> -- 
> 2.55.0.rc0.738.g0c8ab3ebcc-goog
> 
> 

^ permalink raw reply related

* Re: [PATCH v2 3/4] irqchip/gic-v3: Add Renesas R-Car Gen4 erratum workaround
From: Marc Zyngier @ 2026-06-22  6:55 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Thomas Gleixner, linux-pci, Yoshihiro Shimoda,
	Krzysztof Wilczyński, Bjorn Helgaas, Catalin Marinas,
	Conor Dooley, Geert Uytterhoeven, Krzysztof Kozlowski,
	Lorenzo Pieralisi, Manivannan Sadhasivam, Rob Herring, devicetree,
	linux-arm-kernel, linux-doc, linux-kernel, linux-renesas-soc
In-Reply-To: <d6fce333-4353-4e49-873f-eb3187a631e4@mailbox.org>

On Sun, 21 Jun 2026 23:46:25 +0100,
Marek Vasut <marek.vasut@mailbox.org> wrote:
> 
> On 6/21/26 12:59 PM, Thomas Gleixner wrote:
> > On Fri, Jun 19 2026 at 00:02, Marek Vasut wrote:
> >> Renesas R-Car S4/V4H/V4M GIC600 integration has address width for AXI
> >> or APB interface configured to 32 bit, it can therefore access only
> >> the first 4 GiB of physical address space. This information comes from
> >> R-Car V4H Interface Specification sheet, there is currently no technical
> >> update number assigned to this limitation. Further input from hardware
> >> engineer indicates that this limitation also applies to R-Car S4 and V4M.
> >> Name the limitation GEN4GICITS1, and add a driver quirk to mitigate this
> >> limitation.
> >> 
> >> The quirk is keyed on the combination of the GIC implementation
> >> and the platform identification in the device tree.
> >> 
> >> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> >> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> > 
> > This SOB chain is broken.
> 
> Broken ? I don't understand , could you please elaborate ?

Either Shimoda-san is the sole author of the change and you are
posting their work, then the first line of the patch should say:

 From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

with your own SoB immediately following their SoB (see [1]).

Or this has been co-developed, and both of you should be credited as
authors. then Shimoda-san's SoB should be preceded by their
Co-developed-by: tag (see [2]).

 Co-developed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
 Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
 Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

This shows exactly who did what, who forwarded whose patch, and forms
the base of the DCO which is documented at [3].

Thanks,

	M.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst#n449
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst#n503
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst#n396

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply

* Re: [PATCH v4 0/5] mm/zswap: Implement per-cgroup proactive writeback
From: Hao Jia @ 2026-06-22  6:08 UTC (permalink / raw)
  To: Muchun Song, youngjun.park, yosry
  Cc: akpm, tj, hannes, shakeel.butt, mhocko, mkoutny, nphamcs,
	chengming.zhou, roman.gushchin, linux-mm, linux-kernel, linux-doc,
	Hao Jia
In-Reply-To: <CAAAF57B-7DE9-45EA-8AB6-DE6CFAF60F47@linux.dev>



On 2026/6/21 12:20, Muchun Song wrote:
> 
> 
>> On Jun 18, 2026, at 12:48, Hao Jia <jiahao.kernel@gmail.com> wrote:
>>
>> From: Hao Jia <jiahao1@lixiang.com>
>>
>> Zswap currently writes back pages to backing swap reactively, triggered
>> either by the shrinker or by the pool reaching its size limit. Although
>> proactive memory reclaim can automatically write back a portion of zswap
>> pages via the shrinker, it cannot explicitly control the amount of
>> writeback for a specific memory cgroup. Moreover, proactive memory reclaim
>> may not always be triggered during a steady state.
>>
>> In certain scenarios, it is desirable to trigger writeback in advance to
>> free up memory. For example, users may want to prepare for an upcoming
>> memory-intensive workload by flushing cold memory to the backing storage
>> when the system is relatively idle.
>>
>> This patch series introduces a "zswap_writeback_only" key to memory.reclaim
>> cgroup interface, allowing users to proactively write back cold compressed
>> data from zswap to the backing swap device. When specified, this key
>> bypasses standard memory reclaim and exclusively performs proactive zswap
>> writeback up to the requested budget. If omitted, the default reclaim
>> behavior remains unchanged.
>>
>> Example usage:
>>   # Write back 10MB of compressed data from zswap to the backing swap
>>   echo "10M zswap_writeback_only" > memory.reclaim
> 
> I’m not entirely sure if other candidate names were already brought up
> in previous discussions, so my apologies if I'm repeating something here!
> I do think expanding memory.reclaim is a great approach. That said, I
> was wondering if we could make the interface a bit more concise while
> keeping it flexible for future extensions.
> 
> Essentially, what we want is to control the specific targets of the reclaim
> process—such as file, anon, or zswap. What do you think about using
> something like "source=zswap"? For instance, if we want to reclaim 10M from
> zswap, the command would look like this:
> 
> 	echo "10M source=zswap" > memory.reclaim
> 

Thanks for the suggestion. TBH, I personally think your approach makes 
more sense than "zswap_writeback_only".


Hi YoungJun and Yosry,

I am not sure if this suggestion from Muchun could decouple zswap 
proactive writeback from the swap tiers, or make it easier to migrate to 
swap tiers in the future:

     echo "10M source=zswap" > memory.reclaim

For now, we only specify the source. Later on, the swap tiers feature 
could extend this to control whether to demote to SSD swap, HDD swap, or 
other tiers.

Thanks,
Hao


> If we only want to reclaim 10M from file pages, we could easily extend the
> syntax:
> 
> 	echo "10M source=file" > memory.reclaim
> 
> And of course, we could even combine them down the road:
> 
> 	echo "10M source=anon,file" > memory.reclaim
> 
> to only reclaim anon and file but bypass zswap.
> 
> Just some thoughts of mine.
> 
> Muchun,
> Thanks


^ permalink raw reply

* Re: [PATCH v8 24/46] KVM: guest_memfd: Make in-place conversion the default
From: Yan Zhao @ 2026-06-22  4:53 UTC (permalink / raw)
  To: ackerleytng
  Cc: aik, andrew.jones, binbin.wu, brauner, chao.p.peng, david,
	jmattson, jthoughton, michael.roth, oupton, pankaj.gupta, qperret,
	rick.p.edgecombe, rientjes, shivankg, steven.price, tabba, willy,
	wyihan, forkloop, pratyush, suzuki.poulose, aneesh.kumar, liam,
	Paolo Bonzini, Sean Christopherson, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Steven Rostedt,
	Masami Hiramatsu, Mathieu Desnoyers, Jonathan Corbet, Shuah Khan,
	Shuah Khan, Vishal Annapurve, Andrew Morton, Chris Li,
	Kairui Song, Kemeng Shi, Nhat Pham, Barry Song, Axel Rasmussen,
	Yuanchu Xie, Wei Xu, Youngjun Park, Qi Zheng, Shakeel Butt,
	Kiryl Shutsemau, Baoquan He, Jason Gunthorpe, Vlastimil Babka,
	kvm, linux-kernel, linux-trace-kernel, linux-doc, linux-kselftest,
	linux-mm, linux-coco
In-Reply-To: <20260618-gmem-inplace-conversion-v8-24-9d2959357853@google.com>

On Thu, Jun 18, 2026 at 05:32:01PM -0700, Ackerley Tng via B4 Relay wrote:
> From: Ackerley Tng <ackerleytng@google.com>
> 
> Make in-place conversion the default if the arch has private mem.
> 
> The default can be overridden at compile type by enabling
> CONFIG_KVM_VM_MEMORY_ATTRIBUTES, or at KVM load time through a module
> parameter.
> 
> In-place conversion also implies tracking a guest's private/shared state in
> guest_memfd. To avoid inconsistencies in the way memory attributes are
> tracked between the per-VM or by guest_memfd, make the module_param
> read-only (0444).
> 
> Document that using per-VM attributes for tracking private/shared state of
> guest memory is deprecated in favor of tracking in guest_memfd.
> 
> Warn if the admin sets gmem_in_place_conversion as false when
> CONFIG_KVM_VM_MEMORY_ATTRIBUTES is not enabled. Add warning in the code
> path where guest memory is populated for a CoCo VM, since that's the
> earliest point in a CoCo VM's lifecycle where memory attributes are
> queried. Unlike other query sites, this site is exclusively used by CoCo
> VMs.
> 
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>  arch/x86/kvm/Kconfig   | 7 ++++++-
>  virt/kvm/guest_memfd.c | 5 +++++
>  virt/kvm/kvm_main.c    | 3 ++-
>  3 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
> index c28393dc664eb..a3c189d765150 100644
> --- a/arch/x86/kvm/Kconfig
> +++ b/arch/x86/kvm/Kconfig
> @@ -85,7 +85,12 @@ config KVM_VM_MEMORY_ATTRIBUTES
>  	bool "Enable per-VM PRIVATE vs. SHARED attributes (for CoCo VMs)"
>  	help
>  	  Enable support for tracking PRIVATE vs. SHARED memory using per-VM
> -	  memory attributes.
> +	  memory attributes.  Using per-VM attributes are deprecated in favor
> +	  of tracking PRIVATE state in guest_memfd.  Select this if you need
> +	  to run CoCo VMs using a VMM that doesn't support guest_memfd memory
> +	  attributes.
> +
> +	  If unsure, say N.
>  
>  config KVM_SW_PROTECTED_VM
>  	bool "Enable support for KVM software-protected VMs"
> diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
> index 86c9f5b0863cb..5cb73543c03c8 100644
> --- a/virt/kvm/guest_memfd.c
> +++ b/virt/kvm/guest_memfd.c
> @@ -1193,10 +1193,15 @@ static bool kvm_gmem_range_is_private(struct file *file, pgoff_t index,
>  {
>  	struct maple_tree *mt = &GMEM_I(file_inode(file))->attributes;
>  
> +#ifdef CONFIG_KVM_VM_MEMORY_ATTRIBUTES
>  	if (!gmem_in_place_conversion)
>  		return kvm_range_has_vm_memory_attributes(kvm, gfn, gfn + nr_pages,
>  							  KVM_MEMORY_ATTRIBUTE_PRIVATE,
>  							  KVM_MEMORY_ATTRIBUTE_PRIVATE);
> +#else
> +	if (WARN_ON_ONCE(!gmem_in_place_conversion))
> +		return false;
> +#endif
>  
>  	return kvm_gmem_range_has_attributes(mt, index, nr_pages,
>  					     KVM_MEMORY_ATTRIBUTE_PRIVATE);
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index dd1d18a1d2f68..46e92b5dc3804 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -102,7 +102,8 @@ static bool __ro_after_init allow_unsafe_mappings;
>  module_param(allow_unsafe_mappings, bool, 0444);
>  
>  #ifdef kvm_arch_has_private_mem
> -bool __ro_after_init gmem_in_place_conversion = false;
> +bool __ro_after_init gmem_in_place_conversion = !IS_ENABLED(CONFIG_KVM_VM_MEMORY_ATTRIBUTES);
> +module_param(gmem_in_place_conversion, bool, 0444);

With gmem_in_place_conversion=true, userspace can create guest_memfd without the
MMAP flag. In such cases, shared memory is allocated from different backends.
This means this module parameter only enables per-gmem memory attribute and does
not guarantee that gmem in-place conversion will actually occur.

To avoid confusion, could we rename this module parameter to something more
accurate, such as gmem_memory_attribute?


>  EXPORT_SYMBOL_FOR_KVM_INTERNAL(gmem_in_place_conversion);
>  #endif
>  
> 
> -- 
> 2.55.0.rc0.738.g0c8ab3ebcc-goog
> 
> 

^ permalink raw reply

* Re: [RFC PATCH 0/2] kasan: hw_tags: Add option to tag only at allocation time
From: Dev Jain @ 2026-06-22  4:21 UTC (permalink / raw)
  To: Isaac Manjarres
  Cc: ryabinin.a.a, akpm, corbet, glider, andreyknvl, dvyukov,
	vincenzo.frascino, kasan-dev, linux-mm, linux-kernel, skhan,
	workflows, linux-doc, linux-arm-kernel, ryan.roberts,
	anshuman.khandual, kaleshsingh, 21cnbao, david, will,
	catalin.marinas
In-Reply-To: <aiyhb2XwMMJE3st7@google.com>



On 13/06/26 5:46 am, Isaac Manjarres wrote:
> On Fri, Jun 12, 2026 at 04:44:22AM +0000, Dev Jain wrote:
>> Introduce a boot option to tag only at allocation time of the objects. This
>> reduces KASAN MTE overhead, the tradeoff being reduced ability of
>> catching bugs.
>>
>> Now, when a memory object will be freed, it will retain the random tag it
>> had at allocation time. This compromises on catching UAF bugs, till the
>> time the object is not reallocated, at which point it will have a new
>> random tag.
>>
>> Hence, not catching "use-after-free-before-reallocation" and not catching
>> "double-free" will be the compromise for reduced KASAN overhead.
>>
>> This is an RFC because we are not clear about the performance benefit.
>>
>> Android folks, please help with testing!
>>
>> ---
>> Applies on Linus master (9716c086c8e8).
>>
>> Dev Jain (2):
>>   kasan: hw_tags: Use KASAN_PAGE_REDZONE for vmalloc redzoning
>>   kasan: hw_tags: Add boot option to elide free time poisoning
>>
>>  Documentation/dev-tools/kasan.rst |  4 +++
>>  mm/kasan/hw_tags.c                | 45 +++++++++++++++++++++++++++++--
>>  mm/kasan/kasan.h                  | 23 +++++++++++++++-
>>  3 files changed, 69 insertions(+), 3 deletions(-)
>>
>> -- 
>> 2.43.0
> 
> I tested out this series on one of our devices that has MTE support,
> and didn't see any functional issues.

Thanks for testing Isaac! Do you have the bandwidth to carry out some
performance tests? We want to see whether this patchset gets perf boost
on some HW.

> 
> One thing I did notice though, and it's independent of this patch, is
> that the vmalloc_oob is failing, but that happens even if these patches
> aren't present.
> 
> Thanks,
> Isaac


^ permalink raw reply

* Re: [PATCH v6 5/6] kselftest: alloc_tag: add kselftest for ioctl interface
From: Hao Ge @ 2026-06-22  3:20 UTC (permalink / raw)
  To: Suren Baghdasaryan, Abhishek Bapat
  Cc: Andrew Morton, Kent Overstreet, Shuah Khan, Jonathan Corbet,
	linux-doc, linux-kernel, linux-mm, Sourav Panda
In-Reply-To: <CAJuCfpHPBq7TiD1wfvMyVWbBOw9prEY7LvoLveeoYQOuEEJabg@mail.gmail.com>


On 2026/6/21 08:10, Suren Baghdasaryan wrote:
> On Thu, Jun 18, 2026 at 10:36 AM Abhishek Bapat
> <abhishekbapat@google.com> wrote:
>> Introduce a kselftest to verify the new IOCTL-based interface for
>> /proc/allocinfo. The test covers:
>>
>> 1. Validation of the filename filter.
>> 2. Validation of the function filter.
>>
>> The first test validates the functionality of the filename filter. Using
>> "mm/memory.c" as the candidate filename filter, it retrieves filtered
>> entries from both procfs and ioctl and matches the first VEC_MAX_ENTRIES
>> entries.
>>
>> The second test validates the functionality of the function filter.
>> It uses "dup_mm" as the candidate function as we do not expect this
>> function name to change frequently and hence won't be needing to modify
>> this test often.
>>
>> Note that both the tests match line no, function name and file name
>> fields. Bytes allocated and calls are not matched as those values may
>> change in the time when the data is being read from procfs and ioctl and
>> hence can lead to false negatives.
>>
>> Signed-off-by: Abhishek Bapat <abhishekbapat@google.com>
>> ---
>>   MAINTAINERS                                   |   1 +
>>   tools/testing/selftests/Makefile              |   1 +
>>   tools/testing/selftests/alloc_tag/Makefile    |   9 +
>>   .../alloc_tag/allocinfo_ioctl_test.c          | 335 ++++++++++++++++++
>>   4 files changed, 346 insertions(+)
>>   create mode 100644 tools/testing/selftests/alloc_tag/Makefile
>>   create mode 100644 tools/testing/selftests/alloc_tag/allocinfo_ioctl_test.c
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 019cc4c285a3..6610dd42e484 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -16715,6 +16715,7 @@ F:      include/linux/alloc_tag.h
>>   F:     include/linux/pgalloc_tag.h
>>   F:     include/uapi/linux/alloc_tag.h
>>   F:     lib/alloc_tag.c
>> +F:     tools/testing/selftests/alloc_tag/
>>
>>   MEMORY CONTROLLER DRIVERS
>>   M:     Krzysztof Kozlowski <krzk@kernel.org>
>> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
>> index 6e59b8f63e41..276a78c64736 100644
>> --- a/tools/testing/selftests/Makefile
>> +++ b/tools/testing/selftests/Makefile
>> @@ -1,5 +1,6 @@
>>   # SPDX-License-Identifier: GPL-2.0
>>   TARGETS += acct
>> +TARGETS += alloc_tag
>>   TARGETS += alsa
>>   TARGETS += amd-pstate
>>   TARGETS += arm64
>> diff --git a/tools/testing/selftests/alloc_tag/Makefile b/tools/testing/selftests/alloc_tag/Makefile
>> new file mode 100644
>> index 000000000000..f2b8fc022c3b
>> --- /dev/null
>> +++ b/tools/testing/selftests/alloc_tag/Makefile
>> @@ -0,0 +1,9 @@
>> +# SPDX-License-Identifier: GPL-2.0
>> +
>> +TEST_GEN_PROGS := allocinfo_ioctl_test
>> +
>> +CFLAGS += -Wall
>> +CFLAGS += -I../../../../usr/include
> I recall Hao suggested replacing this path with $(KHDR_INCLUDES). Have
> you tried that?

Hi Suren and Abhishek

Yes, I suggested this in my previous email.

Using CFLAGS += -I../../../../usr/include fails to support out-of-tree 
build workflows.

I ran the following command:

make O=/home alldebug_defconfig

make O=/home -j8

make O=/home headers_install

make -C tools/testing/selftests/ TARGETS=alloc_tag O=/home/


[root@localhost linux]# make -C tools/testing/selftests 
TARGETS=alloc_tag O=/home/
make: Entering directory '/home/linux/tools/testing/selftests'
   CC       allocinfo_ioctl_test
allocinfo_ioctl_test.c:16:10: fatal error: linux/alloc_tag.h: No such 
file or directory
    16 | #include <linux/alloc_tag.h>
       |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [allocinfo_ioctl_test] Error 1


Therefore, using $(KHDR_INCLUDES) here is more appropriate. The 
corresponding build flow is as follows:

https://elixir.bootlin.com/linux/v7.1/source/tools/testing/selftests/Makefile#L198


After modification, the compilation output is shown below:

[root@localhost linux]# make -C tools/testing/selftests 
TARGETS=alloc_tag O=/home/
make: Entering directory '/home/linux/tools/testing/selftests'
   CC       allocinfo_ioctl_test
make: Leaving directory '/home/linux/tools/testing/selftests'

[root@localhost linux]# ls /home/kselftest/alloc_tag/allocinfo_ioctl_test
/home/kselftest/alloc_tag/allocinfo_ioctl_test
[root@localhost linux]#


Thanks

Best Regards

Hao


>
>> +
>> +include ../lib.mk
>> +
>> diff --git a/tools/testing/selftests/alloc_tag/allocinfo_ioctl_test.c b/tools/testing/selftests/alloc_tag/allocinfo_ioctl_test.c
>> new file mode 100644
>> index 000000000000..1ae0291f2245
>> --- /dev/null
>> +++ b/tools/testing/selftests/alloc_tag/allocinfo_ioctl_test.c
>> @@ -0,0 +1,335 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +
>> +/* kselftest for allocinfo ioctl
>> + * allocinfo ioctl retrives allocinfo data through ioctl
>> + * Copyright (C) 2026 Google, Inc.
>> + */
>> +
>> +#include <fcntl.h>
>> +#include <stdio.h>
>> +#include <stdlib.h>
>> +#include <string.h>
>> +#include <stdbool.h>
>> +#include <unistd.h>
>> +#include <sys/ioctl.h>
>> +#include <linux/types.h>
>> +#include <linux/alloc_tag.h>
>> +#include "../kselftest.h"
>> +
>> +#define MAX_LINE_LEN           512
>> +#define ALLOCINFO_PROC         "/proc/allocinfo"
>> +
>> +enum ioctl_ret {
>> +       IOCTL_SUCCESS = 0,
>> +       IOCTL_FAILURE = 1,
>> +       IOCTL_INVALID_DATA = 2,
>> +};
>> +
>> +#define VEC_MAX_ENTRIES 32
>> +
>> +struct allocinfo_tag_data_vec {
>> +       struct allocinfo_tag_data tag[VEC_MAX_ENTRIES];
>> +       __u64 count;
>> +};
>> +
>> +static inline int __allocinfo_get_content_id(int dev_fd, struct allocinfo_content_id *params)
>> +{
>> +       return ioctl(dev_fd, ALLOCINFO_IOC_CONTENT_ID, params);
>> +}
>> +
>> +static inline int __allocinfo_get_at(int dev_fd, struct allocinfo_get_at *params)
>> +{
>> +       return ioctl(dev_fd, ALLOCINFO_IOC_GET_AT, params);
>> +}
>> +
>> +static inline int __allocinfo_get_next(int dev_fd, struct allocinfo_tag_data *params)
>> +{
>> +       return ioctl(dev_fd, ALLOCINFO_IOC_GET_NEXT, params);
>> +}
>> +
>> +static bool match_entry(const struct allocinfo_tag_data *procfs_entry,
>> +                       const struct allocinfo_tag_data *tag_data,
>> +                       bool match_bytes, bool match_calls, bool match_lineno,
>> +                       bool match_function, bool match_filename)
>> +{
>> +       if (match_bytes && tag_data->counter.bytes != procfs_entry->counter.bytes) {
>> +               ksft_print_msg("size retrieved through ioctl does not match procfs\n");
>> +               return false;
>> +       }
>> +
>> +       if (match_calls && tag_data->counter.calls != procfs_entry->counter.calls) {
>> +               ksft_print_msg("call count retrieved through ioctl does not match procfs\n");
>> +               return false;
>> +       }
>> +
>> +       if (match_lineno && tag_data->tag.lineno != procfs_entry->tag.lineno) {
>> +               ksft_print_msg("lineno retrieved through ioctl does not match procfs\n");
>> +               return false;
>> +       }
>> +
>> +       if (match_function &&
>> +           strncmp(tag_data->tag.function, procfs_entry->tag.function, ALLOCINFO_STR_SIZE)) {
>> +               ksft_print_msg("function retrieved through ioctl does not match procfs\n");
>> +               return false;
>> +       }
>> +
>> +       if (match_filename &&
>> +           strncmp(tag_data->tag.filename, procfs_entry->tag.filename, ALLOCINFO_STR_SIZE)) {
>> +               ksft_print_msg("filename retrieved through ioctl does not match procfs\n");
>> +               return false;
>> +       }
>> +       return true;
>> +}
>> +
>> +static bool match_entries(const struct allocinfo_tag_data_vec *procfs_entries,
>> +                         const struct allocinfo_tag_data_vec *tags,
>> +                         bool match_bytes, bool match_calls, bool match_lineno,
>> +                         bool match_function, bool match_filename)
>> +{
>> +       __u64 i;
>> +
>> +       if (procfs_entries->count != tags->count) {
>> +               ksft_print_msg("Entry count mismatch. ioctl entries: %llu, proc entries: %llu\n",
>> +                              tags->count, procfs_entries->count);
>> +               return false;
>> +       }
>> +       for (i = 0; i < procfs_entries->count; i++) {
>> +               if (!match_entry(&procfs_entries->tag[i], &tags->tag[i],
>> +                                match_bytes, match_calls, match_lineno,
>> +                                match_function, match_filename)) {
>> +                       ksft_print_msg("%lluth entry does not match.\n", i);
>> +                       return false;
>> +               }
>> +       }
>> +       return true;
>> +}
>> +
>> +static const char *allocinfo_str(const char *str)
>> +{
>> +       size_t len = strlen(str);
>> +
>> +       if (len >= ALLOCINFO_STR_SIZE)
>> +               str += (len - ALLOCINFO_STR_SIZE) + 1;
>> +       return str;
>> +}
>> +
>> +static void allocinfo_copy_str(char *dest, const char *src)
>> +{
>> +       strncpy(dest, allocinfo_str(src), ALLOCINFO_STR_SIZE - 1);
>> +       dest[ALLOCINFO_STR_SIZE - 1] = '\0';
>> +}
>> +
>> +static int get_filtered_procfs_entries(struct allocinfo_tag_data_vec *procfs_entries,
>> +                                      const struct allocinfo_filter *filter)
>> +{
>> +       FILE *fp = fopen(ALLOCINFO_PROC, "r");
>> +       char line[MAX_LINE_LEN];
>> +       int matches;
>> +       struct allocinfo_tag_data procfs_entry;
>> +
>> +       if (!fp) {
>> +               ksft_print_msg("Failed to open " ALLOCINFO_PROC " for reading\n");
>> +               return 1;
>> +       }
>> +       memset(procfs_entries, 0, sizeof(*procfs_entries));
>> +       while (fgets(line, sizeof(line), fp) && procfs_entries->count < VEC_MAX_ENTRIES) {
>> +               char filename[MAX_LINE_LEN];
>> +               char function[MAX_LINE_LEN];
>> +
>> +               memset(&procfs_entry, 0, sizeof(procfs_entry));
>> +               matches = sscanf(line, "%llu %llu %[^:]:%llu func:%s",
>> +                                &procfs_entry.counter.bytes,
>> +                                &procfs_entry.counter.calls,
>> +                                filename,
>> +                                &procfs_entry.tag.lineno,
>> +                                function);
>> +
>> +               if (matches != 5)
>> +                       continue;
>> +
>> +               allocinfo_copy_str(procfs_entry.tag.filename, filename);
>> +               allocinfo_copy_str(procfs_entry.tag.function, function);
>> +
>> +               if (filter->mask & ALLOCINFO_FILTER_MASK_FILENAME) {
>> +                       if (strncmp(procfs_entry.tag.filename,
>> +                                   filter->fields.filename, ALLOCINFO_STR_SIZE))
>> +                               continue;
>> +               }
>> +               if (filter->mask & ALLOCINFO_FILTER_MASK_FUNCTION) {
>> +                       if (strncmp(procfs_entry.tag.function,
>> +                                   filter->fields.function, ALLOCINFO_STR_SIZE))
>> +                               continue;
>> +               }
>> +               if (filter->mask & ALLOCINFO_FILTER_MASK_LINENO) {
>> +                       if (procfs_entry.tag.lineno != filter->fields.lineno)
>> +                               continue;
>> +               }
>> +               if (filter->mask & ALLOCINFO_FILTER_MASK_MIN_SIZE) {
>> +                       if (procfs_entry.counter.bytes < filter->min_size)
>> +                               continue;
>> +               }
>> +               if (filter->mask & ALLOCINFO_FILTER_MASK_MAX_SIZE) {
>> +                       if (procfs_entry.counter.bytes > filter->max_size)
>> +                               continue;
>> +               }
>> +
>> +               memcpy(&procfs_entries->tag[procfs_entries->count++], &procfs_entry,
>> +                      sizeof(procfs_entry));
>> +       }
>> +       fclose(fp);
>> +       return 0;
>> +}
>> +
>> +static enum ioctl_ret get_filtered_ioctl_entries(struct allocinfo_tag_data_vec *tags,
>> +                                                const struct allocinfo_filter *filter,
>> +                                                __u64 start_pos)
>> +{
>> +       int fd = open(ALLOCINFO_PROC, O_RDONLY);
>> +
>> +       if (fd < 0) {
>> +               ksft_print_msg("Failed to open " ALLOCINFO_PROC " for IOCTL\n");
>> +               return IOCTL_FAILURE;
>> +       }
>> +
>> +       struct allocinfo_content_id start_cont_id, end_cont_id;
>> +       struct allocinfo_get_at get_at_params;
>> +       const int max_retries = 10;
>> +       int retry_count = 0;
>> +       int status;
>> +
>> +       /*
>> +        * __allocinfo_get_content_id may return different values if a kernel module was loaded
>> +        * between the two calls. If that happens, the data gathered cannot be considered consistent
>> +        * and hence needs to be fetched again to avoid flakiness.
>> +        */
>> +       do {
>> +               if (__allocinfo_get_content_id(fd, &start_cont_id)) {
>> +                       ksft_print_msg("allocinfo_get_content_id failed\n");
>> +                       status = IOCTL_FAILURE;
>> +                       goto exit;
> nit: I would prefer a "break" instead of these "goto exit" statements
> for exiting this loop. Makes the code flow more readable IMHO.
>
>> +               }
>> +
>> +               memset(tags, 0, sizeof(*tags));
>> +               memset(&get_at_params, 0, sizeof(get_at_params));
>> +               memcpy(&get_at_params.filter, filter, sizeof(*filter));
>> +               get_at_params.pos = start_pos;
>> +               if (__allocinfo_get_at(fd, &get_at_params)) {
>> +                       ksft_print_msg("allocinfo_get_at failed\n");
>> +                       status = IOCTL_FAILURE;
>> +                       goto exit;
>> +               }
>> +               memcpy(&tags->tag[tags->count++], &get_at_params.data, sizeof(get_at_params.data));
>> +
>> +               while (tags->count < VEC_MAX_ENTRIES &&
>> +                      __allocinfo_get_next(fd, &tags->tag[tags->count]) == 0)
>> +                       tags->count++;
>> +
>> +               if (__allocinfo_get_content_id(fd, &end_cont_id)) {
>> +                       ksft_print_msg("allocinfo_get_content_id failed\n");
>> +                       status = IOCTL_FAILURE;
>> +                       goto exit;
>> +               }
>> +
>> +               if (start_cont_id.id == end_cont_id.id) {
>> +                       status = IOCTL_SUCCESS;
>> +               } else {
>> +                       ksft_print_msg("allocinfo_get_content_id mismatch, retrying...\n");
>> +                       status = IOCTL_INVALID_DATA;
>> +               }
>> +       } while (status == IOCTL_INVALID_DATA && retry_count++ < max_retries);
>> +
>> +exit:
>> +       close(fd);
>> +       return status;
>> +}
>> +
>> +static int run_filter_test(const struct allocinfo_filter *filter)
>> +{
>> +       struct allocinfo_tag_data_vec *tags = malloc(sizeof(*tags));
>> +       struct allocinfo_tag_data_vec *procfs_entries = malloc(sizeof(*procfs_entries));
>> +       int ioctl_status;
>> +       int ret = KSFT_PASS;
>> +
>> +       if (!tags || !procfs_entries) {
>> +               ksft_print_msg("Memory allocation failed.\n");
>> +               ret = KSFT_FAIL;
>> +               goto exit;
>> +       }
>> +
>> +       if (get_filtered_procfs_entries(procfs_entries, filter)) {
>> +               ksft_print_msg("Error retrieving entries from " ALLOCINFO_PROC "\n");
>> +               ret = KSFT_SKIP;
>> +               goto exit;
>> +       }
>> +
>> +       if (procfs_entries->count == 0) {
>> +               ksft_print_msg("No entries found in " ALLOCINFO_PROC ", skipping test\n");
>> +               ret = KSFT_SKIP;
>> +               goto exit;
>> +       }
>> +
>> +       ioctl_status = get_filtered_ioctl_entries(tags, filter, 0);
>> +       if (ioctl_status == IOCTL_INVALID_DATA) {
>> +               ksft_print_msg("Trouble retrieving valid IOCTL entries, skipping.\n");
>> +               ret = KSFT_SKIP;
>> +               goto exit;
>> +       }
>> +       if (ioctl_status == IOCTL_FAILURE) {
>> +               ksft_print_msg("Error retrieving IOCTL entries.\n");
>> +               ret = KSFT_FAIL;
>> +               goto exit;
>> +       }
>> +
>> +       if (!match_entries(procfs_entries, tags, false, false, true, true, true))
>> +               ret = KSFT_FAIL;
>> +
>> +exit:
>> +       free(tags);
>> +       free(procfs_entries);
>> +       return ret;
>> +}
>> +
>> +static int test_filename_filter(void)
>> +{
>> +       struct allocinfo_filter filter;
>> +       const char *target_filename = "mm/memory.c";
>> +
>> +       memset(&filter, 0, sizeof(filter));
>> +       filter.mask |= ALLOCINFO_FILTER_MASK_FILENAME;
>> +       strncpy(filter.fields.filename, target_filename, ALLOCINFO_STR_SIZE);
>> +
>> +       return run_filter_test(&filter);
>> +}
>> +
>> +static int test_function_filter(void)
>> +{
>> +       struct allocinfo_filter filter;
>> +       const char *target_function = "dup_mm";
>> +
>> +       memset(&filter, 0, sizeof(filter));
>> +       filter.mask |= ALLOCINFO_FILTER_MASK_FUNCTION;
>> +       strncpy(filter.fields.function, target_function, ALLOCINFO_STR_SIZE);
>> +
>> +       return run_filter_test(&filter);
>> +}
>> +
>> +int main(int argc, char *argv[])
>> +{
>> +       int ret;
>> +
>> +       ksft_set_plan(2);
>> +
>> +       ret = test_filename_filter();
>> +       if (ret == KSFT_SKIP)
>> +               ksft_test_result_skip("Skipping test_filename_filter\n");
>> +       else
>> +               ksft_test_result(ret == KSFT_PASS, "test_filename_filter\n");
>> +
>> +       ret = test_function_filter();
>> +       if (ret == KSFT_SKIP)
>> +               ksft_test_result_skip("Skipping test_function_filter\n");
>> +       else
>> +               ksft_test_result(ret == KSFT_PASS, "test_function_filter\n");
>> +
>> +       ksft_finished();
>> +}
>> --
>> 2.55.0.rc0.786.g65d90a0328-goog
>>

^ permalink raw reply

* Re: [PATCH v6 1/8] tracing/probes: Support dumping fetcharg program for debugging dynamic events
From: Masami Hiramatsu @ 2026-06-22  0:01 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: Steven Rostedt, Mathieu Desnoyers, Jonathan Corbet, Shuah Khan,
	linux-kernel, linux-trace-kernel, linux-doc, linux-kselftest
In-Reply-To: <178196863297.560995.16891637449659873905.stgit@devnote2>

Hi

Sashiko found another bug about FETCH_OP_TP_ARG. which seems using
fetch_insn parameter wrongly (using different parameters).
I need to fix it first.
We also may need to rename FETCH_OP_DATA to FETCH_OP_IMMSTR.

Thanks,

On Sun, 21 Jun 2026 00:17:13 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> For debugging probe events, it is helpful to verify the compiled
> fetch instructions for each probe argument. This introduces a new
> kernel config CONFIG_PROBE_EVENTS_DUMP_FETCHARG to decode the
> instruction sequence of each argument and display it under a
> commented line starting with '#' immediately following the dynamic
> event definition (such as in dynamic_events, kprobe_events,
> uprobe_events, etc.).
> 
> For example:
> /sys/kernel/tracing # cat dynamic_events
> p:kprobes/p_vfs_read_0 vfs_read arg1=+0(file):ustring arg2=%ax:x16
> #  arg1: ARG(0) -> ST_USTRING(offset=0,size=4) -> END
> #  arg2: REG(80) -> ST_RAW(size=2) -> END
> 
> Assisted-by: Antigravity:gemini-3.5-flash
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> ---
>  Changes in v6:
>    - Newly added.
> ---
>  kernel/trace/Kconfig        |   11 +++++
>  kernel/trace/trace_eprobe.c |    2 +
>  kernel/trace/trace_fprobe.c |    2 +
>  kernel/trace/trace_kprobe.c |    2 +
>  kernel/trace/trace_probe.c  |   90 +++++++++++++++++++++++++++++++++++++++++++
>  kernel/trace/trace_probe.h  |   77 ++++++++++++++++++++++---------------
>  kernel/trace/trace_uprobe.c |    3 +
>  7 files changed, 157 insertions(+), 30 deletions(-)
> 
> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> index e130da35808f..ed83fbfb4b7c 100644
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -779,6 +779,17 @@ config PROBE_EVENTS_BTF_ARGS
>  	  kernel function entry or a tracepoint.
>  	  This is available only if BTF (BPF Type Format) support is enabled.
>  
> +config PROBE_EVENTS_DUMP_FETCHARG
> +	depends on PROBE_EVENTS
> +	bool "Dump of dynamic probe event fetch-arguments"
> +	default n
> +	help
> +	  This shows the dump of fetch-arguments of dynamic probe events
> +	  alongside their event definitions in the dynamic_events file
> +	  as comment lines. This is useful to debug the probe events.
> +
> +	  If unsure, say N.
> +
>  config KPROBE_EVENTS
>  	depends on KPROBES
>  	depends on HAVE_REGS_AND_STACK_ACCESS_API
> diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c
> index b66d6196338d..fdb4ce993cad 100644
> --- a/kernel/trace/trace_eprobe.c
> +++ b/kernel/trace/trace_eprobe.c
> @@ -87,6 +87,8 @@ static int eprobe_dyn_event_show(struct seq_file *m, struct dyn_event *ev)
>  		seq_printf(m, " %s=%s", ep->tp.args[i].name, ep->tp.args[i].comm);
>  	seq_putc(m, '\n');
>  
> +	trace_probe_dump_args(m, &ep->tp);
> +
>  	return 0;
>  }
>  
> diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c
> index 4d1abbf66229..536781cd4c47 100644
> --- a/kernel/trace/trace_fprobe.c
> +++ b/kernel/trace/trace_fprobe.c
> @@ -1449,6 +1449,8 @@ static int trace_fprobe_show(struct seq_file *m, struct dyn_event *ev)
>  		seq_printf(m, " %s=%s", tf->tp.args[i].name, tf->tp.args[i].comm);
>  	seq_putc(m, '\n');
>  
> +	trace_probe_dump_args(m, &tf->tp);
> +
>  	return 0;
>  }
>  
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index a8420e6abb56..cfa807d8e760 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -1320,6 +1320,8 @@ static int trace_kprobe_show(struct seq_file *m, struct dyn_event *ev)
>  		seq_printf(m, " %s=%s", tk->tp.args[i].name, tk->tp.args[i].comm);
>  	seq_putc(m, '\n');
>  
> +	trace_probe_dump_args(m, &tk->tp);
> +
>  	return 0;
>  }
>  
> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> index 98532c503d02..9d174cd1fb1c 100644
> --- a/kernel/trace/trace_probe.c
> +++ b/kernel/trace/trace_probe.c
> @@ -2393,3 +2393,93 @@ int trace_probe_print_args(struct trace_seq *s, struct probe_arg *args, int nr_a
>  	}
>  	return 0;
>  }
> +
> +#ifdef CONFIG_PROBE_EVENTS_DUMP_FETCHARG
> +
> +struct fetch_op_decode {
> +	const char *name;
> +	void (*decode)(struct seq_file *m, struct fetch_insn *insn);
> +};
> +
> +static const struct fetch_op_decode fetch_op_decode[];
> +
> +static void fetcharg_decode_none(struct seq_file *m, struct fetch_insn *insn)
> +{
> +	seq_puts(m, fetch_op_decode[insn->op].name);
> +}
> +
> +static void fetcharg_decode_param(struct seq_file *m, struct fetch_insn *insn)
> +{
> +	seq_printf(m, "%s(%u)", fetch_op_decode[insn->op].name, insn->param);
> +}
> +
> +static void fetcharg_decode_imm(struct seq_file *m, struct fetch_insn *insn)
> +{
> +	seq_printf(m, "%s(0x%lx)", fetch_op_decode[insn->op].name, insn->immediate);
> +}
> +
> +static void fetcharg_decode_ptr(struct seq_file *m, struct fetch_insn *insn)
> +{
> +	seq_printf(m, "%s(%p)", fetch_op_decode[insn->op].name, insn->data);
> +}
> +
> +static void fetcharg_decode_symbol(struct seq_file *m, struct fetch_insn *insn)
> +{
> +	seq_printf(m, "%s(%s)", fetch_op_decode[insn->op].name, (char *)insn->data);
> +}
> +
> +static void fetcharg_decode_offset(struct seq_file *m, struct fetch_insn *insn)
> +{
> +	seq_printf(m, "%s(offset=%d)", fetch_op_decode[insn->op].name, insn->offset);
> +}
> +
> +static void fetcharg_decode_store(struct seq_file *m, struct fetch_insn *insn)
> +{
> +	if (insn->op == FETCH_OP_ST_RAW)
> +		seq_printf(m, "%s(size=%u)", fetch_op_decode[insn->op].name, insn->size);
> +	else
> +		seq_printf(m, "%s(offset=%d,size=%u)", fetch_op_decode[insn->op].name, insn->offset, insn->size);
> +}
> +
> +static void fetcharg_decode_bf(struct seq_file *m, struct fetch_insn *insn)
> +{
> +	seq_printf(m, "%s(basesize=%u,lshift=%u,rshift=%u)",
> +		   fetch_op_decode[insn->op].name, insn->basesize, insn->lshift, insn->rshift);
> +}
> +
> +#define FETCH_OP(opname, decode_fn) \
> +	[FETCH_OP_##opname] = { .name = #opname, .decode = fetcharg_decode_##decode_fn },
> +
> +static const struct fetch_op_decode fetch_op_decode[] = {
> +	FETCH_OP_LIST
> +};
> +#undef FETCH_OP
> +
> +static void trace_probe_dump_arg(struct seq_file *m, struct probe_arg *parg)
> +{
> +	int i;
> +
> +	seq_printf(m, "#  %s: ", parg->name);
> +	for (i = 0; i < FETCH_INSN_MAX; i++) {
> +		struct fetch_insn *insn = parg->code + i;
> +
> +		if (insn->op >= ARRAY_SIZE(fetch_op_decode) || !fetch_op_decode[insn->op].decode)
> +			seq_printf(m, "unknown(%d)", insn->op);
> +		else
> +			fetch_op_decode[insn->op].decode(m, insn);
> +
> +		if (insn->op == FETCH_OP_END)
> +			break;
> +		seq_puts(m, " -> ");
> +	}
> +	seq_putc(m, '\n');
> +}
> +
> +void trace_probe_dump_args(struct seq_file *m, struct trace_probe *tp)
> +{
> +	int i;
> +
> +	for (i = 0; i < tp->nr_args; i++)
> +		trace_probe_dump_arg(m, &tp->args[i]);
> +}
> +#endif /* CONFIG_PROBE_EVENTS_DUMP_FETCHARG */
> diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
> index 0f09f7aaf93f..b428ef42b229 100644
> --- a/kernel/trace/trace_probe.h
> +++ b/kernel/trace/trace_probe.h
> @@ -83,38 +83,47 @@ static nokprobe_inline u32 update_data_loc(u32 loc, int consumed)
>  /* Printing function type */
>  typedef int (*print_type_func_t)(struct trace_seq *, void *, void *);
>  
> +#define FETCH_OP_LIST							\
> +	/* Stage 1 (load) ops */					\
> +	FETCH_OP(NOP, none)		/* NOP */			\
> +	FETCH_OP(REG, param)		/* Register: .param = offset */	\
> +	FETCH_OP(STACK, param)		/* Stack: .param = index */	\
> +	FETCH_OP(STACKP, none)		/* Stack pointer */		\
> +	FETCH_OP(RETVAL, none)		/* Return value */		\
> +	FETCH_OP(IMM, imm)		/* Immediate: .immediate */	\
> +	FETCH_OP(COMM, none)		/* Current comm */		\
> +	FETCH_OP(ARG, param)		/* Argument: .param = index */	\
> +	FETCH_OP(FOFFS, imm)		/* File offset: .immediate */	\
> +	FETCH_OP(DATA, ptr)		/* Allocated data: .data */	\
> +	FETCH_OP(EDATA, offset)		/* Entry data: .offset */	\
> +	FETCH_OP(TP_ARG, param)		/* Tracepoint argument: .data */\
> +	/* Stage 2 (dereference) ops */					\
> +	FETCH_OP(DEREF, offset)		/* Dereference: .offset */	\
> +	FETCH_OP(UDEREF, offset)	/* User-space dereference: .offset */\
> +	/* Stage 3 (store) ops */					\
> +	FETCH_OP(ST_RAW, store)		/* Raw value: .size */		\
> +	FETCH_OP(ST_MEM, store)		/* Memory: .offset, .size */	\
> +	FETCH_OP(ST_UMEM, store)	/* User memory: .offset, .size */\
> +	FETCH_OP(ST_STRING, store)	/* String: .offset, .size */	\
> +	FETCH_OP(ST_USTRING, store)	/* User string: .offset, .size */\
> +	FETCH_OP(ST_SYMSTR, store)	/* Symbol name: .offset, .size */\
> +	FETCH_OP(ST_EDATA, offset)	/* Entry data: .offset */	\
> +	/* Stage 4 (modify) op */					\
> +	FETCH_OP(MOD_BF, bf)		/* Bitfield: .basesize, .lshift, .rshift*/\
> +	/* Stage 5 (loop) op */						\
> +	FETCH_OP(LP_ARRAY, param)	/* Loop array: .param = count */\
> +	/* End */							\
> +	FETCH_OP(END, none)						\
> +	/* Unresolved Symbol holder */					\
> +	FETCH_OP(NOP_SYMBOL, symbol)	/* Non loaded symbol: .data = symbol name */
> +
> +#define FETCH_OP(opname, decode_fn) FETCH_OP_##opname,
>  enum fetch_op {
> -	FETCH_OP_NOP = 0,
> -	// Stage 1 (load) ops
> -	FETCH_OP_REG,		/* Register : .param = offset */
> -	FETCH_OP_STACK,		/* Stack : .param = index */
> -	FETCH_OP_STACKP,	/* Stack pointer */
> -	FETCH_OP_RETVAL,	/* Return value */
> -	FETCH_OP_IMM,		/* Immediate : .immediate */
> -	FETCH_OP_COMM,		/* Current comm */
> -	FETCH_OP_ARG,		/* Function argument : .param */
> -	FETCH_OP_FOFFS,		/* File offset: .immediate */
> -	FETCH_OP_DATA,		/* Allocated data: .data */
> -	FETCH_OP_EDATA,		/* Entry data: .offset */
> -	// Stage 2 (dereference) op
> -	FETCH_OP_DEREF,		/* Dereference: .offset */
> -	FETCH_OP_UDEREF,	/* User-space Dereference: .offset */
> -	// Stage 3 (store) ops
> -	FETCH_OP_ST_RAW,	/* Raw: .size */
> -	FETCH_OP_ST_MEM,	/* Mem: .offset, .size */
> -	FETCH_OP_ST_UMEM,	/* Mem: .offset, .size */
> -	FETCH_OP_ST_STRING,	/* String: .offset, .size */
> -	FETCH_OP_ST_USTRING,	/* User String: .offset, .size */
> -	FETCH_OP_ST_SYMSTR,	/* Kernel Symbol String: .offset, .size */
> -	FETCH_OP_ST_EDATA,	/* Store Entry Data: .offset */
> -	// Stage 4 (modify) op
> -	FETCH_OP_MOD_BF,	/* Bitfield: .basesize, .lshift, .rshift */
> -	// Stage 5 (loop) op
> -	FETCH_OP_LP_ARRAY,	/* Array: .param = loop count */
> -	FETCH_OP_TP_ARG,	/* Trace Point argument */
> -	FETCH_OP_END,
> -	FETCH_NOP_SYMBOL,	/* Unresolved Symbol holder */
> +	FETCH_OP_LIST
>  };
> +#undef FETCH_OP
> +
> +#define FETCH_NOP_SYMBOL FETCH_OP_NOP_SYMBOL
>  
>  struct fetch_insn {
>  	enum fetch_op op;
> @@ -370,6 +379,14 @@ bool trace_probe_match_command_args(struct trace_probe *tp,
>  int trace_probe_create(const char *raw_command, int (*createfn)(int, const char **));
>  int trace_probe_print_args(struct trace_seq *s, struct probe_arg *args, int nr_args,
>  		 u8 *data, void *field);
> +#ifdef CONFIG_PROBE_EVENTS_DUMP_FETCHARG
> +void trace_probe_dump_args(struct seq_file *m, struct trace_probe *tp);
> +#else
> +static inline void trace_probe_dump_args(struct seq_file *m, struct trace_probe *tp)
> +{
> +	return;
> +}
> +#endif
>  
>  #ifdef CONFIG_HAVE_FUNCTION_ARG_ACCESS_API
>  int traceprobe_get_entry_data_size(struct trace_probe *tp);
> diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> index c274346853d1..b2e264a4b96c 100644
> --- a/kernel/trace/trace_uprobe.c
> +++ b/kernel/trace/trace_uprobe.c
> @@ -765,6 +765,9 @@ static int trace_uprobe_show(struct seq_file *m, struct dyn_event *ev)
>  		seq_printf(m, " %s=%s", tu->tp.args[i].name, tu->tp.args[i].comm);
>  
>  	seq_putc(m, '\n');
> +
> +	trace_probe_dump_args(m, &tu->tp);
> +
>  	return 0;
>  }
>  
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply

* Re: [PATCH v2 3/4] irqchip/gic-v3: Add Renesas R-Car Gen4 erratum workaround
From: Marek Vasut @ 2026-06-21 22:46 UTC (permalink / raw)
  To: Thomas Gleixner, linux-pci
  Cc: Yoshihiro Shimoda, Krzysztof Wilczyński, Bjorn Helgaas,
	Catalin Marinas, Conor Dooley, Geert Uytterhoeven,
	Krzysztof Kozlowski, Lorenzo Pieralisi, Manivannan Sadhasivam,
	Marc Zyngier, Rob Herring, devicetree, linux-arm-kernel,
	linux-doc, linux-kernel, linux-renesas-soc
In-Reply-To: <87cxxkma5p.ffs@fw13>

On 6/21/26 12:59 PM, Thomas Gleixner wrote:
> On Fri, Jun 19 2026 at 00:02, Marek Vasut wrote:
>> Renesas R-Car S4/V4H/V4M GIC600 integration has address width for AXI
>> or APB interface configured to 32 bit, it can therefore access only
>> the first 4 GiB of physical address space. This information comes from
>> R-Car V4H Interface Specification sheet, there is currently no technical
>> update number assigned to this limitation. Further input from hardware
>> engineer indicates that this limitation also applies to R-Car S4 and V4M.
>> Name the limitation GEN4GICITS1, and add a driver quirk to mitigate this
>> limitation.
>>
>> The quirk is keyed on the combination of the GIC implementation
>> and the platform identification in the device tree.
>>
>> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> 
> This SOB chain is broken.

Broken ? I don't understand , could you please elaborate ?

Should I sort this alphabetically or is that something else ?

Thank you for your help !

^ permalink raw reply

* Re: [PATCH v3 1/2] dt-bindings: iio: dac: Add AD5529R
From: Conor Dooley @ 2026-06-21 18:35 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Nuno Sá, Janani Sunil, Rodrigo Alencar, Janani Sunil,
	Lars-Peter Clausen, Michael Hennerich, David Lechner,
	Nuno Sá, Andy Shevchenko, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Jonathan Corbet, Shuah Khan,
	linux-iio, devicetree, linux-kernel, linux-doc, Mark Brown
In-Reply-To: <20260621153330.79b6600c@jic23-huawei>

[-- Attachment #1: Type: text/plain, Size: 15710 bytes --]

On Sun, Jun 21, 2026 at 03:33:40PM +0100, Jonathan Cameron wrote:
> On Fri, 19 Jun 2026 16:54:11 +0100
> Nuno Sá <noname.nuno@gmail.com> wrote:
> 
> > On Fri, Jun 19, 2026 at 03:12:07PM +0100, Conor Dooley wrote:
> > > On Fri, Jun 19, 2026 at 02:01:08PM +0100, Nuno Sá wrote:  
> > > > On Fri, Jun 19, 2026 at 12:40:54PM +0100, Conor Dooley wrote:  
> > > > > On Fri, Jun 19, 2026 at 12:36:55PM +0100, Conor Dooley wrote:  
> > > > > > On Fri, Jun 19, 2026 at 12:33:11PM +0200, Janani Sunil wrote:  
> > > > > > > 
> > > > > > > On 6/14/26 21:44, Jonathan Cameron wrote:  
> > > > > > > > On Tue, 9 Jun 2026 16:47:23 +0200
> > > > > > > > Janani Sunil <jan.sun97@gmail.com> wrote:
> > > > > > > >   
> > > > > > > > > On 5/26/26 15:11, Rodrigo Alencar wrote:  
> > > > > > > > > > On 26/05/19 05:42PM, Janani Sunil wrote:  
> > > > > > > > > > > Devicetree bindings for AD5529R 16 channel 12/16 bit high voltage,
> > > > > > > > > > > buffered voltage output digital-to-analog converter (DAC) with an
> > > > > > > > > > > integrated precision reference.  
> > > > > > > > > > ...
> > > > > > > > > > Probably others may comment on that, but...
> > > > > > > > > > 
> > > > > > > > > > This parent node may support device addressing for multi-device support through
> > > > > > > > > > those ID pins. I suppose that each device may have its own power supplies or
> > > > > > > > > > other resources like the toggle pins or reset and enable.
> > > > > > > > > > 
> > > > > > > > > > That way I suppose that an example would look like...  
> > > > > > > > > > > +
> > > > > > > > > > > +patternProperties:
> > > > > > > > > > > +  "^channel@([0-9]|1[0-5])$":
> > > > > > > > > > > +    type: object
> > > > > > > > > > > +    description: Child nodes for individual channel configuration
> > > > > > > > > > > +
> > > > > > > > > > > +    properties:
> > > > > > > > > > > +      reg:
> > > > > > > > > > > +        description: Channel number.
> > > > > > > > > > > +        minimum: 0
> > > > > > > > > > > +        maximum: 15
> > > > > > > > > > > +
> > > > > > > > > > > +      adi,output-range-microvolt:
> > > > > > > > > > > +        description: |
> > > > > > > > > > > +          Output voltage range for this channel as [min, max] in microvolts.
> > > > > > > > > > > +          If not specified, defaults to 0V to 5V range.
> > > > > > > > > > > +        oneOf:
> > > > > > > > > > > +          - items:
> > > > > > > > > > > +              - const: 0
> > > > > > > > > > > +              - enum: [5000000, 10000000, 20000000, 40000000]
> > > > > > > > > > > +          - items:
> > > > > > > > > > > +              - const: -5000000
> > > > > > > > > > > +              - const: 5000000
> > > > > > > > > > > +          - items:
> > > > > > > > > > > +              - const: -10000000
> > > > > > > > > > > +              - const: 10000000
> > > > > > > > > > > +          - items:
> > > > > > > > > > > +              - const: -15000000
> > > > > > > > > > > +              - const: 15000000
> > > > > > > > > > > +          - items:
> > > > > > > > > > > +              - const: -20000000
> > > > > > > > > > > +              - const: 20000000
> > > > > > > > > > > +
> > > > > > > > > > > +    required:
> > > > > > > > > > > +      - reg
> > > > > > > > > > > +
> > > > > > > > > > > +    additionalProperties: false
> > > > > > > > > > > +
> > > > > > > > > > > +required:
> > > > > > > > > > > +  - compatible
> > > > > > > > > > > +  - reg
> > > > > > > > > > > +  - vdd-supply
> > > > > > > > > > > +  - avdd-supply
> > > > > > > > > > > +  - hvdd-supply
> > > > > > > > > > > +
> > > > > > > > > > > +dependencies:
> > > > > > > > > > > +  spi-cpha: [ spi-cpol ]
> > > > > > > > > > > +  spi-cpol: [ spi-cpha ]
> > > > > > > > > > > +
> > > > > > > > > > > +allOf:
> > > > > > > > > > > +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> > > > > > > > > > > +
> > > > > > > > > > > +unevaluatedProperties: false
> > > > > > > > > > > +
> > > > > > > > > > > +examples:
> > > > > > > > > > > +  - |
> > > > > > > > > > > +    #include <dt-bindings/gpio/gpio.h>
> > > > > > > > > > > +
> > > > > > > > > > > +    spi {
> > > > > > > > > > > +        #address-cells = <1>;
> > > > > > > > > > > +        #size-cells = <0>;
> > > > > > > > > > > +
> > > > > > > > > > > +        dac@0 {
> > > > > > > > > > > +            compatible = "adi,ad5529r-16";
> > > > > > > > > > > +            reg = <0>;
> > > > > > > > > > > +            spi-max-frequency = <25000000>;
> > > > > > > > > > > +
> > > > > > > > > > > +            vdd-supply = <&vdd_regulator>;
> > > > > > > > > > > +            avdd-supply = <&avdd_regulator>;
> > > > > > > > > > > +            hvdd-supply = <&hvdd_regulator>;
> > > > > > > > > > > +            hvss-supply = <&hvss_regulator>;
> > > > > > > > > > > +
> > > > > > > > > > > +            reset-gpios = <&gpio0 87 GPIO_ACTIVE_LOW>;
> > > > > > > > > > > +
> > > > > > > > > > > +            #address-cells = <1>;
> > > > > > > > > > > +            #size-cells = <0>;
> > > > > > > > > > > +
> > > > > > > > > > > +            channel@0 {
> > > > > > > > > > > +                reg = <0>;
> > > > > > > > > > > +                adi,output-range-microvolt = <0 5000000>;
> > > > > > > > > > > +            };
> > > > > > > > > > > +
> > > > > > > > > > > +            channel@1 {
> > > > > > > > > > > +                reg = <1>;
> > > > > > > > > > > +                adi,output-range-microvolt = <(-10000000) 10000000>;
> > > > > > > > > > > +            };
> > > > > > > > > > > +
> > > > > > > > > > > +            channel@2 {
> > > > > > > > > > > +                reg = <2>;
> > > > > > > > > > > +                adi,output-range-microvolt = <0 40000000>;
> > > > > > > > > > > +            };
> > > > > > > > > > > +        };
> > > > > > > > > > > +    };  
> > > > > > > > > > ...
> > > > > > > > > > 
> > > > > > > > > > 	spi {
> > > > > > > > > > 		#address-cells = <1>;
> > > > > > > > > > 		#size-cells = <0>;
> > > > > > > > > > 
> > > > > > > > > > 		multi-dac@0 {
> > > > > > > > > > 			compatible = "adi,ad5529r-16";
> > > > > > > > > > 			reg = <0>;
> > > > > > > > > > 			spi-max-frequency = <25000000>;
> > > > > > > > > > 
> > > > > > > > > > 			#address-cells = <1>;
> > > > > > > > > > 			#size-cells = <0>;
> > > > > > > > > > 
> > > > > > > > > > 			dac@0 {
> > > > > > > > > > 				reg = <0>;
> > > > > > > > > > 				vdd-supply = <&vdd_regulator>;
> > > > > > > > > > 				avdd-supply = <&avdd_regulator>;
> > > > > > > > > > 				hvdd-supply = <&hvdd_regulator>;
> > > > > > > > > > 				hvss-supply = <&hvss_regulator>;
> > > > > > > > > > 
> > > > > > > > > > 				reset-gpios = <&gpio0 87 GPIO_ACTIVE_LOW>;
> > > > > > > > > > 
> > > > > > > > > > 				#address-cells = <1>;
> > > > > > > > > > 				#size-cells = <0>;
> > > > > > > > > > 
> > > > > > > > > > 				channel@0 {
> > > > > > > > > > 					reg = <0>;
> > > > > > > > > > 					adi,output-range-microvolt = <0 5000000>;
> > > > > > > > > > 				};
> > > > > > > > > > 
> > > > > > > > > > 				channel@1 {
> > > > > > > > > > 					reg = <1>;
> > > > > > > > > > 					adi,output-range-microvolt = <(-10000000) 10000000>;
> > > > > > > > > > 				};
> > > > > > > > > > 
> > > > > > > > > > 				channel@2 {
> > > > > > > > > > 					reg = <2>;
> > > > > > > > > > 					adi,output-range-microvolt = <0 40000000>;
> > > > > > > > > > 				};
> > > > > > > > > > 			}
> > > > > > > > > > 
> > > > > > > > > > 			dac@1 {
> > > > > > > > > > 				reg = <1>;
> > > > > > > > > > 				vdd-supply = <&vdd_regulator>;
> > > > > > > > > > 				avdd-supply = <&avdd_regulator>;
> > > > > > > > > > 				hvdd-supply = <&hvdd_regulator>;
> > > > > > > > > > 				hvss-supply = <&hvss_regulator>;
> > > > > > > > > > 
> > > > > > > > > > 				reset-gpios = <&gpio0 88 GPIO_ACTIVE_LOW>;
> > > > > > > > > > 
> > > > > > > > > > 				#address-cells = <1>;
> > > > > > > > > > 				#size-cells = <0>;
> > > > > > > > > > 
> > > > > > > > > > 				channel@0 {
> > > > > > > > > > 					reg = <0>;
> > > > > > > > > > 					adi,output-range-microvolt = <0 5000000>;
> > > > > > > > > > 				};
> > > > > > > > > > 
> > > > > > > > > > 				channel@1 {
> > > > > > > > > > 					reg = <1>;
> > > > > > > > > > 					adi,output-range-microvolt = <(-10000000) 10000000>;
> > > > > > > > > > 				};
> > > > > > > > > > 			}
> > > > > > > > > > 		};
> > > > > > > > > > 	};
> > > > > > > > > > 
> > > > > > > > > > then you might need something like:
> > > > > > > > > > 
> > > > > > > > > > 	patternProperties:
> > > > > > > > > > 		"^dac@[0-3]$":
> > > > > > > > > > 
> > > > > > > > > > and put most of the things under this node pattern.
> > > > > > > > > > 
> > > > > > > > > > So the main driver that you're putting together might need to handle up to four instances.
> > > > > > > > > > Even if your current driver cannot handle this, the dt-bindings might need cover that.
> > > > > > > > > > 
> > > > > > > > > > Need to double check if each dac node needs a separate compatible, so you would maybe populate
> > > > > > > > > > a platform data to be shared with the child nodes, which would be a separate driver.
> > > > > > > > > > (not sure if it would make sense to mix and match ad5529r-16 and ad5529r-12).  
> > > > > > > > > Hi Rodrigo,
> > > > > > > > > 
> > > > > > > > > Thank you for looking at this.
> > > > > > > > > 
> > > > > > > > > For now, I would prefer to keep the binding scoped to a single AD5529R device instance. The current
> > > > > > > > > hardware/use case we have only needs one device node and the driver is written around that model as well.
> > > > > > > > > While the device addressing pins could allow multi-device topology, we do not have an actual platform using
> > > > > > > > > that configuration at the moment, so I would prefer not to introduce an extra parent/child binding structure
> > > > > > > > > speculatively without a validating use case.  
> > > > > > > > Interesting feature - kind of similar to address control on a typical i2c bus device, or
> > > > > > > > looking at it another way a kind of distributed SPI mux.
> > > > > > > > 
> > > > > > > > Challenge of a binding is we need to anticipate the future.  So I think we do need something
> > > > > > > > like Rodrigo is suggesting even if we only (for now) support a single instance in the driver.
> > > > > > > > That would leave the path open to supporting the addressing at a later date.
> > > > > > > > An alternative might be to look at it like a chained device setup. In those we pretend there
> > > > > > > > is just one device with a lot of channels etc.  The snag is that here things are more loosely
> > > > > > > > coupled whereas for those devices it tends to be you have to read / write the same register
> > > > > > > > in all devices in the chain as one big SPI message.
> > > > > > > > 
> > > > > > > > +CC Mark Brown as he may know of some precedence for this feature. For his reference..
> > > > > > > > - Each of these device has 2 ID pins.  The SPI transfers have to contain the 2 bit
> > > > > > > > value that matches that or they are ignored.  Thus a single bus + 1 chip select can
> > > > > > > > be used to talk to 4 devices.  Question is what that looks like in device tree + I guess
> > > > > > > > longer term how to support it cleanly in SPI.  
> > > > > > 
> > > > > > I'd swear I have seen this before, from some Microchip devices. Let me
> > > > > > see if I can find what I am thinking of...  
> > > > > 
> > > > > 
> > > > > microchip,mcp3911 and microchip,mcp3564 both seem to do this with
> > > > > slightly different properties.
> > > > > 
> > > > >   microchip,device-addr:
> > > > >     description: Device address when multiple MCP3911 chips are present on the same SPI bus.
> > > > >     $ref: /schemas/types.yaml#/definitions/uint32
> > > > >     enum: [0, 1, 2, 3]
> > > > >     default: 0
> > > > > 
> > > > > and
> > > > > 
> > > > > 
> > > > >   microchip,hw-device-address:
> > > > >     $ref: /schemas/types.yaml#/definitions/uint32
> > > > >     minimum: 0
> > > > >     maximum: 3
> > > > >     description:
> > > > >       The address is set on a per-device basis by fuses in the factory,
> > > > >       configured on request. If not requested, the fuses are set for 0x1.
> > > > >       The device address is part of the device markings to avoid
> > > > >       potential confusion. This address is coded on two bits, so four possible
> > > > >       addresses are available when multiple devices are present on the same
> > > > >       SPI bus with only one Chip Select line for all devices.
> > > > >       Each device communication starts by a CS falling edge, followed by the
> > > > >       clocking of the device address (BITS[7:6] - top two bits of COMMAND BYTE
> > > > >       which is first one on the wire).
> > > > > 
> > > > > This sounds exactly like the sort of feature that you're dealing with
> > > > > here?
> > > > >   
> > > > 
> > > > The core idea yes but for this chip, things are a bit more annoying (but
> > > > Janani can correct me if I'm wrong). Here, each device can, in theory,
> > > > have it's own supplies, pins and at the very least, channels with maybe
> > > > different scales. That is why Janani is proposing dac nodes. Given I
> > > > honestly don't like much of that "adi,ad5529r-bus" compatible I wondered
> > > > about solving this at the spi level.
> > > > 
> > > > Ah and to make it more annoying, we can also mix 12 and 16 bits variants
> > > > together in the same bus.  
> > > 
> > > I'm definitely missing something, because that property for the
> > > microchip devices is not impacted what else is on the bus. AFAICT, you
> > > could have an mcp3911 and an mcp3564 on the same bus even though both
> > > are completely different devices with different drivers. They have
> > > individual device nodes and their own supplies etc etc. These aren't
> > > per-channel properties on an adc or dac, they're per child device on a
> > > spi bus.  
> > 
> > Maybe I'm the one missing something :). IIRC, spi would not allow two
> > devices on the same CS right? Because for this chip we would need
> > something like:
> > 
> > spi {
> > 	dac@0 {
> > 		reg = <0>;
> > 		adi,pin-id = <0>;
> > 	};
> > 
> > 	dac@1 {
> > 		reg = <0>; // which seems already problematic?
> > 		adi,pin-id <1>;
> > 	};
> > 
> > 	...
> > 
> > 	//up to 4
> > };
> Yeah. It's not clear to me how that works for the microchip devices
> (I suspect it doesn't!)
> 
> Just thinking as I type, but could we do something a bit nasty with
> a gpio mux that doesn't actually switch but represents the GPIO being
> shared?  Given this is all tied to the spi bus that should all happen
> under serializing locks. 
> 
> Agreed though that this would be nicer as an SPI thing that let
> us specify that a single CS is share by multiple devices and their
> is some other signal acting to select which one we are talking to.

Whether it works or not, I think it is the more correct approach. Messing
with gpio muxes seems completely wrong, given the chip select may not be
a gpio at all.

Why do you think the microchip devices won't work? Does the spi core
reject multiple devices with the same chip select being registered or
something like that?

Certainly seems like an opportunity though to do something common
property wise, if both ADI and Microchip are trying to do the same thing
here with multiple users of the same chip select.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply

* Re: [PATCH v2 3/4] irqchip/gic-v3: Add Renesas R-Car Gen4 erratum workaround
From: Marc Zyngier @ 2026-06-21 17:00 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-pci, Yoshihiro Shimoda, Krzysztof Wilczyński,
	Bjorn Helgaas, Catalin Marinas, Conor Dooley, Geert Uytterhoeven,
	Krzysztof Kozlowski, Lorenzo Pieralisi, Manivannan Sadhasivam,
	Rob Herring, devicetree, linux-arm-kernel, linux-doc,
	linux-kernel, linux-renesas-soc
In-Reply-To: <20260618220427.14325-4-marek.vasut+renesas@mailbox.org>

On Thu, 18 Jun 2026 23:02:01 +0100,
Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
> 
> Renesas R-Car S4/V4H/V4M GIC600 integration has address width for AXI
> or APB interface configured to 32 bit, it can therefore access only
> the first 4 GiB of physical address space. This information comes from
> R-Car V4H Interface Specification sheet, there is currently no technical
> update number assigned to this limitation. Further input from hardware
> engineer indicates that this limitation also applies to R-Car S4 and V4M.
> Name the limitation GEN4GICITS1, and add a driver quirk to mitigate this
> limitation.
> 
> The quirk is keyed on the combination of the GIC implementation
> and the platform identification in the device tree.
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

With the SoB chain issue addressed:

Acked-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply

* Re: [PATCH v2 2/4] irqchip/gic-v3: Refactor GIC600 limited to 32bit PA erratum handling
From: Marc Zyngier @ 2026-06-21 16:59 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-pci, Krzysztof Wilczyński, Bjorn Helgaas,
	Catalin Marinas, Conor Dooley, Geert Uytterhoeven,
	Krzysztof Kozlowski, Lorenzo Pieralisi, Manivannan Sadhasivam,
	Rob Herring, Yoshihiro Shimoda, devicetree, linux-arm-kernel,
	linux-doc, linux-kernel, linux-renesas-soc
In-Reply-To: <20260618220427.14325-3-marek.vasut+renesas@mailbox.org>

On Thu, 18 Jun 2026 23:02:00 +0100,
Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
> 
> The GIC600 implementation is now known to be used on multiple 64-bit
> SoCs, where it has address width for AXI or APB interface configured
> to 32 bit, and it can access only the first 4GiB of physical address
> space.
> 
> Rework the handling of the quirk to work around this limitation such
> that new entries can be added purely as new compatible strings, with
> no need to add additional functions or new its_quirk array entries.
> 
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

Acked-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply

* Re: [PATCH v3 1/2] dt-bindings: iio: dac: Add AD5529R
From: Jonathan Cameron @ 2026-06-21 14:33 UTC (permalink / raw)
  To: Nuno Sá
  Cc: Conor Dooley, Janani Sunil, Rodrigo Alencar, Janani Sunil,
	Lars-Peter Clausen, Michael Hennerich, David Lechner,
	Nuno Sá, Andy Shevchenko, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Jonathan Corbet, Shuah Khan,
	linux-iio, devicetree, linux-kernel, linux-doc, Mark Brown
In-Reply-To: <ajVlD-j0nIGrRVow@nsa>

On Fri, 19 Jun 2026 16:54:11 +0100
Nuno Sá <noname.nuno@gmail.com> wrote:

> On Fri, Jun 19, 2026 at 03:12:07PM +0100, Conor Dooley wrote:
> > On Fri, Jun 19, 2026 at 02:01:08PM +0100, Nuno Sá wrote:  
> > > On Fri, Jun 19, 2026 at 12:40:54PM +0100, Conor Dooley wrote:  
> > > > On Fri, Jun 19, 2026 at 12:36:55PM +0100, Conor Dooley wrote:  
> > > > > On Fri, Jun 19, 2026 at 12:33:11PM +0200, Janani Sunil wrote:  
> > > > > > 
> > > > > > On 6/14/26 21:44, Jonathan Cameron wrote:  
> > > > > > > On Tue, 9 Jun 2026 16:47:23 +0200
> > > > > > > Janani Sunil <jan.sun97@gmail.com> wrote:
> > > > > > >   
> > > > > > > > On 5/26/26 15:11, Rodrigo Alencar wrote:  
> > > > > > > > > On 26/05/19 05:42PM, Janani Sunil wrote:  
> > > > > > > > > > Devicetree bindings for AD5529R 16 channel 12/16 bit high voltage,
> > > > > > > > > > buffered voltage output digital-to-analog converter (DAC) with an
> > > > > > > > > > integrated precision reference.  
> > > > > > > > > ...
> > > > > > > > > Probably others may comment on that, but...
> > > > > > > > > 
> > > > > > > > > This parent node may support device addressing for multi-device support through
> > > > > > > > > those ID pins. I suppose that each device may have its own power supplies or
> > > > > > > > > other resources like the toggle pins or reset and enable.
> > > > > > > > > 
> > > > > > > > > That way I suppose that an example would look like...  
> > > > > > > > > > +
> > > > > > > > > > +patternProperties:
> > > > > > > > > > +  "^channel@([0-9]|1[0-5])$":
> > > > > > > > > > +    type: object
> > > > > > > > > > +    description: Child nodes for individual channel configuration
> > > > > > > > > > +
> > > > > > > > > > +    properties:
> > > > > > > > > > +      reg:
> > > > > > > > > > +        description: Channel number.
> > > > > > > > > > +        minimum: 0
> > > > > > > > > > +        maximum: 15
> > > > > > > > > > +
> > > > > > > > > > +      adi,output-range-microvolt:
> > > > > > > > > > +        description: |
> > > > > > > > > > +          Output voltage range for this channel as [min, max] in microvolts.
> > > > > > > > > > +          If not specified, defaults to 0V to 5V range.
> > > > > > > > > > +        oneOf:
> > > > > > > > > > +          - items:
> > > > > > > > > > +              - const: 0
> > > > > > > > > > +              - enum: [5000000, 10000000, 20000000, 40000000]
> > > > > > > > > > +          - items:
> > > > > > > > > > +              - const: -5000000
> > > > > > > > > > +              - const: 5000000
> > > > > > > > > > +          - items:
> > > > > > > > > > +              - const: -10000000
> > > > > > > > > > +              - const: 10000000
> > > > > > > > > > +          - items:
> > > > > > > > > > +              - const: -15000000
> > > > > > > > > > +              - const: 15000000
> > > > > > > > > > +          - items:
> > > > > > > > > > +              - const: -20000000
> > > > > > > > > > +              - const: 20000000
> > > > > > > > > > +
> > > > > > > > > > +    required:
> > > > > > > > > > +      - reg
> > > > > > > > > > +
> > > > > > > > > > +    additionalProperties: false
> > > > > > > > > > +
> > > > > > > > > > +required:
> > > > > > > > > > +  - compatible
> > > > > > > > > > +  - reg
> > > > > > > > > > +  - vdd-supply
> > > > > > > > > > +  - avdd-supply
> > > > > > > > > > +  - hvdd-supply
> > > > > > > > > > +
> > > > > > > > > > +dependencies:
> > > > > > > > > > +  spi-cpha: [ spi-cpol ]
> > > > > > > > > > +  spi-cpol: [ spi-cpha ]
> > > > > > > > > > +
> > > > > > > > > > +allOf:
> > > > > > > > > > +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> > > > > > > > > > +
> > > > > > > > > > +unevaluatedProperties: false
> > > > > > > > > > +
> > > > > > > > > > +examples:
> > > > > > > > > > +  - |
> > > > > > > > > > +    #include <dt-bindings/gpio/gpio.h>
> > > > > > > > > > +
> > > > > > > > > > +    spi {
> > > > > > > > > > +        #address-cells = <1>;
> > > > > > > > > > +        #size-cells = <0>;
> > > > > > > > > > +
> > > > > > > > > > +        dac@0 {
> > > > > > > > > > +            compatible = "adi,ad5529r-16";
> > > > > > > > > > +            reg = <0>;
> > > > > > > > > > +            spi-max-frequency = <25000000>;
> > > > > > > > > > +
> > > > > > > > > > +            vdd-supply = <&vdd_regulator>;
> > > > > > > > > > +            avdd-supply = <&avdd_regulator>;
> > > > > > > > > > +            hvdd-supply = <&hvdd_regulator>;
> > > > > > > > > > +            hvss-supply = <&hvss_regulator>;
> > > > > > > > > > +
> > > > > > > > > > +            reset-gpios = <&gpio0 87 GPIO_ACTIVE_LOW>;
> > > > > > > > > > +
> > > > > > > > > > +            #address-cells = <1>;
> > > > > > > > > > +            #size-cells = <0>;
> > > > > > > > > > +
> > > > > > > > > > +            channel@0 {
> > > > > > > > > > +                reg = <0>;
> > > > > > > > > > +                adi,output-range-microvolt = <0 5000000>;
> > > > > > > > > > +            };
> > > > > > > > > > +
> > > > > > > > > > +            channel@1 {
> > > > > > > > > > +                reg = <1>;
> > > > > > > > > > +                adi,output-range-microvolt = <(-10000000) 10000000>;
> > > > > > > > > > +            };
> > > > > > > > > > +
> > > > > > > > > > +            channel@2 {
> > > > > > > > > > +                reg = <2>;
> > > > > > > > > > +                adi,output-range-microvolt = <0 40000000>;
> > > > > > > > > > +            };
> > > > > > > > > > +        };
> > > > > > > > > > +    };  
> > > > > > > > > ...
> > > > > > > > > 
> > > > > > > > > 	spi {
> > > > > > > > > 		#address-cells = <1>;
> > > > > > > > > 		#size-cells = <0>;
> > > > > > > > > 
> > > > > > > > > 		multi-dac@0 {
> > > > > > > > > 			compatible = "adi,ad5529r-16";
> > > > > > > > > 			reg = <0>;
> > > > > > > > > 			spi-max-frequency = <25000000>;
> > > > > > > > > 
> > > > > > > > > 			#address-cells = <1>;
> > > > > > > > > 			#size-cells = <0>;
> > > > > > > > > 
> > > > > > > > > 			dac@0 {
> > > > > > > > > 				reg = <0>;
> > > > > > > > > 				vdd-supply = <&vdd_regulator>;
> > > > > > > > > 				avdd-supply = <&avdd_regulator>;
> > > > > > > > > 				hvdd-supply = <&hvdd_regulator>;
> > > > > > > > > 				hvss-supply = <&hvss_regulator>;
> > > > > > > > > 
> > > > > > > > > 				reset-gpios = <&gpio0 87 GPIO_ACTIVE_LOW>;
> > > > > > > > > 
> > > > > > > > > 				#address-cells = <1>;
> > > > > > > > > 				#size-cells = <0>;
> > > > > > > > > 
> > > > > > > > > 				channel@0 {
> > > > > > > > > 					reg = <0>;
> > > > > > > > > 					adi,output-range-microvolt = <0 5000000>;
> > > > > > > > > 				};
> > > > > > > > > 
> > > > > > > > > 				channel@1 {
> > > > > > > > > 					reg = <1>;
> > > > > > > > > 					adi,output-range-microvolt = <(-10000000) 10000000>;
> > > > > > > > > 				};
> > > > > > > > > 
> > > > > > > > > 				channel@2 {
> > > > > > > > > 					reg = <2>;
> > > > > > > > > 					adi,output-range-microvolt = <0 40000000>;
> > > > > > > > > 				};
> > > > > > > > > 			}
> > > > > > > > > 
> > > > > > > > > 			dac@1 {
> > > > > > > > > 				reg = <1>;
> > > > > > > > > 				vdd-supply = <&vdd_regulator>;
> > > > > > > > > 				avdd-supply = <&avdd_regulator>;
> > > > > > > > > 				hvdd-supply = <&hvdd_regulator>;
> > > > > > > > > 				hvss-supply = <&hvss_regulator>;
> > > > > > > > > 
> > > > > > > > > 				reset-gpios = <&gpio0 88 GPIO_ACTIVE_LOW>;
> > > > > > > > > 
> > > > > > > > > 				#address-cells = <1>;
> > > > > > > > > 				#size-cells = <0>;
> > > > > > > > > 
> > > > > > > > > 				channel@0 {
> > > > > > > > > 					reg = <0>;
> > > > > > > > > 					adi,output-range-microvolt = <0 5000000>;
> > > > > > > > > 				};
> > > > > > > > > 
> > > > > > > > > 				channel@1 {
> > > > > > > > > 					reg = <1>;
> > > > > > > > > 					adi,output-range-microvolt = <(-10000000) 10000000>;
> > > > > > > > > 				};
> > > > > > > > > 			}
> > > > > > > > > 		};
> > > > > > > > > 	};
> > > > > > > > > 
> > > > > > > > > then you might need something like:
> > > > > > > > > 
> > > > > > > > > 	patternProperties:
> > > > > > > > > 		"^dac@[0-3]$":
> > > > > > > > > 
> > > > > > > > > and put most of the things under this node pattern.
> > > > > > > > > 
> > > > > > > > > So the main driver that you're putting together might need to handle up to four instances.
> > > > > > > > > Even if your current driver cannot handle this, the dt-bindings might need cover that.
> > > > > > > > > 
> > > > > > > > > Need to double check if each dac node needs a separate compatible, so you would maybe populate
> > > > > > > > > a platform data to be shared with the child nodes, which would be a separate driver.
> > > > > > > > > (not sure if it would make sense to mix and match ad5529r-16 and ad5529r-12).  
> > > > > > > > Hi Rodrigo,
> > > > > > > > 
> > > > > > > > Thank you for looking at this.
> > > > > > > > 
> > > > > > > > For now, I would prefer to keep the binding scoped to a single AD5529R device instance. The current
> > > > > > > > hardware/use case we have only needs one device node and the driver is written around that model as well.
> > > > > > > > While the device addressing pins could allow multi-device topology, we do not have an actual platform using
> > > > > > > > that configuration at the moment, so I would prefer not to introduce an extra parent/child binding structure
> > > > > > > > speculatively without a validating use case.  
> > > > > > > Interesting feature - kind of similar to address control on a typical i2c bus device, or
> > > > > > > looking at it another way a kind of distributed SPI mux.
> > > > > > > 
> > > > > > > Challenge of a binding is we need to anticipate the future.  So I think we do need something
> > > > > > > like Rodrigo is suggesting even if we only (for now) support a single instance in the driver.
> > > > > > > That would leave the path open to supporting the addressing at a later date.
> > > > > > > An alternative might be to look at it like a chained device setup. In those we pretend there
> > > > > > > is just one device with a lot of channels etc.  The snag is that here things are more loosely
> > > > > > > coupled whereas for those devices it tends to be you have to read / write the same register
> > > > > > > in all devices in the chain as one big SPI message.
> > > > > > > 
> > > > > > > +CC Mark Brown as he may know of some precedence for this feature. For his reference..
> > > > > > > - Each of these device has 2 ID pins.  The SPI transfers have to contain the 2 bit
> > > > > > > value that matches that or they are ignored.  Thus a single bus + 1 chip select can
> > > > > > > be used to talk to 4 devices.  Question is what that looks like in device tree + I guess
> > > > > > > longer term how to support it cleanly in SPI.  
> > > > > 
> > > > > I'd swear I have seen this before, from some Microchip devices. Let me
> > > > > see if I can find what I am thinking of...  
> > > > 
> > > > 
> > > > microchip,mcp3911 and microchip,mcp3564 both seem to do this with
> > > > slightly different properties.
> > > > 
> > > >   microchip,device-addr:
> > > >     description: Device address when multiple MCP3911 chips are present on the same SPI bus.
> > > >     $ref: /schemas/types.yaml#/definitions/uint32
> > > >     enum: [0, 1, 2, 3]
> > > >     default: 0
> > > > 
> > > > and
> > > > 
> > > > 
> > > >   microchip,hw-device-address:
> > > >     $ref: /schemas/types.yaml#/definitions/uint32
> > > >     minimum: 0
> > > >     maximum: 3
> > > >     description:
> > > >       The address is set on a per-device basis by fuses in the factory,
> > > >       configured on request. If not requested, the fuses are set for 0x1.
> > > >       The device address is part of the device markings to avoid
> > > >       potential confusion. This address is coded on two bits, so four possible
> > > >       addresses are available when multiple devices are present on the same
> > > >       SPI bus with only one Chip Select line for all devices.
> > > >       Each device communication starts by a CS falling edge, followed by the
> > > >       clocking of the device address (BITS[7:6] - top two bits of COMMAND BYTE
> > > >       which is first one on the wire).
> > > > 
> > > > This sounds exactly like the sort of feature that you're dealing with
> > > > here?
> > > >   
> > > 
> > > The core idea yes but for this chip, things are a bit more annoying (but
> > > Janani can correct me if I'm wrong). Here, each device can, in theory,
> > > have it's own supplies, pins and at the very least, channels with maybe
> > > different scales. That is why Janani is proposing dac nodes. Given I
> > > honestly don't like much of that "adi,ad5529r-bus" compatible I wondered
> > > about solving this at the spi level.
> > > 
> > > Ah and to make it more annoying, we can also mix 12 and 16 bits variants
> > > together in the same bus.  
> > 
> > I'm definitely missing something, because that property for the
> > microchip devices is not impacted what else is on the bus. AFAICT, you
> > could have an mcp3911 and an mcp3564 on the same bus even though both
> > are completely different devices with different drivers. They have
> > individual device nodes and their own supplies etc etc. These aren't
> > per-channel properties on an adc or dac, they're per child device on a
> > spi bus.  
> 
> Maybe I'm the one missing something :). IIRC, spi would not allow two
> devices on the same CS right? Because for this chip we would need
> something like:
> 
> spi {
> 	dac@0 {
> 		reg = <0>;
> 		adi,pin-id = <0>;
> 	};
> 
> 	dac@1 {
> 		reg = <0>; // which seems already problematic?
> 		adi,pin-id <1>;
> 	};
> 
> 	...
> 
> 	//up to 4
> };
Yeah. It's not clear to me how that works for the microchip devices
(I suspect it doesn't!)

Just thinking as I type, but could we do something a bit nasty with
a gpio mux that doesn't actually switch but represents the GPIO being
shared?  Given this is all tied to the spi bus that should all happen
under serializing locks. 

Agreed though that this would be nicer as an SPI thing that let
us specify that a single CS is share by multiple devices and their
is some other signal acting to select which one we are talking to.

Jonathan


> 
> - Nuno Sá
> 
> 


^ permalink raw reply

* Re: [PATCH 1/2] tracing: Move non-trace_printk prototypes back to kernel.h
From: Steven Rostedt @ 2026-06-21 13:24 UTC (permalink / raw)
  To: Yury Norov, Steven Rostedt
  Cc: linux-kernel, linux-trace-kernel, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, Andrew Morton, Linus Torvalds,
	Sebastian Andrzej Siewior, John Ogness, Thomas Gleixner,
	Peter Zijlstra, Julia Lawall, linux-doc, linux-kbuild,
	linuxppc-dev, dri-devel, linux-stm32, linux-arm-kernel,
	linux-rdma, linux-usb, linux-ext4, linux-nfs, kvm, intel-gfx
In-Reply-To: <ajfiVTlCIVlqW3sh@yury>



On June 21, 2026 2:08:37 PM GMT+01:00, Yury Norov <yury.norov@gmail.com> wrote:
>On Sun, Jun 21, 2026 at 05:34:31AM -0400, Steven Rostedt wrote:
>> From: Steven Rostedt <rostedt@goodmis.org>
>> 
>> In order to remove the include to trace_printk.h from kernel.h the tracing
>> control prototypes need to be moved back into kernel.h. That's because
>
>Please don't. Instead, you can split them out to trace_control.h, and
>include where needed. I actually have a prototype for it, FYI:
>
>https://github.com/norov/linux/tree/trace_pritk3
>

Sure, I have no problem adding another header for this.

>> they are used in other common header files like rcu.h. There's no point in
>> removing trace_printk.h from kernel.h if it just gets added back to other
>> common headers.
>> 
>> Prototypes are very cheap for the compiler and should not be an issue.
>
>It's not about cost, it's about mess. kernel.h is included everywhere.
>Is that API needed everywhere? No, it's needed in literally 10 files.
>So, no place in kernel.h.
> 

Well one of those files is rcu.h which is also pretty much included everywhere. But OK.

-- Steve 


>> 
>> 2.53.0
>> 

^ permalink raw reply

* Re: [PATCH 2/2] tracing: Add CONFIG_TRACE_PRINTK_DEBUGGING to clean up kernel.h
From: Yury Norov @ 2026-06-21 13:57 UTC (permalink / raw)
  To: Yury Norov
  Cc: Steven Rostedt, linux-kernel, linux-trace-kernel,
	Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	Linus Torvalds, Sebastian Andrzej Siewior, John Ogness,
	Thomas Gleixner, Peter Zijlstra, Julia Lawall, linux-doc,
	linux-kbuild, linuxppc-dev, dri-devel, linux-stm32,
	linux-arm-kernel, linux-rdma, linux-usb, linux-ext4, linux-nfs,
	kvm, intel-gfx
In-Reply-To: <ajfphe4Z8BrfYoUX@yury>

On Sun, Jun 21, 2026 at 09:39:17AM -0400, Yury Norov wrote:
> On Sun, Jun 21, 2026 at 05:47:21AM -0400, Steven Rostedt wrote:
> > On Sun, 21 Jun 2026 05:34:32 -0400
> > Steven Rostedt <rostedt@kernel.org> wrote:
> > 
> > > Instead of having trace_printk.h included in kernel.h, create a config
> > > TRACE_PRINTK_DEBUGGING that when set will update the CFLAGS in the
> > > Makefile to allow developers to add trace_printk() without the need to add
> > > the include for it. Having it included in the Makefile keeps it from being
> > > in the dependency chain and it will not waste extra CPU cycles for those
> > > building the kernel without using trace_printk.
> > 
> > Bah, I only tested with the config option enabled, and missed some
> > dependencies with it disabled.
> 
> Yes you did.
>  
> > For instance, rcu.h also uses ftrace_dump() so that too needs to go
> > into kernel.h.
> 
> No, it shouldn't.
> 
> > I also need to add a few more includes to trace_printk.h.
> 
> > OK, I need to run this through all my tests to find where else I missed
> > adding the includes. But the idea should hopefully satisfy everyone.
> 
> If you include it under config in kernel.h, to make the kernel buildable,

I mean: in kernel.h or in Makefile.

> you need to include trace_printk.h explicitly where it's actually used.
> IOW, apply my patch v4-7.
> 
> Then, developers who use trace_printk() on their development machine,
> will be really frustrated when their debugging code will break client
> build just because CONFIG_TRACE_PRINTK_DEBUGGING is disabled there.
> They will spend a day, at best, communicating with remote managers,
> and end up with adding #include <linux/trace_printk.h> in the files
> they touch. Is that your plan?
> 
> If I was one of those developers, the solution would be simple for me:
> don't use trace_printk() at all.
> 
> Thanks,
> Yury

^ permalink raw reply

* Re: [PATCH 2/2] tracing: Add CONFIG_TRACE_PRINTK_DEBUGGING to clean up kernel.h
From: Yury Norov @ 2026-06-21 13:39 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, linux-trace-kernel, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, Andrew Morton, Linus Torvalds,
	Sebastian Andrzej Siewior, John Ogness, Thomas Gleixner,
	Peter Zijlstra, Julia Lawall, Yury Norov, linux-doc, linux-kbuild,
	linuxppc-dev, dri-devel, linux-stm32, linux-arm-kernel,
	linux-rdma, linux-usb, linux-ext4, linux-nfs, kvm, intel-gfx
In-Reply-To: <20260621054721.7cde38f0@fedora>

On Sun, Jun 21, 2026 at 05:47:21AM -0400, Steven Rostedt wrote:
> On Sun, 21 Jun 2026 05:34:32 -0400
> Steven Rostedt <rostedt@kernel.org> wrote:
> 
> > Instead of having trace_printk.h included in kernel.h, create a config
> > TRACE_PRINTK_DEBUGGING that when set will update the CFLAGS in the
> > Makefile to allow developers to add trace_printk() without the need to add
> > the include for it. Having it included in the Makefile keeps it from being
> > in the dependency chain and it will not waste extra CPU cycles for those
> > building the kernel without using trace_printk.
> 
> Bah, I only tested with the config option enabled, and missed some
> dependencies with it disabled.

Yes you did.
 
> For instance, rcu.h also uses ftrace_dump() so that too needs to go
> into kernel.h.

No, it shouldn't.

> I also need to add a few more includes to trace_printk.h.

> OK, I need to run this through all my tests to find where else I missed
> adding the includes. But the idea should hopefully satisfy everyone.

If you include it under config in kernel.h, to make the kernel buildable,
you need to include trace_printk.h explicitly where it's actually used.
IOW, apply my patch v4-7.

Then, developers who use trace_printk() on their development machine,
will be really frustrated when their debugging code will break client
build just because CONFIG_TRACE_PRINTK_DEBUGGING is disabled there.
They will spend a day, at best, communicating with remote managers,
and end up with adding #include <linux/trace_printk.h> in the files
they touch. Is that your plan?

If I was one of those developers, the solution would be simple for me:
don't use trace_printk() at all.

Thanks,
Yury

^ permalink raw reply

* [PATCH v2 2/2] docs/zh_CN: update sphinx.rst translation
From: Jiandong Qiu @ 2026-06-21 13:12 UTC (permalink / raw)
  To: alexs, si.yanteng
  Cc: dzm91, corbet, skhan, linux-doc, linux-kernel, Jiandong Qiu
In-Reply-To: <20260621131215.1303439-1-qiujiandong1998@gmail.com>

Update the zh_CN translation of doc-guide/sphinx.rst.

Update this translation through commit f1c2db1f145b
("docs: move test_doc_build.py to tools/docs")

- clean up the file header anchor `_sphinxdoc_zh`
- sync the Chinese translation with the current Sphinx build requirements
- add sections on HTML math rendering and minimum-version testing
- refresh guidance for tables, cross-references, and commit references

Assisted-by: Codex:GPT-5.4
Signed-off-by: Jiandong Qiu <qiujiandong1998@gmail.com>
---
 .../translations/zh_CN/doc-guide/sphinx.rst   | 167 ++++++++++++++----
 1 file changed, 133 insertions(+), 34 deletions(-)

diff --git a/Documentation/translations/zh_CN/doc-guide/sphinx.rst b/Documentation/translations/zh_CN/doc-guide/sphinx.rst
index 3375c6f3a811..11e846fc97e4 100644
--- a/Documentation/translations/zh_CN/doc-guide/sphinx.rst
+++ b/Documentation/translations/zh_CN/doc-guide/sphinx.rst
@@ -1,10 +1,11 @@
+.. SPDX-License-Identifier: GPL-2.0
 .. include:: ../disclaimer-zh_CN.rst
 
 :Original: Documentation/doc-guide/sphinx.rst
 
-:译者: 吴想成 Wu XiangCheng <bobwxc@email.cn>
-
-.. _sphinxdoc_zh:
+:译者:
+ - 吴想成 Wu XiangCheng <bobwxc@email.cn>
+ - 裘剑东 Jiandong Qiu <qiujiandong1998@gmail.com>
 
 简介
 ====
@@ -14,7 +15,7 @@ Linux内核使用 `Sphinx <http://www.sphinx-doc.org/>`_ 来把 ``Documentation`
 换成漂亮的文档。使用 ``make htmldocs`` 或 ``make pdfdocs`` 命令即可构建HTML
 或PDF格式的文档。生成的文档放在 ``Documentation/output`` 文件夹中。
 
-reStructuredText文件可能包含包含来自源文件的结构化文档注释或kernel-doc注释。
+reStructuredText文件可能包含来自源文件的结构化文档注释或kernel-doc注释。
 通常它们用于描述代码的功能、类型和设计。kernel-doc注释有一些特殊的结构和
 格式,但除此之外,它们还被作为reStructuredText处理。
 
@@ -26,7 +27,7 @@ reStructuredText文件可能包含包含来自源文件的结构化文档注释
 安装Sphinx
 ==========
 
-Documentation/ 下的ReST文件现在使用sphinx1.7或更高版本构建。
+Documentation/ 下的ReST文件现在使用 ``sphinx`` 3.4.3 或更高版本构建。
 
 这有一个脚本可以检查Sphinx的依赖项。更多详细信息见
 :ref:`sphinx-pre-install_zh` 。
@@ -38,21 +39,13 @@ Documentation/ 下的ReST文件现在使用sphinx1.7或更高版本构建。
 ``virtualenv-3`` 或 ``virtualenv`` 在虚拟环境中安装Sphinx,具体取决于发行版
 如何打包Python3。
 
-.. note::
-
-   #) html输出建议使用RTD主题。根据Sphinx版本的不同,它应该用
-      ``pip install sphinx_rtd_theme`` 单独安装。
+总之,如您要安装最新版的Sphinx,应执行::
 
-   #) 一些ReST页面包含数学表达式。由于Sphinx的工作方式,这些表达式是使用 LaTeX
-      编写的。它需要安装amsfonts和amsmath宏包,以便显示。
+       $ virtualenv sphinx_latest
+       $ . sphinx_latest/bin/activate
+       (sphinx_latest) $ pip install -r Documentation/sphinx/requirements.txt
 
-总之,如您要安装Sphinx 2.4.4版本,应执行::
-
-       $ virtualenv sphinx_2.4.4
-       $ . sphinx_2.4.4/bin/activate
-       (sphinx_2.4.4) $ pip install -r Documentation/sphinx/requirements.txt
-
-在运行 ``. sphinx_2.4.4/bin/activate`` 之后,提示符将变化,以指示您正在使用新
+在运行 ``. sphinx_latest/bin/activate`` 之后,提示符将变化,以指示您正在使用新
 环境。如果您打开了一个新的shell,那么在构建文档之前,您需要重新运行此命令以再
 次进入虚拟环境中。
 
@@ -76,6 +69,23 @@ PDF和LaTeX构建
 根据发行版的不同,您可能还需要安装一系列 ``texlive`` 软件包,这些软件包提供了
 ``XeLaTeX`` 工作所需的最小功能集。
 
+HTML中的数学表达式
+------------------
+
+有些ReST页面中包含数学表达式。由于Sphinx的工作方式,这些表达式使用LaTeX
+符号书写。Sphinx在HTML输出中渲染数学表达式有两种方式:一种是名为 `imgmath`_
+的扩展,它将数学表达式转换成图像并嵌入到HTML页面中。
+另一种是名为 `mathjax`_ 的扩展,它将数学表达式的渲染交由支持 JavaScript
+的浏览器处理。
+在6.1版内核文档之前,前者是唯一可用的方式,并且需要安装大量texlive软件包,
+其中包括amsfonts和amsmath等。
+
+自内核6.1版本起,无需安装任何texlive软件包即可构建包含数学表达式的HTML
+页面。更多信息请参阅 :ref:`choice_of_math_renderer_zh`。
+
+.. _imgmath: https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.imgmath
+.. _mathjax: https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.mathjax
+
 .. _sphinx-pre-install_zh:
 
 检查Sphinx依赖项
@@ -108,7 +118,29 @@ PDF和LaTeX构建
 
 ``--no-virtualenv``
 
-	使用Sphinx的系统打包,而不是Python虚拟环境。
+	使用系统发行版提供的Sphinx软件包,而不是Python虚拟环境。
+
+安装最小版本的Sphinx
+--------------------
+
+在修改Sphinx构建系统时,确保其最小支持版本仍然可用非常重要。
+然而,在现代发行版上,这样做正变得越来越困难,因为在Python 3.13及以上版本
+环境下,已经无法安装该最小版本。
+
+要按照 Documentation/translations/zh_CN/process/changes.rst
+中定义的最低支持Python版本进行测试,可以使用该版本创建一个虚拟环境,
+并安装最小依赖::
+
+	/usr/bin/python3.9 -m venv sphinx_min
+	. sphinx_min/bin/activate
+	pip install -r Documentation/sphinx/min_requirements.txt
+
+更全面的测试可以使用以下脚本完成:
+
+	tools/docs/test_doc_build.py
+
+该脚本会为每个受支持的Python版本创建一个虚拟环境,并可选择针对一定范围内的
+Sphinx版本构建文档。
 
 Sphinx构建
 ==========
@@ -117,17 +149,66 @@ Sphinx构建
 的格式:请参阅 ``make help`` 的文档部分。生成的文档放在 ``Documentation/output``
 下相应格式的子目录中。
 
-要生成文档,显然必须安装Sphinx( ``sphinx-build`` )。要让HTML输出更漂亮,可以
-使用Read the Docs Sphinx主题( ``sphinx_rtd_theme`` )。对于PDF输出,您还需要
-``XeLaTeX`` 和来自ImageMagick(https://www.imagemagick.org)的 ``convert(1)`` 。
-所有这些软件在大多发行版中都可用或已打包。
+要生成文档,显然必须安装Sphinx( ``sphinx-build`` )。对于PDF输出,您还需
+要 ``XeLaTeX`` 和来自 ImageMagick(https://www.imagemagick.org)的
+``convert(1)`` 。\ [#ink]_ 所有这些软件在各大发行版中都很常见,
+也都有对应的软件包。
 
 要传递额外的选项给Sphinx,可以使用make变量 ``SPHINXOPTS`` 。例如,使用
 ``make SPHINXOPTS=-v htmldocs`` 获得更详细的输出。
 
+也可以通过make变量 ``DOCS_CSS`` 传入一个额外的DOCS_CSS覆盖文件,以自定义
+html布局。
+
+默认情况下,构建HTML文档时使用的是"Alabaster"主题;该主题随Sphinx一同提供,
+无需单独安装。也可以通过make变量 ``DOCS_THEME`` 覆盖Sphinx主题。
+
+.. note::
+
+   有些人可能更喜欢在html输出中使用RTD主题。根据Sphinx版本的不同,它可能需要
+   单独安装,可使用 ``pip install sphinx_rtd_theme`` 进行安装。
+
+还有一个make变量 ``SPHINXDIRS`` ,在测试构建某个文档子集时很有用。例如,您可
+以通过运行 ``make SPHINXDIRS=doc-guide htmldocs`` 构建
+``Documentation/doc-guide`` 下的文档。 ``make help`` 的文档部分会显示可指定的
+子目录列表。
 
 要删除生成的文档,请运行 ``make cleandocs`` 。
 
+.. [#ink] 如果还安装了来自 Inkscape(https://inkscape.org)的 ``inkscape(1)`` ,
+	  则能够提升嵌入到PDF文档中的图像质量,尤其是在5.18及之后的内核版本中。
+
+.. _choice_of_math_renderer_zh:
+
+数学渲染器的选择
+----------------
+
+自内核 6.1 版本起, ``mathjax`` 可作为html输出中数学渲染器的后备方案。\ [#sph1_8_zh]_
+
+数学渲染器会根据可用命令按如下方式选择:
+
+.. table:: HTML 中数学渲染器的选择
+
+    ============ ================= ============
+    数学渲染器   所需命令          图像格式
+    ============ ================= ============
+    imgmath      latex, dvipng     PNG(栅格)
+    mathjax
+    ============ ================= ============
+
+也可以通过设置环境变量 ``SPHINX_IMGMATH`` 来覆盖该选择,如下所示:
+
+.. table:: 设置 ``SPHINX_IMGMATH`` 的效果
+
+    ====================== ==========
+    设置                   渲染器
+    ====================== ==========
+    ``SPHINX_IMGMATH=yes`` imgmath
+    ``SPHINX_IMGMATH=no``  mathjax
+    ====================== ==========
+
+.. [#sph1_8_zh] 数学渲染器的后备机制要求Sphinx >= 1.8。
+
 编写文档
 ========
 
@@ -187,7 +268,8 @@ Sphinx构建
        ~~~~~~~~
 
   尽管RST没有规定具体的顺序(“没有强加一个固定数量和顺序的节标题装饰风格,最终
-  按照的顺序将是实际遇到的顺序。”),但是拥有一个通用级别的文档更容易遵循。
+  按照的顺序将是实际遇到的顺序。”),但整体上让较高层级的标题样式保持一致,
+  会更便于阅读和理解文档结构。
 
 * 对于插入固定宽度的文本块(用于代码样例、用例等): ``::`` 用于语法高亮意义不
   大的内容,尤其是短代码段; ``.. code-block:: <language>`` 用于需要语法高亮的
@@ -218,15 +300,24 @@ C域
 神奇力量,如果给定函数名的索引项存在,文档构建系统会自动将对 ``function()``
 的引用转换为交叉引用。如果在内核文档中看到 ``c:func:`` 的用法,请删除它。
 
-
-列表
+表格
 ----
 
-我们建议使用 *列式表* 格式。 *列式表* 格式是二级列表。与ASCII艺术相比,它们对
-文本文件的读者来说可能没有那么舒适。但其优点是易于创建或修改,而且修改的差异
-(diff)更有意义,因为差异仅限于修改的内容。
+reStructuredText 为表格语法提供了多种选项。内核文档中的表格通常优先使用
+*simple table* 或 *grid table* 语法。更多细节请参阅
+`reStructuredText 用户参考中的表格语法`_ 。
+
+.. _reStructuredText 用户参考中的表格语法:
+   https://docutils.sourceforge.io/docs/user/rst/quickref.html#tables
 
-*平铺表* 也是一个二级列表,类似于 *列式表* ,但具有一些额外特性:
+列式表
+~~~~~~
+
+列式表(``list-table``)格式对于无法用常规Sphinx ASCII艺术格式轻松排版的表格来说
+可能很有用。然而,这种格式对于纯文本文档的读者来说几乎无法理解,因此,
+除非有充分的理由,否则应避免使用。
+
+``flat-table`` 也是一个二级列表,类似于 ``list-table`` ,但具有一些额外特性:
 
 * 列范围:使用 ``cspan`` 修饰,可以通过其他列扩展单元格
 
@@ -302,15 +393,15 @@ C域
 
 从一页文档到另一页文档的交叉引用可以通过简单地写出文件路径来完成,无特殊格式
 要求。路径可以是绝对路径或相对路径。绝对路径从“Documentation/”开始。例如,要
-交叉引用此页,以下写法皆可,取决于具体的文档目录(注意 ``.rst`` 扩展名是可选
+交叉引用此页,以下写法皆可,取决于具体的文档目录(注意 ``.rst`` 扩展名是必需
 的)::
 
     参见 Documentation/doc-guide/sphinx.rst 。此法始终可用。
     请查看 sphinx.rst ,仅在同级目录中有效。
     请阅读 ../sphinx.rst ,上级目录中的文件。
 
-如果要使用相对路径,则需要使用Sphinx的 ``doc`` 修饰。例如,从同一目录引用此页
-的操作如下::
+如果希望链接显示的文本不同于文档标题,则需要使用 Sphinx 的 ``doc`` 修饰。例
+如::
 
     参见 :doc:`sphinx文档的自定义链接文本 <sphinx>`.
 
@@ -318,7 +409,15 @@ C域
 个没有任何特殊作用的 ``:doc:`` 用法,请将其转换为文档路径。
 
 有关交叉引用kernel-doc函数或类型的信息,请参阅
-Documentation/doc-guide/kernel-doc.rst 。
+Documentation/translations/zh_CN/doc-guide/kernel-doc.rst 。
+
+引用提交
+~~~~~~~~
+
+对 git 提交的引用如果采用以下格式书写,会自动转换为超链接::
+
+    commit 72bf4f1767f0
+    commit 72bf4f1767f0 ("net: do not leave an empty skb in write queue")
 
 .. _sphinx_kfigure_zh:
 
-- 
Jiandong Qiu <qiujiandong1998@gmail.com>

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox