]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agomlx5ib: Limit mkey page size to 2GB
Hans Petter Selasky [Wed, 16 Jun 2021 13:01:31 +0000 (15:01 +0200)]
mlx5ib: Limit mkey page size to 2GB

The maximum page size in the mkey context is 2GB.

Until today, we didn't enforce this requirement in the code, and therefore,
if we got a page size larger than 2GB, we have passed zeros in the
log_page_shift instead of the actual value and the registration failed.

This patch limits the driver to use compound pages of 2GB for mkeys.

Linux commit:
762f899ae7875554284af92b821be8c083227092

Reviewed by: kib
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 565cb4e8cc5efb4c493efe5cf2cb2ec36f69a413)

2 years agomlx5ib: Simplify mlx5_ib_cont_pages()
Hans Petter Selasky [Wed, 16 Jun 2021 13:01:30 +0000 (15:01 +0200)]
mlx5ib: Simplify mlx5_ib_cont_pages()

The patch simplifies mlx5_ib_cont_pages and fixes the following
issues in the original implementation:

First issues is related to alignment of the PFNs. After the check
base + p != PFN, the alignment of the PFN wasn't checked. So the PFN
sequence 0, 1, 1, 2 would result in a page_shift of 13 even though
the 3rd PFN is not 8KB aligned.

This wasn't actually a bug because it was supported by all the
existing mlx5 compatible device, but we don't want to require
this support in all future devices.

Another issue is because the inner loop didn't advance PFN so
the test "if (base + p != pfn)" always failed for SGE with
len > (1<<page_shift).

Linux commit:
d67bc5d4e3e100d762c0f57ea67f28bc219698a6

Reviewed by: kib
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 21bc3710a4b46655067cbad54d1f21952c871dd2)

2 years agomlx5en: Add more error checks in the transmit path.
Hans Petter Selasky [Wed, 16 Jun 2021 13:01:29 +0000 (15:01 +0200)]
mlx5en: Add more error checks in the transmit path.

- Upon error more completion events than requested may be generated,
  particularly when using the completion event factor feature.
- Count number of event errors in the transmit path.

Reviewed by: kib
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 4f4739a77b0e69dae57fd1687926d6e48a698fe4)

2 years agomlx5ib: Support RAW Ethernet when RoCE is disabled in mlx5ib(4)
Hans Petter Selasky [Wed, 16 Jun 2021 13:01:28 +0000 (15:01 +0200)]
mlx5ib: Support RAW Ethernet when RoCE is disabled in mlx5ib(4)

On some environments, such as certain SRIOV VF configurations, RoCE is
not supported for mlx5 Ethernet ports. Currently, the driver will not
open IB device on that port.

This is problematic, since we do want user-space RAW Ethernet (RAW_PACKET
QPs) functionality to remain in place. For that end, enhance the relevant
driver flows such that we do create a device instance in that case.

Linux commit:
ca5b91d63192ceaa41a6145f8c923debb64c71fa

Reviewed by: kib
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 626cb01d4439b85eba9632a7738cddc64b6ad42d)

2 years agomlx5en: Add missing media types for 100GBit/s, 200Gbit/s and 400Gbit/s.
Hans Petter Selasky [Wed, 16 Jun 2021 13:01:28 +0000 (15:01 +0200)]
mlx5en: Add missing media types for 100GBit/s, 200Gbit/s and 400Gbit/s.

Make the mlx5e_mode_table[] array one dimensional, because there is only
one entry, 10G ER/LR, which share the same protocol bit.

This patch only adds support for basic sub-type distinguishing for the
extended protocol bits. Use verbose ifconfig eeprom output to get actual
media type.

Remove write only "connector_type" variable while at it.

Reviewed by: kib
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit a888087fba37da7c968058062b644f4a79b558c3)

2 years agomlx5: drop Giant around VSC lock and CRSPACE enumeration on attach
Konstantin Belousov [Mon, 5 Jul 2021 09:24:00 +0000 (12:24 +0300)]
mlx5: drop Giant around VSC lock and CRSPACE enumeration on attach

(cherry picked from commit 78f5ebaed62e38caafc72f4ec1c0a7c2013e15c7)

2 years agomlx5: add a knob to administratively disable mlx5 fw dump setup
Konstantin Belousov [Mon, 5 Jul 2021 07:55:19 +0000 (10:55 +0300)]
mlx5: add a knob to administratively disable mlx5 fw dump setup

(cherry picked from commit 8391db038df87e0fa5519617e3bb35a2cf78b41e)

2 years agomlx5: Fix PBMC register mapping
Konstantin Belousov [Mon, 26 Apr 2021 11:39:11 +0000 (14:39 +0300)]
mlx5: Fix PBMC register mapping

(cherry picked from commit 0fc0b62b0f7be49bcf4c5670a6c81386e333fb02)

2 years agomlx5: Fix PPLM register mapping
Konstantin Belousov [Wed, 21 Apr 2021 14:12:53 +0000 (17:12 +0300)]
mlx5: Fix PPLM register mapping

(cherry picked from commit 06a3fd0e5c86ae4f00075c1571cf4e183e28b4c4)

2 years agomlx5en: add ASCII art providing an overview of flow tables organization
Konstantin Belousov [Mon, 26 Apr 2021 22:38:46 +0000 (01:38 +0300)]
mlx5en: add ASCII art providing an overview of flow tables organization

(cherry picked from commit b1277d42d718cd42d04d39fa2d61873655e909b3)

2 years agomlx5en: vxlan: do not report TCP inner packet as UDP for software parser
Konstantin Belousov [Thu, 22 Jul 2021 11:53:30 +0000 (14:53 +0300)]
mlx5en: vxlan: do not report TCP inner packet as UDP for software parser

