platform/kernel/linux-starfive.git
21 months agoiio: add modifiers for linear acceleration
Andrea Merello [Wed, 7 Sep 2022 13:21:52 +0000 (15:21 +0200)]
iio: add modifiers for linear acceleration

Add IIO_MOD_LINEAR_X, IIO_MOD_LINEAR_Y and IIO_MOD_LINEAR_Z modifiers to te
IIO core, which is preparatory for adding the Bosch BNO055 IMU driver.

Bosch BNO055 IMU can report raw accelerations (among x, y and z axis) as
well as the so called "linear accelerations" (again, among x, y and z axis)
which is basically the acceleration after subtracting gravity and for which
those new modifiers are for.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-2-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: dps310: Reset chip after timeout
Eddie James [Thu, 15 Sep 2022 19:57:19 +0000 (14:57 -0500)]
iio: pressure: dps310: Reset chip after timeout

The DPS310 chip has been observed to get "stuck" such that pressure
and temperature measurements are never indicated as "ready" in the
MEAS_CFG register. The only solution is to reset the device and try
again. In order to avoid continual failures, use a boolean flag to
only try the reset after timeout once if errors persist.

Fixes: ba6ec48e76bc ("iio: Add driver for Infineon DPS310")
Cc: <stable@vger.kernel.org>
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220915195719.136812-3-eajames@linux.ibm.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: dps310: Refactor startup procedure
Eddie James [Thu, 15 Sep 2022 19:57:18 +0000 (14:57 -0500)]
iio: pressure: dps310: Refactor startup procedure

Move the startup procedure into a function, and correct a missing
check on the return code for writing the PRS_CFG register.

Cc: <stable@vger.kernel.org>
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220915195719.136812-2-eajames@linux.ibm.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agodt-bindings: iio: adi,ad7923: add adi,range-double property
Nuno Sá [Mon, 12 Sep 2022 08:12:23 +0000 (10:12 +0200)]
dt-bindings: iio: adi,ad7923: add adi,range-double property

Document the new property to enable doubling the analog input range.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220912081223.173584-4-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: adc: ad7923: support extended range
Nuno Sá [Mon, 12 Sep 2022 08:12:22 +0000 (10:12 +0200)]
iio: adc: ad7923: support extended range

By default the driver was always setting the RANGE bit which means that
the analog input goes from 0 to VREF. However, we might want to have 0
to 2xVREF. This change adds a new Firmware property to allow for the
extended range while keeping the default behavior if nothing is provided.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220912081223.173584-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: adc: ad7923: fix channel readings for some variants
Nuno Sá [Mon, 12 Sep 2022 08:12:21 +0000 (10:12 +0200)]
iio: adc: ad7923: fix channel readings for some variants

Some of the supported devices have 4 or 2 LSB trailing bits that should
not be taken into account. Hence we need to shift these bits out which
fits perfectly on the scan type shift property. This change fixes both
raw and buffered reads.

Fixes: f2f7a449707e ("iio:adc:ad7923: Add support for the ad7904/ad7914/ad7924")
Fixes: 851644a60d20 ("iio: adc: ad7923: Add support for the ad7908/ad7918/ad7928")
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220912081223.173584-2-nuno.sa@analog.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: adc: stm32-adc: add id registers support
Olivier Moysan [Thu, 15 Sep 2022 13:54:52 +0000 (15:54 +0200)]
iio: adc: stm32-adc: add id registers support

Add support of identification registers to STM32 ADC.

By default the ADC hardware instance number is retrieved from
the compatible configuration data. Get the available ADC number
per ADC block, from hardware configuration register,
when this register exists.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20220915135452.1712453-1-olivier.moysan@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agodt-bindings: iio: imu: st_lsm6dsx: add lsm6dstx device bindings
Lorenzo Bianconi [Thu, 15 Sep 2022 17:35:00 +0000 (19:35 +0200)]
dt-bindings: iio: imu: st_lsm6dsx: add lsm6dstx device bindings

Add device bindings for lsm6dstx IMU sensor.
Use lsm6dst as fallback device for lsm6dstx since it implements all the
features currently supported by lsm6dstx.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/dadc2acf88b0b73feac9a8980ad9af1658297bc1.1663262890.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: imu: st_lsm6dsx: add support to LSM6DSTX
Lorenzo Bianconi [Thu, 15 Sep 2022 17:34:59 +0000 (19:34 +0200)]
iio: imu: st_lsm6dsx: add support to LSM6DSTX

Add support to STM LSM6DSTX (acc + gyro) Mems sensor.
The LSM6DSTX sensor can use LSM6DST as fallback device since it
implements all the LSM6DSTX features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/lsm6dstx.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/573a232b0f320b2ec92c56fa24393cfb275183fb.1663262890.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agodrivers: iio: adc: ltc2497: Rename the LTC2499 iio device
Ciprian Regus [Fri, 16 Sep 2022 14:09:22 +0000 (17:09 +0300)]
drivers: iio: adc: ltc2497: Rename the LTC2499 iio device

Set the iio device's name based on the chip used for the
LTC2499 only. The most common way for IIO clients to interact
with a device is to address it based on it's name. By using
the dev_name() function, the name will be set based on a
i2c_client's kobj name, which has the format i2c_instance-i2c_address
(1-0076 for example). This is not ideal, since it makes a
requirement for userspace to have knowledge about the hardware
connections of the device.

The name field is set to NULL for the LTC2497 and LTC2496, so
that the old name can kept as it is, since changing it will
result in an ABI breakage.

Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Link: https://lore.kernel.org/r/20220916140922.2506248-6-ciprian.regus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agodrivers: iio: adc: ltc2497: LTC2499 support
Ciprian Regus [Fri, 16 Sep 2022 14:09:21 +0000 (17:09 +0300)]
drivers: iio: adc: ltc2497: LTC2499 support

The LTC2499 is a 16-channel (eight differential), 24-bit,
ADC with Easy Drive technology and a 2-wire, I2C interface.

Implement support for the LTC2499 ADC by extending the LTC2497
driver. A new chip_info struct is added to differentiate between
chip types and resolutions when reading data from the device.

Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/2499fe.pdf
Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Link: https://lore.kernel.org/r/20220916140922.2506248-5-ciprian.regus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoAdd MAINTAINERS entries for LTC2497 and LTC2496
Ciprian Regus [Fri, 16 Sep 2022 14:09:20 +0000 (17:09 +0300)]
Add MAINTAINERS entries for LTC2497 and LTC2496

Update the MAINTAINERS file to include the path for the LTC2497
and LTC2496 devicetree bindings documentation.

Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Link: https://lore.kernel.org/r/20220916140922.2506248-4-ciprian.regus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agodt-bindings: iio: adc: Add docs for LTC2499
Ciprian Regus [Fri, 16 Sep 2022 14:09:19 +0000 (17:09 +0300)]
dt-bindings: iio: adc: Add docs for LTC2499

Update the bindings documentation for ltc2497 to include the ltc2499.

Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220916140922.2506248-3-ciprian.regus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoMAINTAINERS: Remove duplicate matching entry
Ciprian Regus [Fri, 16 Sep 2022 14:09:18 +0000 (17:09 +0300)]
MAINTAINERS: Remove duplicate matching entry

