Fri May 10 14:42:21 2024 UTC (12d)
arm/fdt/cpu_fdt.c: Use `cpu' iattr to attach cpufreq.

Now that cpu has an explicit interface attribute, cpufeaturebus,
_all_ children of cpu must use an explicit interface attribute to
disambiguate.  For children that weren't previously attached using an
explicit interface attribute, the name of the parent, `cpu', serves
as the iattr.

XXX I think we should either
(a) not use cpufreqbus, since in the aarch64 case it doesn't seem to
    be passing any information through attach args, or
(b) create another iattr like cpufdtbus for use by cpufreq_dt.c,
    which does rely on attach args, if it has to attach differently
    from the rest of fdtbus.
But for now this should get aarch64 on fdt booting again.


(riastradh)
diff -r1.43 -r1.44 src/sys/arch/arm/fdt/cpu_fdt.c

cvs diff -r1.43 -r1.44 src/sys/arch/arm/fdt/cpu_fdt.c (expand / switch to unified diff)

--- src/sys/arch/arm/fdt/cpu_fdt.c 2024/05/09 12:41:08 1.43
+++ src/sys/arch/arm/fdt/cpu_fdt.c 2024/05/10 14:42:21 1.44
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpu_fdt.c,v 1.43 2024/05/09 12:41:08 pho Exp $ */ 1/* $NetBSD: cpu_fdt.c,v 1.44 2024/05/10 14:42:21 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include "opt_multiprocessor.h" 29#include "opt_multiprocessor.h"
30#include "psci_fdt.h" 30#include "psci_fdt.h"
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.43 2024/05/09 12:41:08 pho Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.44 2024/05/10 14:42:21 riastradh Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/atomic.h> 36#include <sys/atomic.h>
37#include <sys/bus.h> 37#include <sys/bus.h>
38#include <sys/device.h> 38#include <sys/device.h>
39#include <sys/lwp.h> 39#include <sys/lwp.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/kernel.h> 41#include <sys/kernel.h>
42 42
43#include <dev/fdt/fdtvar.h> 43#include <dev/fdt/fdtvar.h>
44 44
45#include <arm/armreg.h> 45#include <arm/armreg.h>
46#include <arm/cpu.h> 46#include <arm/cpu.h>
@@ -88,27 +88,27 @@ cpu_fdt_attach(device_t parent, device_t @@ -88,27 +88,27 @@ cpu_fdt_attach(device_t parent, device_t
88 uint32_t capacity_dmips_mhz = be32toh(*cap_ptr); 88 uint32_t capacity_dmips_mhz = be32toh(*cap_ptr);
89 89
90 prop_dictionary_set_uint32(dict, "capacity_dmips_mhz", 90 prop_dictionary_set_uint32(dict, "capacity_dmips_mhz",
91 capacity_dmips_mhz); 91 capacity_dmips_mhz);
92 } 92 }
93 93
94 if (fdtbus_get_reg(phandle, 0, &cpuid, NULL) != 0) 94 if (fdtbus_get_reg(phandle, 0, &cpuid, NULL) != 0)
95 cpuid = 0; 95 cpuid = 0;
96 96
97 /* Attach the CPU */ 97 /* Attach the CPU */
98 cpu_attach(self, cpuid); 98 cpu_attach(self, cpuid);
99 99
100 /* Attach CPU frequency scaling provider */ 100 /* Attach CPU frequency scaling provider */
101 config_found(self, faa, NULL, CFARGS_NONE); 101 config_found(self, faa, NULL, CFARGS(.iattr = "cpu"));
102} 102}
103 103
104#if defined(MULTIPROCESSOR) && (NPSCI_FDT > 0 || defined(__aarch64__)) 104#if defined(MULTIPROCESSOR) && (NPSCI_FDT > 0 || defined(__aarch64__))
105static register_t 105static register_t
106cpu_fdt_mpstart_pa(void) 106cpu_fdt_mpstart_pa(void)
107{ 107{
108 bool ok __diagused; 108 bool ok __diagused;
109 paddr_t pa; 109 paddr_t pa;
110 110
111 ok = pmap_extract(pmap_kernel(), (vaddr_t)cpu_mpstart, &pa); 111 ok = pmap_extract(pmap_kernel(), (vaddr_t)cpu_mpstart, &pa);
112 KASSERT(ok); 112 KASSERT(ok);
113 113
114 return pa; 114 return pa;