Commit Graph

264166 Commits

Author SHA1 Message Date
tsoome
2ce9b4fef1 loader: show APFS partition type name
Add small visual aid in lsdev output.
2019-11-04 12:20:19 +00:00
kevans
47a6a041b5 patch(1): give /dev/null patches special treatment
We have a bad habit of duplicating contents of files that are sourced from
/dev/null and applied more than once... take the more sane (in most ways)
GNU route and complain if the file exists and offer reversal options.

This still falls short a little bit as selecting "don't reverse, apply
anyway" will still give you duplicated file contents. There's probably other
issues as well, but awareness is the first step to happiness.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D21535
2019-11-04 03:07:01 +00:00
wulf
54588be978 [ig4] Try to workaround MIPS namespace pollution issue 2019-11-04 02:29:58 +00:00
jhibbits
d80c8cf1c1 powerpc/pmap: Make use of tlb1_mapin_region in pmap_mapdev_attr()
tlb1_mapin_region() and pmap_mapdev_attr() do roughly the same thing -- map
a chunk of physical address space(memory or MMIO) into virtual, but do it in
differing ways.  Unify the code, settling on pmap_mapdev_attr()'s algorithm,
to simplify and unify the logic.  This fixes a bug with growing the kernel
mappings in mmu_booke_bootstrap(), where part of the mapping was not getting
done, leading to a hang when the unmapped VAs were accessed.
2019-11-04 00:35:40 +00:00
andrew
3de5e49155 Move the struct debug_monitor_state out of _KERNEL.
Some userland libraries incude machine/pcb.h and this needs the full
definition of struct debug_monitor_state. To allow this to work move
stuct debug_monitor_state out of the _KERNEL guard.

Sponsored by:	DARPA, AFRL
2019-11-03 22:17:49 +00:00
tsoome
b13b509b6a loader: allow booting from pool with log device
Apparently people are using log with boot pool, so we can not just
error out there. Still we will need to investigate how to handle
log properly.
2019-11-03 21:36:29 +00:00
tsoome
10427e0250 loader: factor out label and uberblock load from vdev_probe, add MMP checks
Clean up the label read.
2019-11-03 21:19:52 +00:00
wulf
14be287881 [ig4] Convert ithread interrupt handler to filter based one. 2019-11-03 21:17:50 +00:00
wulf
5d7fca894b [ig4] Enable additional registers support on Appolo Lake controllers
To be inline with intel-lpss Linux driver
2019-11-03 21:17:01 +00:00
wulf
47be3a39b3 [ig4] Add support for CannonLake controllers
They are clocked at 216MHz rate, much higher than previous models.

PR:		240485
Submitted by:	Neel Chauhan <neel@neelc.org>
2019-11-03 21:16:06 +00:00
wulf
70a0e03f96 [ig4] Add generic resource methods to bus interface
That allows ig4 children to allocate IRQs
2019-11-03 21:15:01 +00:00
wulf
ef049a0028 [ig4] Minor improvement of write pipelining
With leaving some data queued in the TX FIFO at the end of write cycle.
2019-11-03 21:14:08 +00:00
wulf
eceba04c2b [ig4] wait for bus stop condition after stop command issued
It gives better error detection and ig4 driver's lock coverage
in a pipelined write case
2019-11-03 21:12:59 +00:00
wulf
7eb08c1ab6 [ig4] On SkyLake controllers issue reset on attach unconditionally.
It is very helpful during debugging of I2C issues.
It is done only for SkyLakes due to lack of testing on other hardware.
2019-11-03 21:10:47 +00:00
wulf
c44f76cb88 [ig4] Set STOP condition and flush TX/RX FIFOs on error
if controller has not it done for us yet.

Reset controller when transfer abort is failed.
2019-11-03 21:08:26 +00:00
wulf
6db292bf64 [ig4] Improve error detection
Handle error bits of INTR_STAT and TX_ABORT registers.

Move interrupt clearing from interrupt handler to polling loop to get
common execution path with polled mode.

Do not clear interrupts with reading of IG4_REG_CLR_INTR register as
interrupts, triggered during the period from reg_read(IG4_REG_INTR_STAT)
to reg_read(IG4_REG_CLR_INTR) will be missed.
Instead, read each IG4_REG_CLR_* register separately.
2019-11-03 21:07:12 +00:00
wulf
8f66034b62 [ig4] Convert polling loop from status-based to interrupt-based
INTR_STAT register exposes more useful informaton then STA register does
e.g. it exposes error and I2C bus STOP conditions. Make it a main source
of I2C transfer state.
2019-11-03 21:06:06 +00:00
wulf
6a63678a8b [ig4] Use interrupts for waiting for empty TX FIFO 2019-11-03 21:04:51 +00:00
wulf
ea0594af54 [ig4] Convert last remaining usage of TX_NOTFULL status to TX_EMPTY
in ig4iic_read routine. It makes possible interrupt utilization while
waiting for empty space in TX FIFO.
2019-11-03 21:03:55 +00:00
wulf
3ac102ed91 [ig4] Rewrite ig4iic_write routine to use TX_EMPTY status flag
rather than TX_NOTFULL. It makes possible interrupt utilization while
waiting for empty space in TX FIFO.
2019-11-03 21:03:07 +00:00
wulf
02a12ea506 [ig4] Remove dead code inherited from DragonflyBSD 2019-11-03 21:01:53 +00:00
wulf
84dfa9df84 [ig4] Add suspend/resume support
That is done with re-execution of controller initialization procedure
from resume handler.