(cherry picked from commit 1db1e58d9384ff9171c248abbef71cf7aea5ebbe)

2 years agomlx5en: Add missing error case when creating VXLAN flow tables.
Hans Petter Selasky [Wed, 16 Jun 2021 13:01:27 +0000 (15:01 +0200)]
mlx5en: Add missing error case when creating VXLAN flow tables.

(cherry picked from commit 2f7ce2326f9486e90cda2f0129331e1ab3694252)

2 years agomlx5en: Fix for IPv6 VxLAN checksum offload.
Hans Petter Selasky [Wed, 16 Jun 2021 13:01:25 +0000 (15:01 +0200)]
mlx5en: Fix for IPv6 VxLAN checksum offload.

(cherry picked from commit 1918b253d36a82ccc171df40d9abb75923f1ece5)

2 years agomlx5en: Honor IFCAP_VXLAN_HWCSUM
Konstantin Belousov [Tue, 20 Apr 2021 11:16:47 +0000 (14:16 +0300)]
mlx5en: Honor IFCAP_VXLAN_HWCSUM

(cherry picked from commit 48acda2b2d6d173a2231a3db153dd4709dcb5276)

2 years agomlx5en: remove all dynamic vxlan steering rules on close and reinstall on open
Konstantin Belousov [Wed, 14 Apr 2021 07:09:36 +0000 (10:09 +0300)]
mlx5en: remove all dynamic vxlan steering rules on close and reinstall on open

(cherry picked from commit 0e4cb0d5a487339cc7f5e151c466e20aeac1e4d9)

2 years agomlx5en: add mlx5e_add_vxlan_rule_from_db() helper
Konstantin Belousov [Wed, 14 Apr 2021 07:08:56 +0000 (10:08 +0300)]
mlx5en: add mlx5e_add_vxlan_rule_from_db() helper

(cherry picked from commit 559eaa44d91ad74973612843835a8248b3df7341)

2 years agomlx5en: remove unneeded protocol and port parameters from mlx5e_add_vxal_rule
Konstantin Belousov [Wed, 14 Apr 2021 07:03:46 +0000 (10:03 +0300)]
mlx5en: remove unneeded protocol and port parameters from mlx5e_add_vxal_rule

(cherry picked from commit e012189d0265851c631261bdcb175727ba715b34)

2 years agomlx5: fix typo, KENREL_MIN_LEVEL->KERNEL_MIN_LEVEL
Konstantin Belousov [Wed, 7 Apr 2021 14:08:43 +0000 (17:08 +0300)]
mlx5: fix typo, KENREL_MIN_LEVEL->KERNEL_MIN_LEVEL

(cherry picked from commit 859e41e90165b00b99addf4c498b8ec031ba9df9)

2 years agomlx5en: announce mce(4) capabilities for stateless VxLAN offloading
Konstantin Belousov [Tue, 6 Apr 2021 03:46:12 +0000 (06:46 +0300)]
mlx5en: announce mce(4) capabilities for stateless VxLAN offloading

(cherry picked from commit bf202a8d7afb2e024d3d29d4d90e24b3925e9f06)

2 years agomlx5en: handle checksum and TSO offloading for VxLAN packets on TX
Konstantin Belousov [Tue, 6 Apr 2021 03:45:20 +0000 (06:45 +0300)]
mlx5en: handle checksum and TSO offloading for VxLAN packets on TX

(cherry picked from commit 7c9febf9f11bec467ef79c6ff19d695ace7edb6b)

2 years agomlx5en: handle offloaded Rx checksums calculated for tunneled packets
Konstantin Belousov [Tue, 6 Apr 2021 03:44:13 +0000 (06:44 +0300)]
mlx5en: handle offloaded Rx checksums calculated for tunneled packets

(cherry picked from commit 149349e01ecd3a4655f7cbebe54973f6f0b0b371)

2 years agomlx5en: build TIRs to handle inner RSS
Konstantin Belousov [Tue, 6 Apr 2021 03:43:23 +0000 (06:43 +0300)]
mlx5en: build TIRs to handle inner RSS

(cherry picked from commit fba6942f19f9cd6455f34658c8fff2ada1ee9691)

2 years agomlx5en: allow software parser for created send queues
Konstantin Belousov [Tue, 6 Apr 2021 03:42:12 +0000 (06:42 +0300)]
mlx5en: allow software parser for created send queues

(cherry picked from commit 5e12b3bb43bcc4aacc859242d7a653e64d6b339a)

2 years agomlx5en: register vxlan start/stop handlers
Konstantin Belousov [Tue, 6 Apr 2021 03:38:59 +0000 (06:38 +0300)]
mlx5en: register vxlan start/stop handlers

(cherry picked from commit 861a612d7bad4812630c9be55e7b59d8fe2cfa18)

2 years agomlx5en: eliminate magic constant
Konstantin Belousov [Tue, 6 Apr 2021 03:30:09 +0000 (06:30 +0300)]
mlx5en: eliminate magic constant

(cherry picked from commit 1b36b3869f3be722dd15760ddcb4598b6dfe7cf7)

2 years agomlx5en: style, remove redundant parentheses
Konstantin Belousov [Tue, 6 Apr 2021 03:29:22 +0000 (06:29 +0300)]
mlx5en: style, remove redundant parentheses

(cherry picked from commit 16816f968917f15ba69fe56faafe4564439c6d47)

2 years agomlx5en: increase the limit MLX5E_MAX_TX_HEADER
Konstantin Belousov [Tue, 6 Apr 2021 03:26:47 +0000 (06:26 +0300)]
mlx5en: increase the limit MLX5E_MAX_TX_HEADER

