Commit Graph

1267002 Commits

Author SHA1 Message Date
Chris Morgan
6560cfcfb4 Input: adc-joystick - handle inverted axes
When one or more axes are inverted, (where min > max), normalize the
data so that min < max and invert the values reported to the input
stack.

This ensures we can continue defining the device correctly in the
device tree while not breaking downstream assumptions that min is
always less than max.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Acked-by: Artur Rojek <contact@artur-rojek.eu>
Link: https://lore.kernel.org/r/20240115192752.266367-1-macroalpha82@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-06-07 12:29:32 -07:00
Erick Archer
5bbcece640 Input: gameport - use sizeof(*pointer) instead of sizeof(type)
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/PAXPR02MB72483F512F863C74A4AECA2B8BFB2@PAXPR02MB7248.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-06-07 11:59:41 -07:00
Erick Archer
06b449d7f7 Input: serio - use sizeof(*pointer) instead of sizeof(type)
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237D3D898CCC9C50C18DE078BFB2@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-06-07 11:59:21 -07:00
Dmitry Torokhov
1854792551 Merge branch 'ib/6.9-disable-irq-guard' into next
This brings in support for guard(disable_irq)(...);
2024-06-06 14:39:44 -07:00
Dmitry Torokhov
c764947687 linux/interrupt.h: allow "guard" notation to disable and reenable IRQ
Drivers often need to first disable an interrupt, carry out some
action, and then reenable the interrupt. Introduce support for the
"guard" notation for this so that the following is possible:

	...

	scoped_cond_guard(mutex_intr, return -EINTR, &data->sysfs_mutex) {
		guard(disable_irq)(&client->irq);

		error = elan_acquire_baseline(data);
		if (error)
			return error;
	}

	...

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/ZljAV6HjkPSEhWSw@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-06-06 14:35:01 -07:00
Jason Gerecke
7ba38c2a9e Input: wacom_w8001 - correct device name generation
Fixes: 6c7cc1a29d ("Input: wacom_w8001 - simplify device name generation")
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Link: https://lore.kernel.org/r/20240605164656.61623-1-jason.gerecke@wacom.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-06-06 13:43:10 -07:00
Erick Archer
2960d4c8e7 Input: tablet - use sizeof(*pointer) instead of sizeof(type)
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237B05083487507CFAF96B08BFE2@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-06-02 21:32:03 -07:00
Erick Archer
dc2f1423f0 Input: mouse - use sizeof(*pointer) instead of sizeof(type)
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237FB736DBF67A58798FDF38BFE2@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-06-02 21:32:02 -07:00
Erick Archer
a0bd7adadb Input: misc - use sizeof(*pointer) instead of sizeof(type)
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237884EB989EFF55D1BEF8B8BFE2@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-06-02 21:32:01 -07:00
Erick Archer
bb8706a419 Input: keyboard - use sizeof(*pointer) instead of sizeof(type)
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237277464F23CA168BFB3B18BF52@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-06-02 21:32:01 -07:00
Jason Gerecke
6c7cc1a29d Input: wacom_w8001 - simplify device name generation
Replace pairs of strscpy/strlcat calls with snprintf.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Link: https://lore.kernel.org/r/CANRwn3SuTjdCCK4YH1ObvsC_gZuythAQ7kSHJP-CiAFw9h5Qcw@mail.gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-05-30 13:55:48 -07:00
Dmitry Torokhov
6f47c7ae8c Linux 6.9
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmZBML0eHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGt3MH/3r3+FUQy4GWJARA
 T7Q2AB36dHI5dA5N3Q1t3L4VVgeypjy5ZScgMi5J4MtEr2m3z2akjWH9+SVnFxMd
 Nf7s4McY+461MpindBoGEKeJFsxXWiOqf8i+5lc6JGgHAjD1qiIjD5lFFirgTbeJ
 vSd6wbzYwLp4145TM2J8R7xG5ib2DMk0Z0n3DcOmWVCTIJujSPCM7Wz+86w/vw2e
 4hkqPrcmQS3CGov/fOMnSvALkA6MegWmpvYv3/z7Kj6yq3TEz5sYKR9FZzRxj7bm
 FoW0T7gkxHXGODnQsD7Ex4CG+XYfUyv8H2LgImYAk8sjMZWD8sTzOuGM8g89RLS+
 tvGYU9U=
 =MG7d
 -----END PGP SIGNATURE-----

Merge tag 'v6.9' into next

Sync up with the mainline to bring in the new cleanup API.
2024-05-27 21:37:18 -07:00
Joel Selvaraj
832f54c9cc Input: edt-ft5x06 - add support for FocalTech FT5452 and FT8719
The driver is compatible with FocalTech FT5452 and FT8719 touchscreens
too. FT5452 supports up to 5 touch points. FT8719 supports up to 10 touch
points. Add compatible data for both of them.

Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>
Link: https://lore.kernel.org/r/20240521-add-support-ft5452-and-ft8719-touchscreen-v1-2-2a648ac7176b@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-05-22 10:36:11 -07:00
Joel Selvaraj
fe96230097 dt-bindings: input: touchscreen: edt-ft5x06: Document FT5452 and FT8719 support
Document FocalTech FT5452 and FT8719 support by adding their compatibles.

Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240521-add-support-ft5452-and-ft8719-touchscreen-v1-1-2a648ac7176b@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-05-22 10:36:11 -07:00
Kirill Artemev
e7647cbaba Input: xpad - add support for Machenike G5 Pro Controller
Add VID and PID to the xpad_device and VID to the xpad_table
to allow driver to use Machenike G5 Pro Controller, which is
XTYPE_XBOX360 compatible in Xinput mode.

Signed-off-by: Kirill Artemev <artewar6767@gmail.com>
Link: https://lore.kernel.org/r/20240516032926.12501-2-artewar6767@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-05-20 16:46:27 -07:00
Dmitry Torokhov
0774d19038 Input: try trimming too long modalias strings
If an input device declares too many capability bits then modalias
string for such device may become too long and not fit into uevent
buffer, resulting in failure of sending said uevent. This, in turn,
may prevent userspace from recognizing existence of such devices.

This is typically not a concern for real hardware devices as they have
limited number of keys, but happen with synthetic devices such as
ones created by xen-kbdfront driver, which creates devices as being
capable of delivering all possible keys, since it doesn't know what
keys the backend may produce.

To deal with such devices input core will attempt to trim key data,
in the hope that the rest of modalias string will fit in the given
buffer. When trimming key data it will indicate that it is not
complete by placing "+," sign, resulting in conversions like this:

old: k71,72,73,74,78,7A,7B,7C,7D,8E,9E,A4,AD,E0,E1,E4,F8,174,
new: k71,72,73,74,78,7A,7B,7C,+,

This should allow existing udev rules continue to work with existing
devices, and will also allow writing more complex rules that would
recognize trimmed modalias and check input device characteristics by
other means (for example by parsing KEY= data in uevent or parsing
input device sysfs attributes).

Note that the driver core may try adding more uevent environment
variables once input core is done adding its own, so when forming
modalias we can not use the entire available buffer, so we reduce
it by somewhat an arbitrary amount (96 bytes).

Reported-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Jason Andryuk <jandryuk@gmail.com>
Link: https://lore.kernel.org/r/ZjAWMQCJdrxZkvkB@google.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-05-19 17:58:45 -07:00
Uwe Kleine-König
5852f2afcd Input: drop explicit initialization of struct i2c_device_id::driver_data to 0
These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.

While add it, also remove commas after the sentinel entries.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20240509174158.2211071-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-05-13 15:43:19 -07:00
Christophe JAILLET
adb2e48afc Input: zet6223 - remove an unused field in struct zet6223_ts
In "struct zet6223_ts", the 'vcc' and 'vio' fields are unused.

So, remove them.

Found with cppcheck, unusedStructMember.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/3065d885341e2730dd3e7905d75514796a8c25e4.1715507858.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-05-13 14:10:09 -07:00
Christophe JAILLET
ae7620b283 Input: chipone_icn8505 - remove an unused field in struct icn8505_data
In "struct icn8505_data", the 'wake_gpio' field is unused.
There is also nothing about gpio neither in this driver nor in the
data-sheet.

So, remove it.

Found with cppcheck, unusedStructMember.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/37443a675ca07c91c5f0118ce255406e6e3c08f5.1715502304.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-05-13 14:09:57 -07:00
Linus Torvalds
a38297e3fb Linux 6.9 2024-05-12 14:12:29 -07:00
Linus Torvalds
af300a3959 Fix Kselftest's vfork() side effects
See https://lore.kernel.org/r/20240511171445.904356-1-mic@digikod.net
 -----BEGIN PGP SIGNATURE-----
 
 iIYEABYKAC4WIQSVyBthFV4iTW/VU1/l49DojIL20gUCZkCZRxAcbWljQGRpZ2lr
 b2QubmV0AAoJEOXj0OiMgvbSQCwBAJlgxbBIQbzfPOOaAQu/QMXYuDdwXJhMogOq
 XVp4F/i7AQCZUC+rRWVFD3KdQo7L8OqdLnPKiw4fDk3Zph3t9zqbCQ==
 =czaR
 -----END PGP SIGNATURE-----

Merge tag 'kselftest-fix-vfork-2024-05-12' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux

Pull Kselftest fixes from Mickaël Salaün:
 "Fix Kselftest's vfork() side effects.

  As reported by Kernel Test Robot and Sean Christopherson, some
  tests fail since v6.9-rc1 . This is due to the use of vfork() which
  introduced some side effects. Similarly, while making it more generic,
  a previous commit made some Landlock file system tests flaky, and
  subject to the host's file system mount configuration.

  This fixes all these side effects by replacing vfork() with clone3()
  and CLONE_VFORK, which is cleaner (no arbitrary shared memory) and
  makes the Kselftest framework more robust"

Link: https://lore.kernel.org/oe-lkp/202403291015.1fcfa957-oliver.sang@intel.com
Link: https://lore.kernel.org/r/ZjPelW6-AbtYvslu@google.com
Link: https://lore.kernel.org/r/20240511171445.904356-1-mic@digikod.net

* tag 'kselftest-fix-vfork-2024-05-12' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux:
  selftests/harness: Handle TEST_F()'s explicit exit codes
  selftests/harness: Fix vfork() side effects
  selftests/harness: Share _metadata between forked processes
  selftests/pidfd: Fix wrong expectation
  selftests/harness: Constify fixture variants
  selftests/landlock: Do not allocate memory in fixture data
  selftests/harness: Fix interleaved scheduling leading to race conditions
  selftests/harness: Fix fixture teardown
  selftests/landlock: Fix FS tests when run on a private mount point
  selftests/pidfd: Fix config for pidfd_setns_test
2024-05-12 13:01:59 -07:00
Linus Torvalds
2842076beb s390:
* Fix NULL pointer read on ioctl(KVM_CHECK_EXTENSION) for /dev/kvm.
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmZAei4UHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroPXEQf+I/nn4VcOA/vGVSaXYrdr5ouWkat4
 bfnBc46gOcaVvHCq7rgkmxgmLCsyG5aDpSy66qoCY6pC/IKdTYHxQrqcy8xickrP
 vn7I80iQ4SkjFoLitgTU7+xXCMhF28F1bNhjZAxgxxfGbQvJzZYBeiDrAoS9vVUJ
 Hu3Jw6Qtz9gYL5BM6x8MhzjqOpGz93qT5hyH//sP977cYyNgiQgeC5nzgZy91mbu
 d1sRLmKcIrqw+p6CfuqVGpXqVhpk2jc7va3l9QAiUJPq5JkScQyohHeE271hCxMT
 R9srmlroKi2dBl/IVPPnxEtGwCYgv/J4XZ6At/BgH2ZWVnu13O6Eob+JTQ==
 =hdJ5
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-6.9' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull kvm fix from Paolo Bonzini:

 - Fix NULL pointer read on s390 in ioctl(KVM_CHECK_EXTENSION) for
   /dev/kvm

* tag 'for-linus-6.9' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: s390: Check kvm pointer when testing KVM_CAP_S390_HPAGE_1M
2024-05-12 12:15:39 -07:00
Linus Torvalds
ba16c1cf11 - Fix a race condition when clearing error count bits and toggling
the error interrupt throug the same register, in synopsys_edac
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmZAdYEACgkQEsHwGGHe
 VUrtORAAvwK9Ump8tGigXQ58aXY7a2b+iYrYiZtZkP23y0p81HJdYruanHeeLM4n
 CYKnuI+yKFP/e5jfxQj6vPj5sKk6U285+C2L/7MsHcfKf/bFzgjopzHLKYS+u6E6
 YtjJQOFbozMvsDnF0BcxQf3OAiLsEkvA4JKb8gE7YqslMlJF5nhTVRRYtX3H+RBH
 FBupB/wZqvFS41igzTexkY89L71TlhRbP2hjUKScV4N5v9Jhh0m2PmApARW2EGkW
 X4RhqIs8kHVBseuNpanV/vBLJDFekJtZD95WLFltK10pGC306gMzEGVIj3H4Dnw3
 qrgDK2hHxz9/i3ukHox5YoMKWVXBYTTo74a1kMvAoQxmCBERPQopUKu34nq9/NpQ
 ecWN6pFFwhwQAjdZkAoZgJknJtIaO8Ti4Uj9roN1PFgBDCConGXhJbFrU+z3WPfR
 aUk3VK4zBDyUSBkj9TJviWPm+8Se5HdcqgrFFqiLH5BYZIUWPYit8Q56LYzx5sKp
 +OgaguxjVwdyaPovFs6h/ae7/mJzzXn7FPRfOmeOH3KVFbo1X+Cu+o/lolXHfbvN
 KFfov33DMDuHLs6ECYrEM8OwIXXFcYBe/Pd7TePkaoEr9+7arujaBEJvMAyTQaWN
 x1OsOBo4Nxg7YYvfMVO7pKIv5Mn1LomAlOs8VZynRWAFeSqcaFk=
 =mBtC
 -----END PGP SIGNATURE-----

