~vicamo/+git/ubuntu-kernel:bug-1974429/r8152-usb-config-selection/unstable

Last commit made on 2023-03-14
Get this branch:
git clone -b bug-1974429/r8152-usb-config-selection/unstable https://git.launchpad.net/~vicamo/+git/ubuntu-kernel
Only You-Sheng Yang can upload to this branch. If you are You-Sheng Yang please log in for upload directions.

Branch merges

Branch information

Name:
bug-1974429/r8152-usb-config-selection/unstable
Repository:
lp:~vicamo/+git/ubuntu-kernel

Recent commits

d71ab2c... by Bjørn Mork

r8152: add USB device driver for config selection

BugLink: https://bugs.launchpad.net/somerville/+bug/1974429

Subclassing the generic USB device driver to override the
default configuration selection regardless of matching interface
drivers.

The r815x family devices expose a vendor specific function which
the r8152 interface driver wants to handle. This is the preferred
device mode. Additionally one or more USB class functions are
usually supported for hosts lacking a vendor specific driver. The
choice is USB configuration based, with one alternate function per
configuration.

Example device with both NCM and ECM alternate cfgs:

T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=5000 MxCh= 0
D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 3
P: Vendor=0bda ProdID=8156 Rev=31.00
S: Manufacturer=Realtek
S: Product=USB 10/100/1G/2.5G LAN
S: SerialNumber=001000001
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=256mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=00 Driver=r8152
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=83(I) Atr=03(Int.) MxPS= 2 Ivl=128ms
C: #Ifs= 2 Cfg#= 2 Atr=a0 MxPwr=256mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0d Prot=00 Driver=
E: Ad=83(I) Atr=03(Int.) MxPS= 16 Ivl=128ms
I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=01 Driver=
I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
C: #Ifs= 2 Cfg#= 3 Atr=a0 MxPwr=256mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=
E: Ad=83(I) Atr=03(Int.) MxPS= 16 Ivl=128ms
I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=
I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms

A problem with this is that Linux will prefer class functions over
vendor specific functions. Using the above example, Linux defaults
to cfg #2, running the device in a sub-optimal NCM mode.

Previously we've attempted to work around the problem by
blacklisting the devices in the ECM class driver "cdc_ether", and
matching on the ECM class function in the vendor specific interface
driver. The latter has been used to switch back to the vendor
specific configuration when the driver is probed for a class
function.

This workaround has several issues;
- class driver blacklists is additional maintanence cruft in an
  unrelated driver
- class driver blacklists prevents users from optionally running
  the devices in class mode
- each device needs double match entries in the vendor driver
- the initial probing as a class function slows down device
  discovery

Now these issues have become even worse with the introduction of
firmware supporting both NCM and ECM, where NCM ends up as the
default mode in Linux. To use the same workaround, we now have
to blacklist the devices in to two different class drivers and
add yet another match entry to the vendor specific driver.

This patch implements an alternative workaround strategy -
independent of the interface drivers. It avoids adding a
blacklist to the cdc_ncm driver and will let us remove the
existing blacklist from the cdc_ether driver.

As an additional bonus, removing the blacklists allow users to
select one of the other device modes if wanted.

Change-Id: I664077c6d7744029fbe1434e885577c96aa1b18f
Signed-off-by: Bjørn Mork <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(backported from commit ec51fbd1b8a2bca2948dede99c14ec63dc57ff6b)
Signed-off-by: You-Sheng Yang <email address hidden>

2dccd65... by AaronMa

wifi: mt76: mt7921: fix error code of return in mt7921_acpi_read

BugLink: https://bugs.launchpad.net/bugs/2009118

Kernel NULL pointer dereference when ACPI SAR table isn't implemented well.
Fix the error code of return to mark the ACPI SAR table as invalid.

[ 5.077128] mt7921e 0000:06:00.0: sar cnt = 0
[ 5.077381] BUG: kernel NULL pointer dereference, address:
0000000000000004
[ 5.077630] #PF: supervisor read access in kernel mode
[ 5.077883] #PF: error_code(0x0000) - not-present page
[ 5.078138] PGD 0 P4D 0
[ 5.078398] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ 5.079202] RIP: 0010:mt7921_init_acpi_sar+0x106/0x220
[mt7921_common]
...
[ 5.080786] Call Trace:
[ 5.080786] <TASK>
[ 5.080786] mt7921_register_device+0x37d/0x490 [mt7921_common]
[ 5.080786] mt7921_pci_probe.part.0+0x2ee/0x310 [mt7921e]
[ 5.080786] mt7921_pci_probe+0x52/0x70 [mt7921e]
[ 5.080786] local_pci_probe+0x47/0x90
[ 5.080786] pci_call_probe+0x55/0x190
[ 5.080786] pci_device_probe+0x84/0x120

