History log of /freebsd-current/sys/powerpc/include/cpu.h
Revision Date Author Comments
# 2ff63af9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# 254e4e5b 28-Dec-2021 John Baldwin <jhb@FreeBSD.org>

Simplify swi for bus_dma.

When a DMA request using bounce pages completes, a swi is triggered to
schedule pending DMA requests using the just-freed bounce pages. For
a long time this bus_dma swi has been tied to a "virtual memory" swi
(swi_vm). However, all of the swi_vm implementations are the same and
consist of checking a flag (busdma_swi_pending) which is always true
and if set calling busdma_swi. I suspect this dates back to the
pre-SMPng days and that the intention was for swi_vm to serve as a
mux. However, in the current scheme there's no need for the mux.

Instead, remove swi_vm and vm_ih. Each bus_dma implementation that
uses bounce pages is responsible for creating its own swi (busdma_ih)
which it now schedules directly. This swi invokes busdma_swi directly
removing the need for busdma_swi_pending.

One consequence is that the swi now works on RISC-V which had previously
failed to invoke busdma_swi from swi_vm.

Reviewed by: imp, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33447


# b6d8f3b5 31-Mar-2021 Justin Hibbits <jhibbits@FreeBSD.org>

powerpc/powermac: Constrain 'cpu_sleep()' for AIM to mpc745x

Rename cpu_sleep() to mpc745x_sleep() to denote what it's actually
intended for. This function is very G4-specific, and will not work on
any other CPU. This will afterward eliminate a
platform_smp_timebase_sync() call by directly updating the timebase
instead.


# 81962477 10-May-2020 Justin Hibbits <jhibbits@FreeBSD.org>

powerpc: Add a CPU-custom machine check handler

Summary:
Some machine checks are process-recoverable, others are not. Let a
CPU-specific handler decide what to do.

This works around a machine check error hit while building www/firefox
and mail/thunderbird, which would otherwise cause the build to fail.

More work is needed to handle all possible machine check conditions, but
this is sufficient to unblock some ports building.

Differential Revision: https://reviews.freebsd.org/D23731


# da54cd87 25-Apr-2019 Justin Hibbits <jhibbits@FreeBSD.org>

powerpc: Add another feature2 flag, and update power9 definition

Also fix the definition of PPC_FEATURE2_HTM_NOSUSPEND, a bad line copy.

This now closer matches Linux's definition.


# 4cbbb748 05-Nov-2018 John Baldwin <jhb@FreeBSD.org>

Add a KPI for the delay while spinning on a spin lock.

Replace a call to DELAY(1) with a new cpu_lock_delay() KPI. Currently
cpu_lock_delay() is defined to DELAY(1) on all platforms. However,
platforms with a DELAY() implementation that uses spin locks should
implement a custom cpu_lock_delay() doesn't use locks.

Reviewed by: kib
MFC after: 3 days


# ef6da5e5 19-May-2018 Justin Hibbits <jhibbits@FreeBSD.org>

Add support for the XIVE XICS emulation mode for POWER9 systems

Summary:
POWER9 systems use a new interrupt controller, XIVE, managed through OPAL
firmware calls. The OPAL firmware includes support for emulating the previous
generation XICS presentation layer in addition to a new "XIVE Exploitation"
mode. As a stopgap until we have XIVE exploitation mode, enable XICS emulation
mode so that we at least have an interrupt controller.

Since the CPPR is local to the current CPU, it cannot be updated for APs when
initializing on the BSP. This adds a new function, directly called by the
powernv platform code, to initialize the CPPR on AP bringup.

Reviewed by: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D15492


# 38c32a14 21-Apr-2018 Justin Hibbits <jhibbits@FreeBSD.org>

Fix the build post r332859

sysentvec::sv_hwcap/sv_hwcap2 are pointers to u_long, so cpu_features* need
to be u_long to use the pointers. This also requires a temporary cast in
printing the bitfields, which is fine because the feature flag fields are
only 32 bits anyway.


# 18f48e0c 20-Apr-2018 Justin Hibbits <jhibbits@FreeBSD.org>

