Commit Graph

5520 Commits

Author SHA1 Message Date
Mateusz Guzik
c3f1a13902 Retire broken GPROF support from the kernel
The option is not even recognized and with that patched it does not
compile. Even if it did work, it would be prohibitively expensive to
use.

Interested parties can use pmcstat or dtrace instead.
2022-11-15 14:17:10 +00:00
Elliott Mitchell
21cc0918c7 sys: Nuke double-semicolons
A distinct number of double-semicolons have ended up in FreeBSD.  Take a
pass at getting rid of many of these harmless typos.

Reviewed by: emaste, rrs
Pull Request: https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D31716
2022-11-02 09:34:20 -06:00
Elliott Mitchell
ccd9b49f20 sys: use .S for assembly language files that use the preprocessor
Reviewed by:	imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D35908
2022-11-02 10:29:00 -04:00
Gordon Bergling
34fcce0087 xilinx: Fix a typo in a source code comment
- s/interrut/interrupt/

MFC after:	3 days
2022-11-01 08:00:53 +01:00
Warner Losh
91f45a3cf3 intrng: Remove from NOTES file
INTRNG is required on these platforms. Remove it from the NOTES file
since it is now in the DEFAULTS file.

Suggested by:		mhorne
Sponsored by:		Netflix
2022-10-25 10:57:29 -06:00
Konstantin Belousov
ca18304ea4 arm, arm64: tweak hard-coded load addresses for PIE binaries
They are used when ASLR is not applied.
The need for adjusting is due to rtld direct exec mode puts ld-elf.so.1
at the PIE load address, and this address must not conflict with the
default linker' load address for non-PIE binaries.  Otherwise rtld in
direct mode cannot activate image.  Example of implicit failure is ldd(1)
refusing to run.

Reported by:	kp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37085
2022-10-25 19:00:44 +03:00
Warner Losh
d4f6b11f66 DEFAULTS: move intrng to DEFAULTS for its platforms.
Sponsored by:		Netflix
Reviewed by:		manu, kevans
Differential Revision:	https://reviews.freebsd.org/D37107
2022-10-24 12:13:03 -06:00
Warner Losh
f94d74ff3a arm: Fix name of config file in comment
This file was never named GENERICV6 in the FreeBSD tree. It entered the
tree in b9413b5512 as GENERIC.

Sponsored by:		Netflix
2022-10-20 10:48:31 -06:00
Takanori Watanabe
7b5d62bb73 ofw: add BUS_GET_DEVICE_PATH interface to openfirm/fdt, somewhat incomplete.
This add BUS_GET_DEVICE_PATH interface,
which shows device tree of openfirm/fdt.

In qemu-system-arm64 with "virt" machine with device-tree firmware,
% devctl getpath OFW cpu0

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D37031
2022-10-18 16:55:47 +09:00
John Baldwin
4d90a5afc5 sys: Consolidate common implementation details of PV entries.
Add a <sys/_pv_entry.h> intended for use in <machine/pmap.h> to
define struct pv_entry, pv_chunk, and related macros and inline
functions.

Note that powerpc does not yet use this as while the mmu_radix pmap
in powerpc uses the new scheme (albeit with fewer PV entries in a
chunk than normal due to an used pv_pmap field in struct pv_entry),
the Book-E pmaps for powerpc use the older style PV entries without
chunks (and thus require the pv_pmap field).

Suggested by:	kib
Reviewed by:	kib
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D36685
2022-10-07 10:14:03 -07:00
Andrew Turner
839374bbfe Teach the GICv3 driver to translate memory ranges
As with the GICv1/2 driver teach the GICv3 driver to translate memory
ranges of children. This allows us to create a common
bus_alloc_resource implementation for bot hACPI and FDT attachments.

Sponsored by:	The FreeBSD Foundation
2022-09-23 15:28:45 +01:00
John Baldwin
f49fd63a6a kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers.
Reviewed by:	kib, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D36549
2022-09-22 15:09:19 -07:00
John Baldwin
7ae99f80b6 pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t.
This matches the return type of pmap_mapdev/bios.

Reviewed by:	kib, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D36548
2022-09-22 15:08:52 -07:00
Andrew Turner
42353d81e3 Use DEFINE_CLASS_0 in the arm generic timer
Rather than defining the structure manually use the DEFINE_CLASS_0
macro. As we have both an ACPI and FDT attachment we need to use the
_0 variant of the macro as DEFINE_CLASS would create two structures
with the same name.

Sponsored by:	The FreeBSD Foundation
2022-09-21 10:59:14 +01:00
Andrew Turner
e13c6a6fca Teach the GICv3 driver about a vgic child
This will be used by bhyve to attach a virtual GIC driver.

