Commit Graph

33507 Commits

Author SHA1 Message Date
Konstantin Belousov
2cf37001fc Make kern.timecounter.hardware tunable
Noted and reviewed by:	kevans
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D29122
2021-11-16 09:48:22 +01:00
Konstantin Belousov
c3fc52ec06 Add ddb 'show timecounter' command.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-11-16 09:48:22 +01:00
Robert Watson
512e0b59af Changes that improve DTrace FBT reliability
on freebsd/arm64:

- Implement a dtrace_getnanouptime(), matching the existing
  dtrace_getnanotime(), to avoid DTrace calling out to a potentially
  instrumentable function.

  (These should probably both be under KDTRACE_HOOKS.  Also, it's not clear
  to me that they are correct implementations for the DTrace thread time
  functions they are used in .. fixes for another commit.)

- Don't allow FBT to instrument functions involved in EL1 exception handling
  that are involved in FBT trap processing: handle_el1h_sync() and
  do_el1h_sync().

- Don't allow FBT to instrument DDB and KDB functions, as that makes it
  rather harder to debug FBT problems.

Prior to these changes, use of FBT on FreeBSD/arm64 rapidly led to kernel
panics due to recursion in DTrace.

Reliable FBT on FreeBSD/arm64 is reliant on another change from @andrew to
have the aarch64 instrumentor more carefully check that instructions it
replaces are against the stack pointer, which can otherwise lead to memory
corruption.  That change remains under review.

MFC after:	2 weeks
Reviewed by:	andrew, kp, markj (earlier version), jrtc27 (earlier version)
Differential revision:	https://reviews.freebsd.org/D27766
2021-11-16 09:48:22 +01:00
Konstantin Belousov
62c428f241 Remove double-calls to tc_get_timecount()
to warm timecounters.

It seems that second call does not add any useful state change for all
implemented timecounters.

Discussed with:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2021-11-16 09:48:22 +01:00
Pawel Biernacki
eb909371c7 Mark more nodes as CTLFLAG_MPSAFE
or CTLFLAG_NEEDGIANT (17 of many)

r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718
2021-11-16 09:48:22 +01:00
Konstantin Belousov
166a80c3d8 Consolidate read code for timecounters
and fix possible overflow in bintime()/binuptime().

The algorithm to read the consistent snapshot of current timehand is
repeated in each accessor, including the details proper rollup
detection and synchronization with the writer.  In fact there are only
two different kind of readers: one for bintime()/binuptime() which has
to do the in-place calculation, and another kind which fetches some
member from struct timehand.

Extract the logic into type-checked macros, GETTHBINTIME() for bintime
calculation, and GETTHMEMBER() for safe read of a structure' member.
This way, the synchronization is only written in bintime_off() and
getthmember().

In bintime_off(), use overflow-safe calculation of th_scale *
delta(timecounter).  In tc_windup, pre-calculate the min delta value
which overflows and require slow algorithm, into the new timehands
th_large_delta member.

This part with overflow fix was written by Bruce Evans.