Remove the specific entry for ad5758, since
Documentation/devicetree/bindings/iio/*/adi,* already matches
the path.

Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Link: https://lore.kernel.org/r/20220916140922.2506248-2-ciprian.regus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: ltc2497: Fix reading conversion results
Uwe Kleine-König [Mon, 15 Aug 2022 09:16:47 +0000 (09:16 +0000)]
iio: ltc2497: Fix reading conversion results

After the result of the previous conversion is read the chip
automatically starts a new conversion and doesn't accept new i2c
transfers until this conversion is completed which makes the function
return failure.

So add an early return iff the programming of the new address isn't
needed. Note this will not fix the problem in general, but all cases
that are currently used. Once this changes we get the failure back, but
this can be addressed when the need arises.

Fixes: 69548b7c2c4f ("iio: adc: ltc2497: split protocol independent part in a separate module ")
Reported-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Denys Zagorui <dzagorui@cisco.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220815091647.1523532-1-dzagorui@cisco.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: bmp280: Add more tunable config parameters for BMP380
Angel Iglesias [Mon, 12 Sep 2022 23:54:42 +0000 (01:54 +0200)]
iio: pressure: bmp280: Add more tunable config parameters for BMP380

Allows sampling frequency and IIR filter coefficients configuration
using sysfs ABI.

The IIR filter coefficient is configurable using the sysfs attribute
"filter_low_pass_3db_frequency".

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/876f8a2277f71672488e99aa02aae4239d530f51.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agodt-bindings: iio: pressure: bmp085: Add BMP380 compatible string
Angel Iglesias [Mon, 12 Sep 2022 23:53:50 +0000 (01:53 +0200)]
dt-bindings: iio: pressure: bmp085: Add BMP380 compatible string

Add bosch,bmp380 compatible string for the new family of sensors.
This family includes the BMP380, BMP384 and BMP388. The register map
in this family changes substantially and introduces new features
but core concepts and operations carryover from the previous iterations

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/67224da4ae308bb752fc8fdecc54345cedab6c21.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: bmp280: Add support for BMP380 sensor family
Angel Iglesias [Mon, 12 Sep 2022 23:52:13 +0000 (01:52 +0200)]
iio: pressure: bmp280: Add support for BMP380 sensor family

Adds compatibility with the new generation of this sensor, the BMP380.

Includes basic sensor initialization to do pressure and temp
measurements and allows tuning oversampling settings for each channel.

The compensation algorithms are adapted from the device datasheet and
the repository https://github.com/BoschSensortec/BMP3-Sensor-API.

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/f1da2a2f1bc5bb083f318335c23b4f3d9bb8e536.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: bmp280: reorder i2c device tables declarations
Angel Iglesias [Mon, 12 Sep 2022 23:50:07 +0000 (01:50 +0200)]
iio: pressure: bmp280: reorder i2c device tables declarations

Change device tables declarations to forward order like in SPI codepath.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/a3969b60e428b9bd29ea1ebc6dd69aa5bbe59da0.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: bmp280: Fix alignment for DMA safety
Angel Iglesias [Mon, 12 Sep 2022 23:48:21 +0000 (01:48 +0200)]
iio: pressure: bmp280: Fix alignment for DMA safety

Adds DMA-safe buffers to driver data struct to store raw data from sensors

The multiple buffers used thorough the driver share the same memory
allocated as part of the device data instance. The union containing
the buffers is aligned to allow safe usage with DMA operations, such
as regmap bulk read calls.

Updated measurement and calibration reading functions to use the safe
DMA buffers.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/7919793f7f63224d5ce413c66d648029683c17ac.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: bmp280: simplify driver initialization logic
Angel Iglesias [Mon, 12 Sep 2022 23:47:31 +0000 (01:47 +0200)]
iio: pressure: bmp280: simplify driver initialization logic

Simplified common initialization logic of different sensor types
unifying calibration and initial configuration recovery.

Default config param values of each sensor type are stored inside
chip_info structure and used to initialize sensor data struct instance.

The helper functions for read each sensor type calibration are converted
to a callback available on the chip_info struct.

Separated bme280 specific calibration code from bmp280 function. Dropped
the additional chip_id argument in bmp280 code as is not longer required.
Now both bmp280/bme280 calibration function use same signature as bmp180.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/584c90f309e4f24bf2e4aa2b15c8577d288f978d.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: bmp280: Simplify bmp280 calibration data reading
Angel Iglesias [Mon, 12 Sep 2022 23:46:42 +0000 (01:46 +0200)]
iio: pressure: bmp280: Simplify bmp280 calibration data reading

On bmp280 and bme280, the temperature and pressure calibration parameters
are available on a contiguous memory region. Considering this arrangement,
simplified the calibration reading function by using only one buffer
to read in batch temperature and pressure registers.

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/96d81282c95006d857f4d836d2ff3ee0740a85a0.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: bmp280: use FIELD_GET, FIELD_PREP and GENMASK
Angel Iglesias [Mon, 12 Sep 2022 23:45:49 +0000 (01:45 +0200)]
iio: pressure: bmp280: use FIELD_GET, FIELD_PREP and GENMASK

Cleaned and simplified register values construction and extraction
converting to use FIELD_PREP and FIELD_GET macros.

Replaced hardcoded bit masks with GENMASK macro.

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/3cbe56f29c2a46bc5dc23c5b72e1b43c9207f44d.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: bmp280: reorder local variables following reverse xmas tree
Angel Iglesias [Mon, 12 Sep 2022 23:44:52 +0000 (01:44 +0200)]
iio: pressure: bmp280: reorder local variables following reverse xmas tree

Reordered definitions of local variables following the reverse christmas
tree convention.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/363a106afbfe30ce590b80b1494c8b3322870f8a.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: dac: ad5593r: add check for i2c functionality
Nuno Sá [Tue, 13 Sep 2022 07:34:13 +0000 (09:34 +0200)]
iio: dac: ad5593r: add check for i2c functionality

Make sure that the needed i2c functionality is supported during probe.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Link: https://lore.kernel.org/r/20220913073413.140475-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: dac: ad5593r: Fix i2c read protocol requirements
Michael Hennerich [Tue, 13 Sep 2022 07:34:12 +0000 (09:34 +0200)]
iio: dac: ad5593r: Fix i2c read protocol requirements

For reliable operation across the full range of supported
interface rates, the AD5593R needs a STOP condition between
address write, and data read (like show in the datasheet Figure 40)
so in turn i2c_smbus_read_word_swapped cannot be used.

While at it, a simple helper was added to make the code simpler.

Fixes: 56ca9db862bf ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs")
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220913073413.140475-2-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: temperature: mlx90614 Refactoring available filter attributes
Crt Mori [Tue, 6 Sep 2022 11:26:32 +0000 (13:26 +0200)]
iio: temperature: mlx90614 Refactoring available filter attributes

Change/refactor to the new way of defining available attribute values.

Signed-off-by: Crt Mori <cmo@melexis.com>
Link: https://lore.kernel.org/r/20220906112632.244453-1-cmo@melexis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agodrivers: iio: accel: adxl312 and adxl314 support
George Mois [Mon, 5 Sep 2022 13:20:18 +0000 (16:20 +0300)]
drivers: iio: accel: adxl312 and adxl314 support

ADXL312 and ADXL314 are small, thin, low power, 3-axis accelerometers
with high resolution (13-bit) measurement up to +/-12 g and +/- 200 g
respectively.

Implement support for ADXL312 and ADXL314 by extending the ADXL313
driver.

Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL312.pdf
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL314.pdf
Signed-off-by: George Mois <george.mois@analog.com>
Link: https://lore.kernel.org/r/20220905132018.364900-2-george.mois@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agodt-bindings: iio: accel: adxl313: Add compatibles for adxl312 and adxl314
George Mois [Mon, 5 Sep 2022 13:20:17 +0000 (16:20 +0300)]
dt-bindings: iio: accel: adxl313: Add compatibles for adxl312 and adxl314

Extend the adi,adxl313.yaml file with information regrding the
ADXL312 and ADXL314 devices.

Signed-off-by: George Mois <george.mois@analog.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220905132018.364900-1-george.mois@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: bmp280: fix datasheet links
Angel Iglesias [Mon, 12 Sep 2022 22:26:44 +0000 (00:26 +0200)]
iio: pressure: bmp280: fix datasheet links

Updated links for BMP280 and BME280 datasheets on Bosch website.
Datasheet of BMP180 is no longer available on the manufacturer's website,
changed the link to a copy hosted by a third party.

Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/20220912222645.377874-1-ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoiio: pressure: st_pressure: Add support for LPS22DF
Martyn Welch [Fri, 9 Sep 2022 16:16:10 +0000 (17:16 +0100)]
iio: pressure: st_pressure: Add support for LPS22DF

Add support for ST LPS22DF pressure sensor.

Datasheet: https://www.st.com/resource/en/datasheet/lps22df.pdf
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Link: https://lore.kernel.org/r/20220909161611.780720-2-martyn.welch@collabora.co.uk
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agodt-bindings: iio: st,st-sensors add LPS22DF.
Martyn Welch [Fri, 9 Sep 2022 16:16:09 +0000 (17:16 +0100)]
dt-bindings: iio: st,st-sensors add LPS22DF.

Add support for the ST LPS22DF, an I2C/SPI pressure sensor.

Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220909161611.780720-1-martyn.welch@collabora.co.uk
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
21 months agoMerge tag 'coresight-next-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Wed, 21 Sep 2022 14:16:03 +0000 (16:16 +0200)]
Merge tag 'coresight-next-v6.1' of git://git./linux/kernel/git/coresight/linux into char-misc-next

Suzuki writes:
  "coresight: Changes for v6.1

   Coresight trace subsystem updates for v6.1 includes:
     - Support for HiSilicon PTT trace
     - Coresight cleanup of sysfs accessor functions, reduced
       code size.
     - Expose coresight timestamp source for ETMv4+
     - DT binding updates to include missing properties
     - Minor documentation, Kconfig text fixes.

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>"
* tag 'coresight-next-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux:
  hwtracing: hisi_ptt: Fix up for "iommu/dma: Make header private"
  MAINTAINERS: Add maintainer for HiSilicon PTT driver
  docs: trace: Add HiSilicon PTT device driver documentation
  hwtracing: hisi_ptt: Add tune function support for HiSilicon PCIe Tune and Trace device
  hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device
  iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity
  coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused
  coresight: Make new csdev_access offsets unsigned
  coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors
  coresight: Re-use same function for similar sysfs register accessors
  coresight: Simplify sysfs accessors by using csdev_access abstraction
  coresight: Remove unused function parameter
  coresight: etm4x: docs: Add documentation for 'ts_source' sysfs interface
  coresight: etm4x: Expose default timestamp source in sysfs
  dt-bindings: arm: coresight-tmc: Add 'iommu' property
  dt-bindings: arm: coresight: Add 'power-domains' property
  coresight: docs: Fix a broken reference
  coresight: trbe: fix Kconfig "its" grammar

21 months agoMerge tag 'iio-for-6.1a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Wed, 21 Sep 2022 14:04:24 +0000 (16:04 +0200)]
Merge tag 'iio-for-6.1a' of https://git./linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

1st set of IIO new device support, features and cleanup for 6.1

This includes Nuno Sa's work to move the IIO core over to generic firmware
properties rather than having DT specific code paths. Combined with Andy
Shevchenko's long term work on drivers, this leaves IIO in a good state for
handling other firmware types.

New device support
- liteon,ltrf216a
  * New driver and dt bindings to support this Light sensor.
- maxim,max11205
  * New driver for this 16bit single channel ADC.
- memsensing,msa311
  * New driver for this accelerometer. Includes a string helper for read/write.
- richtek,rtq6056
  * New driver and dt binding to support this current monitor used to measure
    power usage.
- yamaha,yas530
  * Support the YAS537 variant (series includes several fixes for other parts
    and new driver features).

Staging graduation
- adi,ad7746 CDC. Cleanup conducted against set of roadtest tests using
  the posted RFC of that framework.

Features
- core
  * Large rework to make all the core IIO code use generic firmware properties.
    Includes switching some drivers over as well using newly provided
    generic interfaces and allowing removal of DT specific ones.
  * Support for gesture event types for single and double tap. Used in
    bosch,bma400.
- atmel,at91-sama5d2
  * Add support for temperature sensor which uses two muxed inputs to estimate
    the temperature.
  * Handle trackx bits of EMR register to improve temp sampling accuracy.
  * Runtime PM support.
- liteon,ltrf216a
  * Add a _raw channel output to allow working around an issue with
    differing conversions equations that breaks some user space controls.
- mexelis,mlx90632
  * Support regulator control.
- ti,tsc2046
  * External reference voltage support.

Clean up and minor fixes
- Tree-wide
  * devm_clk_get_enabled() replacements of opencoded equivalent.
  * Remaining IIO_DMA_MINALIGN conversions (the staging/iio drivers).
  * Various minor warning and similar cleanup such as missing static
    markings.
  * strlcpy() to strscpy() for cases where return value not checked.
  * provide units.h entries for more HZ units and use them in drivers.
- dt-bindings cleanup
  * Drop maintainers listss where the email address is bouncing.
  * Switch spi devices over to using spi-peripheral.yaml
  * Add some missing unevaluatedProperties / additionalProperties: false
    entries.
- ABI docs
  * Add some missing channel type specific sampling frequency entries.
  * Add parameter names for callback parameters.
- MAINTAINERS
  * Fix wrong ADI forum links.
- core
  * lockdep class per device, to avoid an issue with nest when one IIO
    device is the consumer of another.
  * White space tweaks.
- asc,dlhl60d
  * Use get_unaligned_be24 to avoid some unusual data manipulation and masking.
- atmel,at91-sama5d2
  * Fix wrong max value.
  * Improve error handling when measuring pressure and touch.
  * Add locks to remove races on updating oversampling / sampling freq.
  * Add missing calls in suspend and resume path to ensure state is correctly
    brought up if buffered capture was in use when suspend happened.
  * Error out of write_raw() callback if buffered capture enabled to avoid
    unpredictable behavior.
  * Handle different versions having different oversampling ratio support and
    drop excess error checking.
  * Cleanup magic value defines where the name is just the value and hence
    hurts readability.
  * Use read_avail() callback to provide info on possible oversampling ratios.
  * Correctly handle variable bit depth when doing oversampling on different
    supported parts. Also handle higher oversampling ratios.
- fsl,imx8qxp
  * Don't ignore errors from regulator_get_voltage() so as to avoid some
    very surprising scaling.
- invensense,icp10100
  * Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS. UNIVERSAL rarely made
    sense and is now deprecated. In this driver we just avoid double disabling
    in some paths.
- maxim,max1363
  * Drop consumer channel map provision by platform data. There have been
    better ways of doing this for years and there are no in tree users.
- microchip,mcp3911
  * Update status to maintained.
- qcom,spmi-adc5
  * Support measurement of LDO output voltage.
- qcom,spmi-adc
  * Add missing channel available on SM6125 SoC.
- st,stmpe
  * Drop requirement on node name in binding now that driver correctly
    doesn't enforce it.
- stx104
  * Move to more appropriate addac directory
- ti,am335x
  * Document ti,am654-adc compatible already in use in tree.
- ti,hmc5843
  * Move dev_pm_ops out of header and use new pm macros to handle export.
- yamaha,yas530
  * Minor cleanups.

* tag 'iio-for-6.1a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (142 commits)
  iio: pressure: icp10100: Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS().
  iio: adc: max1363: Drop provision to provide an IIO channel map via platform data
  iio: accel: bma400: Add support for single and double tap events
  iio: Add new event type gesture and use direction for single and double tap
  iio: Use per-device lockdep class for mlock
  iio: adc: add max11205 adc driver
  dt-bindings: iio: adc: Add max11205 documentation file
  iio: magnetometer: yamaha-yas530: Use dev_err_probe()
  iio: magnetometer: yamaha-yas530: Make strings const in chip info
  iio: magnetometer: yamaha-yas530: Use pointers as driver data
  iio: adc: tsc2046: silent spi_device_id warning
  iio: adc: tsc2046: add vref support
  dt-bindings: iio: adc: ti,tsc2046: add vref-supply property
  iio: light: ltrf216a: Add raw attribute
  dt-bindings: iio: Add missing (unevaluated|additional)Properties on child nodes
  MAINTAINERS: fix Analog Devices forum links
  iio/accel: fix repeated words in comments
  dt-bindings: iio: accel: add dt-binding schema for msa311 accel driver
  iio: add MEMSensing MSA311 3-axis accelerometer driver
  dt-bindings: vendor-prefixes: add MEMSensing Microsystems Co., Ltd.
  ...

21 months agoMerge tag 'mhi-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi...
Greg Kroah-Hartman [Wed, 21 Sep 2022 13:43:35 +0000 (15:43 +0200)]
Merge tag 'mhi-for-v6.1' of git://git./linux/kernel/git/mani/mhi into char-misc-next

Manivannan writes:
  "MHI Host
   --------

   - Print the modem name while probing the MHI host pci-generic driver. This has
     been exposed as a debug information so far but on a low storate embedded
     devices such as OpenWRT based products, this helps in identifying the
     attached modem without enabling the debug logs."

* tag 'mhi-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi:
  bus: mhi: host: always print detected modem name

21 months agoMerge tag 'fpga-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga...
Greg Kroah-Hartman [Wed, 21 Sep 2022 13:42:42 +0000 (15:42 +0200)]
Merge tag 'fpga-for-6.1-rc1' of git://git./linux/kernel/git/fpga/linux-fpga into char-misc-next

Xu writes:

FPGA Manager changes for 6.1-rc1

DFL

- Matthew's change adds new device IDs supported by DFL.
- Dan's change uses array_size() for memory allocation to prevent
potential overflow

Microchip

- Conor's change adds MODULE_AUTHOR entry for microchip-spi driver
- Krzysztof's change refines dt-bindings

Intel m10 bmc secure update

- Russ's change adds new device ID supported by the driver

All patches have been reviewed on the mailing list, and have been in the
last linux-next releases (as part of our for-next branch).

Signed-off-by: Xu Yilun <yilun.xu@intel.com>
* tag 'fpga-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga:
  fpga: m10bmc-sec: d5005 bmc secure update driver
  fpga: prevent integer overflow in dfl_feature_ioctl_set_irq()
  dt-bindings: fpga: microchip,mpf-spi-fpga-mgr: use spi-peripheral-props.yaml
  fpga: microchip-spi: add missing module author entry
  fpga: dfl-pci: Add IDs for Intel N6000, N6001 and C6100 cards

22 months agobus: mhi: host: always print detected modem name
Koen Vandeputte [Wed, 31 Aug 2022 10:03:49 +0000 (12:03 +0200)]
bus: mhi: host: always print detected modem name

This harmless print provides a very easy way of knowing
if the modem is detected properly during probing.

Promote it to an informational print so no hassle is required
enabling kernel debugging info to obtain it.

The rationale here is that:
On a lot of low-storage embedded devices, extensive kernel
debugging info is not always present as this would
increase it's size to much causing partition size issues.

Signed-off-by: Koen Vandeputte <koen.vandeputte@citymesh.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
Link: https://lore.kernel.org/r/20220831100349.1488762-1-koen.vandeputte@citymesh.com
[mani: added missing review tags]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
22 months agohwtracing: hisi_ptt: Fix up for "iommu/dma: Make header private"
Stephen Rothwell [Mon, 12 Sep 2022 16:03:59 +0000 (10:03 -0600)]
hwtracing: hisi_ptt: Fix up for "iommu/dma: Make header private"

drivers/hwtracing/ptt/hisi_ptt.c:13:10: fatal error: linux/dma-iommu.h: No such file or directory
   13 | #include <linux/dma-iommu.h>
      |          ^~~~~~~~~~~~~~~~~~~

Caused by:

  commit ff0de066b463 ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device")

interacting with:

  commit f2042ed21da7 ("iommu/dma: Make header private")

from the iommu tree.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Yicong Yang <yangyicong@hisilicon.com>
[Fixed subject line and added changelog text]
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
22 months agofpga: m10bmc-sec: d5005 bmc secure update driver
Russ Weight [Fri, 2 Sep 2022 16:57:06 +0000 (09:57 -0700)]
fpga: m10bmc-sec: d5005 bmc secure update driver

Add a driver name for the D5005 BMC secure update driver. Different
driver names are used for the N3000 and D5005 devices because future
changes will add conditional code based on the device type (N3000
vs D5005). This change enables D5005 secure updates of BCM images,
BMC firmware, static-region images, etc.

Signed-off-by: Russ Weight <russell.h.weight@intel.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20220902165706.518074-3-russell.h.weight@intel.com
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
22 months agocomedi: convert sysfs snprintf to sysfs_emit
Xuezhi Zhang [Thu, 1 Sep 2022 01:34:23 +0000 (09:34 +0800)]
comedi: convert sysfs snprintf to sysfs_emit

Follow the advice of the Documentation/filesystems/sysfs.rst
and show() should only use sysfs_emit() or sysfs_emit_at()
when formatting the value to be returned to user space.

Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
Link: https://lore.kernel.org/r/20220901013423.418464-1-zhangxuezhi3@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: pci_endpoint_test: Fix pci_endpoint_test_{copy,write,read}() panic
Shunsuke Mie [Wed, 7 Sep 2022 02:01:00 +0000 (11:01 +0900)]
misc: pci_endpoint_test: Fix pci_endpoint_test_{copy,write,read}() panic

The dma_map_single() doesn't permit zero length mapping. It causes a follow
panic.

A panic was reported on arm64:

[   60.137988] ------------[ cut here ]------------
[   60.142630] kernel BUG at kernel/dma/swiotlb.c:624!
[   60.147508] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[   60.152992] Modules linked in: dw_hdmi_cec crct10dif_ce simple_bridge rcar_fdp1 vsp1 rcar_vin videobuf2_vmalloc rcar_csi2 v4l
2_mem2mem videobuf2_dma_contig videobuf2_memops pci_endpoint_test videobuf2_v4l2 videobuf2_common rcar_fcp v4l2_fwnode v4l2_asyn
c videodev mc gpio_bd9571mwv max9611 pwm_rcar ccree at24 authenc libdes phy_rcar_gen3_usb3 usb_dmac display_connector pwm_bl
[   60.186252] CPU: 0 PID: 508 Comm: pcitest Not tainted 6.0.0-rc1rpci-dev+ #237
[   60.193387] Hardware name: Renesas Salvator-X 2nd version board based on r8a77951 (DT)
[   60.201302] pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   60.208263] pc : swiotlb_tbl_map_single+0x2c0/0x590
[   60.213149] lr : swiotlb_map+0x88/0x1f0
[   60.216982] sp : ffff80000a883bc0
[   60.220292] x29: ffff80000a883bc0 x28: 0000000000000000 x27: 0000000000000000
[   60.227430] x26: 0000000000000000 x25: ffff0004c0da20d0 x24: ffff80000a1f77c0
[   60.234567] x23: 0000000000000002 x22: 0001000040000010 x21: 000000007a000000
[   60.241703] x20: 0000000000200000 x19: 0000000000000000 x18: 0000000000000000
[   60.248840] x17: 0000000000000000 x16: 0000000000000000 x15: ffff0006ff7b9180
[   60.255977] x14: ffff0006ff7b9180 x13: 0000000000000000 x12: 0000000000000000
[   60.263113] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
[   60.270249] x8 : 0001000000000010 x7 : ffff0004c6754b20 x6 : 0000000000000000
[   60.277385] x5 : ffff0004c0da2090 x4 : 0000000000000000 x3 : 0000000000000001
[   60.284521] x2 : 0000000040000000 x1 : 0000000000000000 x0 : 0000000040000010
[   60.291658] Call trace:
[   60.294100]  swiotlb_tbl_map_single+0x2c0/0x590
[   60.298629]  swiotlb_map+0x88/0x1f0
[   60.302115]  dma_map_page_attrs+0x188/0x230
[   60.306299]  pci_endpoint_test_ioctl+0x5e4/0xd90 [pci_endpoint_test]
[   60.312660]  __arm64_sys_ioctl+0xa8/0xf0
[   60.316583]  invoke_syscall+0x44/0x108
[   60.320334]  el0_svc_common.constprop.0+0xcc/0xf0
[   60.325038]  do_el0_svc+0x2c/0xb8
[   60.328351]  el0_svc+0x2c/0x88
[   60.331406]  el0t_64_sync_handler+0xb8/0xc0
[   60.335587]  el0t_64_sync+0x18c/0x190
[   60.339251] Code: 52800013 d2e00414 35fff45c d503201f (d4210000)
[   60.345344] ---[ end trace 0000000000000000 ]---

To fix it, this patch adds a checking the payload length if it is zero.

Fixes: 343dc693f7b7 ("misc: pci_endpoint_test: Prevent some integer overflows")
Cc: stable <stable@kernel.org>
Signed-off-by: Shunsuke Mie <mie@igel.co.jp>
Link: https://lore.kernel.org/r/20220907020100.122588-2-mie@igel.co.jp
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: pci_endpoint_test: Aggregate params checking for xfer
Shunsuke Mie [Wed, 7 Sep 2022 02:00:59 +0000 (11:00 +0900)]
misc: pci_endpoint_test: Aggregate params checking for xfer

Each transfer test functions have same parameter checking code. This patch
unites those to an introduced function.

Signed-off-by: Shunsuke Mie <mie@igel.co.jp>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/20220907020100.122588-1-mie@igel.co.jp
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc/xilinx_sdfec: Replace kmap() with kmap_local_page()
Fabio M. De Francesco [Thu, 1 Sep 2022 15:44:08 +0000 (17:44 +0200)]
misc/xilinx_sdfec: Replace kmap() with kmap_local_page()

kmap() is being deprecated in favor of kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead as
the mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when the
kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again, the
kernel virtual addresses are restored and still valid.

Since its use in xilinx_sdfec.c is safe, replace kmap()i / kunmap() with
kmap_local_page() / kunmap_local().

Cc: "Venkataramanan, Anirudh" <anirudh.venkataramanan@intel.com>
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220901154408.23984-3-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc/xilinx_sdfec: Call kunmap() on pages mapped with kmap()
Fabio M. De Francesco [Thu, 1 Sep 2022 15:44:07 +0000 (17:44 +0200)]
misc/xilinx_sdfec: Call kunmap() on pages mapped with kmap()

Pages in an array are mapped in a loop but, after the code is done with
the virtual addresses, these pages are never unmapped.

Therefore, call kunmap() to unmap pages[i].

Cc: "Venkataramanan, Anirudh" <anirudh.venkataramanan@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220901154408.23984-2-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc/vmw_vmci: Use kmap_local_page() in vmci_queue_pair.c
Fabio M. De Francesco [Thu, 1 Sep 2022 13:57:14 +0000 (15:57 +0200)]
misc/vmw_vmci: Use kmap_local_page() in vmci_queue_pair.c

kmap() is being deprecated in favor of kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead as
the mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when the
kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again, the
kernel virtual addresses are restored and still valid.

Since its use in vmci_queue_pair.c is safe everywhere, replace kmap() with
kmap_local_page().

Cc: "Venkataramanan, Anirudh" <anirudh.venkataramanan@intel.com>
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220901135714.16481-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agovirt: vbox: Remove unproper information
Jiasheng Jiang [Thu, 1 Sep 2022 14:46:19 +0000 (22:46 +0800)]
virt: vbox: Remove unproper information

When drivers are working properly, they are quiet.
Therefore, the vbg_info() should be removed.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220901144619.3550352-1-jiasheng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agovirt: vbox: convert to use dev_groups
Jiasheng Jiang [Thu, 1 Sep 2022 14:46:10 +0000 (22:46 +0800)]
virt: vbox: convert to use dev_groups

The driver core supports the ability to handle the creation and removal
of device-specific sysfs files in a race-free manner. Moreover, it can
guarantee the success of creation. Therefore, it should be better to
convert to use dev_groups.

Fixes: 0ba002bc4393 ("virt: Add vboxguest driver for Virtual Box Guest integration")
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220901144610.3550300-1-jiasheng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: use module_auxiliary_driver
Wei Yongjun [Wed, 7 Sep 2022 14:58:08 +0000 (14:58 +0000)]
misc: microchip: pci1xxxx: use module_auxiliary_driver

Use the module_auxiliary_driver() macro to make the code simpler
by eliminating module_init and module_exit calls.

Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.")
Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20220907145808.1789249-5-weiyongjun@huaweicloud.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: Add missing MODULE_DEVICE_TABLE
Wei Yongjun [Wed, 7 Sep 2022 14:58:07 +0000 (14:58 +0000)]
misc: microchip: pci1xxxx: Add missing MODULE_DEVICE_TABLE

This patch adds missing MODULE_DEVICE_TABLE definition which generates
correct modalias for automatic loading of this driver when it is built
as an external module.

Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.")
Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20220907145808.1789249-4-weiyongjun@huaweicloud.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: Make symbol 'pci1xxxx_gpio_auxiliary_id_table' static
Wei Yongjun [Wed, 7 Sep 2022 14:58:06 +0000 (14:58 +0000)]
misc: microchip: pci1xxxx: Make symbol 'pci1xxxx_gpio_auxiliary_id_table' static

The sparse tool complains as follows:

drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:409:34: warning:
 symbol 'pci1xxxx_gpio_auxiliary_id_table' was not declared. Should it be static?

This symbol is not used outside of mchp_pci1xxxx_gpio.c, so marks it static.

Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.")
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20220907145808.1789249-3-weiyongjun@huaweicloud.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: Fix missing spin_lock_init()
Wei Yongjun [Wed, 7 Sep 2022 14:58:05 +0000 (14:58 +0000)]
misc: microchip: pci1xxxx: Fix missing spin_lock_init()

The driver allocates the spinlock but not initialize it.
Use spin_lock_init() on it to initialize it correctly.

Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.")
Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20220907145808.1789249-2-weiyongjun@huaweicloud.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: fix error handling in gp_aux_bus_probe()
Wei Yongjun [Wed, 7 Sep 2022 14:58:04 +0000 (14:58 +0000)]
misc: microchip: pci1xxxx: fix error handling in gp_aux_bus_probe()

In some error handling path, resoures alloced may not released.
This patch fix them.

Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.")
Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20220907145808.1789249-1-weiyongjun@huaweicloud.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoMAINTAINERS: Add maintainer for HiSilicon PTT driver
Yicong Yang [Tue, 16 Aug 2022 11:44:14 +0000 (19:44 +0800)]
MAINTAINERS: Add maintainer for HiSilicon PTT driver

Add maintainer for driver and documentation of HiSilicon PTT device.

Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220816114414.4092-6-yangyicong@huawei.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
22 months agodocs: trace: Add HiSilicon PTT device driver documentation
Yicong Yang [Tue, 16 Aug 2022 11:44:13 +0000 (19:44 +0800)]
docs: trace: Add HiSilicon PTT device driver documentation

Document the introduction and usage of HiSilicon PTT device driver as well
as the sysfs attributes description provided by the driver.

Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
[Fixed month and kernel version]
Link: https://lore.kernel.org/r/20220816114414.4092-5-yangyicong@huawei.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
22 months agohwtracing: hisi_ptt: Add tune function support for HiSilicon PCIe Tune and Trace...
Yicong Yang [Tue, 16 Aug 2022 11:44:12 +0000 (19:44 +0800)]
hwtracing: hisi_ptt: Add tune function support for HiSilicon PCIe Tune and Trace device

Add tune function for the HiSilicon Tune and Trace device. The interface
of tune is exposed through sysfs attributes of PTT PMU device.

Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20220816114414.4092-4-yangyicong@huawei.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
22 months agohwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace...
Yicong Yang [Tue, 16 Aug 2022 11:44:11 +0000 (19:44 +0800)]
hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device

HiSilicon PCIe tune and trace device(PTT) is a PCIe Root Complex integrated
Endpoint(RCiEP) device, providing the capability to dynamically monitor and
tune the PCIe traffic and trace the TLP headers.

Add the driver for the device to enable the trace function. Register PMU
device of PTT trace, then users can use trace through perf command. The
driver makes use of perf AUX trace function and support the following
events to configure the trace:

- filter: select Root port or Endpoint to trace
- type: select the type of traced TLP headers
- direction: select the direction of traced TLP headers
- format: select the data format of the traced TLP headers

This patch initially add basic trace support of PTT device.

Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20220816114414.4092-3-yangyicong@huawei.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
22 months agoiommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity
Yicong Yang [Tue, 16 Aug 2022 11:44:10 +0000 (19:44 +0800)]
iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity

The DMA operations of HiSilicon PTT device can only work properly with
identical mappings. So add a quirk for the device to force the domain
as passthrough.

Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Link: https://lore.kernel.org/r/20220816114414.4092-2-yangyicong@huawei.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
22 months agoMAINTAINERS: Add a new entry for VMWARE VSOCK VMCI TRANSPORT DRIVER
Vishnu Dasa [Tue, 6 Sep 2022 17:27:22 +0000 (10:27 -0700)]
MAINTAINERS: Add a new entry for VMWARE VSOCK VMCI TRANSPORT DRIVER

Add a new entry for VMWARE VSOCK VMCI TRANSPORT DRIVER in the
MAINTAINERS file.

Acked-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
Link: https://lore.kernel.org/r/20220906172722.19862-4-vdasa@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoMAINTAINERS: Change status of some VMware drivers
Vishnu Dasa [Tue, 6 Sep 2022 17:27:21 +0000 (10:27 -0700)]
MAINTAINERS: Change status of some VMware drivers

Change the status from 'Maintained' to 'Supported' for VMWARE
BALLOON DRIVER, VMWARE PVRDMA DRIVER, VMWARE PVSCSI driver,
VMWARE VMCI DRIVER, VMWARE VMMOUSE SUBDRIVER and VMWARE VMXNET3
ETHERNET DRIVER.

This needs to be done to conform to the guidelines in [1].
Maintainers for these drivers are VMware employees.

[1] https://docs.kernel.org/process/maintainers.html

Acked-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
Link: https://lore.kernel.org/r/20220906172722.19862-3-vdasa@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoMAINTAINERS: Change VMware PVSCSI driver entry to upper case
Vishnu Dasa [Tue, 6 Sep 2022 17:27:20 +0000 (10:27 -0700)]
MAINTAINERS: Change VMware PVSCSI driver entry to upper case

Change 'VMware PVSCSI driver' entry to upper case.

This is a trivial change being done for uniformity.

Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
Link: https://lore.kernel.org/r/20220906172722.19862-2-vdasa@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agocoresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused
Nathan Chancellor [Thu, 1 Sep 2022 19:50:55 +0000 (12:50 -0700)]
coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused

When building without CONFIG_CORESIGHT_CTI_INTEGRATION_REGS, there is a
warning about coresight_cti_reg_store() being unused in the file:

  drivers/hwtracing/coresight/coresight-cti-sysfs.c:184:16: warning: 'coresight_cti_reg_store' defined but not used [-Wunused-function]
    184 | static ssize_t coresight_cti_reg_store(struct device *dev,
        |                ^~~~~~~~~~~~~~~~~~~~~~~

This is expected as coresight_cti_reg_store() is only used in the
coresight_cti_reg_rw macro, which is only used in a block guarded by
CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. Mark coresight_cti_reg_store() as
__maybe_unused to clearly indicate that the function may be unused
depending on the configuration.

Fixes: fbca79e55429 ("coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: James Clark <james.clark@arm.com>
Link: https://lore.kernel.org/r/20220901195055.1932340-1-nathan@kernel.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
22 months agobinder: fix binder_alloc kernel-doc warnings
Carlos Llamas [Tue, 6 Sep 2022 13:59:47 +0000 (13:59 +0000)]
binder: fix binder_alloc kernel-doc warnings

Update the kernel-doc section of struct binder_alloc to fix the
following warnings reported by ./scripts/kernel-doc:

  warning: Function parameter or member 'mutex' not described in 'binder_alloc'
  warning: Function parameter or member 'vma_addr' not described in 'binder_alloc'

No functional changes in this patch.

Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Acked-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20220906135948.3048225-4-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agobinder: remove binder_alloc_set_vma()
Carlos Llamas [Tue, 6 Sep 2022 13:59:46 +0000 (13:59 +0000)]
binder: remove binder_alloc_set_vma()

The mmap_locked asserts here are not needed since this is only called
back from the mmap stack in ->mmap() and ->close() which always acquire
the lock first. Remove these asserts along with binder_alloc_set_vma()
altogether since it's trivial enough to be consumed by callers.

Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20220906135948.3048225-3-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agobinder: rename alloc->vma_vm_mm to alloc->mm
Carlos Llamas [Tue, 6 Sep 2022 13:59:45 +0000 (13:59 +0000)]
binder: rename alloc->vma_vm_mm to alloc->mm

Rename ->vma_vm_mm to ->mm to reflect the fact that we no longer cache
this reference from vma->vm_mm but from current->mm instead.

No functional changes in this patch.

Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Acked-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20220906135948.3048225-2-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: fix dependency issues in building the pci1xxxx's aux bus...
Kumaravel Thiagarajan [Tue, 6 Sep 2022 12:49:51 +0000 (18:19 +0530)]
misc: microchip: pci1xxxx: fix dependency issues in building the pci1xxxx's aux bus driver.

build errors and warnings listed below and reported by kernel
test robot <lkp@intel.com> on the char-misc-next branch are
fixed in this add-on patch.

errors:
  ERROR: modpost: "auxiliary_device_init" [drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.ko] undefined!
  ERROR: modpost: "__auxiliary_device_add" [drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.ko] undefined!
  ERROR: modpost: "auxiliary_driver_unregister" [drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.ko] undefined!
  ERROR: modpost: "__auxiliary_driver_register" [drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.ko] undefined!
  ia64-linux-ld: drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.o: in function `gp_aux_bus_probe.part.0':
  mchp_pci1xxxx_gp.c:(.text+0x342): undefined reference to `auxiliary_device_init'
  ia64-linux-ld: mchp_pci1xxxx_gp.c:(.text+0x392): undefined reference to `__auxiliary_device_add'
  ia64-linux-ld: mchp_pci1xxxx_gp.c:(.text+0x5c2): undefined reference to `auxiliary_device_init'
  ia64-linux-ld: mchp_pci1xxxx_gp.c:(.text+0x612): undefined reference to `__auxiliary_device_add'
  ia64-linux-ld: drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.o: in function `pci1xxxx_gpio_driver_init':
  mchp_pci1xxxx_gpio.c:(.init.text+0x42): undefined reference to `__auxiliary_driver_register'

warnings:
  unmet direct dependencies detected for GPIOLIB_IRQCHIP when selected by GP_PCI1XXXX

Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Link: https://lore.kernel.org/r/20220906124951.696776-1-kumaravel.thiagarajan@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoiio: pressure: icp10100: Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS().
Jonathan Cameron [Sun, 7 Aug 2022 19:04:13 +0000 (20:04 +0100)]
iio: pressure: icp10100: Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS().

The suspend and resume callbacks in this driver appear to be safe
to call repeatedly, but why do so when we can use the
DEFINE_RUNTIME_DEV_PM_OPS() macro to supply callbacks that check if
we are already runtime suspended before doing unnecessary work.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20220807190414.1039028-2-jic23@kernel.org
22 months agoiio: adc: max1363: Drop provision to provide an IIO channel map via platform data
Jonathan Cameron [Sun, 21 Aug 2022 16:10:58 +0000 (17:10 +0100)]
iio: adc: max1363: Drop provision to provide an IIO channel map via platform data

Back in the days of board files, platform data was used to provide
information on the mapping from ADC channel to an analog signal
from another device. We've long since moved to doing this via
device tree. Hence drop the support from the max1363 driver which is
the only driver still providing this.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220821161058.2207185-1-jic23@kernel.org
22 months agoiio: accel: bma400: Add support for single and double tap events
Jagath Jog J [Wed, 31 Aug 2022 06:31:17 +0000 (12:01 +0530)]
iio: accel: bma400: Add support for single and double tap events

Add support for single and double tap events based on the tap threshold
value, minimum quiet time before and after the tap and minimum time
between the taps in the double tap. The INT1 pin is used to interrupt
and the event is pushed to userspace.

Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com>
Link: https://lore.kernel.org/r/20220831063117.4141-3-jagathjog1996@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: Add new event type gesture and use direction for single and double tap
Jagath Jog J [Wed, 31 Aug 2022 06:31:16 +0000 (12:01 +0530)]
iio: Add new event type gesture and use direction for single and double tap

Add new event type for tap called gesture and the direction can be used
to differentiate single and double tap. This may be used by accelerometer
sensors to express single and double tap events. For directional tap,
modifiers like IIO_MOD_(X/Y/Z) can be used along with singletap and
doubletap direction.

Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com>
Link: https://lore.kernel.org/r/20220831063117.4141-2-jagathjog1996@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: Use per-device lockdep class for mlock
Vincent Whitchurch [Mon, 29 Aug 2022 09:18:40 +0000 (11:18 +0200)]
iio: Use per-device lockdep class for mlock

If an IIO driver uses callbacks from another IIO driver and calls
iio_channel_start_all_cb() from one of its buffer setup ops, then
lockdep complains due to the lock nesting, as in the below example with
lmp91000.

Since the locks are being taken on different IIO devices, there is no
actual deadlock.  Fix the warning by telling lockdep to use a different
class for each iio_device.

 ============================================
 WARNING: possible recursive locking detected
 --------------------------------------------
 python3/23 is trying to acquire lock:
 (&indio_dev->mlock){+.+.}-{3:3}, at: iio_update_buffers

 but task is already holding lock:
 (&indio_dev->mlock){+.+.}-{3:3}, at: enable_store

 other info that might help us debug this:
  Possible unsafe locking scenario:

        CPU0
        ----
   lock(&indio_dev->mlock);
   lock(&indio_dev->mlock);

  *** DEADLOCK ***

  May be due to missing lock nesting notation

 5 locks held by python3/23:
  #0: (sb_writers#5){.+.+}-{0:0}, at: ksys_write
  #1: (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter
  #2: (kn->active#14){.+.+}-{0:0}, at: kernfs_fop_write_iter
  #3: (&indio_dev->mlock){+.+.}-{3:3}, at: enable_store
  #4: (&iio_dev_opaque->info_exist_lock){+.+.}-{3:3}, at: iio_update_buffers

 Call Trace:
  __mutex_lock
  iio_update_buffers
  iio_channel_start_all_cb
  lmp91000_buffer_postenable
  __iio_update_buffers
  enable_store

Fixes: 67e17300dc1d76 ("iio: potentiostat: add LMP91000 support")
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220829091840.2791846-1-vincent.whitchurch@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: add max11205 adc driver
Ramona Bolboaca [Wed, 31 Aug 2022 13:30:21 +0000 (16:30 +0300)]
iio: adc: add max11205 adc driver

Adding support for max11205 16-bit single-channel ultra-low power
delta-sigma adc.
The MAX11205 is compatible with the 2-wire interface and uses
SCLK and RDY/DOUT for serial communications. In this mode, all
controls are implemented by timing the high or low phase of the SCLK.
The 2-wire serial interface only allows for data to be read out through
the RDY/DOUT output.

Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX11205.pdf
Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220831133021.215625-2-ramona.bolboaca@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoMerge 6.0-rc4 into char-misc-next
Greg Kroah-Hartman [Mon, 5 Sep 2022 05:53:56 +0000 (07:53 +0200)]
Merge 6.0-rc4 into char-misc-next

We need the char-misc fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoLinux 6.0-rc4
Linus Torvalds [Sun, 4 Sep 2022 20:10:01 +0000 (13:10 -0700)]
Linux 6.0-rc4

22 months agoMerge tag 'powerpc-6.0-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
Linus Torvalds [Sun, 4 Sep 2022 18:33:22 +0000 (11:33 -0700)]
Merge tag 'powerpc-6.0-4' of git://git./linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - Fix handling of PCI domains in /proc on 32-bit systems using the
   recently added support for numbering buses from zero for each domain.

 - A fix and a revert for some changes to use READ/WRITE_ONCE() which
   caused problems with KASAN enabled due to sanitisation calls being
   introduced in low-level paths that can't cope with it.

 - Fix build errors on 32-bit caused by the syscall table being
   misaligned sometimes.

 - Two fixes to get IBM Cell native machines booting again, which had
   bit-rotted while my QS22 was temporarily out of action.

 - Fix the papr_scm driver to not assume the order of events returned by
   the hypervisor is stable, and a related compile fix.

Thanks to Aneesh Kumar K.V, Christophe Leroy, Jordan Niethe, Kajol Jain,
Masahiro Yamada, Nathan Chancellor, Pali Rohár, Vaibhav Jain, and Zhouyi
Zhou.

* tag 'powerpc-6.0-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/papr_scm: Ensure rc is always initialized in papr_scm_pmu_register()
  Revert "powerpc/irq: Don't open code irq_soft_mask helpers"
  powerpc: Fix hard_irq_disable() with sanitizer
  powerpc/rtas: Fix RTAS MSR[HV] handling for Cell
  Revert "powerpc: Remove unused FW_FEATURE_NATIVE references"
  powerpc: align syscall table for ppc32
  powerpc/pci: Enable PCI domains in /proc when PCI bus numbers are not unique
  powerpc/papr_scm: Fix nvdimm event mappings

22 months agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sun, 4 Sep 2022 18:27:14 +0000 (11:27 -0700)]
Merge tag 'for-linus' of git://git./virt/kvm/kvm

Pull kvm fixes from Paolo Bonzini:
 "s390:

   - PCI interpretation compile fixes

  RISC-V:

   - fix unused variable warnings in vcpu_timer.c

   - move extern sbi_ext declarations to a header

  x86:

   - check validity of argument to KVM_SET_MP_STATE

   - use guest's global_ctrl to completely disable guest PEBS

   - fix a memory leak on memory allocation failure

   - mask off unsupported and unknown bits of IA32_ARCH_CAPABILITIES

   - fix build failure with Clang integrated assembler

   - fix MSR interception

   - always flush TLBs when enabling dirty logging"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: x86: check validity of argument to KVM_SET_MP_STATE
  perf/x86/core: Completely disable guest PEBS via guest's global_ctrl
  KVM: x86: fix memoryleak in kvm_arch_vcpu_create()
  KVM: x86: Mask off unsupported and unknown bits of IA32_ARCH_CAPABILITIES
  KVM: s390: pci: Hook to access KVM lowlevel from VFIO
  riscv: kvm: move extern sbi_ext declarations to a header
  riscv: kvm: vcpu_timer: fix unused variable warnings
  KVM: selftests: Fix ambiguous mov in KVM_ASM_SAFE()
  KVM: selftests: Fix KVM_EXCEPTION_MAGIC build with Clang
  KVM: VMX: Heed the 'msr' argument in msr_write_intercepted()
  kvm: x86: mmu: Always flush TLBs when enabling dirty logging
  kvm: x86: mmu: Drop the need_remote_flush() function

22 months agoMakefile.extrawarn: re-enable -Wformat for clang; take 2
Nick Desaulniers [Thu, 1 Sep 2022 17:59:13 +0000 (10:59 -0700)]
Makefile.extrawarn: re-enable -Wformat for clang; take 2

-Wformat was recently re-enabled for builds with clang, then quickly
re-disabled, due to concerns stemming from the frequency of default
argument promotion related warning instances.

commit 258fafcd0683 ("Makefile.extrawarn: re-enable -Wformat for clang")
commit 21f9c8a13bb2 ("Revert "Makefile.extrawarn: re-enable -Wformat for clang"")

ISO WG14 has ratified N2562 to address default argument promotion
explicitly for printf, as part of the upcoming ISO C2X standard.

The behavior of clang was changed in clang-16 to not warn for the cited
cases in all language modes.

Add a version check, so that users of clang-16 now get the full effect
of -Wformat. For older clang versions, re-enable flags under the
-Wformat group that way users still get some useful checks related to
format strings, without noisy default argument promotion warnings. I
intentionally omitted -Wformat-y2k and -Wformat-security from being
re-enabled, which are also part of -Wformat in clang-16.

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Link: https://github.com/llvm/llvm-project/issues/57102
Link: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2562.pdf
Suggested-by: Justin Stitt <jstitt007@gmail.com>
Suggested-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: Youngmin Nam <youngmin.nam@samsung.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22 months agodt-bindings: iio: adc: Add max11205 documentation file
Ramona Bolboaca [Wed, 31 Aug 2022 13:30:20 +0000 (16:30 +0300)]
dt-bindings: iio: adc: Add max11205 documentation file

Add bindings documentation file and MAINTAINERS entry for MAX11205.

Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220831133021.215625-1-ramona.bolboaca@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: magnetometer: yamaha-yas530: Use dev_err_probe()
Andy Shevchenko [Wed, 31 Aug 2022 14:15:30 +0000 (17:15 +0300)]
iio: magnetometer: yamaha-yas530: Use dev_err_probe()

Unify error message format by using dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220831141530.80572-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: magnetometer: yamaha-yas530: Make strings const in chip info
Andy Shevchenko [Wed, 31 Aug 2022 14:15:29 +0000 (17:15 +0300)]
iio: magnetometer: yamaha-yas530: Make strings const in chip info

For better compiler coverage mark strings consts in the chip info.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220831141530.80572-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: magnetometer: yamaha-yas530: Use pointers as driver data
Andy Shevchenko [Wed, 31 Aug 2022 14:15:28 +0000 (17:15 +0300)]
iio: magnetometer: yamaha-yas530: Use pointers as driver data

Unify ID tables to use pointers for driver data. It will allow
to simplify the driver later on.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220831141530.80572-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: tsc2046: silent spi_device_id warning
Oleksij Rempel [Sun, 4 Sep 2022 10:02:03 +0000 (12:02 +0200)]
iio: adc: tsc2046: silent spi_device_id warning

Add spi_device_id to silent following kernel runtime warning:
"SPI driver tsc2046 has no spi_device_id for ti,tsc2046e-adc".

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220904100203.3614502-3-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: tsc2046: add vref support
Oleksij Rempel [Sun, 4 Sep 2022 10:02:02 +0000 (12:02 +0200)]
iio: adc: tsc2046: add vref support

If VREF pin is attached, we should use external VREF source instead of
the internal. Otherwise we will get wrong measurements on some of the channel
types.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220904100203.3614502-2-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: adc: ti,tsc2046: add vref-supply property
Oleksij Rempel [Sun, 4 Sep 2022 10:02:01 +0000 (12:02 +0200)]
dt-bindings: iio: adc: ti,tsc2046: add vref-supply property

Add property for the voltage reference supply.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220904100203.3614502-1-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoMerge tag 'gpio-fixes-for-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 4 Sep 2022 04:27:27 +0000 (21:27 -0700)]
Merge tag 'gpio-fixes-for-v6.0-rc4' of git://git./linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:
 "A a set of fixes from the GPIO subsystem.

  Most are small driver fixes except the realtek-otto driver patch which
  is pretty big but addresses a significant flaw that can cause the CPU
  to stay infinitely busy on uncleared ISR on some platforms.

  Summary:
   - MAINTAINERS update
   - fix resource leaks in gpio-mockup and gpio-pxa
   - add missing locking in gpio-pca953x
   - use 32-bit I/O in gpio-realtek-otto
   - make irq_chip structures immutable in four more drivers"

* tag 'gpio-fixes-for-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  gpio: ws16c48: Make irq_chip immutable
  gpio: 104-idio-16: Make irq_chip immutable
  gpio: 104-idi-48: Make irq_chip immutable
  gpio: 104-dio-48e: Make irq_chip immutable
  gpio: realtek-otto: switch to 32-bit I/O
  gpio: pca953x: Add mutex_lock for regcache sync in PM
  gpio: mockup: remove gpio debugfs when remove device
  gpio: pxa: use devres for the clock struct
  MAINTAINERS: rectify entry for XILINX GPIO DRIVER

22 months agogpio: ws16c48: Make irq_chip immutable
William Breathitt Gray [Fri, 2 Sep 2022 17:45:26 +0000 (13:45 -0400)]
gpio: ws16c48: Make irq_chip immutable

Kernel warns about mutable irq_chips:

    "not an immutable chip, please consider fixing!"

Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the
new helper functions, and call the appropriate gpiolib functions.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
22 months agogpio: 104-idio-16: Make irq_chip immutable
William Breathitt Gray [Fri, 2 Sep 2022 17:45:25 +0000 (13:45 -0400)]
gpio: 104-idio-16: Make irq_chip immutable

Kernel warns about mutable irq_chips:

    "not an immutable chip, please consider fixing!"

Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the
new helper functions, and call the appropriate gpiolib functions.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
22 months agogpio: 104-idi-48: Make irq_chip immutable
William Breathitt Gray [Fri, 2 Sep 2022 17:45:24 +0000 (13:45 -0400)]
gpio: 104-idi-48: Make irq_chip immutable

Kernel warns about mutable irq_chips:

    "not an immutable chip, please consider fixing!"

Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the
new helper functions, and call the appropriate gpiolib functions.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
22 months agogpio: 104-dio-48e: Make irq_chip immutable
William Breathitt Gray [Fri, 2 Sep 2022 17:45:23 +0000 (13:45 -0400)]
gpio: 104-dio-48e: Make irq_chip immutable

Kernel warns about mutable irq_chips:

    "not an immutable chip, please consider fixing!"

Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the
new helper functions, and call the appropriate gpiolib functions.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
22 months agoMerge tag 'for-linus-6.0-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 3 Sep 2022 20:23:11 +0000 (13:23 -0700)]
Merge tag 'for-linus-6.0-rc4-tag' of git://git./linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:

 - a minor fix for the Xen grant driver

 - a small series fixing a recently introduced problem in the Xen
   blkfront/blkback drivers with negotiation of feature usage

* tag 'for-linus-6.0-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen/grants: prevent integer overflow in gnttab_dma_alloc_pages()
  xen-blkfront: Cache feature_persistent value before advertisement
  xen-blkfront: Advertise feature-persistent as user requested
  xen-blkback: Advertise feature-persistent as user requested

22 months agoMerge tag 'loongarch-fixes-6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 3 Sep 2022 20:21:01 +0000 (13:21 -0700)]
Merge tag 'loongarch-fixes-6.0-2' of git://git./linux/kernel/git/chenhuacai/linux-loongson

Pull LoongArch fixes from Huacai Chen:
 "Fix several build errors or warnings, cleanup some code, and adjust
  arch_do_signal_or_restart() to adapt generic entry"

* tag 'loongarch-fixes-6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
  LoongArch: mm: Remove the unneeded result variable
  LoongArch: Fix arch_remove_memory() undefined build error
  LoongArch: Fix section mismatch due to acpi_os_ioremap()
  LoongArch: Improve dump_tlb() output messages
  LoongArch: Adjust arch_do_signal_or_restart() to adapt generic entry
  LoongArch: Avoid orphan input sections

22 months agoMerge tag 's390-6.0-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Linus Torvalds [Sat, 3 Sep 2022 20:17:33 +0000 (13:17 -0700)]
Merge tag 's390-6.0-3' of git://git./linux/kernel/git/s390/linux

Pull s390 fixes from Vasily Gorbik:

 - Update defconfigs

 - Fix linker script to align nospec tables correctly to avoid
   potentially unbootable kernel with some config options

 - Fix alignment check in prepare_hugepage_range() for 2GB hugepages to
   avoid BUG in __unmap_hugepage_range() for unaligned mappings later

 - Remove useless hugepage address alignment in hugetlb fault handling

* tag 's390-6.0-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/hugetlb: fix prepare_hugepage_range() check for 2 GB hugepages
  s390: update defconfigs
  s390: fix nospec table alignments
  s390/mm: remove useless hugepage address alignment

22 months agoMerge tag 'input-for-v6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor...
Linus Torvalds [Sat, 3 Sep 2022 20:09:46 +0000 (13:09 -0700)]
Merge tag 'input-for-v6.0-rc3' of git://git./linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:

 - GT1158 ID added to Goodix touchscreen driver

 - Boeder Force Feedback Wheel USB added to iforce joystick driver

 - fixup for iforce driver to avoid hangups

 - fix autoloading of rk805-pwrkey driver.

* tag 'input-for-v6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: iforce - add support for Boeder Force Feedback Wheel
  Input: iforce - wake up after clearing IFORCE_XMIT_RUNNING flag
  Input: goodix - add compatible string for GT1158
  MAINTAINERS: add include/dt-bindings/input to INPUT DRIVERS
  Input: rk805-pwrkey - fix module autoloading
  Input: goodix - add support for GT1158
  dt-bindings: input: touchscreen: add compatible string for Goodix GT1158

22 months agofpga: prevent integer overflow in dfl_feature_ioctl_set_irq()
Dan Carpenter [Thu, 1 Sep 2022 05:18:45 +0000 (08:18 +0300)]
fpga: prevent integer overflow in dfl_feature_ioctl_set_irq()

The "hdr.count * sizeof(s32)" multiplication can overflow on 32 bit
systems leading to memory corruption.  Use array_size() to fix that.

Fixes: 322b598be4d9 ("fpga: dfl: introduce interrupt trigger setting API")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/YxBAtYCM38dM7yzI@kili
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
22 months agoMerge tag 'tty-6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Linus Torvalds [Sat, 3 Sep 2022 17:34:02 +0000 (10:34 -0700)]
Merge tag 'tty-6.0-rc4' of git://git./linux/kernel/git/gregkh/tty

Pull tty/serial driver fixes from Greg KH:
 "Here are some small tty/serial/vt driver fixes for 6.0-rc4 that
  resolve a number of reported issues:

   - n_gsm fixups for previous changes that caused problems

   - much-reported serdev crash fix that showed up in 6.0-rc1

   - vt font selection bugfix

   - kerneldoc build warning fixes

   - other tiny serial core fixes

  All of these have been in linux-next for a while with no reported
  problems"

* tag 'tty-6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: n_gsm: avoid call of sleeping functions from atomic context
  tty: n_gsm: replace kicktimer with delayed_work
  tty: n_gsm: initialize more members at gsm_alloc_mux()
  tty: n_gsm: add sanity check for gsm->receive in gsm_receive_buf()
  tty: serial: atmel: Preserve previous USART mode if RS485 disabled
  tty: serial: lpuart: disable flow control while waiting for the transmit engine to complete
  tty: Fix lookahead_buf crash with serdev
  serial: fsl_lpuart: RS485 RTS polariy is inverse
  vt: Clear selection before changing the font
  serial: document start_rx member at struct uart_ops

22 months agoMerge tag 'staging-6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Sat, 3 Sep 2022 17:32:17 +0000 (10:32 -0700)]
Merge tag 'staging-6.0-rc4' of git://git./linux/kernel/git/gregkh/staging

Pull staging driver fixes from Greg KH:
 "Here are three small staging driver fixes for 6.0-rc4 that resolve
  some reported problems and add some a device id:

   - new device id for r8188eu driver

   - use-after-free bugfixes for the rtl8712 driver

   - fix up firmware dependency problem for the r8188eu driver

  All of these have been in linux-next for a while with no reported
  problems"

* tag 'staging-6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: rtl8712: fix use after free bugs
  staging: r8188eu: Add Rosewill USB-N150 Nano to device tables
  staging: r8188eu: add firmware dependency

22 months agoMerge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 3 Sep 2022 17:27:25 +0000 (10:27 -0700)]
Merge tag 'clk-fixes-for-linus' of git://git./linux/kernel/git/clk/linux

Pull clk fixes from Stephen Boyd:
 "Here's a collection of primarily clk driver fixes, with a couple fixes
  to the core framework.

  We had to revert out a commit that affected boot on some devices that
  have the CLK_OPS_PARENT_ENABLE flag set. It isn't critical to have
  that fix so we'll try again next time.

  Driver side fixes include:

   - Plug an OF-node refcount bug in the TI clk driver

   - Fix the error handling in the raspberry pi firmware get_rate so
     that errors don't look like valid frequencies

   - Avoid going out of bounds in the raspberry pi driver too if the
     video firmware returns something we're not expecting"

* tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
  Revert "clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops"
  clk: bcm: rpi: Show clock id limit in error case
  clk: bcm: rpi: Add missing newline
  clk: bcm: rpi: Prevent out-of-bounds access
  clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate
  clk: core: Fix runtime PM sequence in clk_core_unprepare()
  clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops
  clk: ti: Fix missing of_node_get() ti_find_clock_provider()

22 months agoMerge tag 'hwmon-for-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groec...
Linus Torvalds [Sat, 3 Sep 2022 17:24:30 +0000 (10:24 -0700)]
Merge tag 'hwmon-for-v6.0-rc4' of git://git./linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

 - Fix out of bounds access in gpio-fan driver

 - Fix VOUT margin caching in PMBus core

 - Avoid error message after -EPROBE_DEFER from devm_regulator_register()

* tag 'hwmon-for-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (gpio-fan) Fix array out of bounds access
  hwmon: (pmbus) Fix vout margin caching
  hwmon: (pmbus) Use dev_err_probe() to filter -EPROBE_DEFER error messages

22 months agomm: pagewalk: Fix race between unmap and page walker
Steven Price [Fri, 2 Sep 2022 11:26:12 +0000 (12:26 +0100)]
mm: pagewalk: Fix race between unmap and page walker

The mmap lock protects the page walker from changes to the page tables
during the walk.  However a read lock is insufficient to protect those
areas which don't have a VMA as munmap() detaches the VMAs before
downgrading to a read lock and actually tearing down PTEs/page tables.

For users of walk_page_range() the solution is to simply call pte_hole()
immediately without checking the actual page tables when a VMA is not
present. We now never call __walk_page_range() without a valid vma.

For walk_page_range_novma() the locking requirements are tightened to
require the mmap write lock to be taken, and then walking the pgd
directly with 'no_vma' set.

This in turn means that all page walkers either have a valid vma, or
it's that special 'novma' case for page table debugging.  As a result,
all the odd '(!walk->vma && !walk->no_vma)' tests can be removed.

Fixes: dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22 months agoLoongArch: mm: Remove the unneeded result variable
ye xingchen [Fri, 26 Aug 2022 07:29:03 +0000 (07:29 +0000)]
LoongArch: mm: Remove the unneeded result variable

Return the value pa_to_nid() directly instead of storing it in another
redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
22 months agoLoongArch: Fix arch_remove_memory() undefined build error
Yupeng Li [Wed, 31 Aug 2022 05:40:17 +0000 (13:40 +0800)]
LoongArch: Fix arch_remove_memory() undefined build error

The kernel build error when unslected CONFIG_MEMORY_HOTREMOVE because
arch_remove_memory() is needed by mm/memory_hotplug.c but undefined.

Some build error messages like:

 LD      vmlinux.o
 MODPOST vmlinux.symvers
 MODINFO modules.builtin.modinfo
 GEN     modules.builtin
 LD      .tmp_vmlinux.kallsyms1
loongarch64-linux-gnu-ld: mm/memory_hotplug.o: in function `.L242':
memory_hotplug.c:(.ref.text+0x930): undefined reference to `arch_remove_memory'
make: *** [Makefile:1169:vmlinux] 错误 1

Removed CONFIG_MEMORY_HOTREMOVE requirement and rearrange the file refer
to the definitions of other platform architectures.

Signed-off-by: Yupeng Li <liyupeng@zbhlos.com>
Signed-off-by: Caicai <caizp2008@163.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>