(cherry picked from commit 8b8c71d7ac31140277ab0383d22e6cb5c2d779d4)

2 years agomlx5: Flow steering tree: increase number of supported flow tables from 3 to 5
Konstantin Belousov [Tue, 6 Apr 2021 03:24:19 +0000 (06:24 +0300)]
mlx5: Flow steering tree: increase number of supported flow tables from 3 to 5

(cherry picked from commit bc56a8f9e7abc20820757298cbb32c4aaa4fc0bc)

2 years agomlx5: cqe64: update the tunneled bit name with recent PRM
Konstantin Belousov [Tue, 6 Apr 2021 03:23:22 +0000 (06:23 +0300)]
mlx5: cqe64: update the tunneled bit name with recent PRM

(cherry picked from commit c8bdc78be19da5443c9186fa2fdb6e9427795565)

2 years agozfs: add missed dependency of zfs module on zlib
Konstantin Belousov [Sat, 17 Jul 2021 14:59:47 +0000 (17:59 +0300)]
zfs: add missed dependency of zfs module on zlib

(cherry picked from commit dbaad75f2834f40bfe74ebe393d2101967052036)

2 years agonfscl: Avoid KASSERT() panic in cache_enter_time()
Rick Macklem [Wed, 14 Jul 2021 20:33:37 +0000 (13:33 -0700)]
nfscl: Avoid KASSERT() panic in cache_enter_time()

Commit 844aa31c6d87 added cache_enter_time_flags(), specifically
so that the NFS client could specify that cache enter replace
any stale entry for the same name.  Doing so avoids a KASSERT()
panic() in cache_enter_time(), as reported by the PR.

This patch uses cache_enter_time_flags() for Readdirplus, to
avoid the panic(), since it is impossible for the NFS client
to know if another client (or a local process on the NFS server)
has replaced a file with another file of the same name.

This patch only affects NFS mounts that use the "rdirplus"
mount option.

There may be other places in the NFS client where this needs
to be done, but no panic() has been observed during testing.

PR: 257043

(cherry picked from commit 7f5508fe78d17af968fe67e00ffa7c975aa2c67d)

2 years agodf: remove the unused fstype var
Mateusz Guzik [Tue, 20 Jul 2021 17:00:50 +0000 (19:00 +0200)]
df: remove the unused fstype var

Found with cc --analyze

Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 570b31f61009fb60591cf5fcc26f0f5c12ff5752)

2 years agopf: embed a pointer to the lock in struct pf_kstate
Mateusz Guzik [Mon, 19 Jul 2021 12:40:25 +0000 (14:40 +0200)]
pf: embed a pointer to the lock in struct pf_kstate

This shaves calculation which in particular helps on arm.

Note using the & hack instead would still be more work.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 907257d6967dd23506e69042c55bb1edc983c0ba)

2 years agopf: shrink struct pf_kstate
Mateusz Guzik [Mon, 19 Jul 2021 12:35:31 +0000 (14:35 +0200)]
pf: shrink struct pf_kstate

Makes room for a pointer.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 9009d36afd1e0107e1e5b6988f49436087b3d474)

2 years agopf: add a comment to pf_kstate concerning compat with pf_state_cmp
Mateusz Guzik [Mon, 19 Jul 2021 12:17:33 +0000 (14:17 +0200)]
pf: add a comment to pf_kstate concerning compat with pf_state_cmp

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit f9aa757d8d1e1bfc7951f462e92f00639256cad6)

2 years agopf: add a branch prediction to expire state check in pf_find_state
Mateusz Guzik [Mon, 19 Jul 2021 12:50:08 +0000 (14:50 +0200)]
pf: add a branch prediction to expire state check in pf_find_state

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 144ec0713daa532342a298fd888a1656ae24a62d)

2 years agoarm: dedup counter(9) address calculation
Mateusz Guzik [Mon, 19 Jul 2021 10:46:01 +0000 (10:46 +0000)]
arm: dedup counter(9) address calculation

Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 78e3a168616dbe3a2c96efe568c960a1344f42e9)

2 years agohwpmc: mostly clean up cc --analyze
Mateusz Guzik [Thu, 15 Jul 2021 14:01:11 +0000 (14:01 +0000)]
hwpmc: mostly clean up cc --analyze

Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit aee6e7dc0cabc670f3a9eabac579a030b363a417)

2 years agocache: add cache_enter_time_flags
Mateusz Guzik [Thu, 8 Jul 2021 07:56:27 +0000 (09:56 +0200)]
cache: add cache_enter_time_flags

(cherry picked from commit 844aa31c6d8785e7256a84d8ee7e8ae2362f9367)

2 years agopf: Remove unused arguments from pf_send_tcp()
Kristof Provost [Wed, 19 May 2021 18:33:28 +0000 (20:33 +0200)]
pf: Remove unused arguments from pf_send_tcp()

struct mbuf *replyto is not actually used (and only rarely provided).
The same applies to struct ifnet *ifp.

No functional change.

Reviewed by: mjg
MFC after: 1 week
Sponsored by:   Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31136

(cherry picked from commit 295f2d939d960e2bdf5c1499da3eb41618be05e6)

2 years agocallout: Make cc_cpu local to kern_timeout.c
Mark Johnston [Fri, 16 Jul 2021 02:40:23 +0000 (22:40 -0400)]
callout: Make cc_cpu local to kern_timeout.c

No functional change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c1aff72cfa30fa27efe867a4feb667f1963e8cf7)

2 years agoAdd some missing osd.9 MLINKs
Mark Johnston [Fri, 16 Jul 2021 16:13:51 +0000 (12:13 -0400)]
Add some missing osd.9 MLINKs

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5d40fb677a9ec95a508f510f6238f4ec3ef65e01)

