Commit graph

2350 commits

Author SHA1 Message Date
Andrew Turner a69450102f arm64: Raise a SIGBUS on a user external abort
When userspace triggers an external abort allow it to handle the abort
by raising a SIGBUS.

Reviewed by:	markj, kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42018
2023-10-16 11:38:14 +01:00
Mina Galić 74e4a8d208 pmap: add pmap_kextract(9) man page
Add a man page for pmap_kextract(9), with alias to vtophys(9). This man
page is based on pmap_extract(9).

Add it as cross reference in pmap(9), and add comments above the
function implementations.

Co-authored-by:	Graham Perrin <grahamperrin@gmail.com>
Co-authored-by:	mhorne
Sponsored by:	The FreeBSD Foundation
Pull Request:	https://github.com/freebsd/freebsd-src/pull/827
2023-10-13 15:27:24 -03:00
Konstantin Belousov 6aa641b71d arm64, risvc: warn about ignored kstack_pages for thread0
Suggested by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42143
2023-10-13 12:26:45 +03:00
Konstantin Belousov ac63f7534d arm64, riscv: Use KSTACK_PAGES for the thread0 kstack size designator
instead of kstack_pages. Although it is correct right now to use
kstack_pages on amd64 since the kern.kstack_pages tunable is not
functional on arm64, this is too fragile and wrong on riscv.

Include opt_kstack_pages.h into machdep.c to get the right definition
for KSTACK_PAGES.

Reviewed by:	jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42143
2023-10-13 12:26:45 +03:00
Konstantin Belousov 4095e0bcb9 arm64 locore.S: fix typos
Reviewed by:	jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42143
2023-10-13 12:26:44 +03:00
Andrew Turner e340882d3e arm64: Add BTI landing pads to assembly functions
When we enable BTI iboth the first instruction in a function that could
be called indirectly, and a branch within a function need a valid
landing pad instruction.

There are three options for these instructions:
 1. A breakpoint instruction
 2. A pointer authentication PACIASP/PACIBSP
 3. A BTI instruction

Option 1 will raise a breakpoint exception so isn't useable in either
cases. Option 2 could be used in some function entry cases, but needs
to be paired with an authentication instruction, and is normally only
used in non-leaf functions we can't use it in this case. This leaves
option 3.

There are four variants of the instruction, the C variant is used on
function entry and the J variant is for jumping within a function.
There is also a JC that works with both and one with no target that
works with neither.

Reviewed by:	markj
Sponsored by:	Arm Ltd
Sponsored by:	The FreeBSD Foundation (earlier version)
Differential Revision:	https://reviews.freebsd.org/D42078
2023-10-10 10:52:16 +01:00
Kristof Provost 84d12f887c Add a COMPAT_FREEBSD14 kernel option
Use it wherever COMPAT_FREEBSD13 is currently specified.

Reviewed by:	brooks, zlei
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42100
2023-10-10 11:48:22 +02:00
Dmitry Chagin 03f5bd1e46 linux(4): Drop the outdated comment, nosys is fine since 39024a89
MFC after:		1 week
2023-10-10 12:20:51 +03:00
Bojan Novković 808f5ac3c6 arm64: Add a leaf PTP when pmap_enter(psind=1) creates a wired mapping
Let pmap_enter_l2() create wired mappings.  In particular, allocate a
leaf PTP for use during demotion.  This is a step towards reverting
commit 64087fd7f3.

Reviewed by:	alc, markj
Sponsored by:	Google, Inc. (GSoC 2023)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D41634
2023-10-08 20:40:44 -04:00
Emmanuel Vadot 432ae724e6 dwc: Move every sub drivers to dev/dwc
It makes it easier to find all the sub drivers and change them if needed.
While here do not gate dwc_rk with soc options, dwc_rk is made for all rockchip
SoCs. Same thing for dwc_socfpga
2023-10-05 17:34:38 +02:00
Emmanuel Vadot 137b58e4d2 i2c: Add cadence iic driver
This IP is found in Xilinx SoC, it only been tested on ZynqMP (arm64)
so only enable it there for now.