PR:		238037
2019-11-03 21:00:55 +00:00
wulf
87ed5a7407 [ig4] Implement burst mode for data reads
In this mode DATA_CMD register reads and writes are performed in
TX/RX FIFO-sized bursts to increase I2C bus utilization.

That reduces read time from 60us to 30us per byte when read data is fit
in to RX FIFO buffer in FAST speed mode in my setup.
2019-11-03 20:59:04 +00:00
wulf
da2624c8bf [ig4] Set clock registers based on controller model
IC clock rates are varied between different controller models so we have
to adjust timing registers in each case individually. Borrow intresting
constants and formulas from Intel specs, i2c-designware and lpss_intel
drivers and apply them to FreeBSD supported controller models.

Implement fetching of timing data via ACPI methods execution if available.
2019-11-03 20:57:59 +00:00
wulf
5a2e34d424 [ig4] dump IG4_REG_COMP_PARAM1 and IG4_REG_COMP_VER registers unconditionally
They appeared to be supported (although undocumented) on SkyLakes+ too.
2019-11-03 20:56:53 +00:00
wulf
934acee4bd [cyapa] Postpone start of the polling thread until sleep is available
After recent ig4 changes cyapa driver can be attached before timers
initialization is completed. Start polling thread from config_intrhook
to avoid busy loops in that case.
2019-11-03 20:55:28 +00:00
wulf
110e2c78bc [ig4] Do not wait until interrupts are enabled at attach stage
as the driver is fully functional on a cold boot through utilization of
polled mode.

As a side effect, ig4 children probe and attach methods can be called
earlier in the boot sequence, so now it is up to the child drivers
to wait for a kernel initialization completion if it is required.
2019-11-03 20:54:17 +00:00
wulf
e8b34d4a29 [ig4] Allow enabling of polled mode from iicbus allocation callback
If controller is allocated with IIC_NOWAIT option ig4 enables polled mode
for a period of allocation that makes possible to start I2C transfers
from the contexts where sleeping is not allowed e.g. from ithreads or
callouts.
2019-11-03 20:53:13 +00:00
wulf
799fd2ee8e [ig4] Add support for polled mode
Currently ig4 internally depends on it's own interrupts and uses mtx_sleep()
to wait for them. That means it can not be used from any context where
sleeping is disallowed e.g. on cold boot, from DDB/KDB, from other device
driver's interrupt handlers and so on.

This change replaces sleeps with busy loops in cold boot and DDB cases.
2019-11-03 20:51:22 +00:00
wulf
f03318a994 [ig4] disable controller before initialization of clock counters
It is required by controller specifications.
2019-11-03 20:50:06 +00:00
wulf
0aa789e4c9 [ig4] Stop I2C controller after checking that it's kind of functional.
Obtained from:	DragonfliBSD (0b3eedb)
2019-11-03 20:49:04 +00:00
wulf
77a11f3455 [ig4] We actually need to set the Rx threshold register one smaller.
Setting the IG4_REG_RX_TL register to 1 was actually generating an
interrupt after 2 bytes were available in the Rx fifo. We need to set the
register to 0 to get an interrupt for 1 byte already.

Obtained from:	DragonflyBSD (02f0bf2)
2019-11-03 20:47:49 +00:00
wulf
afd484b49d [ig4] Ignore stray interrupts 2019-11-03 20:46:20 +00:00
wulf
b1f9a0d5db [ig4] Reduce scope of io_lock
Now io_lock is used as condition variable to synchronize active process with
the interrupt handler. It is not used for tasks other than waiting for
interrupt and passing parameters to and from it's handler.
2019-11-03 20:45:25 +00:00
wulf
e5c317571e [ig4] Do not wait for interrupts in set_controller() routine
Specs shows no dedicated interrupt firing on disable of the controller.

Remove io lock acquisitions around set_controller() calls as they are
not needed anymore.
2019-11-03 20:44:16 +00:00
wulf
0f93ec164a [ig4] Drop driver's internal RX FIFO
There is no need to read all controller's RX FIFO data to clear RX_FULL
bit in interrupt handler as interrupts are masked permanently since
previous commit.
2019-11-03 20:43:02 +00:00
wulf
912a626e3e [ig4] Only enable interrupts when we want them. Otherwise keep mask at 0.
This avoids possible interrupt storms, depending on the state of the I2C
controller before the driver attached.

During attaching this clears the interrupt mask.