2 years agonfssvc: Zero the buffer copied out when NFSSVC_DUMPMNTOPTS is set
Mark Johnston [Fri, 16 Jul 2021 02:39:27 +0000 (22:39 -0400)]
nfssvc: Zero the buffer copied out when NFSSVC_DUMPMNTOPTS is set

Reported by: KMSAN
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7a9bc8a82ec20f9208643f1615ea4ca1d0e5d933)

2 years agoaacraid: reduce max I/O size to avoid DMA issues
Leandro Lupori [Mon, 21 Jun 2021 18:04:43 +0000 (15:04 -0300)]
aacraid: reduce max I/O size to avoid DMA issues

Reserve one page for the DMA subsystem, that may need it when the I/O
buffer is not page aligned.

Without this change, writes with the maximum allowed size failed, if:
- physical memory was fragmented, making it necessary to use one DMA
  segment for each page
- the buffer to be written was not page aligned, causing the DMA
  subsystem to need one extra segment

In the scenario above, the DMA subsystem would run out of segments,
resulting in a write with no SG segments, that would fail.

Reviewed by: imp
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D30798

(cherry picked from commit 9c2c6353193b53deb337777c2a06a2648b364f8b)

2 years agozfs: update zfs_gitrev.h
Martin Matuska [Fri, 23 Jul 2021 01:29:33 +0000 (03:29 +0200)]
zfs: update zfs_gitrev.h

From now on, every merge from vendor/openzfs/zfs-2.1-release should come
with an updated zfs_config.h and zfs_gitrev.h

(direct commit)

2 years agoarmv7: allwinner: Add aw_r_intc driver
Emmanuel Vadot [Mon, 5 Jul 2021 09:38:23 +0000 (11:38 +0200)]
armv7: allwinner: Add aw_r_intc driver

This is also needed after the 5.13 dts update.

Sponsored by: Diablotin Systems
Reported by: Mark Millard <marklmi@yahoo.com>

(cherry picked from commit 48687f733fdbbe4b7085aa88a70194c39b44bd9b)

2 years agoarm64: allwinner: Add r_intc driver
Emmanuel Vadot [Thu, 1 Jul 2021 16:41:05 +0000 (18:41 +0200)]
arm64: allwinner: Add r_intc driver

The r intc interrupt controller seems to do a lot of things :
- It can handle the NMI interrupt
- It have local interrupts for some device that also can be muxed with GIC
- It can serve as an forwarder for the GIC

It's mostly used for deepsleep/wakeup if I understood correctly and we do not
support this on arm64.

For now just forward everything to the GIC so interrupts works again for device
which now have this interrupts controller set since dts v5.12

Sponsored by: Diablotin Systems

(cherry picked from commit 993e8236c30a03980a563c63d1e6eae6b6dfbf59)

2 years agoarm: allwinner: dtb: Add overlays to disable SD/MMC node
Emmanuel Vadot [Wed, 26 May 2021 10:58:50 +0000 (12:58 +0200)]
arm: allwinner: dtb: Add overlays to disable SD/MMC node

Useful for dev

Sponsored by: Diablotin Systems

(cherry picked from commit bc805293d8dac3a984edc45a5acf3906af791c13)

2 years agoarm64: rockchip: Add some DTSO to disable sd/mmc
Emmanuel Vadot [Wed, 21 Apr 2021 13:25:29 +0000 (15:25 +0200)]
arm64: rockchip: Add some DTSO to disable sd/mmc

This helps during developement to reduce the number of mmc controller.

(cherry picked from commit eb094080855e1e8c28a70dbebab3e6ecbf8c1255)

2 years agosdhci_fdt: Add gpio_if.h to the source
Emmanuel Vadot [Mon, 21 Jun 2021 19:55:03 +0000 (21:55 +0200)]
sdhci_fdt: Add gpio_if.h to the source

Otherwise if we compile a kernel without gpio support this file isn't compiled.
Also it's needed so it's good to list all deps.

PR: 256756
(cherry picked from commit bf7b542e0216e6bd3bcd5ff46e376643d41f4f9f)

2 years agommc_sim: Make XPT_MMC_GET_TRAN_SETTINGS fully async
Emmanuel Vadot [Thu, 17 Jun 2021 18:09:52 +0000 (20:09 +0200)]
mmc_sim: Make XPT_MMC_GET_TRAN_SETTINGS fully async

Sponsored by: Diablotin Systems

(cherry picked from commit 3386347f65cdcd7c36feec216af05f188f82cf2c)

2 years agodwmmc: Add bus_generic_add_child in the methods
Emmanuel Vadot [Sun, 16 May 2021 15:07:50 +0000 (17:07 +0200)]
dwmmc: Add bus_generic_add_child in the methods

Otherwise sdiob cannot add it's children.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30295

(cherry picked from commit c99d887ca8c420297d2db335ce56075eb12443aa)

2 years agommccam: Read the common members of CSD v1.0 and v2.0
Emmanuel Vadot [Thu, 17 Jun 2021 16:11:04 +0000 (18:11 +0200)]
mmccam: Read the common members of CSD v1.0 and v2.0

And only get the differents ones based on the version.

No functional changes intented.

Sponsored by: Diablotin Systems

(cherry picked from commit 6506efea63f5a52d62ceea4bc18b8faf8a037ff3)

2 years agommccam: Style(9) more mmc_da.c
Emmanuel Vadot [Thu, 17 Jun 2021 15:54:56 +0000 (17:54 +0200)]
mmccam: Style(9) more mmc_da.c

No functional changes.
Sponsored by: Diablotin Systems

(cherry picked from commit 20d601682efe4332dc317a77afada70fa367f89a)

