]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/log
mirror_ubuntu-jammy-kernel.git
2 years agoUBUNTU: SAUCE: intel ipu drivers first release
Wang Yating [Thu, 29 Jul 2021 06:48:20 +0000 (14:48 +0800)]
UBUNTU: SAUCE: intel ipu drivers first release

BugLink: https://bugs.launchpad.net/bugs/1955383
Signed-off-by: Wang Yating <yating.wang@intel.com>
(backported from commit ade34d8d514046f0d24879c95bfb5aa622b16073 github.com/intel/ipu6-drivers)
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: [Config] Add cirruslogic side codec support
Hui Wang [Fri, 18 Mar 2022 04:22:31 +0000 (12:22 +0800)]
UBUNTU: [Config] Add cirruslogic side codec support

BugLink: https://bugs.launchpad.net/bugs/1965496
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoACPI / scan: Create platform device for CS35L41
Lucas Tanure [Fri, 21 Jan 2022 17:24:31 +0000 (17:24 +0000)]
ACPI / scan: Create platform device for CS35L41

BugLink: https://bugs.launchpad.net/bugs/1965496
The ACPI device with CSC3551 or CLSA0100 are sound cards
with multiple instances of CS35L41 connected by I2C or SPI
to the main CPU.

We add an ID to the ignore_serial_bus_ids list to enumerate
all I2C or SPI devices correctly.

The same IDs are also added into serial-multi-instantiate
so that the driver can correctly enumerate the ACPI.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220121172431.6876-10-sbinding@opensource.cirrus.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit d9c01c530cc5e3b6d5bdfeae12c3d0f33fae7498)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda/realtek: Add support for HP Laptops
Lucas Tanure [Fri, 21 Jan 2022 17:24:30 +0000 (17:24 +0000)]
ALSA: hda/realtek: Add support for HP Laptops

BugLink: https://bugs.launchpad.net/bugs/1965496
Add support for two and four CS35L41 using the component
binding method

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20220121172431.6876-9-sbinding@opensource.cirrus.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(backported from commit 07bcab93946cd9980f8eafe89afe991cd918acb0)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoplatform/x86: serial-multi-instantiate: Add SPI support
Stefan Binding [Fri, 21 Jan 2022 17:24:29 +0000 (17:24 +0000)]
platform/x86: serial-multi-instantiate: Add SPI support

BugLink: https://bugs.launchpad.net/bugs/1965496
Add support for spi bus in serial-multi-instantiate driver

Some peripherals can have either a I2C or a SPI connection
to the host (but not both) but use the same HID for both
types. So it is not possible to use the HID to determine
whether it is I2C or SPI. The driver must check the node
to see if it contains I2cSerialBus or SpiSerialBus entries.

For backwards-compatibility with the existing nodes I2C is
checked first and if such entries are found ONLY I2C devices
are created. Since some existing nodes that were already
handled by this driver could also contain unrelated
SpiSerialBus nodes that were previously ignored, and this
preserves that behavior. If there is ever a need to handle
a node where both I2C and SPI devices must be instantiated
this can be added in future.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220121172431.6876-8-sbinding@opensource.cirrus.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 68f201f9061c000d7a4a9f359f021b1cd535d62b)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoplatform/x86: serial-multi-instantiate: Reorganize I2C functions
Lucas Tanure [Fri, 21 Jan 2022 17:24:28 +0000 (17:24 +0000)]
platform/x86: serial-multi-instantiate: Reorganize I2C functions

BugLink: https://bugs.launchpad.net/bugs/1965496
Reorganize I2C functions to accommodate SPI support
Split the probe and factor out parts of the code
that will be used in the SPI support
Also switched from strlcpy() to strscpy()

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220121172431.6876-7-sbinding@opensource.cirrus.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 35a36cbb7b1ce7596fc03962f7ce261b2e908d1f)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoplatform/x86: i2c-multi-instantiate: Rename it for a generic serial driver name
Lucas Tanure [Fri, 21 Jan 2022 17:24:27 +0000 (17:24 +0000)]
platform/x86: i2c-multi-instantiate: Rename it for a generic serial driver name

BugLink: https://bugs.launchpad.net/bugs/1965496
Rename I2C multi instantiate driver to serial-multi-instantiate for
upcoming addition of SPI support

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220121172431.6876-6-sbinding@opensource.cirrus.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 5e63b2ea3dfbab9307e197004a3c5ee4e1442582)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agospi: Add API to count spi acpi resources
Stefan Binding [Fri, 21 Jan 2022 17:24:26 +0000 (17:24 +0000)]
spi: Add API to count spi acpi resources

BugLink: https://bugs.launchpad.net/bugs/1965496
Some ACPI nodes may have more than one Spi Resource.
To be able to handle these case, its necessary to have
a way of counting these resources.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220121172431.6876-5-sbinding@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit e612af7acef2459f1afd885f4107748995a05963)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agospi: Support selection of the index of the ACPI Spi Resource before alloc
Stefan Binding [Fri, 21 Jan 2022 17:24:25 +0000 (17:24 +0000)]
spi: Support selection of the index of the ACPI Spi Resource before alloc

BugLink: https://bugs.launchpad.net/bugs/1965496
If a node contains more than one SPI resource it may be necessary to
use an index to select which one you want to allocate a spi device for.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220121172431.6876-4-sbinding@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 87e59b36e5e26122efd55d77adb9fac827987db0)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agospi: Create helper API to lookup ACPI info for spi device
Stefan Binding [Fri, 21 Jan 2022 17:24:24 +0000 (17:24 +0000)]
spi: Create helper API to lookup ACPI info for spi device

BugLink: https://bugs.launchpad.net/bugs/1965496
This can then be used to find a spi resource inside an
ACPI node, and allocate a spi device.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220121172431.6876-3-sbinding@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(backported from commit 000bee0ed70af79e610444096fb453430220960f)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoRevert "platform/x86: i2c-multi-instantiate: Don't create platform device for INT3515...
Saranya Gopal [Wed, 20 Oct 2021 02:26:20 +0000 (07:56 +0530)]
Revert "platform/x86: i2c-multi-instantiate: Don't create platform device for INT3515 ACPI nodes"

BugLink: https://bugs.launchpad.net/bugs/1965496
This reverts commit 9bba96275576da0cf78ede62aeb2fc975ed8a32d.

The above commit was added to prevent the tipd driver from loading
in devices which have INT3515 ACPI nodes since high CPU load was
reported in these devices due to interrupt flood. Now that the issue
of interrupt flood in the tipd driver is fixed, re-enable the creation
of platform device for INT3515 ACPI nodes.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Saranya Gopal <saranya.gopal@intel.com>
Link: https://lore.kernel.org/r/20211020022620.21012-3-saranya.gopal@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 6e4d56db30a5feb83ba233a68841ba79483e7731)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda/realtek: fix speakers and micmute on HP 855 G8
Alexander Sergeyev [Fri, 14 Jan 2022 16:50:50 +0000 (19:50 +0300)]
ALSA: hda/realtek: fix speakers and micmute on HP 855 G8

BugLink: https://bugs.launchpad.net/bugs/1965496
There are several PCI ids associated with HP EliteBook 855 G8 Notebook
PC. Commit 0e68c4b11f1e6 ("ALSA: hda/realtek: fix mute/micmute LEDs for
HP 855 G8") covers 0x103c:0x8896, while this commit covers 0x103c:0x8895
which needs some additional work on top of the quirk from 0e68c4b11f1e6.

Note that the device can boot up with working speakers and micmute LED
without this patch, but the success rate would be quite low (order of
16 working boots across 709 boots) at least for the built-in drivers
scenario. This also means that there are some timing issues during early
boot and this patch is a workaround.

With this patch applied speakers and headphones are consistenly working,
as well as mute/micmute LEDs and the internal microphone.

Signed-off-by: Alexander Sergeyev <sergeev917@gmail.com>
Link: https://lore.kernel.org/r/20220114165050.ouw2nknuspclynro@localhost.localdomain
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 91502a9a0b0d5252cf3f32ebd898823c2f5aadab)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda/realtek: Add CS35L41 support for Thinkpad laptops
Stefan Binding [Fri, 17 Dec 2021 11:57:08 +0000 (11:57 +0000)]
ALSA: hda/realtek: Add CS35L41 support for Thinkpad laptops

BugLink: https://bugs.launchpad.net/bugs/1965496
Add support for two CS35L41 using I2C bus and the component
binding method

[ Fix the entries to be sorted order by tiwai ]

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-11-tanureal@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit ae7abe36e352eddf8e30d3b1ea3fb402514ba13b)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda/realtek: Add support for Legion 7 16ACHg6 laptop
Lucas Tanure [Fri, 17 Dec 2021 11:57:07 +0000 (11:57 +0000)]
ALSA: hda/realtek: Add support for Legion 7 16ACHg6 laptop

BugLink: https://bugs.launchpad.net/bugs/1965496
Add Support for CS35L41 using the component binding
method

[ corrected the quirk entry position by tiwai ]

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-10-tanureal@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit d3dca026375f2be550041b75833f2e3238738a70)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda: cs35l41: Make cs35l41_hda_remove() return void
Uwe Kleine-König [Mon, 17 Jan 2022 22:00:55 +0000 (23:00 +0100)]
ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void

BugLink: https://bugs.launchpad.net/bugs/1965496
Up to now cs35l41_hda_remove() returns zero unconditionally. Make it
return void instead which makes it easier to see in the callers that
there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220117220055.120955-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 85c25662d18903874fad585d17fc398a7ba37ab0)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda: cs35l41: Tidyup code
Lucas Tanure [Mon, 17 Jan 2022 16:08:30 +0000 (16:08 +0000)]
ALSA: hda: cs35l41: Tidyup code

BugLink: https://bugs.launchpad.net/bugs/1965496
Clean up and simplify cs35l41_hda_bind function

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220117160830.709403-6-tanureal@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 8c286a0f973a81201a0cef72a7ca55eda29fc35c)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda: cs35l41: Make use of the helper function dev_err_probe()
Lucas Tanure [Mon, 17 Jan 2022 16:08:29 +0000 (16:08 +0000)]
ALSA: hda: cs35l41: Make use of the helper function dev_err_probe()