Revert r338215 as this change makes it no-op.

Obtained from:	DragonflyBSD (d7c8555)
2019-11-03 20:42:04 +00:00
wulf
7bc49e9c6d [ig4] Handle controller startup errors
Fail the attach on controller startup errors.  For some reason the
dell xps 13 says there's I2C controller, but the controller appears
to be permanente disabled and will refuse to enable.

Obtained from:	DragonflyBSD (509820b)
2019-11-03 20:40:55 +00:00
wulf
daad053fb2 [ig4] Give common name to PCI and ACPI device drivers
They share common device driver code with different bus attachments

This commit starts a bunch of changes which have following properties:

Reviewed by:		imp (previous version)
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D22016
2019-11-03 20:39:46 +00:00
cem
3d03037bf9 Take arm.arm (armv5) out of universe
It's on the chopping block in two months, the CI tinderbox doesn't bother with
it anymore either, and buildworld fails today due to an issue linking clang.
It's not worth investigating and it just eats up CPU cycles running universe
builds.
2019-11-03 19:36:34 +00:00
cem
36cad53420 armv6: Switch to LLD by default
This could just be ${__TT} == "arm", except armv5 isn't slated for death until
EOY.

arm tinderbox builds.  Let's see what else shakes out.
2019-11-03 19:33:49 +00:00
vmaffione
621be0aeda bhyve: add backend rx backpressure to virtio-net
If a VM is flooded with more ingress packets than the guest OS
can handle, the current virtio-net code will keep reading those
packets and drop most of them as no space is available in the
receive queue. This is an undesirable receive livelock, which
is a waste of CPU and memory resources and potentially opens to
DoS attacks.
With this change, virtio-net uses the new netbe_rx_disable()
function to disable ingress operation in the backend while the
guest is short on RX buffers. Once the guest makes more buffers
available to the RX virtqueue, ingress operation is enabled again
by calling netbe_rx_enable().

Reviewed by:	bryanv, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D20987
2019-11-03 19:02:32 +00:00
vmaffione
e1bd0b5308 bhyve: fix mistake introduced by r352841
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20973
2019-11-03 18:53:42 +00:00
alc
2a4c328a15 Utilize ASIDs to reduce both the direct and indirect costs of context
switching.  The indirect costs being unnecessary TLB misses that are
incurred when ASIDs are not used.  In fact, currently, when we perform a
context switch on one processor, we issue a broadcast TLB invalidation that
flushes the TLB contents on every processor.

Mark all user-space ("ttbr0") page table entries with the non-global flag so
that they are cached in the TLB under their ASID.

Correct an error in pmap_pinit0().  The pointer to the root of the page
table was being initialized to the root of the kernel-space page table
rather than a user-space page table.  However, the root of the page table
that was being cached in process 0's md_l0addr field correctly pointed to a
user-space page table.  As long as ASIDs weren't being used, this was
harmless, except that it led to some unnecessary page table switches in
pmap_switch().  Specifically, other kernel processes besides process 0 would
have their md_l0addr field set to the root of the kernel-space page table,
and so pmap_switch() would actually change page tables when switching
between process 0 and other kernel processes.

Implement a workaround for Cavium erratum 27456 affecting ThunderX machines.
(I would like to thank andrew@ for providing the code to detect the affected
machines.)

Address integer overflow in the definition of TCR_ASID_16.

Setup TCR according to the PARange and ASIDBits fields from
ID_AA64MMFR0_EL1.  Previously, TCR_ASID_16 was unconditionally set.

Modify build_l1_block_pagetable so that lower attributes, such as ATTR_nG,
can be specified as a parameter.

Eliminate some unused code.

Earlier versions were tested to varying degrees by: andrew, emaste, markj

MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D21922
2019-11-03 17:45:30 +00:00
andrew
a7095edbfd Add support for setting hardware breakpoints from ptrace on arm64.
Implement get/fill_dbregs on arm64. This is used by ptrace with the
PT_GETDBREGS and PT_SETDBREGS requests. It allows userspace to set hardware
breakpoints.

The struct dbreg is based on Linux to ease adding hardware breakpoint
support to debuggers.

Reviewed by:	jhb
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22195
2019-11-03 15:42:08 +00:00
tsoome
af75303fb0 loader: zfs.c is missing malloc checks, fix it
malloc() can return NULL, we need to check the return value.
2019-11-03 14:36:16 +00:00
tsoome
587ff29765 loader: we do not support booting from pool with log device
If pool has log device, stop there and tell about it.
2019-11-03 13:25:47 +00:00
tsoome
456782b475 loader: should check malloc in zfs_dev_open
malloc can return NULL.
2019-11-03 13:03:47 +00:00
kib
07c9290329 amd64: Store %cr3 into pcpu saved_ucr3 on double fault.
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-11-03 11:52:50 +00:00
kib
18c82b4baa amd64 ddb: Add printing of kernel/user and saved user %cr3 values from pcpu.
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-11-03 11:51:53 +00:00