Differential Revision:	https://reviews.freebsd.org/D41994
2023-10-03 09:56:20 +02:00
Dmitry Chagin 99abee8b7b linux(4): Regen for linux_nosys change
MFC after:		1 week
2023-10-03 10:38:03 +03:00
Dmitry Chagin 8e523be5a5 linux(4): Deorbit linux_nosys from syscalls.master
Differential Revision:	https://reviews.freebsd.org/D41902
MFC after:		1 week
2023-10-03 10:38:02 +03:00
Konstantin Belousov b82b4ae752 sysentvec: add SV_SIGSYS flag
to allow ABIs to indicate that SIGSYS is needed.  Mark all native
FreeBSD ABIs with the flag.

This implicitly marks Linux' ABIs as not delivering SIGSYS on invalid
syscall.

Reviewed by:	dchagin, markj
Discussed with:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41976
2023-10-03 01:30:52 +03:00
Konstantin Belousov 39024a8914 syscalls: fix missing SIGSYS for several ENOSYS errors
In particular, when the syscall number is too large, or when syscall is
dynamic.  For that, add nosys_sysent structure to pass fake sysent to
syscall top code.

Reviewed by:	dchagin, markj
Discussed with:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41976
2023-10-03 01:30:52 +03:00
Dmitry Chagin 28035f675b linux(4): Regen
MFC after:		1 week
2023-09-25 12:26:34 +03:00
Dmitry Chagin 0a16d3d14d linux(4): Update syscalls.master to 6.5
MFC after:		1 week
2023-09-25 12:24:58 +03:00
Andrew Turner 450f731b7f Add BTI exceptions
We could hit these when executing code marked as using BTI but jumps
to a non-branch target instruction.

Sponsored by:	Arm Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39450
2023-09-22 18:15:14 +01:00
Andrew Turner d61f9bfb0e arm64: Export HWCAP_CPUID
We have export the CPUID registers since 2018 but never set the
HWCAP_CPUID flag to tell userspace it could use them. Fix this by
setting it.

Sponsored by:	Arm Ltd
2023-09-22 18:15:14 +01:00
Emmanuel Vadot db34f02028 arm64: rockchip: rk_clk_composite: Remove gate code
It was a bad idea to have composite clock directly managing gates.
All clocks drivers have been rewrite to not use this functionality
and directly export the gate. We can now remove this code.
2023-09-21 17:49:33 +02:00
Emmanuel Vadot 829b06ad8f arm64: rockchip: rk3399_pmucru: Finish exporting all clocks
- All used clocks are now exported.
- Use the macros from rk_cru.h so code is similar to other rk clock drivers.
2023-09-21 17:49:33 +02:00
Emmanuel Vadot 5b7fe78032 arm64: rockchip: Remove CRU_GATE macro
It's unused now
2023-09-21 17:49:32 +02:00
Emmanuel Vadot 3d2ccc352d arm64: rockchip: rk3399_pmucru: Use GATE macro
It make it easier to read the code and the register number
2023-09-21 17:49:32 +02:00
Emmanuel Vadot 7c6c426f29 arm64: rockchip: rk3328_cru: Use GATE macro
It make it easier to read the code and the register number
2023-09-21 17:49:32 +02:00
Emmanuel Vadot 50a0f1ce28 arm64: rockchip: rk3568_cru: Rewrite
Rewrite correctly the clocks for cru :
- Export all clocks
- Use names from the TRM
- Respect clock topology

Fixes:  a48301a5e0 ("Add initial clocks support for Rockchip RK3568 SoC.")
2023-09-21 17:49:06 +02:00
Emmanuel Vadot 7b6ae431cf arm64: rockchip: rk3568_pmucru: Rewrite
Rewrite correctly the clocks for pmucru :
- Export all clocks
- Use names from the TRM
- Respect clock topology

Fixes:	a48301a5e0 ("Add initial clocks support for Rockchip RK3568 SoC.")
2023-09-21 17:49:04 +02:00
Emmanuel Vadot 8ae54db639 arm64: rockchip: clk: Define PLIST macro in rk_cru.h
We use it in all clock drivers so no need to define it everywhere
2023-09-21 17:49:02 +02:00
Andrew Turner 843bea1871 arm64: Move all BP hardening quirks later
Some quirks were missed due to the change being initially written on a
branch where they are all merged. Move all calls to
install_psci_bp_hardening until after device drivers have attached.

Sponsored by:	Arm Ltd
2023-09-21 10:32:55 +01:00
Andrew Turner c643e82dba arm64: Fix errata workarounds that depend on smccc
Some arm64 errata depend on calling into the firmware via the SMCCC
interface. This needs to happen after the psci driver has attached
as they share the interface.