BugLink: https://bugs.launchpad.net/bugs/1965496
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220117160830.709403-5-tanureal@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit a025df02ce424fa77f6bc6aa195db21677e11274)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda: cs35l41: Add missing default cases
Lucas Tanure [Mon, 17 Jan 2022 16:08:28 +0000 (16:08 +0000)]
ALSA: hda: cs35l41: Add missing default cases

BugLink: https://bugs.launchpad.net/bugs/1965496
Add switch default cases at gpio pins configs

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220117160830.709403-4-tanureal@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit cd8abf7d04c940c627ceb6f416b2142d3e7b36dd)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda: cs35l41: Move cs35l41* calls to its own symbol namespace
Lucas Tanure [Mon, 17 Jan 2022 16:08:27 +0000 (16:08 +0000)]
ALSA: hda: cs35l41: Move cs35l41* calls to its own symbol namespace

BugLink: https://bugs.launchpad.net/bugs/1965496
Create own namespace and avoid polluting the global namespace

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220117160830.709403-3-tanureal@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 77dc3a6ee2eb5851535fe3a84fc31bf0705e4a2e)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda: cs35l41: Add calls to newly added test key function
Charles Keepax [Mon, 17 Jan 2022 16:08:26 +0000 (16:08 +0000)]
ALSA: hda: cs35l41: Add calls to newly added test key function

BugLink: https://bugs.launchpad.net/bugs/1965496
The test key now needs to be manually held when calling
cs35l41_register_errata_patch, after patch:

Add the missing function calls to this driver.

Fixes: f517ba4924ad ("ASoC: cs35l41: Add support for hibernate memory retention mode")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220117160830.709403-2-tanureal@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 6e4320d8ecbc8711209b3075f2d896667006fa37)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda: cs35l41: Avoid overwriting register patch
Charles Keepax [Mon, 17 Jan 2022 16:08:25 +0000 (16:08 +0000)]
ALSA: hda: cs35l41: Avoid overwriting register patch

BugLink: https://bugs.launchpad.net/bugs/1965496
regmap_register_patch can't be used to apply the probe sequence as a
patch is already registers with the regmap by
cs35l41_register_errata_patch and only a single patch can be attached to
a single regmap. The driver doesn't currently rely on a cache sync to
re-apply this probe sequence so simply switch it to a multi write.

Fixes: 7b2f3eb492da ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220117160830.709403-1-tanureal@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 2cb52046d186863e16ac82850c0e225462e493f1)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda: cs35l41: fix double free on error in probe()
Dan Carpenter [Tue, 11 Jan 2022 07:22:32 +0000 (10:22 +0300)]
ALSA: hda: cs35l41: fix double free on error in probe()

BugLink: https://bugs.launchpad.net/bugs/1965496
If we encounter an error after the kfree(acpi_hw_cfg); then the goto
err; will result in a double free.

Fixes: 7b2f3eb492da ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220111072232.GG11243@kili
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 10b1a5a99c6ac42be7a490676aec626fba28b048)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Add support for hibernate memory retention mode
Charles Keepax [Fri, 7 Jan 2022 16:06:36 +0000 (16:06 +0000)]
ASoC: cs35l41: Add support for hibernate memory retention mode

BugLink: https://bugs.launchpad.net/bugs/1965496
The cs35l41 supports a low power DSP memory retention mode. Add support
for entering this mode when then device is not in use.

Co-authored-by: David Rhodes <david.rhodes@cirrus.com>
Signed-off-by: David Rhodes <david.rhodes@cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220107160636.6555-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(backported from commit f517ba4924ad026f2583553db02f3c8bc69de88b)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Update handling of test key registers
Charles Keepax [Fri, 7 Jan 2022 16:06:35 +0000 (16:06 +0000)]
ASoC: cs35l41: Update handling of test key registers

BugLink: https://bugs.launchpad.net/bugs/1965496
In preparation for the addition of PM runtime support move the test
key out of the register patches themselves. This is necessary to
allow the test key to be held during cache synchronisation, which is
required by the OTP settings which were unpacked from the device and
written by the driver.

Also whilst at it, the driver uses a mixture of accessing the test key
register by name and by address, consistently use the name.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220107160636.6555-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit d92321bbe46b0ecae0941461379d39599610d869)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: hda: cs35l41: Add support for CS35L41 in HDA systems
Lucas Tanure [Fri, 17 Dec 2021 11:57:05 +0000 (11:57 +0000)]
ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems

BugLink: https://bugs.launchpad.net/bugs/1965496
Add support for CS35L41 using a new separated driver
that can be used in all upcoming designs

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-8-tanureal@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(backported from commit 7b2f3eb492dac7665c75df067e4d8e4869589f4a)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Correct handling of some registers in the cache
Charles Keepax [Wed, 5 Jan 2022 11:30:22 +0000 (11:30 +0000)]
ASoC: cs35l41: Correct handling of some registers in the cache

BugLink: https://bugs.launchpad.net/bugs/1965496
It makes no sense to cache the test/user key registers, since they
require values written at specific times, mark them volatile. It is
probably best if they can't be accessed from user-space either, so
mark them precious as well.

The interrupt force, edge, polarity and debounce are all settings
applied to the IRQ rather than status bits and as such should not be
volatile.

The OTP trim values will require re-application in the event of a
cache sync and as such should not be volatile. The OTPID however
should be volatile.

The DSP scratch registers are used to read back an error/debug code
from the DSP on shutdown, as such these should be marked volatile.

Finally, add some missing defaults, add TST_FS_MON0, and allow the
DSP core control register to be cached.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220105113026.18955-5-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 5f2f539901b0d9bda722637521a11b7f7cf753f1)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Correct DSP power down
Charles Keepax [Wed, 5 Jan 2022 11:30:21 +0000 (11:30 +0000)]
ASoC: cs35l41: Correct DSP power down

BugLink: https://bugs.launchpad.net/bugs/1965496
The wm_adsp_event should be called before the early_event on power
down, event stops the core running and early_event then powers down
the core. Additionally, the core should only be stopped if it was
actually running in the first place.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220105113026.18955-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(backported from commit 56852cf4b2179fb90068a49538501f31c2de18ea)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Remove incorrect comment
Charles Keepax [Wed, 5 Jan 2022 11:30:20 +0000 (11:30 +0000)]
ASoC: cs35l41: Remove incorrect comment

BugLink: https://bugs.launchpad.net/bugs/1965496
The IRQ is not used for the PDN_DONE bit, this is polled during the DAPM
sequence, remove the misleading comment.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220105113026.18955-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 4e7c3cd87db8d9350062a25a8476f90fd1cbc4c9)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Add cs35l51/53 IDs
David Rhodes [Wed, 5 Jan 2022 11:30:19 +0000 (11:30 +0000)]
ASoC: cs35l41: Add cs35l51/53 IDs

BugLink: https://bugs.launchpad.net/bugs/1965496
Add IDs for the CS35L51/53 variants, the functionality is shared with
CS35L41.

Signed-off-by: David Rhodes <david.rhodes@cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220105113026.18955-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit dcf821319474edde7e85b95608a4539703a2b67d)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Create shared function for boost configuration
Lucas Tanure [Fri, 17 Dec 2021 11:57:04 +0000 (11:57 +0000)]
ASoC: cs35l41: Create shared function for boost configuration

BugLink: https://bugs.launchpad.net/bugs/1965496
ASoC and HDA will use the same registers to configure
internal boost for the device

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-7-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit e8e4fcc047c6e0c5411faeb8cc29aed2e5036a00)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Create shared function for setting channels
Lucas Tanure [Fri, 17 Dec 2021 11:57:03 +0000 (11:57 +0000)]
ASoC: cs35l41: Create shared function for setting channels

BugLink: https://bugs.launchpad.net/bugs/1965496
ASoC and HDA will use the same register to set channels
for the device

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-6-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 3bc3e3da657f17c14df8ae8fab58183407bd7521)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Create shared function for errata patches
Lucas Tanure [Fri, 17 Dec 2021 11:57:02 +0000 (11:57 +0000)]
ASoC: cs35l41: Create shared function for errata patches

BugLink: https://bugs.launchpad.net/bugs/1965496
ASoC and HDA systems require the same errata patches, so
move it to the shared code using a function the correctly
applies the patches by revision

Also, move CS35L41_DSP1_CCM_CORE_CTRL write to errata
patch function as is required to be written at boot,
but not in regmap_register_patch sequence as will affect
waking up from hibernation

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-5-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 8b2278604b6de27329ec7ed82ca696c4751111b6)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Move power initializations to reg_sequence
Lucas Tanure [Fri, 17 Dec 2021 11:57:01 +0000 (11:57 +0000)]
ASoC: cs35l41: Move power initializations to reg_sequence

BugLink: https://bugs.launchpad.net/bugs/1965496
ASoC and HDA systems for all revisions of CS35L41 will benefit
from having this initialization, so add it to reg_sequence of
each revision

By moving to reg_sequence all gains are set to zero. And boost,
monitoring parts, and class D amplifier are disabled.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-4-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 062ce0593315e22aac527389dd6dd4328c49f0fb)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Move cs35l41_otp_unpack to shared code
Lucas Tanure [Fri, 17 Dec 2021 11:57:00 +0000 (11:57 +0000)]
ASoC: cs35l41: Move cs35l41_otp_unpack to shared code

BugLink: https://bugs.launchpad.net/bugs/1965496
ASoC and HDA will do the same cs35l41_otp_unpack, so move it
to shared code

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211217115708.882525-3-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit fe120d4cb6f6cd03007239e7c578b8703fe6d336)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Convert tables to shared source code
Lucas Tanure [Fri, 17 Dec 2021 11:56:59 +0000 (11:56 +0000)]
ASoC: cs35l41: Convert tables to shared source code

BugLink: https://bugs.launchpad.net/bugs/1965496
To support CS35L41 in HDA systems the HDA driver
for CS35L41 would have to duplicate some functions
that already exist on ASoC driver
So instead of duplicate the code, use the new lib
source as a shared resource for both ASoC and HDA