Sync powerpc feature flags with Linux

Not all feature flags are synced. Those for processors we don't currently
support are ignored currently. Those that are supported are synced best I
can tell. One flag was renamed to match the Linux flag name
(PPC_FEATURE2_VCRYPTO -> PPC_FEATURE2_VEC_CRYPTO).


# 6d13fd63 21-Feb-2018 Wojciech Macek <wma@FreeBSD.org>

PowerNV: Put processor to power-save state in idle thread

When processor enters power-save state it releases resources shared with other
cpu threads which makes other cores working much faster.

This patch also implements saving and restoring registers that might get
corrupted in power-save state.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Reviewed by: jhibbits, nwhitehorn, wma
Sponsored by: IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D14330


# 51369649 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 81d7ebb6 07-Nov-2017 Justin Hibbits <jhibbits@FreeBSD.org>

Add the ISEL feature macro for those powerpc cores that have it

This is mostly for completeness, we don't currently use it for anything else.


# 512071de 28-Oct-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Add the SPE feature mask for e500v1 and e500v2

On e500v2 SoCs it will now print:

cpu0: Features 84e08000<PPC32,MMU,SPE,EFPS,EFPD,BOOKE>

at bootup.


# b0bf7fcd 02-Jan-2016 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Bring CPU features list in line with the ABI requirements.

MFC after: 1 week


# 20b6ee61 11-Jul-2015 Justin Hibbits <jhibbits@FreeBSD.org>

cpu_number and cpu_swapout are never used, and only defined in powerpc.


# 35f612b8 22-Feb-2015 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Kernel support for the Vector-Scalar eXtension (VSX) found on the POWER7
and POWER8. This instruction set unifies the 32 64-bit scalar floating
point registers with the 32 128-bit vector registers into a single bank
of 64 128-bit registers. Kernel support mostly amounts to saving and
restoring the wider version of the floating point registers and making
sure that both scalar FP and vector registers are enabled once a VSX
instruction is executed. get_mcontext() and friends currently cannot
see the high bits, which will require a little more work.

As the system compiler (GCC 4.2) does not support VSX, making use of this
from userland requires either newer GCC or clang.

Relnotes: yes
Sponsored by: FreeBSD Foundation


# 9ddcd322 09-Feb-2015 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Set thread priorities on multithreaded CPUs so that threads holding a
spinlock are high-priority and threads waiting for a spinlock are set to
low priority.


# e1c161e7 30-Jan-2014 Justin Hibbits <jhibbits@FreeBSD.org>

Unbreak non-SMP builds. This was broken by r259284. Also, reorganize the
code introduced in that revision a bit.

Reviewed by: nwhitehorn
MFC after: 3 weeks


# 4702d987 12-Dec-2013 Justin Hibbits <jhibbits@FreeBSD.org>

Add PMU-based CPU frequency scaling. This method is used on most Titanium
PowerBooks.

MFC after: 1 month


# a29cc9a3 28-Jul-2013 Andriy Gapon <avg@FreeBSD.org>

Revert r253748,253749

This WIP should not have been committed yet.

Pointyhat to: avg


# 366d8bfb 28-Jul-2013 Andriy Gapon <avg@FreeBSD.org>

put contents of cpu.h under _KERNEL

no userland-serviceable parts inside

MFC after: 20 days


# 2383d92a 23-Sep-2012 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Move the prototype for savectx from cpu.h to pcb.h, as it is on other
platforms, as well as putting it in an #ifdef KERNEL block.

MFC after: 2 weeks


# 460378bf 29-Apr-2012 Dimitry Andric <dim@FreeBSD.org>

Add a convenience macro for the returns_twice attribute, and apply it to
the prototypes of the appropriate functions (getcontext, savectx,
setjmp, sigsetjmp and vfork).

MFC after: 2 weeks


# e3c2930d 11-Apr-2012 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

We don't need kcopy() in any of the remaining places it is used, so
remove it.

MFC after: 2 weeks


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 496ef312 07-Dec-2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

MFC r199886:

Add a CPU features framework on PowerPC and simplify CPU setup a little
more. This provides three new sysctls to user space:
hw.cpu_features - A bitmask of available CPU features
hw.floatingpoint - Whether or not there is hardware FP support
hw.altivec - Whether or not Altivec is available

PR: powerpc/139154


# 227f6604 28-Nov-2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Add a CPU features framework on PowerPC and simplify CPU setup a little
more. This provides three new sysctls to user space:
hw.cpu_features - A bitmask of available CPU features
hw.floatingpoint - Whether or not there is hardware FP support
hw.altivec - Whether or not Altivec is available

PR: powerpc/139154
MFC after: 10 days


# 11722a8c 26-Oct-2008 Marcel Moolenaar <marcel@FreeBSD.org>

Declare btext and etext. Needed by sys/kern/subr_prof.c for
for kernel profiling.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 01bd17cc 09-Jun-2007 Marcel Moolenaar <marcel@FreeBSD.org>

Add kdb_cpu_sync_icache(), intended to synchronize instruction
caches with data caches after writing to memory. This typically
is required to make breakpoints work on ia64 and powerpc. For
those architectures the function is implemented.


# 5405ab48 11-May-2006 Poul-Henning Kamp <phk@FreeBSD.org>

Clean out sysctl machdep.* related defines.

The cmos clock related stuff should really be in MI code.


# b439e431 22-Dec-2005 John Baldwin <jhb@FreeBSD.org>

Tweak how the MD code calls the fooclock() methods some. Instead of
passing a pointer to an opaque clockframe structure and requiring the
MD code to supply CLKF_FOO() macros to extract needed values out of the
opaque structure, just pass the needed values directly. In practice this
means passing the pair (usermode, pc) to hardclock() and profclock() and
passing the boolean (usermode) to hardclock_cpu() and hardclock_process().
Other details:
- Axe clockframe and CLKF_FOO() macros on all architectures. Basically,
all the archs were taking a trapframe and converting it into a clockframe
one way or another. Now they can just extract the PC and usermode values
directly out of the trapframe and pass it to fooclock().
- Renamed hardclock_process() to hardclock_cpu() as the latter is more
accurate.
- On Alpha, we now run profclock() at hz (profhz == hz) rather than at
the slower stathz.
- On Alpha, for the TurboLaser machines that don't have an 8254
timecounter, call hardclock() directly. This removes an extra
conditional check from every clock interrupt on Alpha on the BSP.
There is probably room for even further pruning here by changing Alpha
to use the simplified timecounter we use on x86 with the lapic timer
since we don't get interrupts from the 8254 on Alpha anyway.
- On x86, clkintr() shouldn't ever be called now unless using_lapic_timer
is false, so add a KASSERT() to that affect and remove a condition
to slightly optimize the non-lapic case.
- Change prototypeof arm_handler_execute() so that it's first arg is a
trapframe pointer rather than a void pointer for clarity.
- Use KCOUNT macro in profclock() to lookup the kernel profiling bucket.

Tested on: alpha, amd64, arm, i386, ia64, sparc64
Reviewed by: bde (mostly)


# 60727d8b 06-Jan-2005 Warner Losh <imp@FreeBSD.org>