Sponsored by:	Innovate UK
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36590
2022-09-21 10:59:13 +01:00
Andrew Turner
9526031cd5 Create macros for the Arm timer IRQ indexes
Rather than hard coding these values use a macro to document which
interrupt is being used.

Reviewed by:	emaste
Obtained from:	https://github.com/FreeBSD-UPB/freebsd-src (earlier version)
Sponsored by:	Innovate UK
Sponsored by:	The FreeBSD Foundation
Sponsored by:	University Politehnica of Bucharest
Differential Revision: https://reviews.freebsd.org/D36600
2022-09-21 10:59:08 +01:00
Richard Scheffenegger
bb1d472d79 tcp: make CUBIC the default congestion control mechanism.
This changes the default TCP Congestion Control (CC) to CUBIC.
For small, transactional exchanges (e.g. web objects <15kB), this
will not have a material effect. However, for long duration data
transfers, CUBIC allocates a slightly higher fraction of the
available bandwidth, when competing against NewReno CC.

Reviewed By: tuexen, mav, #transport, guest-ccui, emaste
Relnotes: Yes
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D36537
2022-09-13 12:09:21 +02:00
Adrian Chadd
f060362ade ipq4018: remove write-only variables in USB ehci/xhci bus glue
Changes in compilers / warnings/errors caused this to stop compiling.
Delete the write-only code.

Reviewed by: imp

Differential Revision: https://reviews.freebsd.org/D36532
2022-09-12 20:10:24 -07:00
Peter Jeremy
c02d4224c8
arm64: allwinner: aw_r_intc: Add A64 and H6 compatible.
This fixes booting the Pine H64 with a 5.13 DTS.

Suggested by:	manu@
2022-09-10 20:36:22 +10:00
Matthew Grooms
87705c5c21 bcm2835_clkman: add RPI4 compat string
This enables attachment on the RPI4, thus enabling the bcm2835_pwm
driver too. Per the device tree documentation, these compat strings are
equivalent, and no further changes to the driver are required.

https://lists.freebsd.org/archives/freebsd-arm/2021-June/000143.html

MFC after:	3 days
2022-09-09 12:31:25 -03:00
Albert Jakieła
4a4c6dc9a3 Add ARMADA38X gateclk control
This patch introduces basic gate control driver for Armada38x SoC.
Each gate controls coreclk output to a given peripheral.

Reviewed by:	manu
Obtained from:	Semihalf
Differential Revision: https://reviews.freebsd.org/D36455
2022-09-07 09:44:58 +02:00
Albert Jakieła
07c5be33f1 Add ARMADA38X clkgen driver
This patch introduces clkgen driver for Armada38x SoCs.
Clock topology consists of single coreclk which supplies
clock signal to CPU cores and peripherials.

Reviewed by:	manu
Obtained from:	Semihalf
Differential Revision: https://reviews.freebsd.org/D36453
2022-09-07 09:44:58 +02:00
Andrew Turner
544f047f89 Store mpidr as a 64-bit value on arm64
The mpidr register is 64 bit on arm64 and 32 bit on arm. Fix this by
extending the arm64 definition to include the top 32 bits.

To preserve KBI when MFCing split the value into two 32 bit values.
This will be cleaned up later only on main.

Reviewed by:	bz
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36346
2022-08-31 11:48:31 +01:00
Andrew Turner
5d0aebf4fa Fix the arm generic timer on 32 bit
Hide a variable when we don't use it.

Sponsored by:	The FreeBSD Foundation
2022-08-25 13:17:11 +01:00
Andrew Turner
278111b8a5 Allow the kernel to emulate the physical counter on arm64
When running under a VM we don't have access to the physical counter.
Add support to emulate this instruction by handling the trap in the
kernel. As it is slow only enable when the hw.emulate_phys_counter
tunable is set on boot.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35613
2022-08-25 12:17:23 +01:00
John Baldwin
e663907366 Define _NPCM and the last PC_FREEn constant in terms of _NPCPV.
This applies one of the changes from
5567d6b441 to other architectures
besides arm64.

Reviewed by:	kib
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D36263
2022-08-23 13:31:02 -07:00
Bjoern A. Zeeb
11d08e7e8d arm/gic: fix a KASSERT in arm_gic_reserve_msi_range()
Fix the off-by-one in the KASSERT in arm_gic_reserve_msi_range()
allowing the MSIs being allocated at the end of the IRQ range.

Reported by:	bz
Submitted by:	andrew
Reviewed by:	andrew
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D36291
2022-08-22 11:59:02 +00:00
Dimitry Andric
402dbdd98a Adjust function definition in arm's mv_common.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/arm/mv/mv_common.c:414:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mv_check_soc_family()
                       ^
                        void