2 years agoarm: allwinner: Add clock driver for Display Engine to the build
Emmanuel Vadot [Wed, 2 Jun 2021 08:17:16 +0000 (10:17 +0200)]
arm: allwinner: Add clock driver for Display Engine to the build

This is needed for drm

(cherry picked from commit 25593adbc125b88096de1b5669e1a9e40b7421a1)

2 years agoarm64: allwinner: clk: Test with the current parent freq first
Emmanuel Vadot [Mon, 31 May 2021 12:06:20 +0000 (14:06 +0200)]
arm64: allwinner: clk: Test with the current parent freq first

Even if the clock is flagged with AW_CLK_SET_PARENT the current parent
freq might be enough to get a correct divisor.
So test first if we can get the expected freq before changing the parent
freq.

(cherry picked from commit ac1d7397bf33acf8955fc0871ff124550bf50d1f)

2 years agoarm: Add no-cftconvert for sdma-imx6 files
Emmanuel Vadot [Wed, 14 Apr 2021 13:43:37 +0000 (15:43 +0200)]
arm: Add no-cftconvert for sdma-imx6 files

Fixes a warning when building kernel:
ctfconvert: file.c: Couldn't read ehdr: Invalid argument

MFC after: 3 days

(cherry picked from commit 0c80ad2dc6896c1fd1294cb1af59ab1f8fc95206)

2 years agommc_cam_sim_default_action: do not touch the ccb after dispatching it
Andriy Gapon [Fri, 9 Jul 2021 14:53:17 +0000 (17:53 +0300)]
mmc_cam_sim_default_action: do not touch the ccb after dispatching it

If MMC_SIM_CAM_REQUEST() is successful the ccb could be running or being
completed as the method returns.  Modifying the ccb status could override
whatever status was already set by a MMC driver.

I am not sure what was the purpose of setting the status to CAM_REQ_INVALID
in the success path.  I assume that it was to catch a possibility that the
ccb could be completed without its status explicitly set.  So, I am keeping
the code, it's just moved to before the MMC_SIM_CAM_REQUEST call.

Without this change I was getting random and phantom EIO errors on Rock64
running off an SD card (dwmmc driver) plus occasional panics like:
  Memory modified after free 0xffffa00003985800(2040) val=6 @ 0xffffa00003985854
  panic: Most recently used by CAM CCB

MFC after: 1 week

(cherry picked from commit 66c183f43f0c05ed9238ed9c1859c0c9df7b66dd)

2 years agoan: Deprecate the driver
Emmanuel Vadot [Mon, 7 Jun 2021 16:45:58 +0000 (18:45 +0200)]
an: Deprecate the driver

Last an(4) devices have been End Of Life and End Of Sale in 2007.
Time to remove this driver.

Differential Revision: https://reviews.freebsd.org/D30678
Reviewed by: imp (earlier version), adrian (earlier version)
MFC after: 3 days
Sponsored by: Diablotin Systems

(cherry picked from commit ab30bb8270fa99503a0f204543a9ac3e3c7fa04d)

2 years agoarm64: rockchip: gpio: Give friendlier name to gpio
Emmanuel Vadot [Sun, 16 May 2021 12:47:16 +0000 (14:47 +0200)]
arm64: rockchip: gpio: Give friendlier name to gpio

By default name the gpio P<bank><bankpin>
This make it easier to find the gpio when reading schematics or DTS.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30287

(cherry picked from commit bc1bb80564eef66cef1a7b9791af87ae019aa71d)

2 years agoarm: allwinner: Add mmc_pwrseq support
Emmanuel Vadot [Wed, 26 May 2021 11:13:33 +0000 (13:13 +0200)]
arm: allwinner: Add mmc_pwrseq support

If a pwrseq is found, set power accordingly.

Sponsored by: Diablotin Systems

(cherry picked from commit 6bc8fe8a9f711923253115d2a23b81370ef3e33a)

2 years agoarm: SOCFPGA: Add ext_resources driver
Emmanuel Vadot [Mon, 31 May 2021 17:08:08 +0000 (19:08 +0200)]
arm: SOCFPGA: Add ext_resources driver

mmc_fdt_helpers needs clock and regulators.
Add all the ext_resources driver to SOCFPGA conf file to fix the build

Reported by:    mjg

(cherry picked from commit 2d926ed71eb15efc4b8ac828adfb221056c853fd)

2 years agoarm: RPI-B: Add ext_resources driver
Emmanuel Vadot [Mon, 24 May 2021 10:53:00 +0000 (12:53 +0200)]
arm: RPI-B: Add ext_resources driver

mmc_fdt_helpers needs clock and regulators.
Add all the ext_resources driver to RPI-B conf file to fix the build

Reported by: mjg

(cherry picked from commit 996afd401c6c69d5abaa1aac111ca3cdd0c90a90)

2 years agommc: Only build mmc_fdt_helper and mmc_pwrseq for arch that uses ext_resources
Emmanuel Vadot [Fri, 21 May 2021 17:35:20 +0000 (19:35 +0200)]
mmc: Only build mmc_fdt_helper and mmc_pwrseq for arch that uses ext_resources

This is now a needed requirement and fixes powerpc* build

(cherry picked from commit 80e645dcdb8df280cbbe978f96c49689170eca68)

2 years agoarm: allwinner: aw_mmc: Check regulators status before enabling/disabling them
Emmanuel Vadot [Sun, 16 May 2021 14:24:31 +0000 (16:24 +0200)]
arm: allwinner: aw_mmc: Check regulators status before enabling/disabling them

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30294

(cherry picked from commit 115e71a4571459e69001b5017ec19532e9d60e1b)

2 years agoextres: regulator: Fix regulator_status for already enable regulators
Emmanuel Vadot [Sun, 16 May 2021 14:21:43 +0000 (16:21 +0200)]
extres: regulator: Fix regulator_status for already enable regulators

