Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156664510
D5466.id13801.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D5466.id13801.diff
View Options
Index: sys/arm/arm/platform.c
===================================================================
--- sys/arm/arm/platform.c
+++ sys/arm/arm/platform.c
@@ -177,3 +177,18 @@
PLATFORM_LATE_INIT(plat_obj);
}
+#if defined(SMP) && defined(PLATFORM_SMP)
+void
+platform_mp_setmaxid(void)
+{
+
+ PLATFORM_MP_SETMAXID(plat_obj);
+}
+
+void
+platform_mp_start_ap(void)
+{
+
+ PLATFORM_MP_START_AP(plat_obj);
+}
+#endif
Index: sys/arm/arm/platform_if.m
===================================================================
--- sys/arm/arm/platform_if.m
+++ sys/arm/arm/platform_if.m
@@ -57,6 +57,12 @@
{
return;
}
+
+ static void platform_default_mp_setmaxid(platform_t plat)
+ {
+ mp_ncpus = 1;
+ mp_maxid = 0;
+ }
};
/**
@@ -114,3 +120,16 @@
platform_t _plat;
};
+/**
+ * @brief Called by cpu_mp_setmaxid() to set mp_maxid and mp_ncpus.
+ */
+METHOD void mp_setmaxid {
+ platform_t _plat;
+} DEFAULT platform_default_mp_setmaxid;
+
+/**
+ * @brief Called by cpu_mp_start to start the secondary processors.
+ */
+METHOD void mp_start_ap {
+ platform_t _plat;
+};
Index: sys/arm/conf/VIRT
===================================================================
--- sys/arm/conf/VIRT
+++ sys/arm/conf/VIRT
@@ -26,6 +26,7 @@
options HZ=100
options SCHED_ULE # 4BSD scheduler
options PLATFORM
+options PLATFORM_SMP
options SMP # Enable multiple cores
# Debugging for use in -current
Index: sys/arm/qemu/virt_machdep.c
===================================================================
--- sys/arm/qemu/virt_machdep.c
+++ sys/arm/qemu/virt_machdep.c
@@ -41,6 +41,8 @@
#include <machine/platform.h>
#include <machine/platformvar.h>
+#include <arm/qemu/virt_mp.h>
+
#include "platform_if.h"
struct arm32_dma_range *
@@ -86,6 +88,11 @@
PLATFORMMETHOD(platform_devmap_init, virt_devmap_init),
PLATFORMMETHOD(platform_lastaddr, virt_lastaddr),
+#ifdef SMP
+ PLATFORMMETHOD(platform_mp_start_ap, virt_mp_start_ap),
+ PLATFORMMETHOD(platform_mp_setmaxid, virt_mp_setmaxid),
+#endif
+
PLATFORMMETHOD_END,
};
Index: sys/arm/qemu/virt_mp.h
===================================================================
--- sys/arm/qemu/virt_mp.h
+++ sys/arm/qemu/virt_mp.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2015 Andrew Turner
+ * Copyright (c) 2016 Andrew Turner
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,68 +25,10 @@
*
*/
-#include "opt_platform.h"
+#ifndef _QEMU_VIRT_MP_H_
+#define _QEMU_VIRT_MP_H_
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+void virt_mp_start_ap(platform_t plat);
+void virt_mp_setmaxid(platform_t plat);
-#define _ARM32_BUS_DMA_PRIVATE
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <vm/vm.h>
-
-#include <machine/bus.h>
-#include <machine/devmap.h>
-#include <machine/platform.h>
-#include <machine/platformvar.h>
-
-#include "platform_if.h"
-
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
-
-void
-cpu_reset(void)
-{
-
- while (1);
-}
-
-static vm_offset_t
-virt_lastaddr(platform_t plat)
-{
-
- return (arm_devmap_lastaddr());
-}
-
-/*
- * Set up static device mappings.
- */
-static int
-virt_devmap_init(platform_t plat)
-{
-
- arm_devmap_add_entry(0x09000000, 0x100000); /* Uart */
- return (0);
-}
-
-static platform_method_t virt_methods[] = {
- PLATFORMMETHOD(platform_devmap_init, virt_devmap_init),
- PLATFORMMETHOD(platform_lastaddr, virt_lastaddr),
-
- PLATFORMMETHOD_END,
-};
-
-FDT_PLATFORM_DEF(virt, "virt", 0, "linux,dummy-virt");
+#endif /* _QEMU_VIRT_MP_H_ */
Index: sys/arm/qemu/virt_mp.c
===================================================================
--- sys/arm/qemu/virt_mp.c
+++ sys/arm/qemu/virt_mp.c
@@ -38,12 +38,15 @@
#include <vm/pmap.h>
#include <machine/intr.h>
+#include <machine/platformvar.h>
#include <machine/smp.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_cpu.h>
#include <dev/psci/psci.h>
+#include <arm/qemu/virt_mp.h>
+
static int running_cpus;
int
@@ -64,7 +67,7 @@
}
void
-platform_mp_setmaxid(void)
+virt_mp_setmaxid(platform_t plat)
{
mp_maxid = PCPU_GET(cpuid);
@@ -92,7 +95,7 @@
}
void
-platform_mp_start_ap(void)
+virt_mp_start_ap(platform_t plat)
{
ofw_cpu_early_foreach(virt_start_ap, true);
Index: sys/conf/options.arm
===================================================================
--- sys/conf/options.arm
+++ sys/conf/options.arm
@@ -34,6 +34,7 @@
LOADERRAMADDR opt_global.h
PHYSADDR opt_global.h
PLATFORM opt_global.h
+PLATFORM_SMP opt_global.h
SOCDEV_PA opt_global.h
SOCDEV_VA opt_global.h
PV_STATS opt_pmap.h
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 16, 12:53 PM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33130308
Default Alt Text
D5466.id13801.diff (4 KB)
Attached To
Mode
D5466: Add SMP support to the PLATFORM code.
Attached
Detach File
Event Timeline
Log In to Comment