Cherry-pick commit 0b76c0a from ACPICA (actypes: Distinguish between
D3hot/cold, and default `ACPI_STATE_D3` to D3cold).
The same distinction is made between `PCI_POWERSTATE_D3_HOT` and
`PCI_POWERSTATE_D3_COLD`, as they're defined by ACPI (and are asserted
to be the same).
D3cold is essentially the same as D3hot except the power resources are
turned off. Add support for D3cold to `acpi_pwr_switch_consumer`.
`acpi_d_state_to_str` replaces the `printf("D%d", d_state)` pattern,
allowing for "D3hot" and "D3cold" strings to be printed instead of just
"D3".
Reviewed by: markj, ziaee, mckusick (mentor)
Approved by: markj, mckusick (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48384
This is similar to changes done in other CAM drivers and fixes a panic
because of a sanity check added in b4b166b8c4.
While here, remove unneeded ccb setup in sdiobdiscover.
It's possible that ccb allocation in that function is not needed as
well, but I wasn't sure about that.
MFC after: 1 week
It is not clear how commit ded037e65e could reasonably change BAR
indices, and doing so broke at least the C3000 driver. Revert that part
of the change.
Reported by: kp
Reviewed by: kp, Haresh Sankar Raj <hareshx.sankar.raj@intel.com>
MFC after: 3 days
Fixes: ded037e65e ("qat: driver updates to improve code and fix bugs")
Differential Revision: https://reviews.freebsd.org/D51664
Reformat if_eqos.c to make it easier to follow and closer to style(9).
No functional changes.
Reviewed by: fuz@
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D51693
This patch adds support for the cvitek flavor of the DWC ethernet
controller. This controller is present on the Milk-V riscv SoCs.
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D48530
dwc_attach will currently fail if clk_set_assigned fails, even if the
"assigned_clock" property was not specified. Since there are platforms
whose DTS files do not have this property (e.g. if_dwc_aw,
if_dwc_socfpga), do not return an error if clk_set_assigned
returns ENOENT.
Reviewed by: manu
Differential review: https://reviews.freebsd.org/D48529
This patch add support for cvitek SDHCI controller (only SD card mode).
This controller is present on Milk-V's riscv SoCs.
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D48528
In general sprinkle locking assertions and harmonized KASSERTs
throughout the upper part of the driver to document expectations.
In dwmmc_cmd_done() "cmd" should be set correctly and be used for
both MMCCAM and classic mmc rather than special-casing mmccam.
In dwmmc_next_operation() place variable declarations on the top
for both cases before the first debug and lock assertion calls;
then factor out common parts at the end and put both cases in the
same order.
By calling dwmmc_next_operation() directly from both dwmmc_request()
in the mmc case, and dwmmc_cam_request() in the mmccase (rather than)
chaining calls in the latter, we avoid unlocking the sc in the mmccam
case and have a consistent call path from both; also removing the
mmccam #ifdef from dwmmc_request() brings more clarity.
In dwmmc_next_operation() enhance the panic/error messages with
some extra information and assert that we come in with a cam pinfo
on CAM_ACTIVE_INDEX.
MFC after: 3 days
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D51628
Certain SR-IOV devices enumerate Virtual Functions (VFs) on a different
PCIe bus than their parent Physical Function (PF). In such cases, the
default subordinate bus range assigned by BIOS may be insufficient to cover
all VFs.
This patch dynamically expands the subordinate bus range by:
- Allocating additional bus numbers using bus_alloc_resource() when VFs are
initialized
- Releasing the reserved bus range during VF deletion via
bus_release_resource()
Reviewed by: jhb
Read IIC-HID reports as a single I²C transaction, instead of reading
first the two byte length field, holding the bus, and then the rest
of the report in a separate transaction.
While technically legal, I²C bus split transactions are not universally
supported, and in particular the "Snapdragon Elite" ARM CPU does
not seem to support them.
It is also not obvious that they are beneficial in this case, given
the overhead of controller setup, interrupts and tear-down.
Reviewed by: wulf
Differential Revision: https://reviews.freebsd.org/D51302
This moves the checks previously under #ifdef STRICT in
nvmf_nqn_valid() into a separate helper for userland. This
requires that the NQN starts with "nqn.YYYY-MM." followed by at
least one additional character.
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D48767
This change adds the necessary kernelspace bits required for
supporting NUMA domains in bhyve VMs.
The layout of system memory segments and how they're created has
been reworked. Each guest NUMA domain will now have its own memory
segment. Furthermore, this change allows users to tweak the domain's
backing vm_object domainset(9) policy.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44565
Read and dump the SMU's idlemask value in `dev.amdsmu.0.idlemask`
sysctl.
The idlemask is used internally by AMD and its value is not documented
anywhere. This patch exposes it mainly to help AMD diagnose issues with
S0i3 entry on FreeBSD.
Reviewed by: cem, emaste, kib, mckusick (mentor)
Approved by: emaste, kib, mckusick (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51487
Get "log" address with the `SMU_MSG_LOG_GETDRAM_ADDR_HI/LO` SMU
commands. From this, we dump & read metrics about residency in various
sleep states (none, S0i2, and S0i3), as well as active durations for
the IP blocks on the CPU during the last sleep. All these metrics are
exposed under the `dev.amdsmu.0.metrics` node.
This is useful for debugging sleep as the residency registers in the
`_LPI` object are not populated on some systems (e.g. AMD Phoenix).
A `dev.amdsmu.0.ip_blocks.XXX` node is also created for each IP block,
with children for the current active state and time spent active during
the last sleep.
Differential Revision: https://reviews.freebsd.org/D48714
Reviewed by: cem, kib, mckusick
Approved by: kib, mckusick
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48714
Start work on a driver for the AMD SMU (system management unit), which
will eventually be used for getting S0ix statistics (e.g. how long the
CPU has spent in the deepest - S0i3 - sleep state during the last
sleep) as well as letting PMFW (power management firmware, running on
the SMU) know when we intend to enter and exit sleep. It is what's
responsible for actually turning off the VDD line to the CPU.
With this commit, amdsmu is just able to get the SMU's firmware version
on AMD Rembrandt, Phoenix, and Strix Point CPUs.
This is the equivalent to amd-pmc on Linux.
Reviewed by: cem, kib, mckusick
Approved by: kib, mckusick
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48683
Follow unix(4) commit 51ac5ee0d5 and retire M_BLOCKED for TCP sockets as
well. The M_BLOCKED flag was introduced back 2016 together with non-
blocking sendfile(2). It marked mbufs in a sending socket buffer that
could be ready to sent, but are sitting behind an M_NOTREADY mbuf(s), that
blocks them.
You may consider this flag as an INVARIANT flag that helped to ensure
socket buffer consistency. Or maybe the socket code was so convoluted
back then, that it was unclear if sbfree() may be called on an mbuf that
is in the middle of the buffer, and I decided to introduce the flag to
protect against that. With today state of socket buffer code it became
clear that the latter cannot happen. And this commit adds an assertion
proving that.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D50728
Walk through the disk driver entries chained off of INT13.
MEMDISK is part of the Syslinux project; it loads disk images into
memory, sets an int 13h hook and then does a BIOS boot from the image;
this can be used as part of a PXE boot environment to load installer
disks, however the disks are not accessible from inside the FreeBSD
kernel because it doesn't access disks through BIOS APIs.
This patch detects the disk images in the loader, and passes their
address and length as a driver hint. When the md driver sees the hint,
it maps the image, and presents it to the system.
(rebased and reworked from https://reviews.freebsd.org/D27349)
Feedback from: kib, bapt, olce
Differential Revision: https://reviews.freebsd.org/D45404
The EFI_PROPERTIES_TABLE has been deprecated in the UEFI specification.
It is now replaced by the EFI_MEMORY_ATTRIBUTES_TABLE, which provides
a new header and data format for describing memory region attributes.
Reviewed by: imp
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49998
The hardware can count statistics and the driver has already retrieved
them via qlnx_get_counter().
Advertise the IFCAP_HWSTATS capability to avoid the net stack from
double counting IFCOUNTER_IBYTES.
Reviewed by: kbowling
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D51451
The following up advertising of IFCAP_HWCSUM capability unconditionally
overwrite IFCAP_LINKSTATE.
Reviewed by: kbowling
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D51450
Move the AER processing into the taskqueue thread. We do memory
allocations and such burried deep in things we call, so this just makes
all that simpler and doesn't stall the completion thread. It fixes a few
panics if you get a reliability failure from the drive at the wrong
time.
Sponsored by: Netflix
MFC After: 2 weeks
Remove the failed request queue, it's been unused since bc85cd303c
when we removed the last function that referenced it. Also adjust
the comment for the reset taskqueue. We still start 2 threads.
Sponsored by: Netflix
Follow interrupt-map properties until either an interrupt controller or
invalid node is found. In the former case return the translated details
for the interrupt controller driver to decode. In the latter case return
0 as an error.
Tested on the Arm DTS files that use interrupt-maps and with a
userspace test.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51257
RANDOM_CACHED is overloaded to refer both to entropy obtained from files
loaded by the boot loader, and entropy obtained via writes to
/dev/random. Introduce a new source, RANDOM_RANDOMDEV, to refer to the
latter. This is to enable treating RANDOM_CACHED as a special case in
the NIST health test implementation.
Update the default harvest_mask in rc.conf to include RANDOM_RANDOMDEV,
preserving the old behaviour of accepting writes to /dev/random.
Bump __FreeBSD_version for modules which register a pure source, since
all of their values have now shifted.
Reviewed by: cem
MFC after: 3 months
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51155
This patch implements the noise source health tests described in chapter
four of NIST SP 800-90B[1]. The repetition count test and adaptive
proportion test both help identify cases where a noise source is stuck
and generating the same output too frequently. The tests are disabled
by default, but making an implementation available may help implementors
conform to FIPS validation requirements. This implementation aims to
comply with the requirements listed in section 4.3 of the document.
To enable health testing, set the kern.random.nist_healthtest_enabled
tunable to 1. Startup testing is implemented as specified in the
document: the first 1024 samples from a source are evaluated according
to the two tests, and they are discarded. The RANDOM_CACHED and
RANDOM_PURE_VMGENID sources are excluded from testing, as they are
effectively a one-time source of entropy, and statistical testing
doesn't seem to provide much use.
Since the first 1024 samples from entropy sources are discarded by the
implementation, it is possible that we might end up with insufficient
entropy during early boot if no boot-time entropy source (i.e.,
/entropy) is provided. If this is a problem, it could be remediated by
modifying the implementation to poll applicable sources (e.g., RDRAND)
to complete startup testing quickly, rather than relying on the random
kthread.
The entry point for the tests is random_harvest_healthtest(), intended
to be called from individual CSPRNG implementations in order to leverage
their locking context, e.g., the entropy pool lock in Fortuna. The
Fortuna implementation is modified to call this entry point, mainly to
demonstrate how the health tests can be integrated.
The tests operate on the entropy buffer plus the embedded timestamp,
treating them as a single value. We could alternately apply the tests
to the buffer and timestamp separately.
The main parameters for the tests themselves are H, the expected
min-entropy of samples, and alpha, the desired false positive error
rate. This implementation selects H=1 and alpha=2^{-34}; since each
sample includes a CPU cycle counter value, it seems reasonable to expect
at least one bit of entropy from among the low bits of the
high-frequency counter present on systems where FreeBSD is commonly
deployed, and the false positive rate was somewhat arbitrarily selected;
for more details see the comment in random_healthtest_init().
When a health test fails, a message is printed to the console and the
source is disabled. On-demand testing is also supported via the
kern.random.nist_healthtest_ondemand sysctl. This can be used be an
administrator to re-enable a disabled source, following the same startup
testing mentioned above.
[1] https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90B.pdf
Reviewed by: cem
MFC after: 3 months
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51154
MAC address assigned to a Virtual Function using iovctl configuration
was not passed to the VF, but its presence caused ICE to reject random
address generated by the VF. This lead to VF not being able to send
or recieve traffic. Send the administratively assigned MAC address to
a VF in a response to the 'Get VF Resources' virtual channel command.
While at that replace bcopy with memcpy for consistency, and shorten
an over 80 characters line.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
Adds two new parameters to iovctl config for VLAN filter limits and MAC
filter limits and gives them defaults of 64 and 16, respectively.
These are intended to limit the number of resources that a VF can
consume so that any one VF cannot starve an other VFs or the PF of
filters.
Signed-off-by: Eric Joyner <eric.joyner@intel.com>
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
Let VF driver know that HW supports WB_ON_ITR
feature. It allows polling mode driver such
as DPDK to configure an immediate write-back
of completed descriptors.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
Remove existing RSS HENA configuration to make sure that
only config requested by VF is applied and allow VFs to
disable RSS completely.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
On receiving a virtual channel request from VF driver tried
to configure and enable Tx and Rx queues without making
sure that they were disabled. It caused issue with reloading
a VF driver without a reset e.g. in case it crashed.
Fix that by always disabling all Rx and Tx queues.
While at that make sure that only queues requested by VF
driver are enabled. VF driver may use less queues than
assigned to the function when it was created.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
PF driver needs to tear down and setup VF configuration after
a reset event, e.g. due to reloading a VF driver. Re-use
ice_reset_vf function for that by adding new parameter,
which decides if new reset has to be triggered.
This most likely does not cover all necessary steps
and will be extended in future commits.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
VF driver may request to configure MSI-X vectors for less
queues than assigned by PF. Don't try to configure
unassigned vectors to avoid panic.
While at that make the loop process whole array of vectors
received in a VIRTCHNL_OP_CFG_IRQ_MAP message from a VF.
It's not guarantied that vector '0', which is used for other
interrupt causes and is not mapped to a queue, will be always
on the last position. Condition inside the loop already
handles that vector correctly.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
Filter for unicast MAC address is configured
with a virtual channel message, but filter for
a broadcast traffic was missing. It caused
issues with e.g. ARP.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
The error -1 is actually ERESTART in the context of syscall. It is for
kernel mode only and will not be passed to user mode. When the kernel
sees this error it will restart the syscall.
When the the SFP module data is not available, e.g. the SFP module is
not present, the ioctl handler returns ERESTART and kernel will retry
infinitely, hence the userland `ifconfig -v ql0` will hang forever until
get interrupted. That is apparently wrong.
Fix that by returning error ENODEV to indicate the SFP module data is
not available.
As for the case that ecore_ptt_acquire() fails, it appears to be quite
safe to restart, so keep returning ERESTART.
Reported by: Steve Wheeler
See also: https://redmine.pfsense.org/issues/16248
Reviewed by: kbowling
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D51351
Unmap the IRQ instead of just freeing the map data in the case of an
error. Also don't overwrite the resource's virtual address since the
copy of the map data made by intr_activate_irq is stored there.
Implement gpiobus_release_resource so it can unmap IRQs mapped by
gpio_alloc_intr_resource.
Reviewed by: imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D51325
The TLS RX context had the tcp sequence number of next TLS record set
in resync_tcp_sn parameter instead of in next_record_tcp_sn parameter
during hardware initialization. This prevent the hardware from
synchronizing with the TLS stream, and caused TLS offload to remain
inactive. Set next_record_tcp_sn to the next TCP sequence number and
resync_tcp_sn to zero to enable proper TLS record boundary detection
and activate hardware offload.
Reviewed by: kib, slavash
Sponsored by: NVidia networking
MFC after: 1 week
The ufshci driver tried to allocate a single 256KB segment for the UTP
command descriptor during boot, but failed due to memory fragmentation.
I fixed it to allocate the buffer in 8KB segments instead.
Sponsored by: Samsung Electronics
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D50933
We've done the same in the past to the vnconfig.8->mdconfig.8 link in:
eb5f456981 Remove ancient vnconfig symlink
Reviewed by: bcr, markj, ziaee
Approved by: markj (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27122
Checking for __LP64__ is non-portable as it assumes that ILP32 and LP64
are the only two ABIs that exist, but CheriBSD supports an additional
ABI where long is still 64-bit but pointers are 128-bit capabilities,
and thus __LP64__ is not defined. We could change this to check the
value of __SIZEOF_LONG__, since the code here only cares about that
aspect of the ABI, however in this instance, the only real reason an
ifdef is used at all is to be able to get log2(sizeof(u_long)), but if
we instead multiply and divide rather than shift, and let the compiler
optimise that to a shift, we can just use sizeof(u_long) instead. Note
also that VMBUS_EVTFLAGS_MAX could always just have been defined as
VMBUS_EVTFLAGS_SIZE / sizeof(u_long).
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D50630
Upon collecting tls information, kernel calls driver to get driver/hw
tls state. Driver calls hw to get its tracking and authentication
states, and dump them into the driver state buffer. This requires a
sleep to wait for the hw response.
Reviewed by: kib
Sponsored by: NVidia networking