If a regulator hasn't been enable by a driver but is enabled in hardware
(most likely enabled by U-Boot), regulator_status will returns that it
is enabled and so any call to regulator_disable will panic as it wasn't
enabled by one of our drivers.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30293

(cherry picked from commit f52072b06da761c05dcb636dd1a02dea7214174a)

2 years agommc: dwmmc: Call mmc_fdt_set_power
Emmanuel Vadot [Sun, 16 May 2021 14:20:42 +0000 (16:20 +0200)]
mmc: dwmmc: Call mmc_fdt_set_power

This allow us to powerup/down the card and enabling/disabling the
regulators if any.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30292

(cherry picked from commit ce41765c21ac56a37c60a0e8cd227ee3396740cc)

2 years agommc_fdt_helper: Add mmc_fdt_set_power
Emmanuel Vadot [Sun, 16 May 2021 14:18:46 +0000 (16:18 +0200)]
mmc_fdt_helper: Add mmc_fdt_set_power

This helper can be used to enable/disable the regulator and starting
the power sequence of sd/sdio/eMMC cards.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30291

(cherry picked from commit 03d4e8bb6592fefab7b17f1d163adba4e35a12c2)

2 years agoarm64: allwinner: axp81x: Add support for regnode_status
Emmanuel Vadot [Sun, 16 May 2021 14:14:47 +0000 (16:14 +0200)]
arm64: allwinner: axp81x: Add support for regnode_status

This method is used to know if a regulator is enabled or not.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30290

(cherry picked from commit 182717da888023a8d0d1a66d579b5a5429b8681d)

2 years agommc_fdt_helpers: Parse the optional pwrseq element.
Emmanuel Vadot [Sun, 16 May 2021 12:50:10 +0000 (14:50 +0200)]
mmc_fdt_helpers: Parse the optional pwrseq element.

If a sd/emmc node have a pwrseq property parse it and get the corresponding
driver.
This can later be used to powerup/powerdown the SDIO card or eMMC.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30289

(cherry picked from commit b0387990a784050ef3a14ea49cb513b5eb737844)

2 years agommc: Add mmc-pwrseq driver
Emmanuel Vadot [Sun, 16 May 2021 12:48:56 +0000 (14:48 +0200)]
mmc: Add mmc-pwrseq driver

This driver is used to power up sdio card or eMMC.
It handle the reset-gpio, clocks and needed delays for powerup/powerdown.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30288

(cherry picked from commit 5b2a81f58dc722ca76065536f07ba47efd98dc63)

2 years agommccam: Add two new XPT for MMC and use them in mmc_sim and sdhci
Emmanuel Vadot [Thu, 29 Apr 2021 15:48:49 +0000 (17:48 +0200)]
mmccam: Add two new XPT for MMC and use them in mmc_sim and sdhci

For the discovery phase of SD/eMMC we need to do some transaction in a async
way.
The classic CAM XPT_{GET,SET}_TRAN_SETTING cannot be used in a async way.
This also allow us to split the discovery phase into a more complete state
machine and we don't mtx_sleep with a random number to wait for completion
of the tasks.
For mmc_sim we now do the SET_TRAN_SETTING in a taskqueue so we can call
the needed function for regulators/clocks without the cam lock(s). This part is
still needed to be done for sdhci.
We also now save the host OCR in the discovery phase as it wasn't done before and
only worked because the same ccb was reused.

Reviewed by: imp, kibab, bz
Differential Revision: https://reviews.freebsd.org/D30038

(cherry picked from commit af2253f61c43a7608cdf6995701c1dc361320064)

2 years agomodules: Only build sdhci_fdt for arm and arm64
Emmanuel Vadot [Thu, 13 May 2021 18:23:59 +0000 (20:23 +0200)]
modules: Only build sdhci_fdt for arm and arm64

Other FDT platform (like powerpc64* or riscv64) don't have gpio built
by default so just compile the module for those two arches.

Fixes: 9e08f82058cb ("modules: Add sdhci_fdt module")
(cherry picked from commit 0b426a1c2cef14ded10ded6ec737d5c116182996)

2 years agomodules: Add sdhci_fdt module
Emmanuel Vadot [Wed, 28 Apr 2021 13:57:39 +0000 (15:57 +0200)]
modules: Add sdhci_fdt module

This is a module for sdhci on fdt system

(cherry picked from commit 9e08f82058cb5e3c04cdfe90fc7a0d109c7f2659)

2 years agodwc: Use mii_fdt function
Emmanuel Vadot [Sun, 11 Apr 2021 19:34:57 +0000 (21:34 +0200)]
dwc: Use mii_fdt function

Use the helper function to get phy mode and configure dwc accordingly.

Reviewed by: ian

(cherry picked from commit f77d8d10115b0863cc3dfd6e1746c02847d6569d)

2 years agommccam: probe*: Style(9)
Emmanuel Vadot [Fri, 23 Apr 2021 12:51:13 +0000 (14:51 +0200)]
mmccam: probe*: Style(9)

(cherry picked from commit 80020d7888349168627de066b174450712930ee4)

2 years agommcprobe_done: Style(9)
Emmanuel Vadot [Fri, 23 Apr 2021 12:50:04 +0000 (14:50 +0200)]
mmcprobe_done: Style(9)

(cherry picked from commit e017c1c92c990a78ac99987a008c9eb3d5620941)

2 years agodwmmc: Add \n to a debug printf
Emmanuel Vadot [Thu, 22 Apr 2021 19:41:56 +0000 (21:41 +0200)]
dwmmc: Add \n to a debug printf