/* -> /*- for license, minor formatting changes


# 9f1b87f1 03-Aug-2004 Maxime Henrion <mux@FreeBSD.org>

Instead of calling ia32_pause() conditionally on __i386__ or __amd64__
being defined, define and use a new MD macro, cpu_spinwait(). It only
expands to something on i386 and amd64, so the compiled code should be
identical.

Name of the macro found by: jhb
Reviewed by: jhb


# 02b63cea 26-Sep-2003 Peter Grehan <grehan@FreeBSD.org>

DELAY must be a routine, not a macro definition.


# 26502503 16-Aug-2003 Marcel Moolenaar <marcel@FreeBSD.org>

Further cleanup <machine/cpu.h> and <machine/md_var.h>: move the MI
prototypes of cpu_halt(), cpu_reset() and swi_vm() from md_var.h to
cpu.h. This affects db_command.c and kern_shutdown.c.

ia64: move all MD prototypes from cpu.h to md_var.h. This affects
madt.c, interrupt.c and mp_machdep.c. Remove is_physical_memory().
It's not used (vm_machdep.c).

alpha: the MD prototypes have been left in cpu.h with a comment
that they should be there. Moving them is left for later. It was
expected that the impact would be significant enough to be done in
a seperate commit.

powerpc: MD prototypes left in cpu.h. Comment added.

Suggested by: bde
Tested with: make universe (pc98 incomplete)


# f209c402 25-Jun-2003 Peter Grehan <grehan@FreeBSD.org>

Remove unused bootpath[] variable. It conflicted with a declaration
in the sunlabel utility, causing build problems.


# 0a9b03cb 18-Jan-2003 Peter Grehan <grehan@FreeBSD.org>

Prepended underscores to macro local vars, avoiding gcc "declaration
shadows global" warning

Approved by: benno


# 663a6cc0 18-Sep-2002 Peter Grehan <grehan@FreeBSD.org>

Additional machdep sysctl constants needed for userland utils

Approved by: benno


# 37d87c9f 28-May-2002 Benno Rice <benno@FreeBSD.org>

Move the kcopy() function from trap.c to machdep.c. Add a prototype.


# da57e52a 14-Apr-2002 Benno Rice <benno@FreeBSD.org>

GC an extraneous prototype of delay().


# 812344bc 20-Mar-2002 Alfred Perlstein <alfred@FreeBSD.org>

Remove __P.

Reveiwed by: benno


# 9a7fefa5 27-Feb-2002 Benno Rice <benno@FreeBSD.org>

Add a missing (.


# 0308a577 04-Nov-2001 Mark Peek <mp@FreeBSD.org>

Clean up the trap handling code and make it consistent with the other platforms.

Submitted by: jhb


# d163144b 14-Oct-2001 Benno Rice <benno@FreeBSD.org>

- Correct the type of the argument to delay() so as to not conflict with
sys/boot/common/bootstrap.h.
- Add a prototype for fork_trampoline().


# 5fd2c51e 19-Sep-2001 Mark Peek <mp@FreeBSD.org>

Update PowerPC MD code to compile and do initial bootstrap based on
recent changes (KSE and VM requiring physmem to be setup).

Reviewed by: benno, jhb, julian


# 688ebe12 10-Aug-2001 John Baldwin <jhb@FreeBSD.org>

- Close races with signals and other AST's being triggered while we are in
the process of exiting the kernel. The ast() function now loops as long
as the PS_ASTPENDING or PS_NEEDRESCHED flags are set. It returns with
preemption disabled so that any further AST's that arrive via an
interrupt will be delayed until the low-level MD code returns to user
mode.
- Use u_int's to store the tick counts for profiling purposes so that we
do not need sched_lock just to read p_sticks. This also closes a
problem where the call to addupc_task() could screw up the arithmetic
due to non-atomic reads of p_sticks.
- Axe need_proftick(), aston(), astoff(), astpending(), need_resched(),
clear_resched(), and resched_wanted() in favor of direct bit operations
on p_sflag.
- Fix up locking with sched_lock some. In addupc_intr(), use sched_lock
to ensure pr_addr and pr_ticks are updated atomically with setting
PS_OWEUPC. In ast() we clear pr_ticks atomically with clearing
PS_OWEUPC. We also do not grab the lock just to test a flag.
- Simplify the handling of Giant in ast() slightly.

Reviewed by: bde (mostly)


# c791ba59 30-Jun-2001 Benno Rice <benno@FreeBSD.org>

Add TRAPF_* macros required by MI-ification of ast() and userret().

Submitted by: Mark Peek <mark@whistle.com>


# 6be523bc 29-Jun-2001 John Baldwin <jhb@FreeBSD.org>

Add a new MI pointer to the process' trapframe p_frame instead of using
various differently named pointers buried under p_md.

Reviewed by: jake (in principle)


# f9bac91b 09-Jun-2001 Benno Rice <benno@FreeBSD.org>

Bring in NetBSD code used in the PowerPC port.

Reviewed by: obrien, dfr
Obtained from: NetBSD