Merge tag 'edac_urgent_for_v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras

Pull EDAC fix from Borislav Petkov:

 - Fix a race condition when clearing error count bits and toggling the
   error interrupt throug the same register, in synopsys_edac

* tag 'edac_urgent_for_v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
  EDAC/synopsys: Fix ECC status and IRQ control race condition
2024-05-12 09:09:27 -07:00
Linus Torvalds
775a0eca33 - Add a new PCI ID which belongs to a new AMD CPU family 0x1a
- Ensure that that last level cache ID is set in all cases, in the AMD
   CPU topology parsing code, in order to prevent invalid scheduling
   domain CPU masks
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmZAcSIACgkQEsHwGGHe
 VUr2Ww//Y+tY5iNLOCWCdD+nYcpGupletEUulvMLfEH42AZBNIHRyGCskuLWJAsw
 xBceY5uiTIAhKoSGUlbwIC+SWAdZQjxoF73KJQ55DQSOf7ogPW0SrQrvgI6QyTwb
 kRUNK+SQwqAVJBerFqz7gq9OhA6z+eewCDZPtcinIzWVC1zCVE0G4yEjAofDRF0F
 SbvS60fhFJCkQ/qi8Cz84tsO/+gTnYl3qyYPMCYkNtna5TyGv12tbDlSWSsATFBf
 0WdlXjRmuC1xLkTm/CQeCWrVG0yfvcPzL6lYkTgx9tGI1UBuifn9LZFy82+j8V1+
 tvAM3t7KC5pKa6xEok2L0+PflFsenaBEGoRZ1Os9nQvzCmnvTvLtEVn6DYrYykR4
 HRrH/TLWTSPxWUNSj4d6HPd0meAIqFZtvFPp2/ublr+VNNk3kYVXGVYEHFgnbJhY
 EIAj1H3tDfCToMZ7FjS8wJpaiX5LAw75/onK4IUhoQZdHsqzIxvfjhzvjepctHV2
 co5RFyY+W1K52AwZt4MHPNI4PUvNBcK9cqihDUZ3P5bKh7qWomTq/yrLuQSbuAhq
 /ImZgVPfmM9HKWQOyfr/6MmVQuis8TxYWL8mbQApoHEKpJOjlK9OziFnndQVV+Jh
 mSEIh8tcvUt0jKA2DfgiH6glkeBQOx5iaISeaMHOXIWPC/aW9vs=
 =y9je
 -----END PGP SIGNATURE-----

Merge tag 'x86_urgent_for_v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Borislav Petkov:

 - Add a new PCI ID which belongs to a new AMD CPU family 0x1a

 - Ensure that that last level cache ID is set in all cases, in the AMD
   CPU topology parsing code, in order to prevent invalid scheduling
   domain CPU masks

* tag 'x86_urgent_for_v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/topology/amd: Ensure that LLC ID is initialized
  x86/amd_nb: Add new PCI IDs for AMD family 0x1a
2024-05-12 08:54:28 -07:00
Mickaël Salaün
323feb3bdb
selftests/harness: Handle TEST_F()'s explicit exit codes
If TEST_F() explicitly calls exit(code) with code different than 0, then
_metadata->exit_code is set to this code (e.g. KVM_ONE_VCPU_TEST()).  We
need to keep in mind that _metadata->exit_code can be KSFT_SKIP while
the process exit code is 0.

Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Will Drewry <wad@chromium.org>
Reported-by: Sean Christopherson <seanjc@google.com>
Tested-by: Sean Christopherson <seanjc@google.com>
Closes: https://lore.kernel.org/r/ZjPelW6-AbtYvslu@google.com
Fixes: 0710a1a73f ("selftests/harness: Merge TEST_F_FORK() into TEST_F()")
Link: https://lore.kernel.org/r/20240511171445.904356-11-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-05-11 19:18:47 +02:00
Mickaël Salaün
f453cc3002
selftests/harness: Fix vfork() side effects
Setting the time namespace with CLONE_NEWTIME returns -EUSERS if the
calling thread shares memory with another thread (because of the shared
vDSO), which is the case when it is created with vfork().

Fix pidfd_setns_test by replacing test harness's vfork() call with a
clone3() call with CLONE_VFORK, and an explicit sharing of the
_metadata and self objects.

Replace _metadata->teardown_parent with a new FIXTURE_TEARDOWN_PARENT()
helper that can replace FIXTURE_TEARDOWN().  This is a cleaner approach
and it enables to selectively share the fixture data between the child
process running tests and the parent process running the fixture
teardown.  This also avoids updating several tests to not rely on the
self object's copy-on-write property (e.g. storing the returned value of
a fork() call).

Cc: Christian Brauner <brauner@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Günther Noack <gnoack@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Will Drewry <wad@chromium.org>
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202403291015.1fcfa957-oliver.sang@intel.com
Fixes: 0710a1a73f ("selftests/harness: Merge TEST_F_FORK() into TEST_F()")
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20240511171445.904356-10-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-05-11 19:18:47 +02:00
Mickaël Salaün
24cf65a622
selftests/harness: Share _metadata between forked processes
Unconditionally share _metadata between all forked processes, which
enables to actually catch errors which were previously ignored.

This is required for a following commit replacing vfork() with clone3()
and CLONE_VFORK (i.e. not sharing the full memory) .  It should also be
useful to share _metadata to extend expectations to test process's
forks.  For instance, this change identified a wrong expectation in
pidfd_setns_test.