Fix this by allowing the workarounds to mark when they depend on
device drivers attaching.

This is only an issue on CPU 0 as the workarounds are applied later
for the non-boot CPUs.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41916
2023-09-20 17:01:10 +01:00
Dmitry Chagin d0266fbab9 linux(4): Cleanup dummy syscall list on arm64
These syscalls do not exist on arm64 Linux.

MFC after:		1 week
2023-09-12 13:37:45 +03:00
Dmitry Chagin 027d727d40 linux(4): Cleanup includes under arm64
No functional changes.

MFC after:		1 week
2023-09-11 21:29:28 +03:00
Andrew Turner a35e47369f arm64: Add TCR register masks
These will be used by bhyve to implement page table walking.

Sponsored by:	Arm Ltd
2023-09-08 14:31:26 +01:00
Andrew Turner aea5405389 arm64: Fix the TCR_TBI0 macro to use UL
This needs to be 1UL to ensure the type is large enough for the shift.

Sponsored by:	Arm Ltd
2023-09-08 14:31:25 +01:00
Kyle Evans 602d360186 arm64: start defining a std.apple configuration
The M1 uses FDT, and has bge to start with.  Add a SOC_* option for
the first SoC we'll be supporting.

IOMMU is added commented out because it does have it, but IOMMU is not
well-tested on aarch64.  An initial version of the DART driver will be
upstreamed that just puts the DARTs that support bypass mode into bypass
mode -- we'll be missing some functionality, but we at least still end
up with some USB ports.

Reviewed by:	karels, manu
Input from:	jrtc27 (IOMMU)
Differential Revision:	https://reviews.freebsd.org/D39823
2023-09-08 00:53:51 -05:00
Andrew Turner 8f26d01f53 arm64: Fix the TCR_EPD0 definition
Sponsored by:	Arm Ltd
2023-09-06 18:32:49 +01:00
Andrew Turner 9e2cafe4fb arm64: Enable FEAT_E0PD when supported
FEAT_E0PD adds two fields to the tcr_el1 special register that, when
set, cause userspace access to either the top or bottom half of the
 address spaces without a page walk.

This can be used to stop userspace probing the kernel address space
as the CPU will raise an exception in the same time if the probed
address is in the TLB or not.

Reviewed by:	kevans
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41760
2023-09-06 18:32:49 +01:00
Dmitry Chagin 20845a6994 linux(4): Validate exec_setregs on arm64
The lr register is cleared at the beginning of the _dl_start and _start,
so there is no need to initialize it.
Gnu libc _start takes an rtld_fini pointer in x0 which is set by ld.so
for __libc_start_main, the kernel does not register any atexit pointers.

While here fix whitespaces.

MFC after:		1 week
2023-09-05 21:19:08 +03:00
Dmitry Chagin 2a1cf1b6b5 linux(4): Deduplicate mmap2
To help porting the Linux emulation layer to a new platforms start using
Linux names for conditional builds instead of architecture-specific ifdefs.

MFC after:		1 week
2023-09-05 21:16:39 +03:00
Dmitry Chagin 553b1a4e4e linux(4): Deduplicate mprotect, madvise
MFC after:		1 week
2023-09-05 21:15:52 +03:00
Mitchell Horne c190fb35f3 pmc: better distinguish pmu-events allocation path
Background:

The pm_ev field of struct pmc_op_pmcallocate and struct pmc
traditionally contains the index of the chosen event, corresponding to
the __PMC_EVENTS array in pmc_events.h. This is a static list of events,
maintained by FreeBSD.

In the usual case, libpmc translates the user supplied event name
(string) into the pm_ev index, which is passed as an argument to the
allocation syscall. On the kernel side, the allocation method for the
relevant hwpmc class translates the given index into the event code that
will be written to an event selection register.

In 2018, a new source of performance event definitions was introduced:
the pmu-events json files, which are maintained by the Linux kernel. The
result was better coverage for newer Intel processors with a reduced
maintenance burden for libpmc/hwpmc. Intel and AMD CPUs were
unconditionally switched to allocate events from pmu-events instead of
the traditional scheme (959826ca1b, 81eb4dcf9e).

