Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/apple Make the scheduler aware of the differenc...
details: https://anonhg.NetBSD.org/src/rev/da3509d7aec3
branches: trunk
changeset: 1023292:da3509d7aec3
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed Sep 01 23:05:03 2021 +0000
description:
Make the scheduler aware of the differences between efficiency and
performance cores.
diffstat:
sys/arch/arm/apple/apple_platform.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diffs (57 lines):
diff -r 587594e7dde8 -r da3509d7aec3 sys/arch/arm/apple/apple_platform.c
--- a/sys/arch/arm/apple/apple_platform.c Wed Sep 01 22:44:50 2021 +0000
+++ b/sys/arch/arm/apple/apple_platform.c Wed Sep 01 23:05:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apple_platform.c,v 1.1 2021/08/30 23:26:26 jmcneill Exp $ */
+/* $NetBSD: apple_platform.c,v 1.2 2021/09/01 23:05:03 jmcneill Exp $ */
/*-
* Copyright (c) 2021 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apple_platform.c,v 1.1 2021/08/30 23:26:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apple_platform.c,v 1.2 2021/09/01 23:05:03 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -58,6 +58,18 @@
#include <arch/evbarm/fdt/platform.h>
+/*
+ * Faux DMIPS/MHz values for known CPU types. The values themselves are
+ * unimportant except as relative comparisons between different CPUs on
+ * the same system.
+ */
+static const struct device_compatible_entry cpu_capacity_compat_data[] = {
+ /* Apple M1 */
+ { .compat = "apple,icestorm", .value = 0 }, /* efficiency core */
+ { .compat = "apple,firestorm", .value = 1 }, /* performance core */
+ DEVICE_COMPAT_EOL
+};
+
extern struct bus_space arm_generic_bs_tag;
struct arm32_bus_dma_tag apple_coherent_dma_tag;
@@ -184,6 +196,19 @@
uint8_t eaddr[ETHER_ADDR_LEN];
int len;
+ if (device_is_a(self, "cpu")) {
+ struct fdt_attach_args * const faa = aux;
+ const int phandle = faa->faa_phandle;
+ const struct device_compatible_entry *dce;
+
+ dce = of_compatible_lookup(phandle, cpu_capacity_compat_data);
+ if (dce != NULL) {
+ prop_dictionary_set_uint32(prop, "capacity_dmips_mhz",
+ dce->value);
+ }
+ return;
+ }
+
if (device_is_a(self, "bge") &&
device_is_a(device_parent(self), "pci")) {
struct pci_attach_args * const pa = aux;
Home |
Main Index |
Thread Index |
Old Index