Also, change the way CONFIG_SND_SOC_CS35L41 is
selected, as reported by Intel Kernel test robot,
it is possible to build SND_SOC_CS35L41_SPI/I2C
without the main driver, which would lead to build
failures.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20211217115708.882525-2-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit a87d42227cf5614fe0040ddd1fe642c54298b42c)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Fix undefined reference to core functions
Lucas Tanure [Wed, 1 Dec 2021 18:00:04 +0000 (18:00 +0000)]
ASoC: cs35l41: Fix undefined reference to core functions

BugLink: https://bugs.launchpad.net/bugs/1965496
Auto select core driver if i2c or spi bus drivers are
selected

Fixes: a5e0091d62ab ("ASoC: cs35l41: Fix link problem")
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20211201180004.1402156-2-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 0695ad92fe1a0bb7697eb92c6a145a73c5ab0e24)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Fix link problem
Lucas Tanure [Thu, 25 Nov 2021 14:35:01 +0000 (14:35 +0000)]
ASoC: cs35l41: Fix link problem

BugLink: https://bugs.launchpad.net/bugs/1965496
Can't link I2C and SPI to the same binary, better
to move CS35L41 to 3 modules approach.
And instead of exposing cs35l41_reg, volatile_reg,
readable_reg and precious_reg arrays, move
cs35l41_regmap_i2c/spi to new module and expose it.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211125143501.7720-1-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit a5e0091d62abb9599d9dea505ec0e8c820001831)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Set the max SPI speed for the whole device
Lucas Tanure [Tue, 23 Nov 2021 16:31:39 +0000 (16:31 +0000)]
ASoC: cs35l41: Set the max SPI speed for the whole device

BugLink: https://bugs.launchpad.net/bugs/1965496
Higher speeds are only supported when PLL is enabled, but
the current driver doesn't enable PLL outside of stream
use cases, so better to set the lowest SPI speed accepted
by the entire device.

Move the current frequency set to the spi sub-driver so
the whole device can benefit from that speed.

spi-max-frequency property could be used, but ACPI systems don't
support it, so by setting it in the spi sub-driver probe
both Device Trees and ACPI systems are supported.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211123163149.1530535-2-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 872fc0b6bde8b2dd6891c740cd792d214255dca3)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: DSP Support
David Rhodes [Fri, 29 Oct 2021 21:40:28 +0000 (16:40 -0500)]
ASoC: cs35l41: DSP Support

BugLink: https://bugs.launchpad.net/bugs/1965496
Support for HALO DSP and firmware

Signed-off-by: David Rhodes <drhodes@opensource.cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211029214028.401284-2-drhodes@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(backported from commit bae9e13fc55cbc5ae25409385b2f1ba9187082d0)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Change monitor widgets to siggens
Charles Keepax [Fri, 29 Oct 2021 21:40:27 +0000 (16:40 -0500)]
ASoC: cs35l41: Change monitor widgets to siggens

BugLink: https://bugs.launchpad.net/bugs/1965496
Currently the internal monitor sources are input widgets, which means
if the card is set to fully routed these will not enable unless connected
to something in the machine driver. However, all these are internal
monitor signals so it makes no sense to connect them to something in the
machine driver. As such switch them to siggen widgets which will have
the same behaviour except not require external linkage on a fully routed
card.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: David Rhodes <drhodes@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211029214028.401284-1-drhodes@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit a2697972b9369c41afea8a928c30ac5b7f28d292)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Make cs35l41_remove() return void
Uwe Kleine-König [Wed, 20 Oct 2021 13:24:16 +0000 (15:24 +0200)]
ASoC: cs35l41: Make cs35l41_remove() return void

BugLink: https://bugs.launchpad.net/bugs/1965496
Up to now cs35l41_remove() returns zero unconditionally. Make it
return void instead which makes it easier to see in the callers that
there is no error to handle.

Also the return value of i2c, platform and spi remove callbacks is
ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211020132416.30288-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit ca7270a7b60dfb25b7fd180d93ea18eebd5edee7)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomisc: cs35l41: Remove unused pdn variable
Charles Keepax [Thu, 16 Sep 2021 08:23:46 +0000 (09:23 +0100)]
misc: cs35l41: Remove unused pdn variable

BugLink: https://bugs.launchpad.net/bugs/1965496
Remove pdn variable that was made redundant in an earlier patch.

Fixes: c2f14cc2bcdd ("ASoC: cs35l41: Fix use of an uninitialised variable")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210916082346.12001-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit c6d1fa6c8f663bd49bfe7a20eccb0dc7e43db63a)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Fix a bunch of trivial code formating/style issues
Charles Keepax [Tue, 14 Sep 2021 14:13:49 +0000 (15:13 +0100)]
ASoC: cs35l41: Fix a bunch of trivial code formating/style issues

BugLink: https://bugs.launchpad.net/bugs/1965496
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210914141349.30218-6-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 4295c8cc17481e0d7d4c3a404eaf87dc8dfc26be)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Fixup the error messages
Charles Keepax [Tue, 14 Sep 2021 14:13:48 +0000 (15:13 +0100)]
ASoC: cs35l41: Fixup the error messages

BugLink: https://bugs.launchpad.net/bugs/1965496
It is not idiomatic for ASoC to print the function name in the error
messages, however it is expected to show the return code. Update the
error messages to follow these conventions.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210914141349.30218-5-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 3e60abeb5cb51bccc8bcc6808eef2037ab412334)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Don't overwrite returned error code
Charles Keepax [Tue, 14 Sep 2021 14:13:47 +0000 (15:13 +0100)]
ASoC: cs35l41: Don't overwrite returned error code

BugLink: https://bugs.launchpad.net/bugs/1965496
In multiple places the driver overwrites the error code returned with
a static error code, this is not helpful for debugging. Update to pass
the error codes straight through.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210914141349.30218-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit e371eadf2a93a653211331b66beaac3b1bcbc931)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Combine adjacent register writes
Charles Keepax [Tue, 14 Sep 2021 14:13:46 +0000 (15:13 +0100)]
ASoC: cs35l41: Combine adjacent register writes

BugLink: https://bugs.launchpad.net/bugs/1965496
cs35l41 is often connected over I2C which is a very slow bus, as such
timings can be greatly improved combining writes where acceptable.
Update several points where the driver does multiple register writes
when a single one would suffice.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210914141349.30218-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit fe1024d50477becf35128f3ef03bf3525a2cd140)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Use regmap_read_poll_timeout to wait for OTP boot
Charles Keepax [Tue, 14 Sep 2021 14:13:45 +0000 (15:13 +0100)]
ASoC: cs35l41: Use regmap_read_poll_timeout to wait for OTP boot

BugLink: https://bugs.launchpad.net/bugs/1965496
Just clean up the code a little by using the helper rather than open
coding waiting for OTP_BOOT_DONE.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210914141349.30218-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 3a2eb0b4b02060340af10a1db3c452472471be2f)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: Fix use of an uninitialised variable
Charles Keepax [Tue, 14 Sep 2021 14:13:44 +0000 (15:13 +0100)]
ASoC: cs35l41: Fix use of an uninitialised variable

BugLink: https://bugs.launchpad.net/bugs/1965496
The loop checking PDN_DONE doesn't check the return value from
regmap_read, nor does it initialise val. This means if regmap_read fails
val will be checked for the PDN_DONE bit whilst being uninitialised.

Fix this up by switching to regmap_read_poll_timeout which tidies up the
code and avoids the uninitialised variable.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210914141349.30218-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit c2f14cc2bcdd532f8a18450407ffc27bbbff2319)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: cs35l41: CS35L41 Boosted Smart Amplifier
David Rhodes [Tue, 7 Sep 2021 22:57:18 +0000 (17:57 -0500)]
ASoC: cs35l41: CS35L41 Boosted Smart Amplifier

BugLink: https://bugs.launchpad.net/bugs/1965496
SoC Audio driver for the Cirrus Logic CS35L41 amplifier

Signed-off-by: David Rhodes <drhodes@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210907225719.2018115-2-drhodes@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 6450ef55905688602175fae4ed1bfbfef6a14dde)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: [Debian] Use kernel-testing repo from launchpad
Po-Hsu Lin [Fri, 8 Apr 2022 07:41:44 +0000 (15:41 +0800)]
UBUNTU: [Debian] Use kernel-testing repo from launchpad

BugLink: https://bugs.launchpad.net/bugs/1968016
Reflect the change with kernel-testing repo moved from kernel.ubuntu.com
to launchpad, where we host all of our testing tools.

Use shallow clone to save some bandwidth / time.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Acked-by: Francis Ginther <francis.ginther@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/intel_combo_phy: Print I/O voltage info
Ankit Nautiyal [Wed, 6 Apr 2022 08:03:55 +0000 (16:03 +0800)]
drm/i915/intel_combo_phy: Print I/O voltage info

BugLink: https://bugs.launchpad.net/bugs/1967986
Print I/O voltage and process info for each combo phy ports.

v2: Used drm_dbg_kms for logs. (Jani)
Added names for different voltage levels. (Imre)

v3: Used const char * for names. (Jani)

v4: Dropped the procom values and changed commit msg (Imre)

Suggested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220323094307.2439004-1-ankit.k.nautiyal@intel.com
(cherry picked from commit 3fd6afb623ba0f908af4f81794ccdff4dd5e671e
drmtip)
Signed-off-by: Koba Ko <koba.ko@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
2 years agodrm/i915/display: Remove check for low voltage sku for max dp source rate
Ankit Nautiyal [Wed, 6 Apr 2022 08:03:53 +0000 (16:03 +0800)]
drm/i915/display: Remove check for low voltage sku for max dp source rate

BugLink: https://bugs.launchpad.net/bugs/1967986
The low voltage sku check can be ignored as OEMs need to consider that
when designing the board and then put any limits in VBT.

Same is now changed in Bspec pages.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5272
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220315080247.1161844-2-ankit.k.nautiyal@intel.com
(cherry picked from commit 73867c8709b569cdd7fda67f01dfe02c8d055521
drmtip)
Signed-off-by: Koba Ko <koba.ko@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
2 years agoALSA: hda/cs8409: Add new Dolphin HW variants
Vitaly Rodionov [Wed, 6 Apr 2022 06:13:52 +0000 (14:13 +0800)]
ALSA: hda/cs8409: Add new Dolphin HW variants