Under the pmu-events scheme, the pm_ev field contains an index
corresponding to the selected event from the pmu-events table, something
which the kernel has no knowledge of. The configuration for the
performance counting registers is instead passed via class-dependent
fields (struct pmc_md_op_pmcallocate).

In 2021 I changed the allocation logic so that it would attempt to
pull from the pmu-events table first, and fall-back to the traditional
method (dfb4fb4116). Later, pmu-events support for arm64 and power8
CPUs was added (28dd6730a5 and b48a2770d4).

The problem that remains is that the pm_ev field is overloaded, without
a definitive way to determine whether the event allocation came from the
pmu-events table or FreeBSD's statically-defined PMC events. This
resulted in a recent fix, 21f7397a61.

Change:

To disambiguate these two supported but separate use-cases, add a new
flag, PMC_F_EV_PMU, to be set as part of the allocation, indicating that
the event index came from pmu-events.

This is useful in two ways:
 1. On the kernel side, we can validate the syscall arguments better.
    Some classes support only the traditional event scheme (e.g.
    hwpmc_armv7), while others support only the pmu-events method (e.g.
    hwpmc_core for Intel). We can now check for this. The hwpmc_arm64
    class supports both methods, so the new flag supersedes the existing
    MD flag, PM_MD_EVENT_RAW.

 2. The flag will be tracked in struct pmc for the duration of its
    lifetime, meaning it is communicated back to userspace. This allows
    libpmc to perform the reverse index-to-event-name translation
    without speculating about the meaning of the index value.

Adding the flag is a backwards-incompatible ABI change. We recently
bumped the major version of the hwpmc module, so this breakage is
acceptable.

Reviewed by:	jkoshy
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40753
2023-09-03 13:27:21 -07:00
Andrew Turner 5429e19421 gicv3: Add logging for when its_device_alloc fails
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41566
2023-09-01 10:56:42 +01:00
Andrew Turner 8b143276ae gicv3: Support indirect ITS tables
The GICv3 ITS device supports two options for device tables. Currently
we support a single table to hold all device IDs, however when the
device ID space grows large this can be too large for the GITS_BASER
register to describe.

To handle this case, and to reduce the memory needed when this space
is sparse support the second option, the indirect table. The indirect
table is a 2 level table where the first level contains the physical
address of the second with a valid bit. The second level is an ITS
page sized table where each entry is the original entry size.

As we don't need to allocate a second level table for devices IDs that
don't exist this can reduce the allocation size.

Reviewed by:	gallatin
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41555
2023-09-01 10:56:17 +01:00
Kyle Evans 03d104888c arm64: initialize pcb in the TBI/PAC/etc. fault case
After 2c10be9e06, we may jump to the bad_far label without `pcb` being
set, resulting in a follow-up fault as we may dereference it immediately
after the jump if td_intr_nesting_level == 0.  In this branch, it should
be safe to dereference `td` as we're not handling the special case
mentioned below of accessing it during promotion/demotion.

This seems to fix a null ptr deref I hit during my most recent pkgbase
build attempt on the Windows DevKit, though that was admittedly
encountered while we were on the way to a panic from an apparent
use-after-free in ZFS bits.

Reviewed by:	andrew, markj
Fixes:	2c10be9e06 ("arm64: Handle translation faults for thread [..]")
Differential Revision:	https://reviews.freebsd.org/D41677
2023-08-31 21:10:38 -05:00
John Baldwin d1e4c63d9e efirt_machdep.c: Trim some unused includes
Reviewed by:	imp, kib, markj
Differential Revision:	https://reviews.freebsd.org/D41596
2023-08-28 16:22:03 -07:00
Justin Hibbits 2a3716432d IfAPI: Retire if_etherbpfmtap() and if_bpfmtap()
Summary:
These came in the original DrvAPI commits in 2014, and are obsoleted by
bpf_mtap_if() and ether_bpf_mtap_if().  The `_if` suffix, rather than
prefix, conveys that it's operating on the bpf of the interface, instead
than the interface itself.

