It is hard to reason about the contents of 'ifr' at any given time
as nearly every function sets random fields or pointers in this
structure.
Use local on-stack clean 'struct ifreq' for each function instead.
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40534
MFC after: 2 weeks
Replace several sequential searches for a segment that contains a
phyiscal address with a call to a function that does it by binary
search. In vm_page_reclaim_contig_domain_ext, find the first segment
to reclaim from, and reclaim from each subsequent appropriate segment.
Eliminate vm_phys_scan_contig.
Reviewed by: alc, markj
Differential Revision: https://reviews.freebsd.org/D40058
Add a basic emulation for the command and response buffer interface of
TPM devices. This commit only implements some CRB register and resets
them.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40456
At the moment, the emulation only opens a file descriptor to the TPM
device. Some subsequent commits will read and write from it.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40455
This struct will be used to implement various TPM emulations like a TPM
passthrough or a virtual TPM.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40454
The TPM version config node should always be set. If it's not set,
there's a bug in our code. An assertion is the correct way to check for
this.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40558
Don't allow access to the physical ASLS register. It contains a host
address which is meaningless for the guest. Additionally, it allows the
guest to safely rewrite this register.
This is the last commit required for GVT-d. Nevertheless, it might not
work due to missing firmware support.
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D26209
This makes the OpRegion accessible by the guest. However, the guest
doesn't know the address of the OpRegion. This will be fixed by an
upcoming commit.
The range of the OpRegion is added to the e820 table. This allows the
guest firmware to easily pick up this range and to reserve it properly.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40041
The OpRegion provides some configuration bits and ACPI methods used by
some Intel drivers. The guest needs access to it. In the first step,
we're reading it's address and size.
Reviewed by: jhb
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40040
This register contains a host physical address. This address is
meaningless for the guest. We have to emulate it and set it to a valid
guest physical address.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40060
The graphics stolen memory is only GPU accessible. So, we don't have to
copy any data to it as the guest will be unable to access it anyway. We
just have to allocate and reserve some memory. That's done by adding an
E820 entry for the graphics stolen memory. The guest firmware will pick
up the E820 and reserve this range.
Note that we try to reuse the host address as Intel states that newer
Tiger Lake platforms need this [1].
[1]
e28d6fbfdf/devicemodel/hw/pci/passthrough.c (L626-L629)
Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40059
This is the first step to emulate the graphics stolen memory register.
Note that the graphics stolen memory is somehow confusing. On the one
hand the Intel Open Source HD Graphics Programmers' Reference Manual
states that it's only GPU accessible. As the CPU can't access the area,
the guest shouldn't need it. On the other hand, the Intel GOP driver
refuses to work properly, if it's not set to a proper address.
Intel itself maps it into the guest by EPT [1]. At the moment, we're not
aware of any situation where this EPT mapping is required, so we don't
do it yet.
Intel also states that the Windows driver for Tiger Lake reads the
address of the graphics stolen memory [2]. As the GVT-d code doesn't
support Tiger Lake in its first implementation, we can't check how it
behaves. We should keep an eye on it.
[1]
e28d6fbfdf/devicemodel/hw/pci/passthrough.c (L655-L657)
[2]
e28d6fbfdf/devicemodel/hw/pci/passthrough.c (L626-L629)
Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40039
Don't emulate anything yet. Just check if the user would like to pass an
Intel GPU to the guest.
Reviewed by: jhb, markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40038
It doesn't seem particularly useful to have it enabled by default, and
it spits several dozen lines into the dmesg on a test system.
Reviewed by: andrew
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40499
This appears to have been reserved for some kind of debug hook, but it's
not implemented and appears never to have been used.
Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40555
Use unprivileged loads to access user memory. Without this, the
accesses trap and various dtrace actions such as ustack() fail.
Reviewed by: andrew
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40540
It was used in one place and was added specifically to support dtrace
stack unwinding code. Write an equivalent expression using struct
unwind_state instead. No functional change intended.
Reviewed by: andrew
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40538
At least one downstream (CheriBSD) overrides -march here. Instead of
hard-coding the target, simply append the crypto extension to whatever's
already there.
No functional change intended.
Reviewed by: imp, andrew
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40537
The Emulex OneConnect NIC driver hasn't seen any commits other than ioctl
bug fixes (some severe) and sweeping commits since 2016. There is no
indication of new parts since 2014 or earlier. As such, deprecate the
driver with the aim of removing it prior to FreeBSD 15.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40531
Replace direct stores to userspace addresses (never safe and broken on
modern CPUs) with a copyout. Use a static assert on the size to ensure
we don't overflow the field.
Reviewed by: markj, jhb
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D40519
The mpi3mr driver is written by Broadcom for the 9600 Series 24G PCIe
4.0 Tri-Mode RAID Adapters and eHBAs boards. This is 3rd-Generation
Tri-Mode x8 and x16 NVMe/SAS/SATA (although Broadcom/Avago did muddy the
waters by having multiple 2nd generations cards and referring to them
inconsistently).
Sponsored by: Netflix
This is Broadcom's mpi3mr driver for FreeBSD version 8.6.0.2.0.
The mpi3mr driver supports Broadcom SAS4116-based cards in the 9600
series: 9670W-16i, 9670-24i, 9660-16i, 9620-16i, 9600-24i, 9600-16i,
9600W-16e, 9600-16e, 9600-8i8e.
Initially only available as a module and on amd64/arm64, since that's
how it has been tested to date. Future commits will add it to the kernel
build and may expand the architectures it is supported on.
Co-authored-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Feedback-by: ken (prior versions)
Reviewed-by: imp
RelNotes: yes
Differential-Revision: https://reviews.freebsd.org/D36771
Differential-Revision: https://reviews.freebsd.org/D36772
A char array has an implicit NUL terminating it, which sizeof will
include, so we need to subtract 1 here. Printing a NUL can cause issues
for things like CI environments that aren't expecting it, especially
with recent Jenkins being stricter about not putting NUL in XML files.
Fixes: 3d222369ac ("Add a small tool, resizewin(1), to query terminal for window size")
MFC after: 1 week
In EC2, UEFI boots faster than BIOS, but not all amd64 instance types
support UEFI. AMIs need to have their boot mode designated, which
created a dilemma: Faster boots, or wider compatibility?
The recently added "uefi-preferred" option solves this: AMIs can be
marked to use UEFI where it's available, but fall back to BIOS on
instance types which do not support UEFI.
This uses bsdec2-image-upload 1.4.6, which recently landed in the
ports tree.
PR: 265697
Reviewed by: delphij, imp
MFC after: 1 week
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D40470
Use a goto to clarify the control flow when there is no process
descriptor. This wins back a level of indentation.
No functional change intended.
Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40518
Split out the functional logic from the syscall handler into a helper
function. This keeps it separate from the syscall control-flow logic,
resulting in better readability overall. It also wins back a level of
indentation.
Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40294
Split out the functional logic from the syscall handler into a helper
function. This keeps it separate from the syscall control-flow logic,
resulting in better readability overall. It also wins back a level of
indentation.
Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40293
Split out the large chunk of functional logic from the syscall handler
into a helper function. This keeps it separate from the syscall
control-flow logic, resulting in better readability overall. It also
wins back a level of indentation.
Flip the return values of the pmc_can_allocate_row() and
pmc_can_allocate_rowindex() functions to boolean types, like their
naming implies. We weren't actually using the error codes they were
returning.
While here, make some small style cleanups. No functional change
intended.
Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40292
Begin splitting out the large chunks of functional logic from the
syscall handler into separate helper functions. This keeps it separate
from the syscall control-flow logic, resulting in better readability
overall. It also wins back a level of indentation.
For this and the similar changes to follow, try to keep copyin() and
copyout() calls outside of the helper functions. The changes are
intended to have no functional impact, but do address style issues.
Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40291
Move the functionality into a separate helper function. All other
actions in pmc_hook_handler() already have this.
While here make some small style improvements. Restructure one for loop.
Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40333
Everything else I found worthy of adjustment.
- Order local variable declarations per style(9)
- Make use of __unused annotations rather than cast to void
- Remove unnecessary casts
- Add (void) casts to PMC class methods where the return value is
ignored
- A couple instances of reordering statements for clarity
- Prefer bool type where applicable
- unsigned int -> u_int
- Use uintmax_t/%j in printf calls
- Formatting of comments
Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40517
- Explicitly check the value in conditional statements, per style(9)
- Add braces around more loops and conditionals, wherever it appears
(to me) to aid legibility
- Expand some assignments within if statements
- Fix formatting around list-type FOREACH macros
Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40515
Handle a few things related to spacing:
- Remove redundant/superfluous blank lines (and add a couple where
helpful)
- Add spacing around binary operators
- Remove spacing after casts and before goto labels
- Adjustments for line width of 80 chars
- Tab/space character issues
Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40514
For variables which are only used in PMCDBG* macros.
Reviewed by: jkoshy, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40288