BugLink: https://bugs.launchpad.net/bugs/1967988
Add 5 new Dolphin Systems, same configuration as older systems.

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220328115614.15761-7-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 5e2baa04e4cd94c2465b248b7d861fcff8c22fae)
Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
2 years agoALSA: hda/cs8409: Disable HSBIAS_SENSE_EN for Cyborg
Stefan Binding [Wed, 6 Apr 2022 06:13:51 +0000 (14:13 +0800)]
ALSA: hda/cs8409: Disable HSBIAS_SENSE_EN for Cyborg

BugLink: https://bugs.launchpad.net/bugs/1967988
For ESD reasons, all variants should now set HSBIAS_SENSE_EN.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220328115614.15761-6-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 5e74a144837997e6efc52c56d6686fb6c11c627e)
Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
2 years agoALSA: hda/cs8409: Support new Warlock MLK Variants
Stefan Binding [Wed, 6 Apr 2022 06:13:50 +0000 (14:13 +0800)]
ALSA: hda/cs8409: Support new Warlock MLK Variants

BugLink: https://bugs.launchpad.net/bugs/1967988
Added 15 new laptops, with 2 variants:
Warlock MLK and Warlock MLK with Dual Mic

The only difference between the variants, is the
the dual Mic variants use a stereo DMIC.

These variants do no use reduce volume (Full Scale Volume)

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220328115614.15761-5-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 6581a045d54c6a8fe335dd2f343fc7cd2ebfe9e7)
Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
2 years agoALSA: hda/cs8409: Fix Full Scale Volume setting for all variants
Stefan Binding [Wed, 6 Apr 2022 06:13:49 +0000 (14:13 +0800)]
ALSA: hda/cs8409: Fix Full Scale Volume setting for all variants

BugLink: https://bugs.launchpad.net/bugs/1967988
All current variants (Bullseye/Warlock/Cyborg) should be using
reduced volume (-6dB) for better speaker protection.

Refactor to make more explicit the meaning and setting of
Full Scale Volume setting to avoid future confusion.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220328115614.15761-4-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 342b6b610ae2a351de904022271e740c4c2b452b)
Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
2 years agoALSA: hda/cs8409: Re-order quirk table into ascending order
Stefan Binding [Wed, 6 Apr 2022 06:13:48 +0000 (14:13 +0800)]
ALSA: hda/cs8409: Re-order quirk table into ascending order

BugLink: https://bugs.launchpad.net/bugs/1967988
To ensure consistency, the quirk table should be re-ordered
in ascending order

[ a typo fix in the patch description by tiwai ]

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220328115614.15761-3-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit bdc159dfda0acec5ca3adde1a1b58e1e0ddc8311)
Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
2 years agoALSA: hda/cs8409: Fix Warlock to use mono mic configuration
Stefan Binding [Wed, 6 Apr 2022 06:13:47 +0000 (14:13 +0800)]
ALSA: hda/cs8409: Fix Warlock to use mono mic configuration

BugLink: https://bugs.launchpad.net/bugs/1967988
Warlock/Bullseye Laptops have a mono DMIC, Cyborg uses
a stereo DMIC, and the configuration should reflect this.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220328115614.15761-2-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 8a7724535bacbb94fd9441ec232a83d71006d2a9)
Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
2 years agoUBUNTU: [Config] CONFIG_SPEAKUP=m
Matthew Ruffell [Tue, 5 Apr 2022 07:14:09 +0000 (19:14 +1200)]
UBUNTU: [Config] CONFIG_SPEAKUP=m

BugLink: https://bugs.launchpad.net/bugs/1967702
The speakup screen reader which provides accessibility features for
blind system administrators requires the speakup kernel modules
to function.

To enable the speakup modules, CONFIG_ACCESSIBILITY must be set to
'y'. This is omitted on s390x.

CONFIG_SPEAKUP has been present in the Ubuntu kernel for an
extended period of time. Recently it keeps being disabled, notably
during the transition from drivers/staging/ to
drivers/accessibility/ between 5.8 and 5.11, and the recent patch
to re-enable on Hirsute and Impish's kernels not being applied to
ubuntu-unstable, which is why Jammy never picked it up. See the
old bug LP #1942459 for more.

Signed-off-by: Matthew Ruffell <matthew.ruffell@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: [Config] amd64 CONFIG_SERIAL_8250_MID=y
Tim Gardner [Thu, 31 Mar 2022 17:48:57 +0000 (11:48 -0600)]
UBUNTU: [Config] amd64 CONFIG_SERIAL_8250_MID=y

BugLink: https://bugs.launchpad.net/bugs/1967338
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: Intel: soc-acpi: add entries in ADL match table
Libin Yang [Tue, 29 Mar 2022 04:22:10 +0000 (12:22 +0800)]
ASoC: Intel: soc-acpi: add entries in ADL match table

BugLink: https://bugs.launchpad.net/bugs/1966841
Support configuration with SoundWire RT1316 amplifiers on link0 and
link1, and RT711 on link2 for headphone/headset. This product does not
support local microphones.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit c4dcd7100c26881b1095d5b2651d61190fc5f247)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: [Config] armhf, s390x: update annotations following DEBUG_FORCE_FUNCTION_ALIG...
Paolo Pisati [Thu, 14 Apr 2022 12:00:52 +0000 (14:00 +0200)]
UBUNTU: [Config] armhf, s390x: update annotations following DEBUG_FORCE_FUNCTION_ALIGN_64B support removal in v5.15.34

BugLink: https://bugs.launchpad.net/bugs/1969107
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoLinux 5.15.34
Greg Kroah-Hartman [Wed, 13 Apr 2022 18:59:28 +0000 (20:59 +0200)]
Linux 5.15.34

BugLink: https://bugs.launchpad.net/bugs/1969107
Link: https://lore.kernel.org/r/20220412062942.022903016@linuxfoundation.org
Link: https://lore.kernel.org/r/20220412173836.126811734@linuxfoundation.org
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Fox Chen <foxhlchen@gmail.com>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Ron Economos <re@w6rz.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 1b86fc15ba6d04e393d6e65753f2013963d407f3)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agostacktrace: move filter_irq_stacks() to kernel/stacktrace.c
Marco Elver [Fri, 5 Nov 2021 20:45:25 +0000 (13:45 -0700)]
stacktrace: move filter_irq_stacks() to kernel/stacktrace.c

BugLink: https://bugs.launchpad.net/bugs/1969107
commit f39f21b3ddc7fc0f87eb6dc75ddc81b5bbfb7672 upstream.

filter_irq_stacks() has little to do with the stackdepot implementation,
except that it is usually used by users (such as KASAN) of stackdepot to
reduce the stack trace.

However, filter_irq_stacks() itself is not useful without a stack trace
as obtained by stack_trace_save() and friends.

Therefore, move filter_irq_stacks() to kernel/stacktrace.c, so that new
users of filter_irq_stacks() do not have to start depending on
STACKDEPOT only for filter_irq_stacks().

Link: https://lkml.kernel.org/r/20210923104803.2620285-1-elver@google.com
Signed-off-by: Marco Elver <elver@google.com>
Acked-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Aleksandr Nogikh <nogikh@google.com>
Cc: Taras Madan <tarasmadan@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c9ea4fb1f3f356d7a04ebe15ac867ba3192c6d4f)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopowerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit
Kefeng Wang [Wed, 6 Apr 2022 14:57:57 +0000 (00:57 +1000)]
powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit

BugLink: https://bugs.launchpad.net/bugs/1969107
commit ffa0b64e3be58519ae472ea29a1a1ad681e32f48 upstream.

mpe: On 64-bit Book3E vmalloc space starts at 0x8000000000000000.

Because of the way __pa() works we have:
  __pa(0x8000000000000000) == 0, and therefore
  virt_to_pfn(0x8000000000000000) == 0, and therefore
  virt_addr_valid(0x8000000000000000) == true

Which is wrong, virt_addr_valid() should be false for vmalloc space.
In fact all vmalloc addresses that alias with a valid PFN will return
true from virt_addr_valid(). That can cause bugs with hardened usercopy
as described below by Kefeng Wang:

  When running ethtool eth0 on 64-bit Book3E, a BUG occurred:

    usercopy: Kernel memory exposure attempt detected from SLUB object not in SLUB page?! (offset 0, size 1048)!
    kernel BUG at mm/usercopy.c:99
    ...
    usercopy_abort+0x64/0xa0 (unreliable)
    __check_heap_object+0x168/0x190
    __check_object_size+0x1a0/0x200
    dev_ethtool+0x2494/0x2b20
    dev_ioctl+0x5d0/0x770
    sock_do_ioctl+0xf0/0x1d0
    sock_ioctl+0x3ec/0x5a0
    __se_sys_ioctl+0xf0/0x160
    system_call_exception+0xfc/0x1f0
    system_call_common+0xf8/0x200

  The code shows below,

    data = vzalloc(array_size(gstrings.len, ETH_GSTRING_LEN));
    copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN))

  The data is alloced by vmalloc(), virt_addr_valid(ptr) will return true
  on 64-bit Book3E, which leads to the panic.

  As commit 4dd7554a6456 ("powerpc/64: Add VIRTUAL_BUG_ON checks for __va
  and __pa addresses") does, make sure the virt addr above PAGE_OFFSET in
  the virt_addr_valid() for 64-bit, also add upper limit check to make
  sure the virt is below high_memory.

  Meanwhile, for 32-bit PAGE_OFFSET is the virtual address of the start
  of lowmem, high_memory is the upper low virtual address, the check is
  suitable for 32-bit, this will fix the issue mentioned in commit
  602946ec2f90 ("powerpc: Set max_mapnr correctly") too.

On 32-bit there is a similar problem with high memory, that was fixed in
commit 602946ec2f90 ("powerpc: Set max_mapnr correctly"), but that
commit breaks highmem and needs to be reverted.

We can't easily fix __pa(), we have code that relies on its current
behaviour. So for now add extra checks to virt_addr_valid().

For 64-bit Book3S the extra checks are not necessary, the combination of
virt_to_pfn() and pfn_valid() should yield the correct result, but they
are harmless.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[mpe: Add additional change log detail]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220406145802.538416-1-mpe@ellerman.id.au
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit fddb88bd266f4513abab7c36bca98935c9148a98)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agostatic_call: Don't make __static_call_return0 static
Christophe Leroy [Mon, 14 Mar 2022 11:49:36 +0000 (12:49 +0100)]
static_call: Don't make __static_call_return0 static

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 8fd4ddda2f49a66bf5dd3d0c01966c4b1971308b upstream.