Because this _metadata is used by the new XFAIL_ADD(), use a global
pointer initialized in TEST_F().  This is OK because only XFAIL_ADD()
use it, and XFAIL_ADD() already depends on TEST_F().

Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Will Drewry <wad@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20240511171445.904356-9-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-05-11 19:18:46 +02:00
Mickaël Salaün
821bc4a8fd
selftests/pidfd: Fix wrong expectation
Replace a wrong EXPECT_GT(self->child_pid_exited, 0) with EXPECT_GE(),
which will be actually tested on the parent and child sides with a
following commit.

Cc: Shuah Khan <skhan@linuxfoundation.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/r/20240511171445.904356-8-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-05-11 19:18:46 +02:00
Mickaël Salaün
cc80aa9a22
selftests/harness: Constify fixture variants
FIXTURE_VARIANT_ADD() types are passed as const pointers to
FIXTURE_TEARDOWN().  Make that explicit by constifying the variants
declarations.

Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Will Drewry <wad@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20240511171445.904356-7-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-05-11 19:18:45 +02:00
Mickaël Salaün
3656bc2342
selftests/landlock: Do not allocate memory in fixture data
Do not allocate self->dir_path in the test process because this would
not be visible in the FIXTURE_TEARDOWN() process when relying on
fork()/clone3() instead of vfork().

This change is required for a following commit removing vfork() call to
not break the layout3_fs.* test cases.

Cc: Günther Noack <gnoack@google.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20240511171445.904356-6-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-05-11 19:18:44 +02:00
Mickaël Salaün
a86f18903d
selftests/harness: Fix interleaved scheduling leading to race conditions
Fix a race condition when running several FIXTURE_TEARDOWN() managing
the same resource.  This fixes a race condition in the Landlock file
system tests when creating or unmounting the same directory.

Using clone3() with CLONE_VFORK guarantees that the child and grandchild
test processes are sequentially scheduled.  This is implemented with a
new clone3_vfork() helper replacing the fork() call.

This avoids triggering this error in __wait_for_test():
  Test ended in some other way [127]

Cc: Christian Brauner <brauner@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Günther Noack <gnoack@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Will Drewry <wad@chromium.org>
Fixes: 41cca0542d ("selftests/harness: Fix TEST_F()'s vfork handling")
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20240511171445.904356-5-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-05-11 19:18:43 +02:00
Mickaël Salaün
fff37bd32c
selftests/harness: Fix fixture teardown
Make sure fixture teardowns are run when test cases failed, including
when _metadata->teardown_parent is set to true.

Make sure only one fixture teardown is run per test case, handling the
case where the test child forks.

Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Shengyu Li <shengyu.li.evgeny@gmail.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Fixes: 72d7cb5c19 ("selftests/harness: Prevent infinite loop due to Assert in FIXTURE_TEARDOWN")
Fixes: 0710a1a73f ("selftests/harness: Merge TEST_F_FORK() into TEST_F()")
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20240511171445.904356-4-mic@digikod.net
Rule: add
Link: https://lore.kernel.org/stable/20240506165518.474504-4-mic%40digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-05-11 19:18:43 +02:00
Mickaël Salaün
7e4042abe2
selftests/landlock: Fix FS tests when run on a private mount point
According to the test environment, the mount point of the test's working
directory may be shared or not, which changes the visibility of the
nested "tmp" mount point for the test's parent process calling
umount("tmp").

This was spotted while running tests in containers [1], where mount
points are private.

Cc: Günther Noack <gnoack@google.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Link: https://github.com/landlock-lsm/landlock-test-tools/pull/4 [1]
Fixes: 41cca0542d ("selftests/harness: Fix TEST_F()'s vfork handling")
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20240511171445.904356-3-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-05-11 19:18:42 +02:00
Mickaël Salaün
37dc2e0d38
selftests/pidfd: Fix config for pidfd_setns_test
Required by switch_timens() to open /proc/self/ns/time_for_children.

CONFIG_GENERIC_VDSO_TIME_NS is not available on UML, so pidfd_setns_test
cannot be run successfully on this architecture.

Cc: Shuah Khan <skhan@linuxfoundation.org>
Fixes: 2b40c5db73 ("selftests/pidfd: add pidfd setns tests")
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/r/20240511171445.904356-2-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-05-11 19:18:39 +02:00
Linus Torvalds
cf87f46fd3 drm fixes for 6.9 final
core:
 - fix connector debugging output
 
 i915:
 - Automate CCS Mode setting during engine resets
 - Fix audio time stamp programming for DP
 - Fix parsing backlight BDB data
 
 xe:
 - Fix use zero-length element array
 - Move more from system wq to ordered private wq
 - Do not ignore return for drmm_mutex_init
 
 amdgpu:
 - DCN 3.5 fix
 - MST DSC fixes
 - S0i3 fix
 - S4 fix
 - HDP MMIO mapping fix
 - Fix a regression in visible vram handling
 
 amdkfd:
 - Spatial partition fix
 
 meson:
 - dw-hdmi: power-up fixes
 - dw-hdmi: add badngap setting for g12
 
 nouveau:
 - revert SG_DEBUG fix that has a side effect
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEEKbZHaGwW9KfbeusDHTzWXnEhr4FAmY+jmwACgkQDHTzWXnE
 hr7Pxg//dN+QwBuJZKU98BQAUqeHXX1JHwa28Lk9li9H09xmZhUPQ1LeAhDkq8DA
 VX/2Y6kqFNEh9y/RViV6CkVxwnhZGwJLQL+/mydyhvU5fc1kV9t+dxEweCGcfIqa
 lqg5wUniv0r5qeC74AQswuY8usIuRE0AWb/jTZ5G+62wr0bQXjSgjFXqOmv10Gah
 rLDFlx+3eKDxOIi8NF0sMJbgEEz6Vqr4cJGSW+lTYN18FGPEitO/EPk1qwwJqXNe
 9fK/vquh2i79bI4icphaVzcnrMJYGCyiIz+oOpPJ2P7qiJL5nmAv+nzmgRcFoGdw
 66psgqL2waiwGDOzgiRu/X2rtbYy/PNm704tpgP7g2Ny1iLxqoMJzWYnOnynmK1Q
 rLMxPDjOJgC9VciEorrn6G0m4Yh0EWkfrraFTbXrySOPzvCcE8MAv12NvyltAoA9
 KxyaOntrEYI3a1GDsF5brdSONq2DkOocT1HXya/dMeIX0e2pvaZ4/LNfW96cWkVr
 wl5MlmJXlcRDZIQZ4+NLTUvcS22QV/lFSVMsRbS0ocH+CqdduyyFv2VSctk8Rh3p
 Q9LRD3iyvi7YRBMtff5HBR9c+W5uRz9DpDK7vRdVGbwE3lBEq5eJIOfTIMTP6Wd+
 cWf2cqaMBkipZqQgR9eHHH4mTclTdZiJtgUEXxj11Qe3k81/axQ=
 =Y7zz
 -----END PGP SIGNATURE-----