Reviewed by:	glebius
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D41146
2023-08-25 12:50:14 -04:00
Andrew Turner 7d2dd08d01 gicv3: Add checks for the device ID
Add checks that the device ID is supported by the hardware and is
within the range allocated when the driver attaches.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41554
2023-08-23 17:38:20 +01:00
Andrew Turner 629734783d gicv3: Add a verbose message for unknown tables
Add a message under bootverbose when we find a gicv3 its table type
that is unknown.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41553
2023-08-23 17:38:20 +01:00
Andrew Turner 2f11b2abfc gicv3: Stop setting the esize field
The GITS_BASER esize field is read-only, there is no need to change it.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41552
2023-08-23 17:38:20 +01:00
Andrew Turner 43d74fcac0 Revert "gicv3: Stop setting the esize field"
This reverts commit 47a4b8ca96.

It has the wrong differential review link
2023-08-23 17:38:20 +01:00
Andrew Turner b9cdb04f4e Revert "gicv3: Add a verbose message for unknown tables"
This reverts commit 7f9694ad7e.

It has the wrong differential review link
2023-08-23 17:38:20 +01:00
Andrew Turner 160919c864 Revert "gicv3: Add checks for the device ID"
This reverts commit 950421e231.

It has the wrong differential review link
2023-08-23 17:38:20 +01:00
Andrew Turner 950421e231 gicv3: Add checks for the device ID
Add checks that the device ID is supported by the hardware and is
within the range allocated when the driver attaches.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41551
2023-08-23 15:29:34 +01:00
Andrew Turner 7f9694ad7e gicv3: Add a verbose message for unknown tables
Add a message under bootverbose when we find a gicv3 its table type
that is unknown.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41551
2023-08-23 15:29:34 +01:00
Andrew Turner 47a4b8ca96 gicv3: Stop setting the esize field
The GITS_BASER esize field is read-only, there is no need to change it.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41551
2023-08-23 15:29:34 +01:00
Andrew Turner 3fc4f7c880 gicv3: Split out finding the page size
When adding indirect (2 level) tabled we will need to know the page
size to calculate the size of the level 1 table. To allow for this find
the page size before entering the loop to calculate the final register
value.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41551
2023-08-23 15:29:34 +01:00
Konstantin Belousov 74ccb8ecf6 Add cpu_sync_core()
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32360
2023-08-23 03:02:21 +03:00
Konstantin Belousov 8882b7852a add pmap_active_cpus()
For amd64, i386, arm, and riscv, i.e. all architectures except arm64,
the custom implementation is provided since we maintain the bitmask of
active CPUs anyway.

Arm64 uses somewhat naive iteration over CPUs and match current vmspace'
pmap with the argument. It is not guaranteed that vmspace->pmap is the
same as the active pmap, but the inaccuracy should be toleratable.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32360
2023-08-23 03:02:21 +03:00
Dmitry Chagin 1f9d71ee32 Regen for writev syscall 2023-08-20 10:36:31 +03:00
Dmitry Chagin aad4b799f7 linux(4): Add a writev syscall wrapper
Adding a writev syscall wrapper is needed due to Linux family of write
syscalls doesn't distinguish between in kernel blocking operations
and always returns EAGAIN while FreeBSD can return ENOBUFS.

MFC after:		1 month
2023-08-20 10:36:30 +03:00
Dmitry Chagin e58ff66464 linux(4): Add a write syscall wrapper
Adding a write syscall wrapper is needed due to Linux family of write
syscalls doesn't distinguish between in kernel blocking operations
and always returns EAGAIN while FreeBSD can return ENOBUFS.

MFC after:		1 month
2023-08-20 10:36:29 +03:00
Dmitry Chagin 89d270b28d Regen for write syscall 2023-08-20 10:36:29 +03:00
Dmitry Chagin 510f5c88f0 linux(4): Modify write syscall to match Linux
Adding a write syscall wrapper is needed due to Linux family of write
syscalls doesn't distinguish between in kernel blocking operations
and always returns EAGAIN while FreeBSD can return ENOBUFS.

MFC after:		1 month
2023-08-20 10:36:28 +03:00
Dmitry Salychev 2a9021898c
sff: Add SFP driver (fdt-based draft)
This basic version of the driver obtains properties of the "sff,sfp"
compatible devices and implements a simple interface to provide an I2C
bus device for the rest of the drivers (e.g. to implement SIOCGI2C).

Both of the interface and driver are subjects for a further
generalization to be used in case of non-FDT and non-arm64 platforms.

