mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ali Rouhi <arouhi@sitime.com>
To: "netdev-bot+sashiko@kernel.org" <netdev-bot+sashiko@kernel.org>
Cc: "jiri@resnulli.us" <jiri@resnulli.us>,
	"vadim.fedorenko@linux.dev" <vadim.fedorenko@linux.dev>,
	"arkadiusz.kubalewski@intel.com" <arkadiusz.kubalewski@intel.com>,
	"ivecera@redhat.com" <ivecera@redhat.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"cjubran@nvidia.com" <cjubran@nvidia.com>,
	"Oleg.Zadorozhnyi@devoxsoftware.com"
	<Oleg.Zadorozhnyi@devoxsoftware.com>,
	"prabhakar.mahadev-lad.rj@bp.renesas.com"
	<prabhakar.mahadev-lad.rj@bp.renesas.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v16 06/13] dpll: sit9531x: register DPLL devices and pins
Date: Tue, 1 Dec 2026 23:51:40 +0000	[thread overview]
Message-ID: <20261201235136.95422-5-arouhi@sitime.com> (raw)
In-Reply-To: <179548084210.3135.16370816331062292914@kernel.org>

On Tue, 24 Nov 2026 00:40:42 +0000, netdev-bot+sashiko@kernel.org wrote:

> > +	if (claimed & (claimed - 1))
> > +		dev_warn(sitdev->dev,
> > +			 "OUT%u is in the output-enable mask of more than one PLL (0x%x); taking PLL%c\n",
> > +			 slot, claimed, 'A' + out->pll_idx);
>
> [Severity: Low]
> This warning names the output by its die slot. In prop.c,
> sit9531x_prop_pin_package_label_set() labels output pins "OUT%u" by the
> package index, and its own comment says the two numbers differ on the
> SiT95317.
>
> On the SiT95317, clkout_map is {0, 3, 4, 5, 7, 8, 9, 11}. So the pin that
> userspace sees as "OUT1" shows up here as "OUT3".
>
> Should this print the package index (or both numbers), so one output has
> one name? This looks the same later in the series.

Agreed. v17 names the output by its package index, the number in its pin
label.

> > +	sitdev->irq_ack_fails = 0;
> > +
> > +	kthread_mod_delayed_work(sitdev->kworker, &sitdev->work, 0);
> > +	return IRQ_HANDLED;
> > +}
>
> [Severity: Medium]
> What happens if INTRB is still asserted after this handler returns?
>
> sit9531x_clear_notifications() writes 0xFF to a fixed list of eight
> latches: OUTER_LOL, HO_FREEZE, INNER_LOL and CMON on page 0, plus four
> clock-monitor latches on page 6. The driver does not program or check the
> INTRB source mask, so it relies on whatever the EEPROM/efuse profile set
> up.
>
> One example is NOTIFY_4 (SIT9531X_REG_EEPROM_NOTIF, page 0 reg 0x97).
> regs.h describes it as sticky, with READ_DONE set on every good load.
> sit9531x_eeprom_state_report() reads it, but nothing clears it.
>
> If the profile routes such a latch to INTRB, IRQF_ONESHOT unmasks a line
> that is still asserted. The thread then runs again at once, and every
> pass calls kthread_mod_delayed_work(..., 0).
>
> IRQ_HANDLED is returned every time, so the core's spurious interrupt
> detection never disables the line. irq_ack_fails only counts I2C write
> errors.
>
> Can this loop forever, with back-to-back poll ticks of about a hundred
> paged I2C transfers each? Would it help to read which source asserted
> INTRB and return IRQ_NONE when no source the driver handles is pending?
> This looks the same later in the series.

In v17 the handler and the poll read every documented notification
latch, EEPROM_NOTIF and NOTIFY_5 included, and write back only the bits
found set. An interrupt with no latch set returns IRQ_NONE, so the
core's spurious-interrupt detection can disable a line another source
holds low.

> > +	kthread_queue_delayed_work(sitdev->kworker, &sitdev->work, 0);
> > +
> > +	return 0;
>
> [Severity: Low]
> The commit message says:
>
>   "Probe also reports the EEPROM profile and its CRC and clears the
>   notification registers"
>
> The only callers of sit9531x_clear_notifications() are
> sit9531x_dev_periodic_work() and sit9531x_irq_thread_fn(). Probe just
> queues the poll here, so the latches are cleared asynchronously, after
> probe has returned and the IRQ has been requested.
>
> Could the commit message be reworded to match?
>
> On a similar note, the dpll.c file header says:
>
>   " * DPLL device ops, pin ops (separate input/output), pin registration,"
>
> The device and pin registration code (sit9531x_dpll_pin_register(),
> sit9531x_dpll_pins_register(), sit9531x_dpll_register() and so on) lives
> in core.c, and it is still there later in the series.

Agreed. The v17 message says only that probe reports the EEPROM profile
and its CRC, and the file headers describe the code in each file.