Merge tag 'drm-fixes-2024-05-11' of https://gitlab.freedesktop.org/drm/kernel

Pull drm fixes from Dave Airlie:
 "This should be the last set of fixes for 6.9, i915, xe and amdgpu are
  the bulk here, one of the previous nouveau fixes turned up an issue,
  so reverting it, otherwise one core and a couple of meson fixes.

  core:
   - fix connector debugging output

  i915:
   - Automate CCS Mode setting during engine resets
   - Fix audio time stamp programming for DP
   - Fix parsing backlight BDB data

  xe:
   - Fix use zero-length element array
   - Move more from system wq to ordered private wq
   - Do not ignore return for drmm_mutex_init

  amdgpu:
   - DCN 3.5 fix
   - MST DSC fixes
   - S0i3 fix
   - S4 fix
   - HDP MMIO mapping fix
   - Fix a regression in visible vram handling

  amdkfd:
   - Spatial partition fix

  meson:
   - dw-hdmi: power-up fixes
   - dw-hdmi: add badngap setting for g12

  nouveau:
   - revert SG_DEBUG fix that has a side effect"

* tag 'drm-fixes-2024-05-11' of https://gitlab.freedesktop.org/drm/kernel:
  Revert "drm/nouveau/firmware: Fix SG_DEBUG error with nvkm_firmware_ctor()"
  drm/amdgpu: Fix comparison in amdgpu_res_cpu_visible
  drm/amdkfd: don't allow mapping the MMIO HDP page with large pages
  drm/xe: Use ordered WQ for G2H handler
  drm/xe/guc: Check error code when initializing the CT mutex
  drm/xe/ads: Use flexible-array
  Revert "drm/amdkfd: Add partition id field to location_id"
  dm/amd/pm: Fix problems with reboot/shutdown for some SMU 13.0.4/13.0.11 users
  drm/amd/display: MST DSC check for older devices
  drm/amd/display: Fix idle optimization checks for multi-display and dual eDP
  drm/amd/display: Fix DSC-re-computing
  drm/amd/display: Enable urgent latency adjustments for DCN35
  drm/connector: Add \n to message about demoting connector force-probes
  drm/i915/bios: Fix parsing backlight BDB data
  drm/i915/audio: Fix audio time stamp programming for DP
  drm/i915/gt: Automate CCS Mode setting during engine resets
  drm/meson: dw-hdmi: add bandgap setting for g12
  drm/meson: dw-hdmi: power up phy on device init
2024-05-10 14:37:05 -07:00
Linus Torvalds
c22c3e0753 18 hotfixes, 7 of which are cc:stable.
More fixups for this cycle's page_owner updates.  And a few userfaultfd
 fixes.  Otherwise, random singletons - see the individual changelogs for
 details.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZj6AhAAKCRDdBJ7gKXxA
 jsvHAQCoSRI4qM0a6j5Fs2Q+B1in+kGWTe50q5Rd755VgolEsgD8CUASDgZ2Qv7g
 yDAlluXMv4uvA4RqkZvDiezsENzYQw0=
 =MApd
 -----END PGP SIGNATURE-----

Merge tag 'mm-hotfixes-stable-2024-05-10-13-14' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull MM fixes from Andrew Morton:
 "18 hotfixes, 7 of which are cc:stable.

  More fixups for this cycle's page_owner updates. And a few userfaultfd
  fixes. Otherwise, random singletons - see the individual changelogs
  for details"

* tag 'mm-hotfixes-stable-2024-05-10-13-14' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
  mailmap: add entry for Barry Song
  selftests/mm: fix powerpc ARCH check
  mailmap: add entry for John Garry
  XArray: set the marks correctly when splitting an entry
  selftests/vDSO: fix runtime errors on LoongArch
  selftests/vDSO: fix building errors on LoongArch
  mm,page_owner: don't remove __GFP_NOLOCKDEP in add_stack_record_to_list
  fs/proc/task_mmu: fix uffd-wp confusion in pagemap_scan_pmd_entry()
  fs/proc/task_mmu: fix loss of young/dirty bits during pagemap scan
  mm/vmalloc: fix return value of vb_alloc if size is 0
  mm: use memalloc_nofs_save() in page_cache_ra_order()
  kmsan: compiler_types: declare __no_sanitize_or_inline
  lib/test_xarray.c: fix error assumptions on check_xa_multi_store_adv_add()
  tools: fix userspace compilation with new test_xarray changes
  MAINTAINERS: update URL's for KEYS/KEYRINGS_INTEGRITY and TPM DEVICE DRIVER
  mm: page_owner: fix wrong information in dump_page_owner
  maple_tree: fix mas_empty_area_rev() null pointer dereference
  mm/userfaultfd: reset ptes when close() for wr-protected ones
2024-05-10 14:16:03 -07:00
Dave Airlie
a222a6470d Revert "drm/nouveau/firmware: Fix SG_DEBUG error with nvkm_firmware_ctor()"
This reverts commit 52a6947bf5.

This causes loading failures in
[    0.367379] nouveau 0000:01:00.0: NVIDIA GP104 (134000a1)
[    0.474499] nouveau 0000:01:00.0: bios: version 86.04.50.80.13
[    0.474620] nouveau 0000:01:00.0: pmu: firmware unavailable
[    0.474977] nouveau 0000:01:00.0: fb: 8192 MiB GDDR5
[    0.484371] nouveau 0000:01:00.0: sec2(acr): mbox 00000001 00000000
[    0.484377] nouveau 0000:01:00.0: sec2(acr):load: boot failed: -5
[    0.484379] nouveau 0000:01:00.0: acr: init failed, -5
[    0.484466] nouveau 0000:01:00.0: init failed with -5
[    0.484468] nouveau: DRM-master:00000000:00000080: init failed with -5
[    0.484470] nouveau 0000:01:00.0: DRM-master: Device allocation failed: -5
[    0.485078] nouveau 0000:01:00.0: probe with driver nouveau failed with error -50

I tried tracking it down but ran out of time this week, will revisit next week.