Reviewed by:		bz, manu
Approved by:		bz (mentor)
MFC after:		3 weeks
Differential Revision:	https://reviews.freebsd.org/D41440
2023-08-18 12:40:11 +02:00
Dmitry Chagin 3460fab5fc linux(4): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743 2023-08-18 13:12:02 +03:00
John Baldwin 91d0876a20 arm64 makectx: Fix overflow of tf_x array
PCB_LR isn't stored in tf_x, so trying to store it as pcb_x[PCB_LR] =
tf->tf_x[PCB_LR + PCB_X_START] overflowed the tf_x array.

Reported by:	Morello (bounds check crash)
Reviewed by:	jrtc27, andrew, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41485
2023-08-17 15:26:16 -07:00
Dmitry Chagin 270e01d468 linux(4): Fix leftovers after 2ff63af9 2023-08-17 23:54:00 +03:00
John Baldwin 638c68897f arm64 db_trace: Ensure trapframe pointer is suitably aligned.
Reviewed by:	jrtc27, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41486
2023-08-17 11:32:32 -07:00
Andrew Turner 02f2706606 Add a virtio-gpu 2D driver
Add a driver to connect vt to the VirtIO GPU device in 2D mode. This
provides a output on the display when a qemu virtio gpu device is
added, e.g. with -device virtio-gpu-pci.

Tested on qemu using UTM, and a Hetzner arm64 VM instance.

Reviewed by:	bryanv (earlier version)
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40094
2023-08-17 12:26:57 +01:00
Warner Losh 78d146160d sys: Remove $FreeBSD$: one-line bare tag
Remove /^\s*\$FreeBSD\$$\n/
2023-08-16 11:55:17 -06:00
Warner Losh 031beb4e23 sys: Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:58 -06:00
Warner Losh 685dc743dc sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:36 -06:00
Warner Losh 71625ec9ad sys: Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:24 -06:00
Warner Losh 2ff63af9b8 sys: Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:18 -06:00
Warner Losh 95ee2897e9 sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:11 -06:00
Ed Maste e0c6e89108 arm64: increase MAXCPU to 1024, following amd64
As in commit 9051987e40 for amd64, support up to 1024 CPU cores.
arm64 hardware with more than 256 CPU cores is currently available and
will become increasingly common over FreeBSD 14's lifetime.

PR:		269572
Reviewed by:	andrew
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41319
2023-08-15 08:22:02 -04:00
Andrew Turner 9d09051e26 arm64: Add a driver for the Arm PL031 RTC
It is a simple RTC found in some Arm SoCs, e.g. the Arm Juno.

Reviewed by:	manu
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41267
2023-08-15 13:13:39 +01:00
Bjoern A. Zeeb bfed2417f4 qcom: fix panic in qcom_mdio_ipq4018 implementation
Fix a boot-time panic in qcom_mdio_ipq4018 due to a missing bus function
and hook the file up to the build so that it will not rot away.

Test booted on an ipq807x in 2022.
X-Differential Revision: extracted from D37882
2023-08-11 02:12:55 +00:00
Emmanuel Vadot 393387820b arm64: rockchip: rk_i2c: Probe again at ORDER_LATE
The gic driver is also probed at this pass and depending on the order of
the nodes in the dts rk_i2c can be probed first and will fail, this is the
case for the rk3328 SoC.
The PMIC drivers are also probed at this pass but on the iicbus which is created
in rk_i2c so there is no order conflict here.

Fixes:		ddefad7c4f ("arm64: rockchip: Tweak i2c, pmic and iodomain order")
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-08-09 10:50:04 +02:00
Emmanuel Vadot ddefad7c4f arm64: rockchip: Tweak i2c, pmic and iodomain order
We need i2c first to set it to MIDDLE, then we need one of the pmics
so set them to LATE, only then we can attach iodomain which needs some
regulators exposed by the pmic so set it to LAST.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-08-08 15:58:26 +02:00
Emmanuel Vadot 4b5f5fe78f arm64: intel: Remove firmware driver
This is now covered by ofw_firmware.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37613
2023-08-08 15:13:33 +02:00
Dmitry Chagin b5c0b9555d linux(4): Regen for ioprio syscalls
MFC after:		1 month
2023-08-04 16:03:57 +03:00
Dmitry Chagin 1c83154e49 linux(4): Modify ioprio syscalls to match Linux
MFC after:		1 month
2023-08-04 16:03:55 +03:00
Gordon Bergling f0ab805200 arm64-iommu: Fix a typo in a kernel message
- s/endianess/endianness/