This is because mv_check_soc_family() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days
2022-08-15 20:48:33 +02:00
Mark Johnston
e9552d8b45 arm: Clear TTBCR before enabling the MMU
Upon reset, this register is supposed to have a value of zero.  But when
booting certain v7 CPUs in QEMU, we enter the kernel with several bits
set, including the EAE bit, which enables ARM's PAE extension.  I'm not
sure if QEMU is setting it or if it's the uboot loader.  Because FreeBSD
doesn't implement that extension and uses regular 32-bit page tables,
the kernel hangs immediately after enabling the MMU.

Just clear everything in TTBCR before enabling the MMU, to match the
reset value.  FreeBSD doesn't toggle anything in that register.

PR:		251187
Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36041
2022-08-05 16:21:09 -04:00
Konstantin Belousov
c6d31b8306 AST: rework
Make most AST handlers dynamically registered.  This allows to have
subsystem-specific handler source located in the subsystem files,
instead of making subr_trap.c aware of it.  For instance, signal
delivery code on return to userspace is now moved to kern_sig.c.

Also, it allows to have some handlers designated as the cleanup (kclear)
type, which are called both at AST and on thread/process exit.  For
instance, ast(), exit1(), and NFS server no longer need to be aware
about UFS softdep processing.

The dynamic registration also allows third-party modules to register AST
handlers if needed.  There is one caveat with loadable modules: the
code does not make any effort to ensure that the module is not unloaded
before all threads processed through AST handler in it.  In fact, this
is already present behavior for hwpmc.ko and ufs.ko.  I do not think it
is worth the efforts and the runtime overhead to try to fix it.

Reviewed by:	markj
Tested by:	emaste (arm64), pho
Discussed with:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D35888
2022-08-02 21:11:09 +03:00
John Baldwin
ea8f128c7c pmap_mapdev: Consistently use vm_paddr_t for the first argument.
The devmap variants used vm_offset_t for some reason, and a few places
explicitly cast bus addresses to vm_offset_t.  (Probably those casts
along with similar casts for vm_size_t should just be removed and
instead permit the compiler to DTRT.)

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35961
2022-07-28 15:55:10 -07:00
Kornel Dulęba
361971fbca Rework how shared page related data is stored
Store the shared page address in struct vmspace.
Also instead of storing absolute addresses of various shared page
segments save their offsets with respect to the shared page address.
This will be more useful when the shared page address is randomized.

Approved by:	mw(mentor)
Sponsored by:	Stormshield
Obtained from:	Semihalf
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D35393
2022-07-18 16:27:32 +02:00
Kornel Dulęba
f6ac79fb12 Introduce the PROC_SIGCODE() macro
Use a getter macro instead of fetching the sigcode address directly
from a sysent of a given process. It assumes that the sigcode is stored
in the shared page, which is true in all cases, except for a.out
binaries. This will be later useful when the shared page address
randomization is introduced.
No functional change intended.

Approved by:	mw(mentor)
Sponsored by:	Stormshield
Obtained from:	Semihalf
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D35392
2022-07-18 16:27:26 +02:00
Mitchell Horne
258958b3c7 ddb: use _FLAGS command macros where appropriate
Some command definitions were forced to use DB_FUNC in order to specify
their required flags, CS_OWN or CS_MORE. Use the new macros to simplify
these.

Reviewed by:	markj, jhb
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35582
2022-07-05 11:56:55 -03:00
Gordon Bergling
f1334ab76b freescale: Fix a typo in a source code comment
- s/transistions/transitions/

MFC after:	3 days
2022-07-03 13:55:40 +02:00
Roger Pau Monné
881c145431 elfnote: place note in a PT_NOTE program header
Some tools (firecraker loader) only check for notes in PT_NOTE program
headers, so make sure the notes added using the ELFNOTE macro end up
in such header.

Output from readelf -Wl for and amd64 kernel after the change:

Elf file type is EXEC (Executable file)
Entry point 0xffffffff8038a000
There are 11 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0xffffffff80200040 0x0000000000200040 0x000268 0x000268 R   0x8
  INTERP         0x0002a8 0xffffffff802002a8 0x00000000002002a8 0x00000d 0x00000d R   0x1
      [Requesting program interpreter: /red/herring]
  LOAD           0x000000 0xffffffff80200000 0x0000000000200000 0x189e28 0x189e28 R   0x200000
  LOAD           0x18a000 0xffffffff8038a000 0x000000000038a000 0xe447e8 0xe447e8 R E 0x200000
  LOAD           0xfce7f0 0xffffffff811ce7f0 0x00000000011ce7f0 0x6b955c 0x6b955c R   0x200000
  LOAD           0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 RW  0x200000
  LOAD           0x1801000 0xffffffff81a01000 0x0000000001a01000 0x1c8480 0x5ff000 RW  0x200000
  DYNAMIC        0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 RW  0x8
  GNU_RELRO      0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 R   0x1
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0
  NOTE           0x1687ae0 0xffffffff81887ae0 0x0000000001887ae0 0x0001c0 0x0001c0 R   0x4

 Section to Segment mapping:
  Segment Sections...
[...]
   10     .note.gnu.build-id .note.Xen

Reported by: cperciva
Fixes: 1a9cdd373a ('xen: add PV/PVH kernel entry point')
Fixes: 93ee134a24 ('Integrate support for xen in to i386 common code.')
Sponsored by: Citrix Systems R&D
Reviewed by: emaste
Differential revision: https://reviews.freebsd.org/D35611
2022-06-28 09:51:57 +02:00
Hans Petter Selasky
6c4b6f55f7 busdma: Protect ARM busdma bounce page counters using the bounce page lock.
In bus_dmamap_unload() on ARM, the counters for free_bpages and reserved_bpages
appear to be vulnerable to unprotected read-modify-write operations that result
in accounting that looks like a page leak.

This was noticed on a 2GB quad core i.MX6 system that has more than one device
attached via FTDI based USB serial connection.

Submitted by:	John Hein <jcfyecrayz@liamekaens.com>
Differential Revision:	https://reviews.freebsd.org/D35553
PR:		264836
MFC after:	3 days
Sponsored by:	NVIDIA Networking
2022-06-25 12:01:59 +02:00
Mitchell Horne
3428997cb3 if_dwc: recognize additional rgmii phy-modes
Per the reports, some Allwinner device trees now list the desired
phy-mode as "rgmii-id". The manual string comparison fails to detect
this, and we end up falling back to MII mode. Instead, select the clock
name using the sc->phy_mode variable, which is set in the main attach
function.

The logic to actually handle rgmii-id mode delays will be added to the
relevant PHY driver.

PR:		261355, 264673
Reported by:	Maren <marentoy@protonmail.com>
Reported by:	Arie Bikker <src-2016@bikker.homeunix.net>
Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35500
2022-06-23 15:15:10 -03:00
Gordon Bergling
1261c01d7f am335x: Fix a typo in a source code comment
- s/continous/continuous/

MFC after:	3 days
2022-06-04 13:28:10 +02:00
Gordon Bergling
415e8d12d1 tegra: Fix a typo in a source code comment
- s/Disble/Disable/

MFC after:	3 days
2022-06-04 11:54:09 +02:00
Andrew Turner
f16e38162c Fix an indentation bug in the bcm pci driver
Sponsored by:	The FreeBSD Foundation
2022-05-23 18:24:04 +01:00
Andrew Turner
5749fdc535 Use the error given in the bcm PCI driver
When given an error return it and not just ENXIO as it may contain
information usefule to debug an error.

Sponsored by:	The FreeBSD Foundation
2022-05-23 18:21:40 +01:00
Andrew Turner
c3147104fd Error is not a bool in bcm2838_pci, check for != 0
Fix for style an check if error != 0 in the bcm2838 pci driver.

Sponsored by:	The FreeBSD Foundation
2022-05-23 17:38:18 +01:00
Andrew Turner
b25d7f7477 Fix the style of bcm_pcib_msi_attach a little
Move the definition of error to the top of the function.

Sponsored by:	The FreeBSD Foundation
2022-05-23 17:33:53 +01:00
Andrew Turner
ad52fba11e Add fdt to name of a fdt specific function
Rename pci_host_generic_attach to pci_host_generic_fdt_attach to be
consistant with the acpi attachment.

Sponsored by:	The FreeBSD Foundation
2022-05-23 15:24:35 +01:00
Dmitry Chagin
eca368ecb6 Retire sv_transtrap
Call translate_traps directly from sendsig().

MFC after:		2 weeks
2022-05-20 14:54:03 +03:00
Mitchell Horne
db71383b88 kerneldump: remove physical from dump routines
It is unused, especially now that the underlying d_dumper methods do not
accept the argument.

Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35174
2022-05-13 10:43:19 -03:00
John Baldwin
680ccae390 arm xilinx: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 14:26:45 -07:00
John Baldwin
8537e67130 arm ti: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 14:26:45 -07:00
John Baldwin
9978ade498 arm/arm64 qualcomm: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 14:26:45 -07:00