Reported-by: Dan Moulding <dan@danm.net>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2024-05-11 07:04:10 +10:00
Dave Airlie
b61821bb32 Short summary of fixes pull:
core:
 - fix connector debugging output
 
 meson:
 - dw-hdmi: power-up fixes
 - dw-hdmi: add badngap setting for g12
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAmY9ynIACgkQaA3BHVML
 eiO/Pwf+Ie7fdPnJP/7aodAHRi/gQdwuxxjhLwRwENFP7bjjMhWV/jDnlI/senHx
 ISppKgEqhMmX3rrNn6tOGlZaWgFUi838fS4Nczfx0P1hvNjA2owlEqTIPoFsMHsP
 I1p0yJe4s0LpNp8weBc/IwuZSz0UkuDOsL6xQMUMh7OITdBk+iH9cRMD/+Sg9JgV
 NIzluRCDQ+x3vKmpcUzI9/cDbtVG8XAzPYRvugbHZsX5PwcgZxbsqQXN++uXzvZJ
 X2sSjlzqzzddFmUL18N+uaHf8MNd6BmcLxean4pxnEM+T90VyQdT52OgY2nzXhRK
 aN9Pz8WhRSlXaZEDKxm3VFVdaGuOIQ==
 =6ngs
 -----END PGP SIGNATURE-----

Merge tag 'drm-misc-fixes-2024-05-10' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes

Short summary of fixes pull:

core:
- fix connector debugging output

meson:
- dw-hdmi: power-up fixes
- dw-hdmi: add badngap setting for g12

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240510072027.GA9131@linux.fritz.box
2024-05-11 07:01:16 +10:00
Linus Torvalds
cfb4be1a61 gpio fixes for v6.9
- fix a performance regression in GPIO requesting and releasing after
   the conversion to SRCU
 - fix a use-after-free bug due to a race-condition
 - fix leaking stack memory to user-space in a GPIO uABI corner case
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmY+Y+0ACgkQEacuoBRx
 13L54A/+Mm8dSiQ8svgSzsvdf3lSzk5uROiR5CLlVv2NkkyquWwx0d58i4xyhe2Z
 JIbSvLJxYi9DlGrpkMJglHdYpd8FfCxnTV50bdKH6FMi9KVOZ9oaUuSC6NcYkoL1
 9Vyo3KXigfWCCJ1ay6VmFhgl+5UIJ2Ddbwe4Xh5pQ7gzab30fCL3RCD8V0Aixhtd
 pmDCVv1cjlwAdTOmAfEbGVEGAeghsNRv8a0+PEVNM3uYYlmwzVyr9hZLQLKuSqau
 DWLaHxGRXJUpPy5rDWn9mDushYUlAJSRlZA4dNbQVMp24poRqCVSyQfHmWhmpYr/
 SdyPuEcUuov45H8FTqav/sOxoTBs7f1tb1tvrdkhlrSLnJydw8AE7GIhJWWnvyb4
 cFfSHQL42lrvJmFOTbtJTKXHJ1nLp2eSX7BhkaVYGAmQ59owbTnya1xFEru3vzFi
 p1rHcCcIW10QXIq1ebtqa5tsuA2UI9S7tpDDPCULaqxL3hjn7BJnHdxZYBOJopl9
 AhVRS8uI4Eig4wSquhFqaem9yVhKwdlwWlUfic61cSEfsHJQu4B9gQYPHBbUJCVt
 k6Vu0gzLNGmGa7hv72Udx1SvA9X7Mnb59QGqnmrenxnf3au/5l1k1+X8zA2dOGCj
 o+6YBc66ODyMGpU/p2CP/LFXZe/RQim0jksJbq79qBsRcQFoAI0=
 =fdl3
 -----END PGP SIGNATURE-----

Merge tag 'gpio-fixes-for-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:
 "Some last-minute fixes for this release from the GPIO subsystem.

  The first two address a regression in performance reported to me after
  the conversion to using SRCU in GPIOLIB that was merged during the
  v6.9 merge window. The second patch is not technically a fix but since
  after the first one we no longer need to use a per-descriptor SRCU
  struct, I think it's worth to simplify the code before it gets
  released on Sunday.

  The next two commits fix two memory issues: one use-after-free bug and
  one instance of possibly leaking kernel stack memory to user-space.

  Summary:

   - fix a performance regression in GPIO requesting and releasing after
     the conversion to SRCU

   - fix a use-after-free bug due to a race-condition

   - fix leaking stack memory to user-space in a GPIO uABI corner case"

* tag 'gpio-fixes-for-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  gpiolib: cdev: fix uninitialised kfifo
  gpiolib: cdev: Fix use after free in lineinfo_changed_notify
  gpiolib: use a single SRCU struct for all GPIO descriptors
  gpiolib: fix the speed of descriptor label setting with SRCU
2024-05-10 14:01:00 -07:00
Dave Airlie
06fbf84f46 amd-drm-fixes-6.9-2024-05-10:
amdgpu:
 - DCN 3.5 fix
 - MST DSC fixes
 - S0i3 fix
 - S4 fix
 - HDP MMIO mapping fix
 - Fix a regression in visible vram handling
 
 amdkfd:
 - Spatial partition fix
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQgO5Idg2tXNTSZAr293/aFa7yZ2AUCZj5UXQAKCRC93/aFa7yZ
 2E0TAQDg59wnf7Hw6FR3BkYTtIvPGaFXFY6ckpaNtqO2p1KHjgD+KoTo3+TCgWH1
 iHLF8WMpnN6ZbovK+bbrSQEAzT8yFwA=
 =i9XW
 -----END PGP SIGNATURE-----

Merge tag 'amd-drm-fixes-6.9-2024-05-10' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes

amd-drm-fixes-6.9-2024-05-10:

amdgpu:
- DCN 3.5 fix
- MST DSC fixes
- S0i3 fix
- S4 fix
- HDP MMIO mapping fix
- Fix a regression in visible vram handling

amdkfd:
- Spatial partition fix

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240510171110.1394940-1-alexander.deucher@amd.com
2024-05-11 06:42:45 +10:00
Barry Song
672614a3ed mailmap: add entry for Barry Song
Include a .mailmap entry to synchronize with both my past and current
emails.  Among them, three business mailboxes are dead.

Link: https://lkml.kernel.org/r/20240506042009.10854-1-21cnbao@gmail.com
Signed-off-by: Barry Song <v-songbaohua@oppo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-05-10 12:55:36 -07:00
Michael Ellerman
7e6423441b selftests/mm: fix powerpc ARCH check
In commit 0518dbe97f ("selftests/mm: fix cross compilation with LLVM")
the logic to detect the machine architecture in the Makefile was changed
to use ARCH, and only fallback to uname -m if ARCH is unset.  However the
tests of ARCH were not updated to account for the fact that ARCH is
"powerpc" for powerpc builds, not "ppc64".

Fix it by changing the checks to look for "powerpc", and change the
uname -m logic to convert "ppc64.*" into "powerpc".

With that fixed the following tests now build for powerpc again:
 * protection_keys
 * va_high_addr_switch
 * virtual_address_range
 * write_to_hugetlbfs