(cherry picked from commit 7cbdf8a05db7da9c78e8ac74542febc646d24abd)

2 years agommc: dwmmc: Convert driver to use the mmc_sim interface
Emmanuel Vadot [Wed, 21 Apr 2021 11:56:27 +0000 (13:56 +0200)]
mmc: dwmmc: Convert driver to use the mmc_sim interface

A lot more generic cam related things are done in mmc_sim so this simplify
the driver a lot.

Differential Revision: https://reviews.freebsd.org/D27487
Reviewed by: kibab

(cherry picked from commit f1cc48e5da505004259343392ee4a27b8338fca4)

2 years agoallwinner: aw_mmc: Convert driver to use the mmc_sim interface
Emmanuel Vadot [Wed, 21 Apr 2021 11:54:25 +0000 (13:54 +0200)]
allwinner: aw_mmc: Convert driver to use the mmc_sim interface

A lot more generic cam related things are done in mmc_sim so this simplify
the driver a lot.

Differential Revision: https://reviews.freebsd.org/D27486
Reviewed by: imp

(cherry picked from commit 2671bdb540c582e2d44681e4495916629d033e97)

2 years agommccam: Add mmc_sim, a generic sim for mmc driver to use
Emmanuel Vadot [Wed, 21 Apr 2021 11:52:29 +0000 (13:52 +0200)]
mmccam: Add mmc_sim, a generic sim for mmc driver to use

This adds a generic sim that abstract a lot of what needs to be implemented
in a driver for mmccam support.
A new interface with three methods is added :

 - mmc_sim_get_tran_settings: Use to get what the controller supports in term
   of capabilities, freq etc ...
 - mmc_sim_set_tran_settings: Use to change the speed/freq/etc of the
   sdcard host controller
 - mmc_sim_cam_request: Used for MMCIO requests

Differential Revision: https://reviews.freebsd.org/D27485
Reviewed by: kibab

(cherry picked from commit 47bde7925b41887cb639e651289bc96ccb5b1c24)

2 years agousr.sbin/pwm/pwm add support for flags
Oskar Holmund [Thu, 11 Mar 2021 08:55:23 +0000 (09:55 +0100)]
usr.sbin/pwm/pwm add support for flags

The pwm utility cant set the only flag defined (PWM_POLARITY_INVERTED) so this
patch add the option -I (capital letter i) to send it to the drivers.

None of existing PWM driver have implemented support for flags.
But soon:ish I will put up an review of a pwm driver using TI OMAP DMTimer.

Differential Revision: https://reviews.freebsd.org/D29137
MFC after:   2 weeks

(cherry picked from commit 17b14d8f7733d39397ae5fc104547e358f5f7ddf)

2 years agoshare/man/man9/pwmbus.9 fix types in arguments
Oskar Holmund [Thu, 11 Mar 2021 08:53:26 +0000 (09:53 +0100)]
share/man/man9/pwmbus.9 fix types in arguments

Fix the types of period and duty in share/man/man9/pwmbus.9 to match the one in sys/dev/pmw/pwmbus.c.

Reviewed By: rpokala
Differential Revision: https://reviews.freebsd.org/D29139
MFC after:   3 days

(cherry picked from commit 7d4a5de84d5e54242edc06573522616869e0b37a)

2 years agolibc: add mempcpy(3) and wmempcpy(3)
Konstantin Belousov [Wed, 14 Jul 2021 15:41:36 +0000 (18:41 +0300)]
libc: add mempcpy(3) and wmempcpy(3)

(cherry picked from commit ee37f64cf875255338f917a9da76c643cf59786c)

2 years agoCreate namespace for the symbols added during 14-CURRENT cycle.
Konstantin Belousov [Wed, 14 Jul 2021 15:41:05 +0000 (18:41 +0300)]
Create namespace for the symbols added during 14-CURRENT cycle.

(cherry picked from commit 8c3ea3f4c4f343e5ecf653e2a50e1fb178cd0b02)

2 years agotcp: fix RACK and BBR when using VIMAGE enabled kernel
Michael Tuexen [Mon, 19 Jul 2021 22:29:18 +0000 (00:29 +0200)]
tcp: fix RACK and BBR when using VIMAGE enabled kernel

Fix a bug in VNET handling, which occurs when using specific NICs.
PR: 257195
Reviewed by: rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D31212

(cherry picked from commit a730d82378d3cdf5356775ec0c23ad2ca40c5edb)

2 years agocloudabi and linux ABIs: do not call umtx_thread_cleanup() from thr_exit syscall
Konstantin Belousov [Thu, 1 Jul 2021 22:30:59 +0000 (01:30 +0300)]
cloudabi and linux ABIs: do not call umtx_thread_cleanup() from thr_exit syscall

(cherry picked from commit 747a6b7ace3dd9401289bde8c4e7fc91b8dc18dc)

2 years agoDo not call FreeBSD-ABI specific code for all ABIs
Konstantin Belousov [Thu, 1 Jul 2021 18:00:29 +0000 (21:00 +0300)]
Do not call FreeBSD-ABI specific code for all ABIs

(cherry picked from commit 28a66fc3da3460850520389971e1194f5327f560)

2 years agoMove sv_onexit() sysentvec hook slightly later
Konstantin Belousov [Thu, 1 Jul 2021 18:06:42 +0000 (21:06 +0300)]
Move sv_onexit() sysentvec hook slightly later

(cherry picked from commit 55976ce11a10765dee6c71b7ed6eac016bd560ef)

2 years agoAdd sv_onexec_old() sysent hook for exec event
Konstantin Belousov [Thu, 1 Jul 2021 18:04:06 +0000 (21:04 +0300)]
Add sv_onexec_old() sysent hook for exec event