System.map shows that vmlinux contains several instances of
__static_call_return0():

c0004fc0 t __static_call_return0
c0011518 t __static_call_return0
c00d8160 t __static_call_return0

arch_static_call_transform() uses the middle one to check whether we are
setting a call to __static_call_return0 or not:

c0011520 <arch_static_call_transform>:
c0011520:       3d 20 c0 01     lis     r9,-16383 <== r9 =  0xc001 << 16
c0011524:       39 29 15 18     addi    r9,r9,5400 <== r9 += 0x1518
c0011528:       7c 05 48 00     cmpw    r5,r9 <== r9 has value 0xc0011518 here

So if static_call_update() is called with one of the other instances of
__static_call_return0(), arch_static_call_transform() won't recognise it.

In order to work properly, global single instance of __static_call_return0() is required.

Fixes: 3f2a8fc4b15d ("static_call/x86: Add __static_call_return0()")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/30821468a0e7d28251954b578e5051dc09300d04.1647258493.git.christophe.leroy@csgroup.eu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 68cea1e243b81e23e09b6822be6193321d9bf977)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomm/sparsemem: fix 'mem_section' will never be NULL gcc 12 warning
Waiman Long [Fri, 8 Apr 2022 20:09:01 +0000 (13:09 -0700)]
mm/sparsemem: fix 'mem_section' will never be NULL gcc 12 warning

BugLink: https://bugs.launchpad.net/bugs/1969107
commit a431dbbc540532b7465eae4fc8b56a85a9fc7d17 upstream.

The gcc 12 compiler reports a "'mem_section' will never be NULL" warning
on the following code:

    static inline struct mem_section *__nr_to_section(unsigned long nr)
    {
    #ifdef CONFIG_SPARSEMEM_EXTREME
        if (!mem_section)
                return NULL;
    #endif
        if (!mem_section[SECTION_NR_TO_ROOT(nr)])
                return NULL;
       :

It happens with CONFIG_SPARSEMEM_EXTREME off.  The mem_section definition
is

    #ifdef CONFIG_SPARSEMEM_EXTREME
    extern struct mem_section **mem_section;
    #else
    extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT];
    #endif

In the !CONFIG_SPARSEMEM_EXTREME case, mem_section is a static
2-dimensional array and so the check "!mem_section[SECTION_NR_TO_ROOT(nr)]"
doesn't make sense.

Fix this warning by moving the "!mem_section[SECTION_NR_TO_ROOT(nr)]"
check up inside the CONFIG_SPARSEMEM_EXTREME block and adding an
explicit NR_SECTION_ROOTS check to make sure that there is no
out-of-bound array access.

Link: https://lkml.kernel.org/r/20220331180246.2746210-1-longman@redhat.com
Fixes: 3e347261a80b ("sparsemem extreme implementation")
Signed-off-by: Waiman Long <longman@redhat.com>
Reported-by: Justin Forbes <jforbes@redhat.com>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Rafael Aquini <aquini@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 429f413ed83f6b9f81e8c4362bcc19e817a4d208)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoirqchip/gic, gic-v3: Prevent GSI to SGI translations
Andre Przywara [Mon, 4 Apr 2022 11:08:42 +0000 (12:08 +0100)]
irqchip/gic, gic-v3: Prevent GSI to SGI translations

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 544808f7e21cb9ccdb8f3aa7de594c05b1419061 upstream.

At the moment the GIC IRQ domain translation routine happily converts
ACPI table GSI numbers below 16 to GIC SGIs (Software Generated
Interrupts aka IPIs). On the Devicetree side we explicitly forbid this
translation, actually the function will never return HWIRQs below 16 when
using a DT based domain translation.

We expect SGIs to be handled in the first part of the function, and any
further occurrence should be treated as a firmware bug, so add a check
and print to report this explicitly and avoid lengthy debug sessions.

Fixes: 64b499d8df40 ("irqchip/gic-v3: Configure SGIs as standard interrupts")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220404110842.2882446-1-andre.przywara@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8fe51495efff58061bee06f5099a61080c9a68d2)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopowerpc/64: Fix build failure with allyesconfig in book3s_64_entry.S
Christophe Leroy [Sun, 27 Mar 2022 07:32:26 +0000 (09:32 +0200)]
powerpc/64: Fix build failure with allyesconfig in book3s_64_entry.S

BugLink: https://bugs.launchpad.net/bugs/1969107
commit af41d2866f7d75bbb38d487f6ec7770425d70e45 upstream.

Using conditional branches between two files is hasardous,
they may get linked too far from each other.

  arch/powerpc/kvm/book3s_64_entry.o:(.text+0x3ec): relocation truncated
  to fit: R_PPC64_REL14 (stub) against symbol `system_reset_common'
  defined in .text section in arch/powerpc/kernel/head_64.o

Reorganise the code to use non conditional branches.

Fixes: 89d35b239101 ("KVM: PPC: Book3S HV P9: Implement the rest of the P9 path in C")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[mpe: Avoid odd-looking bne ., use named local labels]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/89cf27bf43ee07a0b2879b9e8e2f5cd6386a3645.1648366338.git.christophe.leroy@csgroup.eu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 69943af22a32ead53693633ab8c0bb55c7afe08e)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoirqchip/gic-v4: Wait for GICR_VPENDBASER.Dirty to clear before descheduling
Marc Zyngier [Thu, 17 Mar 2022 09:49:02 +0000 (09:49 +0000)]
irqchip/gic-v4: Wait for GICR_VPENDBASER.Dirty to clear before descheduling

BugLink: https://bugs.launchpad.net/bugs/1969107
commit af27e41612ec7e5b4783f589b753a7c31a37aac8 upstream.

The way KVM drives GICv4.{0,1} is as follows:
- vcpu_load() makes the VPE resident, instructing the RD to start
  scanning for interrupts
- just before entering the guest, we check that the RD has finished
  scanning and that we can start running the vcpu
- on preemption, we deschedule the VPE by making it invalid on
  the RD

However, we are preemptible between the first two steps. If it so
happens *and* that the RD was still scanning, we nonetheless write
to the GICR_VPENDBASER register while Dirty is set, and bad things
happen (we're in UNPRED land).

This affects both the 4.0 and 4.1 implementations.

Make sure Dirty is cleared before performing the deschedule,
meaning that its_clear_vpend_valid() becomes a sort of full VPE
residency barrier.

Reported-by: Jingyi Wang <wangjingyi11@huawei.com>
Tested-by: Nianyao Tang <tangnianyao@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Fixes: 57e3cebd022f ("KVM: arm64: Delay the polling of the GICR_VPENDBASER.Dirty bit")
Link: https://lore.kernel.org/r/4aae10ba-b39a-5f84-754b-69c2eb0a2c03@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 7b5d60323f904c91ec7d28282196aa8c6406248b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agox86,static_call: Fix __static_call_return0 for i386
Peter Zijlstra [Fri, 18 Mar 2022 20:24:38 +0000 (21:24 +0100)]
x86,static_call: Fix __static_call_return0 for i386

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 1cd5f059d956e6f614ba6666ecdbcf95db05d5f5 upstream.

Paolo reported that the instruction sequence that is used to replace:

    call __static_call_return0

namely:

    66 66 48 31 c0 data16 data16 xor %rax,%rax

decodes to something else on i386, namely:

    66 66 48 data16 dec %ax
    31 c0 xor    %eax,%eax

Which is a nonsensical sequence that happens to have the same outcome.
*However* an important distinction is that it consists of 2
instructions which is a problem when the thing needs to be overwriten
with a regular call instruction again.

As such, replace the instruction with something that decodes the same
on both i386 and x86_64.

Fixes: 3f2a8fc4b15d ("static_call/x86: Add __static_call_return0()")
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220318204419.GT8939@worktop.programming.kicks-ass.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f4f8b6d8490e1824e99b461dc869e4f46bc734ea)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agosched: Teach the forced-newidle balancer about CPU affinity limitation.
Sebastian Andrzej Siewior [Thu, 17 Mar 2022 14:51:32 +0000 (15:51 +0100)]
sched: Teach the forced-newidle balancer about CPU affinity limitation.

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 386ef214c3c6ab111d05e1790e79475363abaa05 upstream.

try_steal_cookie() looks at task_struct::cpus_mask to decide if the
task could be moved to `this' CPU. It ignores that the task might be in
a migration disabled section while not on the CPU. In this case the task
must not be moved otherwise per-CPU assumption are broken.

Use is_cpu_allowed(), as suggested by Peter Zijlstra, to decide if the a
task can be moved.

Fixes: d2dfa17bc7de6 ("sched: Trivial forced-newidle balancer")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/YjNK9El+3fzGmswf@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ff6505766565616deb65a203e62d4ca63c6c277b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agox86/bug: Prevent shadowing in __WARN_FLAGS
Vincent Mailhol [Thu, 24 Mar 2022 02:37:42 +0000 (11:37 +0900)]
x86/bug: Prevent shadowing in __WARN_FLAGS

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 9ce02f0fc68326dd1f87a0a3a4c6ae7fdd39e6f6 upstream.

The macro __WARN_FLAGS() uses a local variable named "f". This being a
common name, there is a risk of shadowing other variables.

For example, GCC would yield:

| In file included from ./include/linux/bug.h:5,
|                  from ./include/linux/cpumask.h:14,
|                  from ./arch/x86/include/asm/cpumask.h:5,
|                  from ./arch/x86/include/asm/msr.h:11,
|                  from ./arch/x86/include/asm/processor.h:22,
|                  from ./arch/x86/include/asm/timex.h:5,
|                  from ./include/linux/timex.h:65,
|                  from ./include/linux/time32.h:13,
|                  from ./include/linux/time.h:60,
|                  from ./include/linux/stat.h:19,
|                  from ./include/linux/module.h:13,
|                  from virt/lib/irqbypass.mod.c:1:
| ./include/linux/rcupdate.h: In function 'rcu_head_after_call_rcu':
| ./arch/x86/include/asm/bug.h:80:21: warning: declaration of 'f' shadows a parameter [-Wshadow]
|    80 |         __auto_type f = BUGFLAG_WARNING|(flags);                \
|       |                     ^
| ./include/asm-generic/bug.h:106:17: note: in expansion of macro '__WARN_FLAGS'
|   106 |                 __WARN_FLAGS(BUGFLAG_ONCE |                     \
|       |                 ^~~~~~~~~~~~
| ./include/linux/rcupdate.h:1007:9: note: in expansion of macro 'WARN_ON_ONCE'
|  1007 |         WARN_ON_ONCE(func != (rcu_callback_t)~0L);
|       |         ^~~~~~~~~~~~
| In file included from ./include/linux/rbtree.h:24,
|                  from ./include/linux/mm_types.h:11,
|                  from ./include/linux/buildid.h:5,
|                  from ./include/linux/module.h:14,
|                  from virt/lib/irqbypass.mod.c:1:
| ./include/linux/rcupdate.h:1001:62: note: shadowed declaration is here
|  1001 | rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f)
|       |                                               ~~~~~~~~~~~~~~~^

For reference, sparse also warns about it, c.f. [1].

This patch renames the variable from f to __flags (with two underscore
prefixes as suggested in the Linux kernel coding style [2]) in order
to prevent collisions.

[1] https://lore.kernel.org/all/CAFGhKbyifH1a+nAMCvWM88TK6fpNPdzFtUXPmRGnnQeePV+1sw@mail.gmail.com/

[2] Linux kernel coding style, section 12) Macros, Enums and RTL,
paragraph 5) namespace collisions when defining local variables in
macros resembling functions
https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl

Fixes: bfb1a7c91fb7 ("x86/bug: Merge annotate_reachable() into_BUG_FLAGS() asm")
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20220324023742.106546-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f399f38eda5779fe90f0620024197f74a45012c0)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoDrivers: hv: vmbus: Replace smp_store_mb() with virt_store_mb()
Andrea Parri (Microsoft) [Mon, 28 Mar 2022 15:44:57 +0000 (17:44 +0200)]
Drivers: hv: vmbus: Replace smp_store_mb() with virt_store_mb()

BugLink: https://bugs.launchpad.net/bugs/1969107
commit eaa03d34535872d29004cb5cf77dc9dec1ba9a25 upstream.

Following the recommendation in Documentation/memory-barriers.txt for
virtual machine guests.

Fixes: 8b6a877c060ed ("Drivers: hv: vmbus: Replace the per-CPU channel lists with a global array of channels")
Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
Link: https://lore.kernel.org/r/20220328154457.100872-1-parri.andrea@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 469eed08becdd16368277855d78095622db80513)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomm: don't skip swap entry even if zap_details specified
Peter Xu [Tue, 22 Mar 2022 21:42:15 +0000 (14:42 -0700)]
mm: don't skip swap entry even if zap_details specified

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 5abfd71d936a8aefd9f9ccd299dea7a164a5d455 upstream.

Patch series "mm: Rework zap ptes on swap entries", v5.

Patch 1 should fix a long standing bug for zap_pte_range() on
zap_details usage.  The risk is we could have some swap entries skipped
while we should have zapped them.

Migration entries are not the major concern because file backed memory
always zap in the pattern that "first time without page lock, then
re-zap with page lock" hence the 2nd zap will always make sure all
migration entries are already recovered.

However there can be issues with real swap entries got skipped
errornoously.  There's a reproducer provided in commit message of patch
1 for that.

Patch 2-4 are cleanups that are based on patch 1.  After the whole
patchset applied, we should have a very clean view of zap_pte_range().

Only patch 1 needs to be backported to stable if necessary.

This patch (of 4):

The "details" pointer shouldn't be the token to decide whether we should
skip swap entries.

For example, when the callers specified details->zap_mapping==NULL, it
means the user wants to zap all the pages (including COWed pages), then
we need to look into swap entries because there can be private COWed
pages that was swapped out.

Skipping some swap entries when details is non-NULL may lead to wrongly
leaving some of the swap entries while we should have zapped them.

A reproducer of the problem:

===8<===
        #define _GNU_SOURCE         /* See feature_test_macros(7) */
        #include <stdio.h>
        #include <assert.h>
        #include <unistd.h>
        #include <sys/mman.h>
        #include <sys/types.h>

        int page_size;
        int shmem_fd;
        char *buffer;

        void main(void)
        {
                int ret;
                char val;

                page_size = getpagesize();
                shmem_fd = memfd_create("test", 0);
                assert(shmem_fd >= 0);

                ret = ftruncate(shmem_fd, page_size * 2);
                assert(ret == 0);

                buffer = mmap(NULL, page_size * 2, PROT_READ | PROT_WRITE,
                                MAP_PRIVATE, shmem_fd, 0);
                assert(buffer != MAP_FAILED);

                /* Write private page, swap it out */
                buffer[page_size] = 1;
                madvise(buffer, page_size * 2, MADV_PAGEOUT);

                /* This should drop private buffer[page_size] already */
                ret = ftruncate(shmem_fd, page_size);
                assert(ret == 0);
                /* Recover the size */
                ret = ftruncate(shmem_fd, page_size * 2);
                assert(ret == 0);

                /* Re-read the data, it should be all zero */
                val = buffer[page_size];
                if (val == 0)
                        printf("Good\n");
                else
                        printf("BUG\n");
        }
===8<===

We don't need to touch up the pmd path, because pmd never had a issue with
swap entries.  For example, shmem pmd migration will always be split into
pte level, and same to swapping on anonymous.

Add another helper should_zap_cows() so that we can also check whether we
should zap private mappings when there's no page pointer specified.

This patch drops that trick, so we handle swap ptes coherently.  Meanwhile
we should do the same check upon migration entry, hwpoison entry and
genuine swap entries too.

To be explicit, we should still remember to keep the private entries if
even_cows==false, and always zap them when even_cows==true.

The issue seems to exist starting from the initial commit of git.

[peterx@redhat.com: comment tweaks]
Link: https://lkml.kernel.org/r/20220217060746.71256-2-peterx@redhat.com
Link: https://lkml.kernel.org/r/20220217060746.71256-1-peterx@redhat.com
Link: https://lkml.kernel.org/r/20220216094810.60572-1-peterx@redhat.com
Link: https://lkml.kernel.org/r/20220216094810.60572-2-peterx@redhat.com
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Kirill A . Shutemov" <kirill@shutemov.name>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Yang Shi <shy828301@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f5e59185b033948c195315227c2e9d7a34b4e311)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoselftests: cgroup: Test open-time cgroup namespace usage for migration checks
Tejun Heo [Thu, 6 Jan 2022 21:02:29 +0000 (11:02 -1000)]
selftests: cgroup: Test open-time cgroup namespace usage for migration checks

BugLink: https://bugs.launchpad.net/bugs/1969107
commit bf35a7879f1dfb0d050fe779168bcf25c7de66f5 upstream.

When a task is writing to an fd opened by a different task, the perm check
should use the cgroup namespace of the latter task. Add a test for it.

Tested-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 4693fce5a5d461ed6cdcce12ec37bbf5cabab699)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoselftests: cgroup: Test open-time credential usage for migration checks
Tejun Heo [Thu, 6 Jan 2022 21:02:29 +0000 (11:02 -1000)]
selftests: cgroup: Test open-time credential usage for migration checks

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 613e040e4dc285367bff0f8f75ea59839bc10947 upstream.

When a task is writing to an fd opened by a different task, the perm check
should use the credentials of the latter task. Add a test for it.

Tested-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 47802775bc119658e59199d859ba31d62dc5e826)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoselftests: cgroup: Make cg_create() use 0755 for permission instead of 0644
Tejun Heo [Thu, 6 Jan 2022 21:02:29 +0000 (11:02 -1000)]
selftests: cgroup: Make cg_create() use 0755 for permission instead of 0644

BugLink: https://bugs.launchpad.net/bugs/1969107
commit b09c2baa56347ae65795350dfcc633dedb1c2970 upstream.

0644 is an odd perm to create a cgroup which is a directory. Use the regular
0755 instead. This is necessary for euid switching test case.

Reviewed-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit e326f218de1fcc0b59a5839671b5fe6d386c4583)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoubsan: remove CONFIG_UBSAN_OBJECT_SIZE
Kees Cook [Thu, 20 Jan 2022 02:10:35 +0000 (18:10 -0800)]
ubsan: remove CONFIG_UBSAN_OBJECT_SIZE

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 69d0db01e210e07fe915e5da91b54a867cda040f upstream.

The object-size sanitizer is redundant to -Warray-bounds, and
inappropriately performs its checks at run-time when all information
needed for the evaluation is available at compile-time, making it quite
difficult to use:

  https://bugzilla.kernel.org/show_bug.cgi?id=214861

With -Warray-bounds almost enabled globally, it doesn't make sense to
keep this around.

Link: https://lkml.kernel.org/r/20211203235346.110809-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Tadeusz Struk <tadeusz.struk@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 33db9912ff7c491f839c89a08e98f755aa09598f)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoRevert "net/mlx5: Accept devlink user input after driver initialization complete"
dann frazier [Thu, 7 Apr 2022 20:16:42 +0000 (14:16 -0600)]
Revert "net/mlx5: Accept devlink user input after driver initialization complete"

BugLink: https://bugs.launchpad.net/bugs/1969107
This reverts commit 9cc25e8529d567e08da98d11f092b21449763144 which is
commit 64ea2d0e7263b67d8efc93fa1baace041ed36d1e upstream.

This patch was shown to introduce a regression:

  # devlink dev param show pci/0000:24:00.0 name flow_steering_mode
  pci/0000:24:00.0:
    name flow_steering_mode type driver-specific
      values:

  (flow steering mode description is missing beneath "values:")

  # devlink dev param set pci/0000:24:00.0 name flow_steering_mode value smfs cmode runtime
  Segmentation fault (core dumped)

  and also with upstream iproute
  # ./iproute2/devlink/devlink dev param set pci/0000:24:00.0 name flow_steering_mode value smfs cmode runtime
  Configuration mode not supported