Fixes: f965333e491e ("mt76: mt7921: introduce ACPI SAR support")
Signed-off-by: Aaron Ma <email address hidden>
Signed-off-by: Felix Fietkau <email address hidden>
(cherry picked from commit 888d89034f9eaeab9b5b75f13dbe35376c7dd471)
Signed-off-by: Aaron Ma <email address hidden>
Signed-off-by: Andrea Righi <email address hidden>

486a028... by Aleksandr Mikhalitsyn

UBUNTU: SAUCE: overlayfs: handle idmapped mounts in ovl_do_(set|remove)xattr

BugLink: http://bugs.launchpad.net/bugs/2009065

We have to use ovl_upper_mnt_userns(ofs) helper to get proper user namespace
for idmapped layer. Otherwise we'll get -EPERM.

Right now, overlayfs on top of idmapped layer always mounted as read-only.
This is serious blocker for LXD/LXC unprivileged containers users who run
Docker containers inside.

Reproducer:
$ cd /idmapped/mount/path
$ mkdir {work,upper,lower,ovl}
$ mount -t overlay overlay -o lowerdir=lower,upperdir=upper,workdir=work ovl
$ touch ovl/test
touch: cannot touch 'ovl/test': Read-only file system

Error from dmesg:
overlayfs: failed to create directory work/work (errno: 1); mounting read-only

Reproducible on all Ubuntu kernels with the base >= 5.19

Fixes: eea996a46f ("UBUNTU: SAUCE: overlayfs: Skip permission checking for trusted.overlayfs.* xattrs")
Signed-off-by: Alexander Mikhalitsyn <email address hidden>
Acked-by: Andrea Righi <email address hidden>
Signed-off-by: Andrea Righi <email address hidden>

58f66ae... by Ankit Nautiyal <email address hidden>

drm/i915/display: Prune Interlace modes for Display >=12

BugLink: https://bugs.launchpad.net/bugs/1993561

Defeature Display Interlace support.
Support for interlace modes is removed from Gen 12 onwards.
Pruning the interlace modes for HDMI for Display >=12.
Bspec: 50490

v2: Add check for both DP and HDMI. (Ville)
Get rid of redundant check for interlace mode in modevalid. (Ville)

v3: Simplify the condition to avoid interlace modes. (Jani)

Signed-off-by: Ankit Nautiyal <email address hidden>
Reviewed-by: Jani Nikula <email address hidden>
Signed-off-by: Uma Shankar <email address hidden>
Link: https://patchwork.freedesktop<email address hidden>
(cherry picked from commit f71c9b7bc35ff7c1fb68d114903876eec658439b)
Signed-off-by: Koba Ko <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Timo Aaltonen <email address hidden>
Signed-off-by: Andrea Righi <email address hidden>

024c182... by Ankit Nautiyal <email address hidden>

drm/i915/display: Drop check for doublescan mode in modevalid

BugLink: https://bugs.launchpad.net/bugs/1993561

Since the DP/HDMI connector do not set connector->doublescan_allowed,
the doublescan modes will get automatically filtered during
drm_helper_probe_single_connector_modes().

Therefore check for double scan modes is not required and is dropped
from modevalid functions for both DP and HDMI.

Signed-off-by: Ankit Nautiyal <email address hidden>
Reviewed-by: Jani Nikula <email address hidden>
Signed-off-by: Uma Shankar <email address hidden>
Link: https://patchwork.freedesktop<email address hidden>
(cherry picked from commit 9d04eb20bc71a383b4d4e383b0b7fac8d38a2e34)
Signed-off-by: Koba Ko <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Timo Aaltonen <email address hidden>
Signed-off-by: Andrea Righi <email address hidden>

97660b7... by Kai-Heng Feng

UBUNTU: SAUCE: drm/i915/display/psr: Disable PSR2 sel fetch on panel SHP 5457

BugLink: https://bugs.launchpad.net/bugs/2007516

There's a panel on XPS 9320 flickers since PSR2 sel fetch became enabled
by default on Linux kernel >= 5.16.

Vendor & Product Identification:
 Manufacturer: SHP
 Model: 5457

Temporarily disable PSR2 sel fetch so the panel falls back to use PSR1
while Intel GFX devs are working on the issue [0].

[0] https://gitlab.freedesktop.org/drm/intel/-/issues/7836

Signed-off-by: Kai-Heng Feng <email address hidden>
Acked-by: Stefan Bader <email address hidden>
Acked-by: Dimitri John Ledkov <email address hidden>
Signed-off-by: Andrea Righi <email address hidden>

bcdd5b9... by Gerald Schaefer <email address hidden>