MFC after:	5 days
2023-08-04 13:52:36 +02:00
Andrew Turner a2afd7b818 Remove MAXCPUS from the gicv3 driver
We create a static array of pointers to per-CPU data. Because the cpuid
space on arm64 is not sparse there is no need to add an extra level of
indirection. Move to use mallocarray to allocate the redistributors as
a single array.

Sponsored by:	Arm Ltd
2023-08-04 10:50:09 +01:00
Andrew Turner 4350a03fef arm64: Make dpcpu static
We don't use this directly outside this file so it can be static.

Sponsored by:	Arm Ltd
2023-08-04 10:50:09 +01:00
Andrew Turner f12952eaee arm64: Comment out some ID registers
Older toolchains don't support reading these registers. Until a fix is
added comment them out.

Reported by:	jhb
Sponsored by:	Arm Ltd
2023-08-03 19:13:17 +01:00
Kristof Provost 6736511623 arm64: enable kern.conftxt
Match other platforms, include the kernel config in the build.

Reviewed by:	emaste
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D41284
2023-08-02 10:51:44 +02:00
Mark Johnston dd24d475d5 arm64: Add constants for decoding ISS fields for WF* exceptions
WFI and WFIT trap to EL2 when executed in a vmm guest.  (Currently
WFE/WFET are not configured to trap.)  We only handle WFI at the moment,
so these constants are useful when handling the exception.

Reviewed by:	andrew
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D41199
2023-07-28 09:34:38 -04:00
Andrew Turner 53e1af5a10 arm64: Decode the ID_AA64PFR2_EL1 register
No fields have been defined, but it has been documented in the
Architecture Reference Manual.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40897
2023-07-28 12:53:02 +01:00
Andrew Turner 8c111e5b37 arm64: Update the ID_AA64PFR1_EL1 fields
While here move to decimal for the _op and _CR definitions to be used
by a future macro to define the register when the assembler doesn't
know about it.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40896
2023-07-28 12:53:02 +01:00
Andrew Turner 0766dde9b5 arm64: Update the ID_AA64PFR0_EL1 fields
While here move to decimal for the _op and _CR definitions to be used
by a future macro to define the register when the assembler doesn't
know about it.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40895
2023-07-28 12:53:02 +01:00
Andrew Turner 22235b631b arm64: Decode the ID_AA64MMFR4_EL1 register
No fields have been defined, but it has been documented in the
Architecture Reference Manual.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40894
2023-07-28 12:53:02 +01:00
Andrew Turner c65679143f arm64: Decode the ID_AA64MMFR3_EL1 register
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40893
2023-07-28 12:53:02 +01:00
Andrew Turner 2134cfe793 arm64: Don't use hex for ID_AA64MMFR2_EL1_op/CR*
It breaks a future macro that creates the alternative register name
for old compilers.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40892
2023-07-28 12:53:02 +01:00
Andrew Turner 284f91de8b arm64: Update the ID_AA64MMFR1_EL1 fields
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40891
2023-07-28 12:53:01 +01:00
Andrew Turner b21402d058 arm64: Update the ID_AA64MMFR0_EL1 fields
While here move to decimal for the _op and _CR definitions to be used
by a future macro to define the register when the assembler doesn't
know about it.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40890
2023-07-28 12:53:01 +01:00
Andrew Turner de01309926 arm64: Update the ID_AA64ISAR1_EL1 fields
While here move to decimal for the _op and _CR definitions to be used
by a future macro to define the register when the assembler doesn't
know about it.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40889
2023-07-28 12:53:01 +01:00
Andrew Turner 4182f58172 arm64: Update the ID_AA64ISAR0_EL1 fields
While here move to decimal for the _op and _CR definitions to be used
by a future macro to define the register when the assembler doesn't
know about it.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40888
2023-07-28 12:53:01 +01:00
Andrew Turner 6fd44e5f53 arm64: Update the ID_AA64DFR0_EL1 fields
While here move to decimal for the _op and _CR definitions to be used
by a future macro to define the register when the assembler doesn't
know about it.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40887
2023-07-28 12:53:01 +01:00
Mark Johnston 1083a8cd85 pcpu: Remove unused definitions of ALT_STACK_SIZE
This was added originally for the sparc64 port and apparently copied to
other platforms.  No functional change intended.

MFC after:	1 week
2023-07-27 16:02:03 -04:00