Note: Instead of reverting, we could instead also backport commit cf530217408e
("devlink: Notify users when objects are accessible"). However, that makes
changes to core devlink code that I'm not sure are suitable for a stable
backport.

Cc: Leon Romanovsky <leonro@nvidia.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Sasha Levin <sashal@kernel.org>
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f1607e13ed715f3b6433361f8ea5d4aa79f03b94)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoKVM: avoid NULL pointer dereference in kvm_dirty_ring_push
Paolo Bonzini [Wed, 6 Apr 2022 17:13:42 +0000 (13:13 -0400)]
KVM: avoid NULL pointer dereference in kvm_dirty_ring_push

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 5593473a1e6c743764b08e3b6071cb43b5cfa6c4 upstream.

kvm_vcpu_release() will call kvm_dirty_ring_free(), freeing
ring->dirty_gfns and setting it to NULL.  Afterwards, it calls
kvm_arch_vcpu_destroy().

However, if closing the file descriptor races with KVM_RUN in such away
that vcpu->arch.st.preempted == 0, the following call stack leads to a
NULL pointer dereference in kvm_dirty_run_push():

 mark_page_dirty_in_slot+0x192/0x270 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3171
 kvm_steal_time_set_preempted arch/x86/kvm/x86.c:4600 [inline]
 kvm_arch_vcpu_put+0x34e/0x5b0 arch/x86/kvm/x86.c:4618
 vcpu_put+0x1b/0x70 arch/x86/kvm/../../../virt/kvm/kvm_main.c:211
 vmx_free_vcpu+0xcb/0x130 arch/x86/kvm/vmx/vmx.c:6985
 kvm_arch_vcpu_destroy+0x76/0x290 arch/x86/kvm/x86.c:11219
 kvm_vcpu_destroy arch/x86/kvm/../../../virt/kvm/kvm_main.c:441 [inline]

The fix is to release the dirty page ring after kvm_arch_vcpu_destroy
has run.

Reported-by: Qiuhao Li <qiuhao@sysec.org>
Reported-by: Gaoning Pan <pgn@zju.edu.cn>
Reported-by: Yongkang Jia <kangel@zju.edu.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 226b4327ef5c88572fc12187193f1b5073c10837)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodmaengine: Revert "dmaengine: shdma: Fix runtime PM imbalance on error"
Vinod Koul [Thu, 10 Mar 2022 04:43:20 +0000 (10:13 +0530)]
dmaengine: Revert "dmaengine: shdma: Fix runtime PM imbalance on error"

BugLink: https://bugs.launchpad.net/bugs/1969107
commit d143f939a95696d38ff800ada14402fa50ebbd6c upstream.

This reverts commit 455896c53d5b ("dmaengine: shdma: Fix runtime PM
imbalance on error") as the patch wrongly reduced the count on error and
did not bail out. So drop the count by reverting the patch .

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 104bfa23a00120f07b4881e6441bfb4c91a9c89a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agotools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
Arnaldo Carvalho de Melo [Mon, 4 Apr 2022 20:28:48 +0000 (17:28 -0300)]
tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 541f695cbcb6932c22638b06e0cbe1d56177e2e9 upstream.

Just like its done for ldopts and for both in tools/perf/Makefile.config.

Using `` to initialize PERL_EMBED_CCOPTS somehow precludes using:

  $(filter-out SOMETHING_TO_FILTER,$(PERL_EMBED_CCOPTS))

And we need to do it to allow for building with versions of clang where
some gcc options selected by distros are not available.

Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # Debian/Selfmade LLVM-14 (x86-64)
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Keeping <john@metanate.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Link: http://lore.kernel.org/lkml/YktYX2OnLtyobRYD@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3c3a8e56553e427eb07dc69dcaca8a409ab6323b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agotools build: Filter out options and warnings not supported by clang
Arnaldo Carvalho de Melo [Tue, 5 Apr 2022 13:33:21 +0000 (10:33 -0300)]
tools build: Filter out options and warnings not supported by clang

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 41caff459a5b956b3e23ba9ca759dd0629ad3dda upstream.

These make the feature check fail when using clang, so remove them just
like is done in tools/perf/Makefile.config to build perf itself.

Adding -Wno-compound-token-split-by-macro to tools/perf/Makefile.config
when building with clang is also necessary to avoid these warnings
turned into errors (-Werror):

    CC      /tmp/build/perf/util/scripting-engines/trace-event-perl.o
  In file included from util/scripting-engines/trace-event-perl.c:35:
  In file included from /usr/lib64/perl5/CORE/perl.h:4085:
  In file included from /usr/lib64/perl5/CORE/hv.h:659:
  In file included from /usr/lib64/perl5/CORE/hv_func.h:34:
  In file included from /usr/lib64/perl5/CORE/sbox32_hash.h:4:
  /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
      ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/lib64/perl5/CORE/zaphod32_hash.h:80:38: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
  #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                       ^~~~~~~~~~
  /usr/lib64/perl5/CORE/perl.h:737:29: note: expanded from macro 'STMT_START'
  #   define STMT_START   (void)( /* gcc supports "({ STATEMENTS; })" */
                                ^
  /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: note: '{' token is here
      ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/lib64/perl5/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
  #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                                  ^
  /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
      ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/lib64/perl5/CORE/zaphod32_hash.h:87:41: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
      v ^= (v>>23);                       \
                                          ^
  /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: note: ')' token is here
      ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/lib64/perl5/CORE/zaphod32_hash.h:88:3: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
  } STMT_END
    ^~~~~~~~
  /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
  #   define STMT_END     )
                          ^

Please refer to the discussion on the Link: tag below, where Nathan
clarifies the situation:

<quote>
acme> And then get to the problems at the end of this message, which seem
acme> similar to the problem described here:
acme>
acme> From  Nathan Chancellor <>
acme> Subject [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
acme>
acme> https://lkml.org/lkml/2020/9/1/135
acme>
acme> So perhaps in this case its better to disable that
acme> -Werror,-Wcompound-token-split-by-macro when building with clang?

Yes, I think that is probably the best solution. As far as I can tell,
at least in this file and context, the warning appears harmless, as the
"create a GNU C statement expression from two different macros" is very
much intentional, based on the presence of PERL_USE_GCC_BRACE_GROUPS.
The warning is fixed in upstream Perl by just avoiding creating GNU C
statement expressions using STMT_START and STMT_END:

  https://github.com/Perl/perl5/issues/18780
  https://github.com/Perl/perl5/pull/18984

If I am reading the source code correctly, an alternative to disabling
the warning would be specifying -DPERL_GCC_BRACE_GROUPS_FORBIDDEN but it
seems like that might end up impacting more than just this site,
according to the issue discussion above.
</quote>

Based-on-a-patch-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # Debian/Selfmade LLVM-14 (x86-64)
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Keeping <john@metanate.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Link: http://lore.kernel.org/lkml/YkxWcYzph5pC1EK8@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit fbe722d48b8eee840015fc1657602f627ca875b7)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoperf python: Fix probing for some clang command line options
Arnaldo Carvalho de Melo [Fri, 8 Apr 2022 13:08:07 +0000 (10:08 -0300)]
perf python: Fix probing for some clang command line options

BugLink: https://bugs.launchpad.net/bugs/1969107
commit dd6e1fe91cdd52774ca642d1da75b58a86356b56 upstream.

The clang compiler complains about some options even without a source
file being available, while others require one, so use the simple
tools/build/feature/test-hello.c file.

Then check for the "is not supported" string in its output, in addition
to the "unknown argument" already being looked for.

This was noticed when building with clang-13 where -ffat-lto-objects
isn't supported and since we were looking just for "unknown argument"
and not providing a source code to clang, was mistakenly assumed as
being available and not being filtered to set of command line options
provided to clang, leading to a build failure.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Keeping <john@metanate.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Link: http://lore.kernel.org/lkml/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 9b2b01e367412d778e308d60af04223227dc691d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoperf build: Don't use -ffat-lto-objects in the python feature test when building...
Arnaldo Carvalho de Melo [Thu, 7 Apr 2022 14:04:20 +0000 (11:04 -0300)]
perf build: Don't use -ffat-lto-objects in the python feature test when building with clang-13

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 3a8a0475861a443f02e3a9b57d044fe2a0a99291 upstream.

Using -ffat-lto-objects in the python feature test when building with
clang-13 results in:

  clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
  error: command '/usr/sbin/clang' failed with exit code 1
  cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
  make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1

Noticed when building on a docker.io/library/archlinux:base container.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Keeping <john@metanate.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 03044b841406d1098a34577f7da52d116acdfb6d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoRevert "nbd: fix possible overflow on 'first_minor' in nbd_dev_add()"
Jens Axboe [Sat, 2 Apr 2022 17:40:23 +0000 (11:40 -0600)]
Revert "nbd: fix possible overflow on 'first_minor' in nbd_dev_add()"

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 7198bfc2017644c6b92d2ecef9b8b8e0363bb5fd upstream.

This reverts commit 6d35d04a9e18990040e87d2bbf72689252669d54.

Both Gabriel and Borislav report that this commit casues a regression
with nbd:

sysfs: cannot create duplicate filename '/dev/block/43:0'

Revert it before 5.18-rc1 and we'll investigage this separately in
due time.

Link: https://lore.kernel.org/all/YkiJTnFOt9bTv6A2@zn.tnic/
Reported-by: Gabriel L. Somlo <somlo@cmu.edu>
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3b14aa053181709d42319d4145855025c23ddd12)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoSUNRPC: Don't call connect() more than once on a TCP socket
Trond Myklebust [Wed, 16 Mar 2022 23:10:43 +0000 (19:10 -0400)]
SUNRPC: Don't call connect() more than once on a TCP socket

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 89f42494f92f448747bd8a7ab1ae8b5d5520577d upstream.

Avoid socket state races due to repeated calls to ->connect() using the
same socket. If connect() returns 0 due to the connection having
completed, but we are in fact in a closing state, then we may leave the
XPRT_CONNECTING flag set on the transport.

Reported-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Fixes: 3be232f11a3c ("SUNRPC: Prevent immediate close+reconnect")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 5d69622eb0361e5ad266d49f6bf312e0bdb3c654)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agortc: mc146818-lib: fix signedness bug in mc146818_get_time()
Dan Carpenter [Tue, 11 Jan 2022 07:19:22 +0000 (10:19 +0300)]
rtc: mc146818-lib: fix signedness bug in mc146818_get_time()

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 7372971c1be5b7d4fdd8ad237798bdc1d1d54162 upstream.