Reported by:	Mark Millard <marklmi@yahoo.com> (the overflow issue)
Tested by:	pho
Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation (kib)
MFC after:	3 weeks
2021-11-16 09:48:22 +01:00
Mateusz Guzik
265c2e620b Remove duplicated empty lines from kern/*.c
No functional changes.
2021-11-16 09:48:22 +01:00
Konstantin Belousov
bc9c0e00cc Initialize timehands linkage much earlier.
Reported and tested by:	trasz
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-16 09:48:22 +01:00
Konstantin Belousov
402dafa495 Make timehands count selectable at boottime.
Tested by:	O'Connor, Daniel <darius@dons.net.au>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D21563

This patch was modified by Sebastian Huber
<sebastian.huber@embedded-brains.de> to adjust it for RTEMS.  See
comment in the patch.
2021-11-16 09:48:22 +01:00
Olivier Houchard
a9ce44bf8f Instead of using an incomplete list of platforms
that uses 64bits time_t in 32bits mode, special case amd64, as i386 is
the only arch that still uses 32bits time_t.
2021-11-16 09:48:22 +01:00
Andrew Turner
975ecc1702 Create a new macro for static DPCPU data.
On arm64 (and possible other architectures) we are unable to use static
DPCPU data in kernel modules. This is because the compiler will generate
PC-relative accesses, however the runtime-linker expects to be able to
relocate these.

In preparation to fix this create two macros depending on if the data is
global or static.

Reviewed by:	bz, emaste, markj
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D16140
2021-11-16 09:48:22 +01:00
Mateusz Guzik
f43beb03c2 tc: bcopy -> memcpy 2021-11-16 09:48:22 +01:00
Brooks Davis
c54b13b072 Move most of the contents of opt_compat.h
to opt_global.h.

opt_compat.h is mentioned in nearly 180 files. In-progress network
driver compabibility improvements may add over 100 more so this is
closer to "just about everywhere" than "only some files" per the
guidance in sys/conf/options.

Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of
sys/compat/linux/*.c.  A fake _COMPAT_LINUX option ensure opt_compat.h
is created on all architectures.

Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the
set of compiled files.

Reviewed by:	kib, cem, jhb, jtl
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14941
2021-11-16 09:48:22 +01:00
Sebastian Huber
f77b692e5c score: Remove FreeBSD identifier 2021-11-16 09:48:22 +01:00
Konstantin Belousov
7d3712fb26 Use atomic_load(9) to read ppsinfo sequence numbers.
In this case volatile qualifiers enusre that a compiler does not
optimize the accesses out.

Reviewed by:	alc, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D13534
2021-11-16 09:48:22 +01:00
Pedro F. Giffuni
73b77be719 SPDX: use the Beerware identifier. 2021-11-16 09:48:22 +01:00
Sebastian Huber
d5649e25f3 kern_tc.c: Remove unused code
This fix relates to a Coverity issue (PW.DECLARED_BUT_NOT_REFERENCED).
2021-11-16 09:48:22 +01:00
Joel Sherrill
c8a1060988 Add support for IDLE Thread stack allocator
Add a stack allocator hook specifically for allocation of IDLE thread stacks.
This allows the user to decide if IDLE thread stacks are statically allocated
or handled by the same custom allocator mechanism as other thread stacks.

Closes #4520.
2021-10-07 10:31:38 -05:00
Chris Johns
99698fb5a2 powerpc/motorola_powerpc: Map LibBSD bus space to the PCI base address
Closes #4516
2021-09-22 10:58:14 +10:00
Chris Johns
cfef84a007 powerpc/io: Make [out/in] le and be calls conditional
- These calls clash with the Linux IO header in LibBSD. Making these
  conditional here means BSPs build and the imported Linux header is
  untouched.

Updates #4245
2021-09-22 10:58:14 +10:00
Ryan Long
e9712e7890 pxcdevctl: Adjust for standard (5 branch)
psxdevctl is supposed to return the value in errno. Before, it was
returning -1 and setting errno. Changed the tests to reflect these
changes. Added code from RRADE's posix_devctl.c.

Closes #4505
2021-09-20 13:48:14 -05:00
Sebastian Huber
ff94ddcd84 rtems: Initialize count of postponed jobs
The rtems_rate_monotonic_get_status() directive returns an arbitrary
number for the count of postponed jobs if it is called for a newly
created period object.  Set the count of postponed jobs to zero during
object creation.

Close #4512.
2021-09-09 15:17:50 +02:00
Gedare Bloom
e5a1b15848 m68k/uC5282: linkcmds KEEP and SORT sections
Fixes a problem with bad epilog code in _fini and to keep sections
necessary with the -ffunction/data-sections.

Closes #4465.
2021-07-01 12:53:50 -06:00
Jan Sommer
4925ab4f52 bsps/i386: Update calibration of TSC to be more accurate
Closes #4456
2021-06-21 10:13:37 +02:00
Sebastian Huber
8d4382ba34 bsps/irq: Change license to BSD-2-Clause
Change license to BSD-2-Clause according to file history and
re-licensing agreement.

Update #3053.
2021-06-21 10:12:26 +02:00
Christian Mauderer
50a835393a cpukit: Add description of release version numbers
The release version in the git sources doesn't change. Add a note why
that is the case.
2021-05-28 08:24:05 +02:00
Sebastian Huber
06427c8df4 rtems: Check entry point in rtems_task_start()
Close #4409.
2021-05-14 09:22:17 +02:00
Sebastian Huber
d697769d46 bsps/arm: ARMV7_CP15_START_WORKSPACE_ENTRY_INDEX
Change the ARMV7_CP15_START_WORKSPACE_ENTRY_INDEX value to be in line
with the workspace entry in ARMV7_CP15_START_DEFAULT_SECTIONS.

Close #4394.
2021-04-29 13:39:36 +02:00
Moyano, Gabriel
bc806d41a5 grlib/genirq: Taking into account that it could be more than one ISR enabled/disabled
Closes #4385
2021-04-16 08:49:54 +02:00
Christian Mauderer
a274b6fdcb shell: Add i2c and spi commands
This adds some commands that are usefull for debugging simple serial
interfaces.

Even if they are a complete re-implementation, the i2c* commands use a
simmilar call like the Linux i2c tools.

Closes #4371
2021-03-31 10:43:48 +02:00
Jan Sommer
ec2660548e bsps/xilinx_zynq: Add Xilinx AXI SPI driver to build
Closes #4370
2021-03-31 10:22:42 +02:00
Jan Sommer
ce2b276803 bsps/xilinx_zynq: Add SPI driver for xilinx-axi-spi
Updates #4370
2021-03-31 10:15:49 +02:00
Jan Sommer
14e74e4312 bsps/xilinx_zynq: Add cadence SPI driver to build system
Closes #4369
2021-03-31 10:02:00 +02:00
Jan Sommer
c86d513664 bsps/xilinx_zynq: Add SPI driver for cadence-spi
Updates #4369
2021-03-31 10:00:12 +02:00
G S Niteesh Babu
08f807e64a rtems-fdt/rtems-fdt.c: Fix bug in loop termination
The while loop, loops infinitely in case of raw FDT data.
The loop condition (size) is not modified during iterations.

Fixes #4350
2021-03-21 12:39:14 +01:00
Sebastian Huber
3a66586c9e rtems: Allow RTEMS_PRIORITY for MrsP semaphores
In order to improve the compatibility of RTEMS 5.2 with future version
of RTEMS which fixed #4346 allow MrsP semaphores to be created with
RTEMS_PRIORITY.

Close #4347.
2021-03-16 15:00:08 +01:00
Jan Sommer
645dbc5fcc bsps/shared: Allow setting baud rate for zynq uart
Closes #4236
2021-03-09 09:28:43 +01:00
Kinsey Moore
2f323700b9 zynq-uart: Fix set_attributes implementation
The zynq-uart set_attributes implementation was configured to always
return false which causes spconsole01 to fail. This restores the
disabled implementation which sets the baud rate registers
appropriately and allows spconsole01 to pass. This also expands the
set_attributes functionality to allow setting of the stop bits,
character width, and parity.

Updates #4236
2021-03-09 09:28:43 +01:00
Daniel Hellstrom
2497a46a76 sparc,leon: avoid triggering LEON3FT errata TN-0009
Update #4154.
2021-03-07 16:08:27 +01:00
Daniel Hellstrom
3074eb0f37 sparc,leon: avoid triggering TN-0009 bad sequence
Update #4154.
2021-03-07 16:08:26 +01:00
Daniel Hellstrom
291267113b grlib,grspw_pkt: correct link state enum numbering
Not used by the driver itself, but shuold be correct if used by
application.

Update #4316.
2021-03-07 16:08:26 +01:00
Martin Aberg
8cfaa0eb76 leon, l2cache: prevent unused diagnostic access
Update #4315.
2021-03-07 16:08:26 +01:00
Martin Aberg
b0eb952427 leon, ahbstat: register definitions for AHBSTAT version 1
Update #4314.
2021-03-07 16:08:26 +01:00
Martin Aberg
1161e1fb92 leon, grspw_router: added router_port_link_div()
Allows user to set SpaceWire run clock divisor for an individual port.

Update #4313.
2021-03-07 16:08:26 +01:00
Daniel Hellstrom
d9d96f0608 sparc: fix bad register alignment for 64 bit store
Update #4311.
2021-03-07 16:08:25 +01:00
Daniel Hellstrom
cb8379dc09 leon: restart and load timer counter at initialization
Without this smp05 and smpthreadlife01 tests may fail
depending on how the boot loader initialized the GPTIMER.
Before the time counter stopped counting when reaching
zero, but tests could work since it could take 2^32 us
before stopping.

The timer driver will potentially overwrite this, but it
happens later due to the initialization order having
RTEMS_SYSINIT_CPU_COUNTER very early.

Update #4312.
2021-03-07 16:08:25 +01:00
Daniel Hellstrom
81e4a15b18 leon,ckinit: avoid assuming 1MHz timer pre-scaler clock
Update #4310.
2021-03-07 16:08:25 +01:00
Daniel Hellstrom
0ed294b6cc leon3: avoid dependency on apbuart/timer driver
Moves drvmgr_drivers[] from amba.c to a separate file in order
to avoid the dependecy on APBUART/GPTIMER drivers. This has
an effect when user configured not to use timer or uart
in their project.

Update #4309.
2021-03-07 16:08:25 +01:00
Daniel Hellstrom
c13205f691 leon,greth: added support for variable sized descriptor table sizes
The descriptor table size is equal to its alignment and set when
configuring the HW IP through VHDL generics. This SW patch simply
probes the HW how large the RX/TX descriptor tables are and adjusts
accordingly.

The number of descriptors actual used are controlled by other
settings (rxDescs and txDescs) controlled by the user.

Update #4308.
2021-03-07 16:08:25 +01:00
Daniel Hellstrom
23cc5a6090 leon,grcan: split out GRCAN non-FD specific support in separate file
Update #4307.
2021-03-07 16:08:24 +01:00