Link: https://lkml.kernel.org/r/20240506115825.66415-1-mpe@ellerman.id.au
Fixes: 0518dbe97f ("selftests/mm: fix cross compilation with LLVM")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Cc: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>	[6.4+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-05-10 12:55:36 -07:00
Linus Torvalds
f4345f05c0 block-6.9-20240510
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmY+Tr0QHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpok2EACLqHZ2faer07Rpmm9pYzQxPVAJ1iQn3+dX
 kQLVStabysazYC8ZRk8VrgUZDJAblHDEct/f4eMVIX0abQoXB6nghkAUPFXledso
 SjCJCzWzhZN7xbC3FAQoxldpFjQxlI3y5xiqcD33bfTouPCDAwkThqCtXIEMwyff
 OwRDvrB8SrGLHIJYPntfKFnI1DTpu41ZFY/508olxs/uZSuUbxdPFQj2rh8gC5on
 b86HvsCS8laGY6EO86bbTjjp9WJJ1MMMaFrPzwc9deWbh/lJDB70hptxrHBLLv5Z
 i+CctM+KEYB/KRL+YjXZSOS2tYmoeA9jEbrtcqiEX87h3F3bfhH4XAp2EDkNoeG9
 bzLRaR8tNsKoBkpauGgptjtxpJKHDs5ax4mJgsphOGGv6VBi+RfUlmIe76XFspzZ
 YJHRjpJ1FsBjyWtQ60W2FWdN+1IrvZ0GriN/Wk68ReHPGp9pBsnK6LXSUSAQ5cq2
 eCKppG7S7ZVMylXZhNOK2E8vgz1XqsaE0wf7jI5tPjQKyZBVFrlIQ0sVBr01mKkv
 ycOJEUx6dGnJrzJPaH3T2m0lhCrUDJaM1/eUWFWvdQEWXyDlGmF6cU0smiSYbeca
 LP4TU+iB5s5D5nltzHq9D+9E96MWm6axhKAfoJZLpPI6+I73xD3hOAw3ufKIlNi9
 jWjtMbArpQ==
 =k1hJ
 -----END PGP SIGNATURE-----

Merge tag 'block-6.9-20240510' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:

 - NVMe pull request via Keith:
     - nvme target fixes (Sagi, Dan, Maurizo)
     - new vendor quirk for broken MSI (Sean)

 - Virtual boundary fix for a regression in this merge window (Ming)

* tag 'block-6.9-20240510' of git://git.kernel.dk/linux:
  nvmet-rdma: fix possible bad dereference when freeing rsps
  nvmet: prevent sprintf() overflow in nvmet_subsys_nsid_exists()
  nvmet: make nvmet_wq unbound
  nvmet-auth: return the error code to the nvmet_auth_ctrl_hash() callers
  nvme-pci: Add quirk for broken MSIs
  block: set default max segment size in case of virt_boundary
2024-05-10 10:24:16 -07:00
Linus Torvalds
ed44935c33 spi: Fixes for v6.9
Two device specific fixes here, one avoiding glitches on chip select
 with the STM32 driver and one for incorrectly configured clocks on the
 Microchip QSPI controller.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmY+C7gACgkQJNaLcl1U
 h9BDiQf9FFfXTPXCXOKfieymySTm/Fi2sjei3zDVeBq0udLXA5CCfGRwCdBLsOjC
 94vJ1vqzaa+mu9Zgb7Ow1Cxx/twtwPsmViemE5o18KMNwpLjLFXiUG1H5ONgKwMS
 8UfEe3PNjUGGHfxbgF7gSDrGzXaHJK4zdcHDzsb68Ch5bRdPWeOOEfOihwRW2YLO
 gm3HL6Rd14Pq55MWYjH4tloEHQSoHHcYtlQDNV3LgM0IVBqts5aeB/tTdapoRMj6
 auMtuBqLtldd0rtd9mp/o9jtyuCPJqDJaN9fgDXnTJlO6cqTtzlIk5ydTiubBJFE
 F530OLr+pMkmfHPZkxGDUkuXKWKJ/A==
 =VCmU
 -----END PGP SIGNATURE-----

Merge tag 'spi-fix-v6.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "Two device specific fixes here, one avoiding glitches on chip select
  with the STM32 driver and one for incorrectly configured clocks on the
  Microchip QSPI controller"

* tag 'spi-fix-v6.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: microchip-core-qspi: fix setting spi bus clock rate
  spi: stm32: enable controller before asserting CS
2024-05-10 10:20:49 -07:00
Linus Torvalds
99dff48496 regulator: Fixes for v6.9
Two fixes here, one from Johan which fixes error handling when we
 attempt to create duplicate debugfs files and one for an incorrect
 specification of ramp_delay with the rtq2208.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmY+C2IACgkQJNaLcl1U
 h9BkKAf+Jf9Xu7YMB66E4+6bn7T95+9Fn0U8u3pjdjpNXn6Z70Kf+Tpr2mCFwJbV
 DNoMuFZzav1+TK/aKQaB1iEXIKgZck3VjsFTRjEwAH4jtjOnEwuvMBnXlrNXZGBb
 /nHOf8y3GAyrYJ0I6E/4BwyHq+WfzK1Dp61dkv91B5W3Cmz/sfuzpZ5uRJpAP33v
 OyGfrUl12F5H3HkqmSPGMmUvyCpt+vzi+Fc/haltEsGVM8TmvyDy/qBML7K2sr2d
 K7ESqCw/0kZ0YlOCSnU8SbMClYj8awGXtWVBLSNWA+51qGvcwgVrOhcX/320x0J8
 Qvug1DZ/dm4DvzwgjD2p013/SQykww==
 =V0Kh
 -----END PGP SIGNATURE-----

Merge tag 'regulator-fix-v6.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
 "Two fixes here, one from Johan which fixes error handling when we
  attempt to create duplicate debugfs files and one for an incorrect
  specification of ramp_delay with the rtq2208"

* tag 'regulator-fix-v6.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: core: fix debugfs creation regression
  regulator: rtq2208: Fix the BUCK ramp_delay range to maximum of 16mVstep/us
2024-05-10 10:18:31 -07:00
Linus Torvalds
92d503011f Fix possible (but unlikely) out-of-bounds access in
the timer migration per-CPU-init code.
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmY+AJMRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1goog/+PiUBrrONN97ZPcHAVcUfu7+9oAFGdMx8
 VbkfD/uPH+etxzkfr2aIakOt+JnM88YwvMcTpdT1NzNZbTYBSM2IYktTYdvXQsCX
 F/Ca0BvyyAqlL/cNbgvfEaQues6HclrLw1JIMJhxzlFJKqXVQDoCX3yESR/0Xs3U
 Mm+BhbfTWQEKBQ8BfdKZEBmGnuyGGFPb14g+IkFAdM6g3KFCPupGhn2wkXlN2PmM
 p5nftL39/ph4mClwYGs98VXaRL6v/jHSo/cwfhqVSAZcGw7z6seAbofCH2av9rD4
 SiNjAyYLb0am+e2izt5o4V3z+T8BM3EfdWC0G9W2Nt/Uq3gvTfEK2uCq25r/CyV6
 P8uS1KUoVrcWKrnr73k8aL2c9Db8PH/F0GL4WwAXjNmDZmgrIjE4gGgaH3j4micw
 PV3Ebse7+X2PWDTKj+e0i0ruqxPlko/rcDnoH6dzcMKb0A82w0IWSehlzWHag7QW
 NZmHNwVA1awzmWyxOPLARmlVpjeHtXzAh+QtprzfVMZfKWCZ4xjKvA+nNjqRyHDb
 apjNLkz+7OAAEICoVrIjV8S92EWDrLn27H7utOeqeqg1MFZuQPtpuYY34QQHwOZu
 7m9KgnNppc6dOY4TPWN28Vy2aaTmEEPJvS67BgjH//WKkCSINW7xY2hMt5SxnQgW
 IqL+v4gVWmk=
 =Wb1D
 -----END PGP SIGNATURE-----

Merge tag 'timers-urgent-2024-05-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fix from Ingo Molnar:
 "Fix possible (but unlikely) out-of-bounds access in the timer
  migration per-CPU-init code"

* tag 'timers-urgent-2024-05-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  timers/migration: Prevent out of bounds access on failure
2024-05-10 10:15:58 -07:00
Linus Torvalds
98957025cf IOMMU Fixes for Linux v6.9-rc7:
Including:
 
 	- Fix offset miscalculation on ARM-SMMU driver
 
 	- AMD IOMMU fix for initializing state of untrusted devices
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEr9jSbILcajRFYWYyK/BELZcBGuMFAmY9+5wACgkQK/BELZcB
 GuPzQg/9EwElcc9Vtdcnoiyl0VgdmlAF3IxLIL8LbM+WEm/PXMK+LnYDBdclLQIo
 lW9v4ZGzm+DKqRF1ksC78/yKWcbfJ31rzkE7Ztf57yzHkVxB1qWe7/ksrpkn0Fjx
 32Y6lhhaw6WACXA1gSvz/TXiL+Zr8F/T++R5Cxc1gCFo11W1A/jrXOKjNgNtNx/U
 O9/uDpIFHdQvvOBmAPpFQi43P7TPb4PylEjPzsJQP239ZTFT7h25vZZHdA3PfyPU
 +nSisgibpOMfyMbqY25q4Qg4+Ek0BvdG3yi8+mlUK9MRKwvebCIBhIsSh2HWSSGu
 jyq0xzPc5Av7ufWNKA9L3jbxgAtnODrc8cUlUQ7lXNNB7hPz10QiDfvMmVXrvcwW
 B8K4agYf2wfK64lJuMpbjbh3qFXbAoWKjQMx7xwji7LVhukdA0ndbERg1YKN3nLO
 39KLatEDgTLqHsKclIbCdwwd8FfYQTFrUTT4nHsVW4YFhtUd8yNuh4bdmOFgHaNg
 /9VhII864BAwWy6P4pYur921rRBorHAQ20PyeOsNOMESFtA7VQOX504zbCayiknf
 dYeoQGUnS202a1gjicpMMWMF5IzZE681Z8YLbndrNyjpiQ5pi8IWDDGstdHqmhtX
 vcc0S0WIMHBlZPbkAATu/A7A3bwymImmbJ1n9y7S6RHbtu/mKGo=
 =zdMj
 -----END PGP SIGNATURE-----

Merge tag 'iommu-fixes-v6.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pull iommu fixes from Joerg Roedel:

 - Fix offset miscalculation on ARM-SMMU driver

 - AMD IOMMU fix for initializing state of untrusted devices

* tag 'iommu-fixes-v6.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu/arm-smmu: Use the correct type in nvidia_smmu_context_fault()
  iommu/amd: Enhance def_domain_type to handle untrusted device
2024-05-10 10:10:21 -07:00
Michel Dänzer
8d2c930735 drm/amdgpu: Fix comparison in amdgpu_res_cpu_visible
It incorrectly claimed a resource isn't CPU visible if it's located at
the very end of CPU visible VRAM.

Fixes: a6ff969fe9 ("drm/amdgpu: fix visible VRAM handling during faults")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3343
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reported-and-Tested-by: Jeremy Day <jsday@noreason.ca>
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
CC: stable@vger.kernel.org
2024-05-10 13:05:13 -04:00
Alex Deucher
be4a2a81b6 drm/amdkfd: don't allow mapping the MMIO HDP page with large pages
We don't get the right offset in that case.  The GPU has
an unused 4K area of the register BAR space into which you can
remap registers.  We remap the HDP flush registers into this
space to allow userspace (CPU or GPU) to flush the HDP when it
updates VRAM.  However, on systems with >4K pages, we end up
exposing PAGE_SIZE of MMIO space.

Fixes: d8e408a827 ("drm/amdkfd: Expose HDP registers to user space")
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
2024-05-10 13:05:13 -04:00
Thomas Gleixner
5754ace3c3 x86/topology/amd: Ensure that LLC ID is initialized
The original topology evaluation code initialized cpu_data::topo::llc_id
with the die ID initialy and then eventually overwrite it with information
gathered from a CPUID leaf.

The conversion analysis failed to spot that particular detail and omitted
this initial assignment under the assumption that each topology evaluation
path will set it up. That assumption is mostly correct, but turns out to be
wrong in case that the CPUID leaf 0x80000006 does not provide a LLC ID.

In that case, LLC ID is invalid and as a consequence the setup of the
scheduling domain CPU masks is incorrect which subsequently causes the
scheduler core to complain about it during CPU hotplug:

  BUG: arch topology borken
       the CLS domain not a subset of the MC domain

Cure it by reusing legacy_set_llc() and assigning the die ID if the LLC ID
is invalid after all possible parsers have been tried.

Fixes: f7fb3b2dd9 ("x86/cpu: Provide an AMD/HYGON specific topology parser")
Reported-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Link: https://lore.kernel.org/r/PUZPR04MB63168AC442C12627E827368581292@PUZPR04MB6316.apcprd04.prod.outlook.com
2024-05-10 17:42:50 +02:00