The mc146818_get_time() function returns zero on success or negative
a error code on failure.  It needs to be type int.

Fixes: d35786b3a28d ("rtc: mc146818-lib: change return values of mc146818_get_time()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220111071922.GE11243@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 22174e8ce8ac32a841e5c63a8b75fdae85ffef8a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoselftests/bpf: Fix u8 narrow load checks for bpf_sk_lookup remote_port
Jakub Sitnicki [Sat, 19 Mar 2022 18:33:55 +0000 (19:33 +0100)]
selftests/bpf: Fix u8 narrow load checks for bpf_sk_lookup remote_port

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 3c69611b8926f8e74fcf76bd97ae0e5dafbeb26a upstream.

In commit 9a69e2b385f4 ("bpf: Make remote_port field in struct
bpf_sk_lookup 16-bit wide") ->remote_port field changed from __u32 to
__be16.

However, narrow load tests which exercise 1-byte sized loads from
offsetof(struct bpf_sk_lookup, remote_port) were not adopted to reflect the
change.

As a result, on little-endian we continue testing loads from addresses:

 - (__u8 *)&ctx->remote_port + 3
 - (__u8 *)&ctx->remote_port + 4

which map to the zero padding following the remote_port field, and don't
break the tests because there is no observable change.

While on big-endian, we observe breakage because tests expect to see zeros
for values loaded from:

 - (__u8 *)&ctx->remote_port - 1
 - (__u8 *)&ctx->remote_port - 2

Above addresses map to ->remote_ip6 field, which precedes ->remote_port,
and are populated during the bpf_sk_lookup IPv6 tests.

Unsurprisingly, on s390x we observe:

  #136/38 sk_lookup/narrow access to ctx v4:OK
  #136/39 sk_lookup/narrow access to ctx v6:FAIL

Fix it by removing the checks for 1-byte loads from offsets outside of the
->remote_port field.

Fixes: 9a69e2b385f4 ("bpf: Make remote_port field in struct bpf_sk_lookup 16-bit wide")
Suggested-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20220319183356.233666-3-jakub@cloudflare.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 9e46f7319549e99b8aba95d5935980ee7347191b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agobpf: Make remote_port field in struct bpf_sk_lookup 16-bit wide
Jakub Sitnicki [Wed, 9 Feb 2022 18:43:32 +0000 (19:43 +0100)]
bpf: Make remote_port field in struct bpf_sk_lookup 16-bit wide

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 9a69e2b385f443f244a7e8b8bcafe5ccfb0866b4 upstream.

remote_port is another case of a BPF context field documented as a 32-bit
value in network byte order for which the BPF context access converter
generates a load of a zero-padded 16-bit integer in network byte order.

First such case was dst_port in bpf_sock which got addressed in commit
4421a582718a ("bpf: Make dst_port field in struct bpf_sock 16-bit wide").

Loading 4-bytes from the remote_port offset and converting the value with
bpf_ntohl() leads to surprising results, as the expected value is shifted
by 16 bits.

Reduce the confusion by splitting the field in two - a 16-bit field holding
a big-endian integer, and a 16-bit zero-padding anonymous field that
follows it.

Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220209184333.654927-2-jakub@cloudflare.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 0c64645e6373761f1f8f292dc122742827f1240e)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoRevert "selftests: net: Add tls config dependency for tls selftests"
Jakub Kicinski [Mon, 28 Mar 2022 21:29:04 +0000 (14:29 -0700)]
Revert "selftests: net: Add tls config dependency for tls selftests"

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 20695e9a9fd39103d1b0669470ae74030b7aa196 upstream.

This reverts commit d9142e1cf3bbdaf21337767114ecab26fe702d47.

The test is supposed to run cleanly with TLS is disabled,
to test compatibility with TCP behavior. I can't repro
the failure [1], the problem should be debugged rather
than papered over.

Link: https://lore.kernel.org/all/20220325161203.7000698c@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com/
Fixes: d9142e1cf3bb ("selftests: net: Add tls config dependency for tls selftests")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20220328212904.2685395-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit e2ff1d65306936f30d4cdd330ae477b0a58c78ea)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet/smc: send directly on setting TCP_NODELAY
Dust Li [Tue, 1 Mar 2022 09:43:59 +0000 (17:43 +0800)]
net/smc: send directly on setting TCP_NODELAY

BugLink: https://bugs.launchpad.net/bugs/1969107
commit b70a5cc045197aad9c159042621baf3c015f6cc7 upstream.

In commit ea785a1a573b("net/smc: Send directly when
TCP_CORK is cleared"), we don't use delayed work
to implement cork.

This patch use the same algorithm, removes the
delayed work when setting TCP_NODELAY and send
directly in setsockopt(). This also makes the
TCP_NODELAY the same as TCP.

Cc: Tony Lu <tonylu@linux.alibaba.com>
Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 7f48521172fb63b9948e86987462cea62564fc2b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoKVM: SVM: Allow AVIC support on system w/ physical APIC ID > 255
Suravee Suthikulpanit [Fri, 11 Feb 2022 00:08:51 +0000 (18:08 -0600)]
KVM: SVM: Allow AVIC support on system w/ physical APIC ID > 255

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 4a204f7895878363ca8211f50ec610408c8c70aa upstream.

Expand KVM's mask for the AVIC host physical ID to the full 12 bits defined
by the architecture.  The number of bits consumed by hardware is model
specific, e.g. early CPUs ignored bits 11:8, but there is no way for KVM
to enumerate the "true" size.  So, KVM must allow using all bits, else it
risks rejecting completely legal x2APIC IDs on newer CPUs.

This means KVM relies on hardware to not assign x2APIC IDs that exceed the
"true" width of the field, but presumably hardware is smart enough to tie
the width to the max x2APIC ID.  KVM also relies on hardware to support at
least 8 bits, as the legacy xAPIC ID is writable by software.  But, those
assumptions are unavoidable due to the lack of any way to enumerate the
"true" width.

Cc: stable@vger.kernel.org
Cc: Maxim Levitsky <mlevitsk@redhat.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Fixes: 44a95dae1d22 ("KVM: x86: Detect and Initialize AVIC support")
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Message-Id: <20220211000851.185799-1-suravee.suthikulpanit@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[modified due to the conflict caused by the commit 391503528257 ("KVM:
x86: SVM: move avic definitions from AMD's spec to svm.h")]
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 20633216ded00e0580582ad00bbf4520c58caff8)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/amdgpu: don't use BACO for reset in S3
Alex Deucher [Fri, 25 Mar 2022 15:53:39 +0000 (11:53 -0400)]
drm/amdgpu: don't use BACO for reset in S3

BugLink: https://bugs.launchpad.net/bugs/1969107
commit ebc002e3ee78409c42156e62e4e27ad1d09c5a75 upstream.

Seems to cause a reboots or hangs on some systems.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1924
Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1953
Fixes: daf8de0874ab5b ("drm/amdgpu: always reset the asic in suspend (v2)")
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b536cf3eb6f949f8bedae7b26713e7ffec13b89b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/amdkfd: Create file descriptor after client is added to smi_clients list
Lee Jones [Thu, 31 Mar 2022 12:21:17 +0000 (13:21 +0100)]
drm/amdkfd: Create file descriptor after client is added to smi_clients list

BugLink: https://bugs.launchpad.net/bugs/1969107
commit e79a2398e1b2d47060474dca291542368183bc0f upstream.

This ensures userspace cannot prematurely clean-up the client before
it is fully initialised which has been proven to cause issues in the
past.

Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3c8902bbf2ab5a15443f3daa73e8da18e7792172)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/nouveau/pmu: Add missing callbacks for Tegra devices
Karol Herbst [Tue, 22 Mar 2022 12:48:00 +0000 (13:48 +0100)]
drm/nouveau/pmu: Add missing callbacks for Tegra devices

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 38d4e5cf5b08798f093374e53c2f4609d5382dd5 upstream.

Fixes a crash booting on those platforms with nouveau.

Fixes: 4cdd2450bf73 ("drm/nouveau/pmu/gm200-: use alternate falcon reset sequence")
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v5.17+
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220322124800.2605463-1-kherbst@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 588393cdae7f6462367cd79e281c71670f20091d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/amdgpu/vcn: Fix the register setting for vcn1
Emily Deng [Mon, 21 Mar 2022 08:25:24 +0000 (16:25 +0800)]
drm/amdgpu/vcn: Fix the register setting for vcn1

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 02fc996d5098f4c3f65bdf6cdb6b28e3f29ba789 upstream.

Correct the code error for setting register UVD_GFX10_ADDR_CONFIG.
Need to use inst_idx, or it only will set VCN0.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 6a5d209898a605c31c26dbd2b002529e37ff0c6e)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/amdgpu/smu10: fix SoC/fclk units in auto mode
Alex Deucher [Fri, 1 Apr 2022 15:08:48 +0000 (11:08 -0400)]
drm/amdgpu/smu10: fix SoC/fclk units in auto mode

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 2f25d8ce09b7ba5d769c132ba3d4eb84a941d2cb upstream.

SMU takes clock limits in Mhz units.  socclk and fclk were
using 10 khz units in some cases.  Switch to Mhz units.
Fixes higher than required SoC clocks.

Fixes: 97cf32996c46d9 ("drm/amd/pm: Removed fixed clock in auto mode DPM")
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 155338be5d9078a569a723d8695b501ab369bdf9)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/amdgpu/display: change pipe policy for DCN 2.1
Benjamin Marty [Wed, 23 Mar 2022 21:08:26 +0000 (22:08 +0100)]
drm/amdgpu/display: change pipe policy for DCN 2.1

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 879791ad8bf3dc5453061cad74776a617b6e3319 upstream.

Fixes crash on MST Hub disconnect.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1849
Fixes: ee2698cf79cc ("drm/amd/display: Changed pipe split policy to allow for multi-display pipe split")
Signed-off-by: Benjamin Marty <info@benjaminmarty.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 0115e4f2f6bc984bc8fdba41ada55f586dc28502)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>