This approach is based on the Arm PSCI driver, though that makes more
extensive use of its softc than we do here. This will be used to extract
the SBI IPI code as a real PIC.
Reviewed by: mhorne, imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D35900
On RISC-V, the root PIC (whether the PLIC or, as will be the case in
future, the local interrupt controller) cannot send IPIs, relying on
another means to trigger the necessary software interrupts (firmware
calls), but there are upcoming standard devices that will be able to
inject them, so we can't just put the firmware calls in the root PIC
driver.
Thus, split out a new intr_ipi_dev from intr_irq_root_dev to use for
sending IPIs. New devices can be registered with a given priority up
until the first IPI is set up, when the best device seen so far gets
frozen as the IPI device to use.
Reviewed by: mhorne
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D35899
The arm and arm64 implementations of dispatching IPIs via PIC_IPI_SEND
are almost identical, and entirely MI with the lone exception of a
single store barrier on arm64 (that is likely either redundant or needed
on arm too). Thus, de-duplicate this code by moving it to INTRNG as a
generic IPI glue framework. The ipi_* functions remain declared in MD
smp.h headers and implemented in MD code, but are trivial wrappers
around intr_ipi_send that could be made MI, at least for INTRNG ports,
at a later date.
Note that, whilst both arm and arm64 had an ii_send member in intr_ipi
to abstract over how to send interrupts,, they were always ultimately
using PIC_IPI_SEND, and so this complexity has been removed. A follow-up
commit will re-introduce the same flexibility by instead allowing a
device other than the root PIC to be registered as the IPI sender.
As part of this, strengthen a MAXCPU assertion that was missed in commit
2f0b059eea ("intrng: switch from MAXCPU to mp_ncpus") (which itself is
mis-titled).
Reviewed by: mmel, mhorne
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D35898
The static irq_root_ipicount variable is only ever written to (with the
value passed to irq_root_ipicount), never read. Moreover, the bcm2836
driver, as used by the Raspberry Pi 2B and 3A/B (but not 4, which uses a
GIC-400, though does have the legacy interrupt controller present too)
passes 0 as ipicount, despite implementing IPIs. It's thus inaccurate
and serves no purpose, so should be removed.
Reviewed by: mmel, imp, mhorne
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D35897
`ti->ti_begin` is actually the offset within the first block that is
unread, so we must use that for our lower bound.
Moving to the previous block has to be done at the end of the loop in
order to correctly handle the case of ti_begin == TTYINQ_DATASIZE. At
that point, lastblock is still the last one with data written and the
next write into the queue would advance lastblock. If we move to the
previous block at the beginning, then we're essentially off by one block
for the entire scan and run the risk of running off the end of the block
queue.
The ti_begin == 0 case is still handled correctly, as we skip the loop
entirely and the linestart gets recorded as the first byte available for
writing. The bit after the loop about moving to the next block is also
still correct, even with both previous fixes in mind: we skipped moving
to the previous block if we hit ti_begin, and `off + 1` would in-fact be
a member of the next block from where we're reading if it falls on a
block boundary.
Reported by: dim
Fixes: 522083ffbd ("kern: tty: recanonicalize the buffer on [...]")
When the packets are generated locally (i.e. PFIL_FWD is not set) we
might generate overly large packets and rely on the NIC to fragment it
for us. In that case we'd reject a valid packet.
Reported by: Herbert J. Skuhra <herbert@gojira.at>
Tested by: Herbert J. Skuhra <herbert@gojira.at>
Fixes: 54c62e3e5d
Sponsored by: Rubicon Communications, LLC ("Netgate")
This function was used only in TCP before 446ccdd08e. It was born in
pain in 2016 to plug different complex panics in TCP timers. It wasn't
warmly accepted in phabricator by all of the reviewers and my recollection
of overall agreement was that "if you need this KPI, then you'd better fix
your code to not need it". However, the function served its duty well all
the way to FreeBSD 14. But now that TCP doesn't need it anymore, let's
retire it to reduce complexity of callout code and also to avoid its
further use.
Reviewed by: jhb, markj, kib, rrs
Differential Revision: https://reviews.freebsd.org/D43546
Improve slowpath processing (reordering, retransmissions)
slightly by calculating maxseg only once. This typically
saves one of two calls to tcp_maxseg().
Reviewed By: glebius, tuexen, cc, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43536
Compare not vnodes, which are different between mount points, but
actual cdev referenced by the devfs node.
Reviewed by: brooks, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D43518
This is based purely on reading the Linux kcmp(2) man page.
In addition to the Linux set of comparators, I also added KCMP_FILEOBJ to
compare underlying file' objects.
Tested by: manu
Reviewed by: brooks, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D43518
The method should return 0 if the file' underlying objects are same. In
other words, if 0 is returned, io from either of file causes
modifications of the same object.
Reviewed by: brooks, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D43518
The function holds and returns struct file for a file descriptor index
in the given process.
Reviewed by: brooks, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D43518
The changes to avoid letting tmpfs use all of memory + swap do not
work well with ZFS ARC. The ARC can grow quite large, and will shrink
when there is memory pressure, but tmpfs does not allow for that.
Pending investigation of the right way to handle this, change the
default value of the vfs.tmpfs.memory_percent sysctl to 100 as a
workaround. The sysctl can be set to 95 to get back to the previous
default.
If this powerpc-specific flag is set on a resource, then the
little-endian bus tag is always used when mapping that resource.
Make use of this flag in the mpc85xx/fsl_sata driver to avoid setting
the SATA BAR's bus tag after bus_alloc_resource.
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D43553
- Implement bus_map/unmap_resource pulling bits from the previous
ofw_pcib_activate/deactivate_resource. One difference here is that
the bus_unmap_resource implementation uses bus_space_unmap instead
of pmap_unmapdev as a complement to the existing use of bus_space_map.
- Use bus_generic_rman_* in various routines for memory and I/O port
resources.
- Use pci_domain_* for PCI_RES_BUS in
ofw_pcib_activate/deactivate_resource.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43441
Previously it failed to compile since the macro passed too many
arguments to the function. Fix by adding the bus handle to the
function and adding an implementation that calls pmap_unmapdev.
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D43440
- Implement bus_map/unmap_resource pulling bits from the previous
thunder_pem_activate/deactivate_resource.
- Use bus_generic_rman_* in various routines for memory and I/O port
resources.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43439
- Implement bus_get_rman pulling bits from nexus_alloc_resource.
- Implement bus_map/unmap_resource pulling bits from
nexus_activate/deactivate_resource.
- Use bus_generic_rman_* for
bus_alloc/adjust/activate/deactivate/release_resource except for
custom interrupt activate/deactivate logic still in
nexus_activate/deactivate_resource.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43437
Implement bus_map/unmap_resource and add bus_get_rman for use by
bus_generic_rman_*.
Reviewed by: imp, jhibbits
Differential Revision: https://reviews.freebsd.org/D43435
- Split out bits of iobus_activate/deactive_resource to implement
iobus_map/unmap_resource.
- Use bus_generic_rman_* methods in several bus methods to handle
memory and I/O port resources.
- Add an implementation of bus_adjust_resource.
Reviewed by: imp, jhibbits
Differential Revision: https://reviews.freebsd.org/D43433
- Split out part of ps3bus_activate_resource into a
ps3bus_map_resource method.
- Implement ps3bus_unmap_resource via pmap_unmapdev.
- Use bus_generic_rman_* to add bus_adjust_resource,
bus_deactivate_resource, and bus_release_resource methods.
Reviewed by: imp, jhibbits
Differential Revision: https://reviews.freebsd.org/D43432
The default hook does nothing, so having an empty handler is pointless.
Simple cleanup.
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40475