> > +
> > +	sitdev->clock_id = SIT9531X_OUI << 24 | (u64)adap << 8 |
> > +			   sitdev->client->addr;
> > +
> > +	return 0;
> > +}
>
> [Severity: Medium]
> The adapter number is range-checked here. client->addr is not masked to
> 8 bits, though, and I2C_CLIENT_TEN is not rejected.
>
> With a 10-bit address (up to 0x3FF), bits 8-9 overlap the adapter field.
> For example, adapter 0 at 10-bit address 0x150 and adapter 1 at address
> 0x50 both produce:
>
>   SIT9531X_OUI << 24 | 0x150
>
> dpll_device_get() matches on (clock_id, device_idx, module). The second
> chip would therefore get the first chip's struct dpll_device for every
> PLL index, and the first chip's XO pin through dpll_pin_get().
>
> dpll_device_register() returns -EEXIST only for an identical (ops, priv)
> pair. Each instance has its own ops copy and priv, so the second
> registration is accepted without any error.
>
> If the part can be addressed with 10-bit addresses, can two chips end up
> merged into one DPLL device, with callbacks answered from the first
> registration's priv? Would rejecting I2C_CLIENT_TEN, or masking the
> address, be enough to avoid this?
>
> The commit message also says:
>
>   "an i2c alias in the firmware description keeps it the same across
>   boots."
>
> That only applies to DT. On ACPI, or with dynamically numbered adapters,
> the id can change between boots. Could the message say so?
>
> This code looks the same later in the series.

In v17 the clock_id comes from the 9-byte die ID at page 0 0x41-0x49. A
die ID of all zeros or all ones, or one another bound part holds, falls
back to the OUI, bus number and address; on that path v17 refuses a
10-bit address, and probe fails with -EBUSY if the fallback id is taken
too. This replaces the answer given to the same question on v15.

> > +	if (sitdev->irq > 0)
> > +		enable_irq(sitdev->irq);
> > +	kthread_queue_delayed_work(sitdev->kworker, &sitdev->work, 0);
> > +
> > +	return 0;
> > +}
>
> [Severity: Medium]
> This comment assumes the part may have lost power. Probe waits for the
> internal boot:
>
> 	fsleep(10000);	/* internal boot after release */
>
> Resume, though, enables the IRQ and queues the poll at delay 0 straight
> away. Can the first I2C transfers from the IRQ thread or the poll reach
> the part before it has finished booting?
>
> After a power loss the part also reloads its EEPROM/efuse profile. Any
> configuration pushed over I2C before probe would be gone;
> sit9531x_eeprom_state_report() even detects that case. The driver still
> uses state cached at probe time by sit9531x_dev_state_fetch():
>
>   ref[].sig_mode selects the DE or SE registers in
>   sit9531x_input_get_regs()
>
>   out[].cmos selects the Hi-Z pairs in sit9531x_output_forced_hiz()
>
>   the output routing, ref[].pll_mask, and chan[].manual_input, which
>   sit9531x_dpll_mode_get() and sit9531x_dpll_supported_modes_get() return
>
> Could resume then read the wrong register pairs and report wrong lock,
> pin and mode state, with no warning?
>
> Later in the series, resume re-reads the INTSYNC owner, the output mutes
> and the delays. It still applies no boot delay, and it still does not
> re-read sig_mode, cmos, routing or manual_input. The output mute refresh
> also depends on the stale out[].cmos.

In v17 resume waits the start-up time as probe does, then reads the
input pair modes, the select modes, the priority tables and the output
routing again; it warns on a change and notifies a DPLL whose mode
moved. Patch 7, which adds the reader of the receiver claims, rebuilds
them on resume.

> > +		if (changed) {
> > +			dev_dbg(sitdev->dev, "%s state changed\n", pin->label);
> > +			dpll_pin_change_ntf(pin->dpll_pin);
> > +		}
> > +	}
> > +}
>
> [Severity: Medium]
> The !chan->active branch is ordered ahead of inner_lol so that an
> unused PLL reports a plain DPLL_LOCK_STATUS_UNLOCKED. Its comment says
> the loss-of-lock bit is not driven there.
>
> This check runs after the whole chain, though. On an inactive PLL with
> its bit set in SIT9531X_REG_PLL_INNER_LOL_STATUS, status_error is still
> overwritten with DPLL_LOCK_STATUS_ERROR_UNDEFINED.
>
> The DPLL core puts DPLL_A_LOCK_STATUS_ERROR in the message whenever the
> status is unlocked and the error is not NONE. Userspace would then be
> told that a PLL the loaded configuration does not use has an undefined
> lock error.
>
> sit9531x_dpll_changes_check() also compares lock_status_error. Each
> time that bit toggles on an unused PLL, it sends a
> dpll_device_change_ntf() as well.
>
> Every branch after the inner_lol one only runs with inner_lol clear,
> and the stale branch sets the error on its own. Could the assignment
> move into the inner_lol branch, so an inactive PLL keeps
> DPLL_LOCK_STATUS_ERROR_NONE? Or is the inner loss-of-lock bit
> meaningful on a PLL that never reached its active state?
>
> This looks the same later in the series.

Agreed. In v17 the lock error is set only for an active PLL with inner
loss of lock; an unused PLL reports UNLOCKED with no error and sends no
notification.

  reply	other threads:[~2026-12-01 23:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 22:57 [PATCH net-next v16 00/13] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 02/13] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 01/13] dpll: omit pin phase attributes the driver has no value for Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 03/13] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 05/13] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 06/13] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi [this message]
2026-11-19 22:57 ` [PATCH net-next v16 08/13] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 07/13] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 10/13] dpll: sit9531x: implement output " Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 09/13] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
2026-11-19 22:58 ` [PATCH net-next v16 11/13] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
2026-11-19 22:58 ` [PATCH net-next v16 12/13] dpll: sit9531x: add support to get phase offset on the connected input Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
2026-11-19 22:58 ` [PATCH net-next v16 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201235136.95422-5-arouhi@sitime.com \
    --to=arouhi@sitime.com \
    --cc=Oleg.Zadorozhnyi@devoxsoftware.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=cjubran@nvidia.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ivecera@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --cc=vadim.fedorenko@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®