s390/mm: add support for RDP (Reset DAT-Protection)

BugLink: https://bugs.launchpad.net/bugs/1982378

RDP instruction allows to reset DAT-protection bit in a PTE, with less
CPU synchronization overhead than IPTE instruction. In particular, IPTE
can cause machine-wide synchronization overhead, and excessive IPTE usage
can negatively impact machine performance.

RDP can be used instead of IPTE, if the new PTE only differs in SW bits
and _PAGE_PROTECT HW bit, for PTE protection changes from RO to RW.
SW PTE bit changes are allowed, e.g. for dirty and young tracking, but none
of the other HW-defined part of the PTE must change. This is because the
architecture forbids such changes to an active and valid PTE, which
is why invalidation with IPTE is always used first, before writing a new
entry.

The RDP optimization helps mainly for fault-driven SW dirty-bit tracking.
Writable PTEs are initially always mapped with HW _PAGE_PROTECT bit set,
to allow SW dirty-bit accounting on first write protection fault, where
the DAT-protection would then be reset. The reset is now done with RDP
instead of IPTE, if RDP instruction is available.

RDP cannot always guarantee that the DAT-protection reset is propagated
to all CPUs immediately. This means that spurious TLB protection faults
on other CPUs can now occur. For this, common code provides a
flush_tlb_fix_spurious_fault() handler, which will now be used to do a
CPU-local TLB flush. However, this will clear the whole TLB of a CPU, and
not just the affected entry. For more fine-grained flushing, by simply
doing a (local) RDP again, flush_tlb_fix_spurious_fault() would need to
also provide the PTE pointer.

Note that spurious TLB protection faults cannot really be distinguished
from racing pagetable updates, where another thread already installed the
correct PTE. In such a case, the local TLB flush would be unnecessary
overhead, but overall reduction of CPU synchronization overhead by not
using IPTE is still expected to be beneficial.

Reviewed-by: Alexander Gordeev <email address hidden>
Signed-off-by: Gerald Schaefer <email address hidden>
Signed-off-by: Heiko Carstens <email address hidden>
(cherry picked from commit 0807b856521f3313d3912ebb52a9144215c4ff08)
Signed-off-by: Frank Heimes <email address hidden>
Signed-off-by: Andrea Righi <email address hidden>

e218b3c... by Harald Freudenberger <email address hidden>

s390/zcrypt: introduce ctfm field in struct CPRBX

BugLink: https://bugs.launchpad.net/bugs/2003637

Modify the CPRBX struct to expose a new field ctfm for use with hardware
command filtering within a CEX8 crypto card in CCA coprocessor mode.

The field replaces a reserved byte padding field so that the layout of the
struct and the size does not change.

The new field is used only by user space applications which may use this to
expose the HW filtering facilities in the crypto firmware layers.

Signed-off-by: Harald Freudenberger <email address hidden>
Signed-off-by: Heiko Carstens <email address hidden>
(cherry picked from commit ad0faae6ceab7d138dddf9a58eab7151c519e0d3)
Signed-off-by: Frank Heimes <email address hidden>
Signed-off-by: Andrea Righi <email address hidden>

9f13bd4... by Andrea Righi

UBUNTU: SAUCE: Revert "fbdev: Make registered_fb[] private to fbmem.c"

This reverts commit 5727dcfd8486 ("fbdev: Make registered_fb[] private
to fbmem.c") that is currently breaking nvidia-510 and
nvidia-515-server.

This patch can be safely dropped once nvidia will correctly support
newer kernels.

Signed-off-by: Andrea Righi <email address hidden>

ca2fbab... by Andrei Gherzan

UBUNTU: SAUCE: selftest: rtcpie: Force passing unreliable subtest

BugLink: https://bugs.launchpad.net/bugs/1814234

Since 0b63accf87225b5eb7e52814c374cf02d733d4bb, the test includes a
verification of time passage that is unstable as it is prone to
different results based on the system load.

Other investigations led to disabling this test in various other
places/projects. For example, Linaro also disabled it[1].

We have chosen to keep this test but to force its result unconditionally
successful as opposed to reverting the aforementioned commit because:
1. it keeps running the test with results and data that we can use in
   the future for any "smarter" way to deal with it - eg. statistical
   approach
2. it minimizes the maintenance burden of this patch kept in our kernel
   trees

It is worth mentioning that upstream was contacted via the mailing list
with no feedback[2]. The request was to increase the current tolerance
set at 10%.

[1] https://bugs.linaro.org/show_bug.cgi?id=3402#c9
[2] https://<email address hidden>/

Signed-off-by: Andrei Gherzan <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Signed-off-by: Andrea Righi <email address hidden>