(cherry picked from commit 71ab344524a14f00f21c4c5638906d7b965d2b64)

2 years agoAdd __diagused
Mateusz Guzik [Thu, 15 Jul 2021 14:01:02 +0000 (14:01 +0000)]
Add __diagused

This can be used for variables which are only used with either
INVARIANTS or WITNESS. Without any annotation they run into dead store
warnings from cc --analyze and always annotating with __unused may hide
bad vars when it should not.

Reviewed by: kib, markj
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31185

(cherry picked from commit b9296725cf99696b48926270a553044522d6e344)

2 years agocam: Mark the qos data is valid in xpd_done_direct() too.
Warner Losh [Sat, 17 Jul 2021 22:10:46 +0000 (16:10 -0600)]
cam: Mark the qos data is valid in xpd_done_direct() too.

Sponsored by: Netflix

(cherry picked from commit abea0c6b0ddc969d1f3b9cab1fd90df00de1f2e4)

2 years agodevd: remove pccard entries
Warner Losh [Thu, 15 Jul 2021 22:17:33 +0000 (16:17 -0600)]
devd: remove pccard entries

The pccard entries are now obsolete, remove them.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31184

(cherry picked from commit a53541355645080cb6d94466f5363db0941da4fa)

2 years agonvme: Enable interrupts after qpair fully constructed
Warner Losh [Thu, 15 Jul 2021 22:17:23 +0000 (16:17 -0600)]
nvme: Enable interrupts after qpair fully constructed

To guard against the ill effects of a spurious interrupt during
construction (or one that was bogusly pending), enable interrupts after
the qpair is completely constructed. Otherwise, we can die with null
pointer dereferences in nvme_qpair_process_completions. This has been
observed in at least one pre-release NVMe drive where the MSIX interrupt
fired while the queue was being created, before we'd started the NVMe
controller card.

The alternative of only turning on the interrupts after the rest was
tried, but was insufficient to work around this bug and made the code
more complicated w/o benefit.

Reviewed by: mav, chuck
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31182

(cherry picked from commit fc9a0840231770bc7e7dcfe4616babdc6d4389a6)

2 years agonanobsd: Bump rescue size to 8GB
Warner Losh [Thu, 15 Jul 2021 22:11:15 +0000 (16:11 -0600)]
nanobsd: Bump rescue size to 8GB

Bump the rescue size from 1.2GB to just shy of 8GB as things have grown
somewhat. Also make it possible to build rescue somewhere other than
/usr/src.

Sponsored by: Netflix

(cherry picked from commit 998abf5a1274609f9b74b3301dc0dabe659bd36b)

2 years agopcengines: Fix kernel config
Warner Losh [Thu, 15 Jul 2021 22:11:11 +0000 (16:11 -0600)]
pcengines: Fix kernel config

Update the old ALIX config to remove devices, add iflib and remove
trailing white space.

Sponsored by: Netflix

(cherry picked from commit e44c62068170987e37ed2d8dea6a035fdc691fc2)

2 years agonanobsd: default to -j $hw.ncpu
Warner Losh [Thu, 15 Jul 2021 22:07:51 +0000 (16:07 -0600)]
nanobsd: default to -j $hw.ncpu

For paralllel builds, default to using all the CPUs on the system. The
old default of -j 3 was too few.

Sponsored by: Netflix

(cherry picked from commit 7e3a794be3752d21fe760cfb2a38665532c4b6b4)

2 years agonanobsd: Use gpart and create code image before full disk image
Arrigo Marchiori [Thu, 15 Jul 2021 22:06:51 +0000 (16:06 -0600)]
nanobsd: Use gpart and create code image before full disk image

The attached patch brings two main changes to the nanobsd script:
 1- gpart is used instead of fdisk;
 2- the code image is created first, and then used to ``assemble'' the
    full disk image.

The patch was first proposed on the freebsd-embedded list:
http://lists.freebsd.org/pipermail/freebsd-embedded/2012-June/001580.html
and is currently under discussion:
http://lists.freebsd.org/pipermail/freebsd-embedded/2014-January/002216.html

Another effect is that the -f option ("suppress code slice extraction")
now imples the -i option ("suppress disk image build").

imp@ applied Patch by hand to new legacy.sh, plus tweaked for NANO_LOG vs
NANO_OBJ confusion in original.

PR: 186030
Reviewed by: imp@
Differential Revision: https://reviews.freebsd.org/D31102

(cherry picked from commit 587c054bea0f652fdbd86baf5807f21c904ac2ad)

2 years agoloader: make sure CPUTYPE is ignored when building
Warner Losh [Thu, 15 Jul 2021 03:06:08 +0000 (21:06 -0600)]
loader: make sure CPUTYPE is ignored when building

CPUTYPE?=native causes -march=native to be added to the command
line. When the host machine is haswell, this causes some versions of
clang to generate code that can't execute in the efi boot loader
environment. Set _CPUCFLAGS= to undo what's done bsd.cpu.mk. bsd.cpu.mk
is included too early to control with NO_CPU_CFLAGS here. The only other
option is to put that in all the Makefiles, and this is less tedious and
error prone.

PR: 194641
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31187
MFC After: 1 week

(cherry picked from commit 7a0c0ff7ee25ff1efa3dbedcb20d2c80178639cc)

2 years agoRemove incorrect __restricted labels from strcspn
Alfonso Gregory [Wed, 14 Jul 2021 21:48:35 +0000 (15:48 -0600)]
Remove incorrect __restricted labels from strcspn

strcspn should never have had the __restrict keywords. While both of
these strings are const, it may have unindended side effects. While this
is the kernel, the POSIX definition also omits restrict.

Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/497

(cherry picked from commit 56d33e86b74b197a36f42255824b56715c96a596)