Index | Thread | Search

From:
Bryan Steele <brynet@gmail.com>
Subject:
Re: ksmn(4) on 19h/1x devices
To:
Jonathan Matthew <jonathan@d14n.org>
Cc:
tech@openbsd.org, claudio@openbsd.org
Date:
Thu, 21 May 2026 07:22:11 -0400

Download raw body.

Thread
On Thu, May 21, 2026 at 09:04:10PM +1000, Jonathan Matthew wrote:
> We've had some of these boxes for a while but I only noticed today that
> ksmn doesn't support them.  The interesting part here is that the check
> in ksmn_ccd_attach() is a bit too aggressive, it ensures there are fewer
> than 12 potential ccd sensors, which happens to be how many these systems
> can have.
> 
> With this cpu:
> cpu0: AMD EPYC 9354P 32-Core Processor, 3250.01 MHz, 19-11-01, patch 0a101154
> 
> I now get some readings:
> hw.sensors.ksmn0.temp0=96.12 degC (Tctl)
> hw.sensors.ksmn0.temp1=40.00 degC (Tccd0)
> hw.sensors.ksmn0.temp2=38.75 degC (Tccd1)
> hw.sensors.ksmn0.temp3=39.62 degC (Tccd2)
> hw.sensors.ksmn0.temp4=39.75 degC (Tccd3)
> hw.sensors.ksmn0.temp5=39.00 degC (Tccd4)
> hw.sensors.ksmn0.temp6=37.62 degC (Tccd5)
> hw.sensors.ksmn0.temp7=39.25 degC (Tccd6)
> hw.sensors.ksmn0.temp8=39.50 degC (Tccd7)
> 
> (plus 3 more copies because it has 4 pci roots)
> 
> ok?

ok brynet@

claudio@ added the support for the additional CCD sensors, I don't have
any AMD machines with them, but that part also makes sense to me.

> 
> Index: ksmn.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/ksmn.c,v
> diff -u -p -r1.10 ksmn.c
> --- ksmn.c	7 Aug 2024 17:39:00 -0000	1.10
> +++ ksmn.c	21 May 2026 06:22:17 -0000
> @@ -105,6 +105,7 @@ static const struct pci_matchid ksmn_dev
>  	{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_17_1X_RC },
>  	{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_17_3X_RC },
>  	{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_17_6X_RC },
> +	{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_1X_RC },
>  	{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_4X_RC },
>  	{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_6X_RC },
>  	{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_RC },
> @@ -215,7 +216,7 @@ ksmn_ccd_attach(struct ksmn_softc *sc, i
>  	uint32_t reg;
>  	int i;
>  
> -	KASSERT(nccd > 0 && nccd < nitems(sc->sc_ccd_sensor));
> +	KASSERT(nccd > 0 && nccd <= nitems(sc->sc_ccd_sensor));
>  
>  	for (i = 0; i < nccd; i++) {
>  		reg = ksmn_read_reg(sc, SMU_17H_CCD_THM(sc->sc_ccd_offset, i));
>