sched_ext: selftests/dsp_local_on: Fix sporadic failures
Subsystems (13)
Sasha Levin
maintainerPATCH 1/31 sched_ext: selftests/dsp_local_on: Fix sporadic failures
From: Tejun Heo <[email protected]>
[ Upstream commit e9fe182772dcb2630964724fd93e9c90b68ea0fd ]
dsp_local_on has several incorrect assumptions, one of which is that p->nr_cpus_allowed always tracks p->cpus_ptr. This is not true when a task is scheduled out while migration is disabled - p->cpus_ptr is temporarily overridden to the previous CPU while p->nr_cpus_allowed remains unchanged.
This led to sporadic test faliures when dsp_local_on_dispatch() tries to put a migration disabled task to a different CPU. Fix it by keeping the previous CPU when migration is disabled.
There are SCX schedulers that make use of p->nr_cpus_allowed. They should also implement explicit handling for p->migration_disabled.
--- tools/testing/selftests/sched_ext/dsp_local_on.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/sched_ext/dsp_local_on.bpf.c +1 -1
@@ -43,7 +43,7 @@ void BPF_STRUCT_OPS(dsp_local_on_dispatch, s32 cpu, struct task_struct *prev)if (!p)return ; -if (p->nr_cpus_allowed == nr_cpus) +if (p->nr_cpus_allowed == nr_cpus && !p->migration_disabled) target =bpf_get_prandom_u32 () % nr_cpus;else target =scx_bpf_task_cpu (p);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/31 HID: intel-ish-hid: fix the length of MNG_SYNC_FW_CLOCK in doorbell
From: Zhang Lixu <[email protected]>
[ Upstream commit 4b54ae69197b9f416baa0fceadff7e89075f8454 ]
The timestamps in the Firmware log and HID sensor samples are incorrect. They show 1970-01-01 because the current IPC driver only uses the first 8 bytes of bootup time when synchronizing time with the firmware. The firmware converts the bootup time to UTC time, which results in the display of 1970-01-01.
In write_ipc_from_queue(), when sending the MNG_SYNC_FW_CLOCK message, the clock is updated according to the definition of ipc_time_update_msg. However, in _ish_sync_fw_clock(), the message length is specified as the size of uint64_t when building the doorbell. As a result, the firmware only receives the first 8 bytes of struct ipc_time_update_msg. This patch corrects the length in the doorbell to ensure the entire ipc_time_update_msg is sent, fixing the timestamp issue.
--- drivers/hid/intel-ish-hid/ipc/ipc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/intel-ish-hid/ipc/ipc.c +3 -3
@@ -578,14 +578,14 @@ static void fw_reset_work_fn(struct work_struct *work)static void _ish_sync_fw_clock (struct ishtp_device *dev) {static unsigned long prev_sync; -uint64_t usec; +struct ipc_time_update_msg time = {};if (prev_sync &&time_before (jiffies, prev_sync +20 *HZ ))return ; prev_sync = jiffies; - usec =ktime_to_us (ktime_get_boottime ()); -ipc_send_mng_msg (dev,MNG_SYNC_FW_CLOCK , &usec,sizeof (uint64_t )); +/* The fields of time would be updated while sending message */ +ipc_send_mng_msg (dev,MNG_SYNC_FW_CLOCK , &time,sizeof (time)); }/**
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/31 HID: intel-ish-hid: Send clock sync message immediately after reset
In reply to Sasha LevinFrom: Zhang Lixu <[email protected]>
[ Upstream commit 7e0d1cff12b895f44f4ddc8cf50311bc1f775201 ]
The ISH driver performs a clock sync with the firmware once at system startup and then every 20 seconds. If a firmware reset occurs right after a clock sync, the driver would wait 20 seconds before performing another clock sync with the firmware. This is particularly problematic with the introduction of the "load firmware from host" feature, where the driver performs a clock sync with the bootloader and then has to wait 20 seconds before syncing with the main firmware.
This patch clears prev_sync immediately upon receiving an IPC reset, so that the main firmware and driver will perform a clock sync immediately after completing the IPC handshake.
--- drivers/hid/intel-ish-hid/ipc/ipc.c | 9 ++++++--- drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/hid/intel-ish-hid/ipc/ipc.c +6 -3
@@ -517,6 +517,10 @@ static int ish_fw_reset_handler(struct ishtp_device *dev)/* ISH FW is dead */ if (!ish_is_input_ready (dev))return -EPIPE ; + +/* Send clock sync at once after reset */ + ishtp_dev->prev_sync =0 ; +/* * Set HOST2ISH.ILUP. Apparently we need this BEFORE sending * RESET_NOTIFY_ACK - FW will be checking for it
@@ -577,13 +581,12 @@ static void fw_reset_work_fn(struct work_struct *work)*/ static void _ish_sync_fw_clock (struct ishtp_device *dev) { -static unsigned long prev_sync;struct ipc_time_update_msg time = {}; -if (prev_sync &&time_before (jiffies, prev_sync +20 *HZ )) +if (dev->prev_sync &&time_before (jiffies, dev->prev_sync +20 *HZ ))return ; - prev_sync = jiffies; + dev->prev_sync = jiffies;/* The fields of time would be updated while sending message */ ipc_send_mng_msg (dev,MNG_SYNC_FW_CLOCK , &time,sizeof (time)); }
drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h +2 -0
@@ -242,6 +242,8 @@ struct ishtp_device {unsigned int ipc_tx_cnt;unsigned long long ipc_tx_bytes_cnt; +/* Time of the last clock sync */ +unsigned long prev_sync;const struct ishtp_hw_ops *ops;size_t mtu;uint32_t ishtp_msg_hdr;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/31 HID: ignore non-functional sensor in HP 5MP Camera
In reply to Sasha LevinFrom: "Chia-Lin Kao (AceLan)" <[email protected]>
[ Upstream commit 363236d709e75610b628c2a4337ccbe42e454b6d ]
The HP 5MP Camera (USB ID 0408:5473) reports a HID sensor interface that is not actually implemented. Attempting to access this non-functional sensor via iio_info causes system hangs as runtime PM tries to wake up an unresponsive sensor.
[453] hid-sensor-hub 0003:0408:5473.0003: Report latency attributes: ffffffff:ffffffff
[453] hid-sensor-hub 0003:0408:5473.0003: common attributes: 5:1, 2:1, 3:1 ffffffff:ffffffff
Add this device to the HID ignore list since the sensor interface is non-functional by design and should not be exposed to userspace.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + 2 files changed, 2 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -1089,6 +1089,7 @@#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001 0x3001#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3003 0x3003#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008 +#define USB_DEVICE_ID_QUANTA_HP_5MP_CAMERA_5473 0x5473#define I2C_VENDOR_ID_RAYDIUM 0x2386#define I2C_PRODUCT_ID_RAYDIUM_4B33 0x4b33
drivers/hid/hid-quirks.c +1 -0
@@ -891,6 +891,7 @@ static const struct hid_device_id hid_ignore_list[] = { { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DPAD) }, #endif { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, + { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_HP_5MP_CAMERA_5473) }, { } };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/31 HID: hid-steam: Fix issues with disabling both gamepad mode and lizard mode
In reply to Sasha LevinFrom: Vicki Pfau <[email protected]>
[ Upstream commit 05c4ede6951b5d8e083b6bb237950cac59bdeb92 ]
When lizard mode is disabled, there were two issues:
1. Switching between gamepad mode and desktop mode still functioned, even though desktop mode did not. This lead to the ability to "break" gamepad mode by holding down the Options key even while lizard mode is disabled
2. If you were in desktop mode when lizard mode is disabled, you would immediately enter this faulty mode.
This patch properly disables the ability to switch between gamepad mode and the faulty desktop mode by holding the Options key, as well as effectively removing the faulty mode by bypassing the early returns if lizard mode is disabled.
--- drivers/hid/hid-steam.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/hid-steam.c +3 -3
@@ -1050,10 +1050,10 @@ static void steam_mode_switch_cb(struct work_struct *work) struct steam_device, mode_switch);unsigned long flags;bool client_opened; - steam->gamepad_mode = !steam->gamepad_mode;if (!lizard_mode)return ; + steam->gamepad_mode = !steam->gamepad_mode;if (steam->gamepad_mode)steam_set_lizard_mode (steam, false);else {
@@ -1598,7 +1598,7 @@ static void steam_do_deck_input_event(struct steam_device *steam,schedule_delayed_work (&steam->mode_switch,45 *HZ /100 ); } -if (!steam->gamepad_mode) +if (!steam->gamepad_mode && lizard_mode)return ; lpad_touched = b10 &BIT (3 );
@@ -1668,7 +1668,7 @@ static void steam_do_deck_sensors_event(struct steam_device *steam,*/ steam->sensor_timestamp_us +=4000 ; -if (!steam->gamepad_mode) +if (!steam->gamepad_mode && lizard_mode)return ;input_event (sensors,EV_MSC ,MSC_TIMESTAMP , steam->sensor_timestamp_us);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/31 usb: phy: generic: Use proper helper for property detection
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 309005e448c1f3e4b81e4416406991b7c3339c1d ]
Since commit c141ecc3cecd7 ("of: Warn when of_property_read_bool() is used on non-boolean properties") a warning is raised if this function is used for property detection. of_property_present() is the correct helper for this.
--- drivers/usb/phy/phy-generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/phy/phy-generic.c +1 -1
@@ -212,7 +212,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)if (of_property_read_u32 (node,"clock-frequency" , &clk_rate)) clk_rate =0 ; - needs_clk =of_property_read_bool (node,"clocks" ); + needs_clk =of_property_present (node,"clocks" ); } nop->gpiod_reset =devm_gpiod_get_optional (dev,"reset" ,GPIOD_ASIS );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/31 HID: intel-ish-hid: ipc: Add Panther Lake PCI device IDs
In reply to Sasha LevinFrom: Zhang Lixu <[email protected]>
[ Upstream commit 18c966b62819b9d3b99eac8fb8cdc8950826e0c2 ]
Add device IDs of Panther Lake-H and Panther Lake-P into ishtp support list.
--- drivers/hid/intel-ish-hid/ipc/hw-ish.h | 2 ++ drivers/hid/intel-ish-hid/ipc/pci-ish.c | 7 +++++++ 2 files changed, 9 insertions(+)
drivers/hid/intel-ish-hid/ipc/hw-ish.h +2 -0
@@ -36,6 +36,8 @@#define PCI_DEVICE_ID_INTEL_ISH_ARL_H 0x7745#define PCI_DEVICE_ID_INTEL_ISH_ARL_S 0x7F78#define PCI_DEVICE_ID_INTEL_ISH_LNL_M 0xA845 +#define PCI_DEVICE_ID_INTEL_ISH_PTL_H 0xE345 +#define PCI_DEVICE_ID_INTEL_ISH_PTL_P 0xE445#define REVISION_ID_CHT_A0 0x6#define REVISION_ID_CHT_Ax_SI 0x0
drivers/hid/intel-ish-hid/ipc/pci-ish.c +7 -0
@@ -26,9 +26,11 @@enum ishtp_driver_data_index {ISHTP_DRIVER_DATA_NONE ,ISHTP_DRIVER_DATA_LNL_M , +ISHTP_DRIVER_DATA_PTL , };#define ISH_FW_GEN_LNL_M "lnlm" +#define ISH_FW_GEN_PTL "ptl"#define ISH_FIRMWARE_PATH (gen) "intel/ish/ish_" gen ".bin"#define ISH_FIRMWARE_PATH_ALL "intel/ish/ish_*.bin"
@@ -37,6 +39,9 @@ static struct ishtp_driver_data ishtp_driver_data[] = { [ISHTP_DRIVER_DATA_LNL_M ] = { .fw_generation =ISH_FW_GEN_LNL_M , }, + [ISHTP_DRIVER_DATA_PTL ] = { + .fw_generation =ISH_FW_GEN_PTL , + }, };static const struct pci_device_id ish_pci_tbl[] = {
@@ -63,6 +68,8 @@ static const struct pci_device_id ish_pci_tbl[] = { {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ARL_H)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ARL_S)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_LNL_M), .driver_data = ISHTP_DRIVER_DATA_LNL_M}, + {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_PTL_H), .driver_data = ISHTP_DRIVER_DATA_PTL}, + {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_PTL_P), .driver_data = ISHTP_DRIVER_DATA_PTL}, {} };MODULE_DEVICE_TABLE (pci, ish_pci_tbl);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/31 HID: topre: Fix n-key rollover on Realforce R3S TKL boards
In reply to Sasha LevinFrom: Daniel Brackenbury <[email protected]>
[ Upstream commit 9271af9d846c7e49c8709b58d5853cb73c00b193 ]
Newer model R3* Topre Realforce keyboards share an issue with their older R2 cousins where a report descriptor fixup is needed in order for n-key rollover to work correctly, otherwise only 6-key rollover is available. This patch adds some new hardware IDs for the R3S 87-key keyboard and makes amendments to the existing hid-topre driver in order to change the correct byte in the new model.
--- drivers/hid/Kconfig | 3 ++- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-topre.c | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-)
drivers/hid/Kconfig +2 -1
@@ -1154,7 +1154,8 @@ config HID_TOPRE tristate "Topre REALFORCE keyboards" depends on HID help - Say Y for N-key rollover support on Topre REALFORCE R2 108/87 key keyboards. + Say Y for N-key rollover support on Topre REALFORCE R2 108/87 key and + Topre REALFORCE R3S 87 key keyboards. config HID_THINGM tristate "ThingM blink(1) USB RGB LED"
drivers/hid/hid-ids.h +1 -0
@@ -1296,6 +1296,7 @@#define USB_VENDOR_ID_TOPRE 0x0853#define USB_DEVICE_ID_TOPRE_REALFORCE_R2_108 0x0148#define USB_DEVICE_ID_TOPRE_REALFORCE_R2_87 0x0146 +#define USB_DEVICE_ID_TOPRE_REALFORCE_R3S_87 0x0313#define USB_VENDOR_ID_TOPSEED 0x0766#define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204
drivers/hid/hid-topre.c +7 -0
@@ -29,6 +29,11 @@ static const __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc,hid_info (hdev,"fixing up Topre REALFORCE keyboard report descriptor\n" ); rdesc[72 ] =0x02 ; + }else if (*rsize >=106 && rdesc[28 ] ==0x29 && rdesc[29 ] ==0xe7 && + rdesc[30 ] ==0x81 && rdesc[31 ] ==0x00 ) { +hid_info (hdev, +"fixing up Topre REALFORCE keyboard report descriptor\n" ); + rdesc[31 ] =0x02 ; }return rdesc; }
@@ -38,6 +43,8 @@ static const struct hid_device_id topre_id_table[] = { USB_DEVICE_ID_TOPRE_REALFORCE_R2_108) }, { HID_USB_DEVICE(USB_VENDOR_ID_TOPRE, USB_DEVICE_ID_TOPRE_REALFORCE_R2_87) }, + { HID_USB_DEVICE(USB_VENDOR_ID_TOPRE, + USB_DEVICE_ID_TOPRE_REALFORCE_R3S_87) }, { } }; MODULE_DEVICE_TABLE(hid, topre_id_table);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 9/31 selftests/cgroup: use bash in test_cpuset_v1_hp.sh
In reply to Sasha LevinFrom: Bharadwaj Raju <[email protected]>
[ Upstream commit fd079124112c6e11c1bca2e7c71470a2d60bc363 ]
The script uses non-POSIX features like [[ for conditionals and hence does not work when run with a POSIX /bin/sh.
Change the shebang to /bin/bash instead, like the other tests in cgroup.
--- tools/testing/selftests/cgroup/test_cpuset_v1_hp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/cgroup/test_cpuset_v1_hp.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # # Test the special cpuset v1 hotplug case where a cpuset become empty of
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/31 HID: hid-apple: Apple Magic Keyboard a3203 USB-C support
In reply to Sasha LevinFrom: Ievgen Vovk <[email protected]>
[ Upstream commit 2813e00dcd748cef47d2bffaa04071de93fddf00 ]
Add Apple Magic Keyboard 2024 model (with USB-C port) device ID (0320) to those recognized by the hid-apple driver. Keyboard is otherwise compatible with the existing implementation for its earlier 2021 model.
--- drivers/hid/hid-apple.c | 5 +++++ drivers/hid/hid-ids.h | 1 + 2 files changed, 6 insertions(+)
drivers/hid/hid-apple.c +5 -0
@@ -474,6 +474,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015) table = magic_keyboard_2015_fn_keys; else if (hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 || + hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024 || hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 || hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021) table = apple2021_fn_keys;
@@ -1150,6 +1151,10 @@ static const struct hid_device_id apple_devices[] = { .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024), + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024), + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021), .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021),
drivers/hid/hid-ids.h +1 -0
@@ -184,6 +184,7 @@#define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242#define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 0x029c +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024 0x0320#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 0x029a#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021 0x029f#define USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT 0x8102
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/31 HID: apple: fix up the F6 key on the Omoton KB066 keyboard
In reply to Sasha LevinFrom: Alex Henrie <[email protected]>
[ Upstream commit 819083cb6eedcc8495cbf84845877bcc741b93b3 ]
The Omoton KB066 is an Apple A1255 keyboard clone (HID product code 05ac:022c). On both keyboards, the F6 key becomes Num Lock when the Fn key is held. But unlike its Apple exemplar, when the Omoton's F6 key is pressed without Fn, it sends the usage code 0xC0301 from the reserved section of the consumer page instead of the standard F6 usage code 0x7003F from the keyboard page. The nonstandard code is translated to KEY_UNKNOWN and becomes useless on Linux. The Omoton KB066 is a pretty popular keyboard, judging from its 29,058 reviews on Amazon at time of writing, so let's account for its quirk to make it more usable.
By the way, it would be nice if we could automatically set fnmode to 0 for Omoton keyboards because they handle the Fn key internally and the kernel's Fn key handling creates undesirable side effects such as making F1 and F2 always Brightness Up and Brightness Down in fnmode=1 (the default) or always F1 and F2 in fnmode=2. Unfortunately I don't think there's a way to identify Bluetooth keyboards more specifically than the HID product code which is obviously inaccurate. Users of Omoton keyboards will just have to set fnmode to 0 manually to get full Fn key functionality.
--- drivers/hid/hid-apple.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-apple.c +3 -0
@@ -546,6 +546,9 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, } } +if (usage->hid ==0xc0301 )/* Omoton KB066 quirk */ + code =KEY_F6 ; +if (usage->code != code) {input_event_with_scancode (input, usage->type, code, usage->hid, value);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/31 btrfs: fix two misuses of folio_shift()
In reply to Sasha LevinFrom: "Matthew Wilcox (Oracle)" <[email protected]>
[ Upstream commit 01af106a076352182b2916b143fc50272600bd81 ]
It is meaningless to shift a byte count by folio_shift(). The folio index is in units of PAGE_SIZE, not folio_size(). We can use folio_contains() to make this work for arbitrary-order folios, so remove the assertion that the folios are of order 0.
--- fs/btrfs/extent_io.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
fs/btrfs/extent_io.c +5 -6
@@ -526,8 +526,6 @@ static void end_bbio_data_read(struct btrfs_bio *bbio)u64 end;u32 len; -/* For now only order 0 folios are supported for data. */ -ASSERT (folio_order (folio) ==0 ); btrfs_debug(fs_info, "%s: bi_sector=%llu, err=%d, mirror=%u", __func__, bio->bi_iter.bi_sector, bio->bi_status,
@@ -555,7 +553,6 @@ static void end_bbio_data_read(struct btrfs_bio *bbio)if (likely (uptodate)) {loff_t i_size =i_size_read (inode); -pgoff_t end_index = i_size >>folio_shift (folio);/* * Zero out the remaining part if this range straddles
@@ -564,9 +561,11 @@ static void end_bbio_data_read(struct btrfs_bio *bbio)* Here we should only zero the range inside the folio, * not touch anything else. * -* NOTE: i_size is exclusive while end is inclusive. +* NOTE: i_size is exclusive while end is inclusive and +* folio_contains() takes PAGE_SIZE units. */ -if (folio_index (folio) == end_index && i_size <= end) { +if (folio_contains (folio, i_size >>PAGE_SHIFT ) && + i_size <= end) {u32 zero_start =max (offset_in_folio (folio, i_size),offset_in_folio (folio, start)); u32 zero_len = offset_in_folio(folio, end) + 1 -
@@ -963,7 +962,7 @@ static int btrfs_do_readpage(struct folio *folio, struct extent_map **em_cached,return ret; } -if (folio->index == last_byte >>folio_shift (folio)) { +if (folio_contains (folio, last_byte >>PAGE_SHIFT )) {size_t zero_offset =offset_in_folio (folio, last_byte);if (zero_offset) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 13/31 objtool: Ignore dangling jump table entries
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit 3724062ca2b1364f02cf44dbea1a552227844ad1 ]
Clang sometimes leaves dangling unused jump table entries which point to the end of the function. Ignore them.
--- tools/objtool/check.c | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/objtool/check.c +9 -0
@@ -2099,6 +2099,14 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn, reloc_addend(reloc) == pfunc->offset)break ; +/* +* Clang sometimes leaves dangling unused jump table entries +* which point to the end of the function. Ignore them. +*/ +if (reloc->sym->sec == pfunc->sec && +reloc_addend (reloc) == pfunc->offset + pfunc->len) + goto next; + dest_insn =find_insn (file, reloc->sym->sec,reloc_addend (reloc));if (!dest_insn)break ;
@@ -2116,6 +2124,7 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn, alt->insn = dest_insn; alt->next = insn->alts; insn->alts = alt; +next: prev_offset =reloc_offset (reloc); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 14/31 sched: Clarify wake_up_q()'s write to task->wake_q.next
In reply to Sasha LevinFrom: Jann Horn <[email protected]>
[ Upstream commit bcc6244e13b4d4903511a1ea84368abf925031c0 ]
Clarify that wake_up_q() does an atomic write to task->wake_q.next, after which a concurrent __wake_q_add() can immediately overwrite task->wake_q.next again.
--- kernel/sched/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/sched/core.c +3 -2
@@ -1058,9 +1058,10 @@ void wake_up_q(struct wake_q_head *head)struct task_struct *task; task = container_of(node, struct task_struct, wake_q); -/* Task can safely be re-inserted now: */ node = node->next; - task->wake_q.next =NULL ; +/* pairs with cmpxchg_relaxed() in __wake_q_add() */ +WRITE_ONCE (task->wake_q.next,NULL ); +/* Task can safely be re-inserted now. */ /* * wake_up_process() executes a full barrier, which pairs with
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 15/31 platform/x86: thinkpad_acpi: Fix invalid fan speed on ThinkPad X120e
In reply to Sasha LevinFrom: Sybil Isabel Dorsett <[email protected]>
[ Upstream commit 1046cac109225eda0973b898e053aeb3d6c10e1d ]
On ThinkPad X120e, fan speed is reported in ticks per revolution rather than RPM.
Recalculate the fan speed value reported for ThinkPad X120e to RPM based on a 22.5 kHz clock.
Based on the information on
https://www.thinkwiki.org/wiki/How_to_control_fan_speed,
the same problem is highly likely to be relevant to at least Edge11, but Edge11 is not addressed in this patch.
--- drivers/platform/x86/thinkpad_acpi.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +14 -2
@@ -7883,6 +7883,7 @@ static struct ibm_struct volume_driver_data = {#define FAN_NS_CTRL_STATUS BIT(2)/* Bit which determines control is enabled or not */ #define FAN_NS_CTRL BIT(4)/* Bit which determines control is by host or EC */ +#define FAN_CLOCK_TPM (22500*60)/* Ticks per minute for a 22.5 kHz clock */ enum {/* Fan control constants */ fan_status_offset =0x2f ,/* EC register 0x2f */
@@ -7938,6 +7939,7 @@ static int fan_watchdog_maxinterval;static bool fan_with_ns_addr;static bool ecfw_with_fan_dec_rpm; +static bool fan_speed_in_tpr;static struct mutex fan_mutex;
@@ -8140,8 +8142,11 @@ static int fan_get_speed(unsigned int *speed) !acpi_ec_read(fan_rpm_offset + 1, &hi)))return -EIO ; -if (likely (speed)) +if (likely (speed)) { *speed = (hi <<8 ) | lo; +if (fan_speed_in_tpr && *speed !=0 ) + *speed =FAN_CLOCK_TPM / *speed; + }break ;case TPACPI_FAN_RD_TPEC_NS :if (!acpi_ec_read (fan_rpm_status_ns, &lo))
@@ -8174,8 +8179,11 @@ static int fan2_get_speed(unsigned int *speed)if (rc)return -EIO ; -if (likely (speed)) +if (likely (speed)) { *speed = (hi <<8 ) | lo; +if (fan_speed_in_tpr && *speed !=0 ) + *speed =FAN_CLOCK_TPM / *speed; + }break ;case TPACPI_FAN_RD_TPEC_NS :
@@ -8786,6 +8794,7 @@ static const struct attribute_group fan_driver_attr_group = {#define TPACPI_FAN_NOFAN 0x0008/* no fan available */ #define TPACPI_FAN_NS 0x0010/* For EC with non-Standard register addresses */ #define TPACPI_FAN_DECRPM 0x0020/* For ECFW's with RPM in register as decimal */ +#define TPACPI_FAN_TPR 0x0040/* Fan speed is in Ticks Per Revolution */ static const struct tpacpi_quirk fan_quirk_table[]__initconst = {TPACPI_QEC_IBM ('1' ,'Y' ,TPACPI_FAN_Q1 ),
@@ -8815,6 +8824,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = {TPACPI_Q_LNV3 ('R' ,'0' ,'V' ,TPACPI_FAN_NS ),/* 11e Gen5 KL-Y */ TPACPI_Q_LNV3 ('N' ,'1' ,'O' ,TPACPI_FAN_NOFAN ),/* X1 Tablet (2nd gen) */ TPACPI_Q_LNV3 ('R' ,'0' ,'Q' ,TPACPI_FAN_DECRPM ),/* L480 */ + TPACPI_Q_LNV('8', 'F', TPACPI_FAN_TPR), /* ThinkPad x120e */ };static int __init fan_init (struct ibm_init_struct *iibm)
@@ -8885,6 +8895,8 @@ static int __init fan_init(struct ibm_init_struct *iibm)if (quirks &TPACPI_FAN_Q1 )fan_quirk1_setup (); +if (quirks &TPACPI_FAN_TPR ) + fan_speed_in_tpr = true;/* Try and probe the 2nd fan */ tp_features.second_fan =1 ;/* needed for get_speed to work */ res =fan2_get_speed (&speed);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 16/31 platform/x86: thinkpad_acpi: Support for V9 DYTC platform profiles
In reply to Sasha LevinFrom: Mark Pearson <[email protected]>
[ Upstream commit 9cff907cbf8c7fb5345918dbcc7b74a01656f34f ]
Newer Thinkpad AMD platforms are using V9 DYTC and this changes the profiles used for PSC mode. Add support for this update. Tested on P14s G5 AMD
--- drivers/platform/x86/thinkpad_acpi.c | 34 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 12 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +22 -12
@@ -10329,6 +10329,10 @@ static struct ibm_struct proxsensor_driver_data = {#define DYTC_MODE_PSC_BALANCE 5/* Default mode aka balanced */ #define DYTC_MODE_PSC_PERFORM 7/* High power mode aka performance */ +#define DYTC_MODE_PSCV9_LOWPOWER 1/* Low power mode */ +#define DYTC_MODE_PSCV9_BALANCE 3/* Default mode aka balanced */ +#define DYTC_MODE_PSCV9_PERFORM 4/* High power mode aka performance */ +#define DYTC_ERR_MASK 0xF/* Bits 0-3 in cmd result are the error result */ #define DYTC_ERR_SUCCESS 1/* CMD completed successful */
@@ -10349,6 +10353,10 @@ static int dytc_capabilities;static bool dytc_mmc_get_available;static int profile_force; +static int platform_psc_profile_lowpower =DYTC_MODE_PSC_LOWPOWER ; +static int platform_psc_profile_balanced =DYTC_MODE_PSC_BALANCE ; +static int platform_psc_profile_performance =DYTC_MODE_PSC_PERFORM ; +static int convert_dytc_to_profile (int funcmode,int dytcmode,enum platform_profile_option *profile) {
@@ -10370,19 +10378,15 @@ static int convert_dytc_to_profile(int funcmode, int dytcmode, }return 0 ;case DYTC_FUNCTION_PSC : -switch (dytcmode) { -case DYTC_MODE_PSC_LOWPOWER : +if (dytcmode == platform_psc_profile_lowpower) *profile =PLATFORM_PROFILE_LOW_POWER ; -break ; -case DYTC_MODE_PSC_BALANCE : +else if (dytcmode == platform_psc_profile_balanced) *profile =PLATFORM_PROFILE_BALANCED ; -break ; -case DYTC_MODE_PSC_PERFORM : +else if (dytcmode == platform_psc_profile_performance) *profile =PLATFORM_PROFILE_PERFORMANCE ; -break ; -default :/* Unknown mode */ +else return -EINVAL ; - } +return 0 ;case DYTC_FUNCTION_AMT :/* For now return balanced. It's the closest we have to 'auto' */
@@ -10403,19 +10407,19 @@ static int convert_profile_to_dytc(enum platform_profile_option profile, int *peif (dytc_capabilities &BIT (DYTC_FC_MMC )) *perfmode =DYTC_MODE_MMC_LOWPOWER ;else if (dytc_capabilities &BIT (DYTC_FC_PSC )) - *perfmode =DYTC_MODE_PSC_LOWPOWER ; + *perfmode = platform_psc_profile_lowpower;break ;case PLATFORM_PROFILE_BALANCED :if (dytc_capabilities &BIT (DYTC_FC_MMC )) *perfmode =DYTC_MODE_MMC_BALANCE ;else if (dytc_capabilities &BIT (DYTC_FC_PSC )) - *perfmode =DYTC_MODE_PSC_BALANCE ; + *perfmode = platform_psc_profile_balanced;break ;case PLATFORM_PROFILE_PERFORMANCE :if (dytc_capabilities &BIT (DYTC_FC_MMC )) *perfmode =DYTC_MODE_MMC_PERFORM ;else if (dytc_capabilities &BIT (DYTC_FC_PSC )) - *perfmode =DYTC_MODE_PSC_PERFORM ; + *perfmode = platform_psc_profile_performance;break ;default :/* Unknown profile */ return -EOPNOTSUPP ;
@@ -10604,6 +10608,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm)if (output &BIT (DYTC_QUERY_ENABLE_BIT )) dytc_version = (output >>DYTC_QUERY_REV_BIT ) &0xF ; +dbg_printk (TPACPI_DBG_INIT ,"DYTC version %d\n" , dytc_version);/* Check DYTC is enabled and supports mode setting */ if (dytc_version <5 )return -ENODEV ;
@@ -10642,6 +10647,11 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) } }else if (dytc_capabilities &BIT (DYTC_FC_PSC )) {/* PSC MODE */ pr_debug ("PSC is supported\n" ); +if (dytc_version >=9 ) {/* update profiles for DYTC 9 and up */ + platform_psc_profile_lowpower =DYTC_MODE_PSCV9_LOWPOWER ; + platform_psc_profile_balanced =DYTC_MODE_PSCV9_BALANCE ; + platform_psc_profile_performance =DYTC_MODE_PSCV9_PERFORM ; + } }else {dbg_printk (TPACPI_DBG_INIT ,"No DYTC support available\n" );return -ENODEV ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 17/31 platform/x86: int3472: Use correct type for "polarity", call it gpio_flags
In reply to Sasha LevinFrom: Sakari Ailus <[email protected]>
[ Upstream commit fc22b06fbd2afefa1eddff69a6fd30c539cef577 ]
Struct gpiod_lookup flags field's type is unsigned long. Thus use unsigned long for values to be assigned to that field. Similarly, also call the field gpio_flags which it really is.
--- drivers/platform/x86/intel/int3472/discrete.c | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/platform/x86/intel/int3472/discrete.c +20 -19
@@ -55,7 +55,7 @@ static void skl_int3472_log_sensor_module_name(struct int3472_discrete_device *istatic int skl_int3472_fill_gpiod_lookup (struct gpiod_lookup *table_entry,struct acpi_resource_gpio *agpio, -const char *func,u32 polarity) +const char *func,unsigned long gpio_flags) {char *path = agpio->resource_source.string_ptr;struct acpi_device *adev;
@@ -70,14 +70,14 @@ static int skl_int3472_fill_gpiod_lookup(struct gpiod_lookup *table_entry,if (!adev)return -ENODEV ; - *table_entry =GPIO_LOOKUP (acpi_dev_name (adev), agpio->pin_table[0 ], func, polarity); + *table_entry =GPIO_LOOKUP (acpi_dev_name (adev), agpio->pin_table[0 ], func, gpio_flags);return 0 ; }static int skl_int3472_map_gpio_to_sensor (struct int3472_discrete_device *int3472,struct acpi_resource_gpio *agpio, -const char *func,u32 polarity) +const char *func,unsigned long gpio_flags) {int ret;
@@ -87,7 +87,7 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347 } ret =skl_int3472_fill_gpiod_lookup (&int3472->gpios.table[int3472->n_sensor_gpios], - agpio, func, polarity); + agpio, func, gpio_flags);if (ret)return ret;
@@ -100,7 +100,7 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347static struct gpio_desc *skl_int3472_gpiod_get_from_temp_lookup (struct int3472_discrete_device *int3472,struct acpi_resource_gpio *agpio, -const char *func,u32 polarity) +const char *func,unsigned long gpio_flags) {struct gpio_desc *desc;int ret;
@@ -111,7 +111,7 @@ skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472,return ERR_PTR (-ENOMEM ); lookup->dev_id =dev_name (int3472->dev); - ret =skl_int3472_fill_gpiod_lookup (&lookup->table[0 ], agpio, func, polarity); + ret =skl_int3472_fill_gpiod_lookup (&lookup->table[0 ], agpio, func, gpio_flags);if (ret)return ERR_PTR (ret);
@@ -122,32 +122,33 @@ skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472,return desc; } -static void int3472_get_func_and_polarity (u8 type,const char **func,u32 *polarity) +static void int3472_get_func_and_polarity (u8 type,const char **func, +unsigned long *gpio_flags) {switch (type) {case INT3472_GPIO_TYPE_RESET : *func ="reset" ; - *polarity =GPIO_ACTIVE_LOW ; + *gpio_flags =GPIO_ACTIVE_LOW ;break ;case INT3472_GPIO_TYPE_POWERDOWN : *func ="powerdown" ; - *polarity =GPIO_ACTIVE_LOW ; + *gpio_flags =GPIO_ACTIVE_LOW ;break ;case INT3472_GPIO_TYPE_CLK_ENABLE : *func ="clk-enable" ; - *polarity =GPIO_ACTIVE_HIGH ; + *gpio_flags =GPIO_ACTIVE_HIGH ;break ;case INT3472_GPIO_TYPE_PRIVACY_LED : *func ="privacy-led" ; - *polarity =GPIO_ACTIVE_HIGH ; + *gpio_flags =GPIO_ACTIVE_HIGH ;break ;case INT3472_GPIO_TYPE_POWER_ENABLE : *func ="power-enable" ; - *polarity =GPIO_ACTIVE_HIGH ; + *gpio_flags =GPIO_ACTIVE_HIGH ;break ;default : *func ="unknown" ; - *polarity =GPIO_ACTIVE_HIGH ; + *gpio_flags =GPIO_ACTIVE_HIGH ;break ; } }
@@ -194,7 +195,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,struct gpio_desc *gpio;const char *err_msg;const char *func; -u32 polarity; +unsigned long gpio_flags;int ret;if (!acpi_gpio_get_io_resource (ares, &agpio))
@@ -217,7 +218,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, type =FIELD_GET (INT3472_GPIO_DSM_TYPE , obj->integer.value); -int3472_get_func_and_polarity (type, &func, &polarity); +int3472_get_func_and_polarity (type, &func, &gpio_flags); pin =FIELD_GET (INT3472_GPIO_DSM_PIN , obj->integer.value);if (pin != agpio->pin_table[0 ])
@@ -227,16 +228,16 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, active_value =FIELD_GET (INT3472_GPIO_DSM_SENSOR_ON_VAL , obj->integer.value);if (!active_value) - polarity ^=GPIO_ACTIVE_LOW ; + gpio_flags ^=GPIO_ACTIVE_LOW ;dev_dbg (int3472->dev,"%s %s pin %d active-%s\n" , func, agpio->resource_source.string_ptr, agpio->pin_table[0 ], -str_high_low (polarity ==GPIO_ACTIVE_HIGH )); +str_high_low (gpio_flags ==GPIO_ACTIVE_HIGH ));switch (type) {case INT3472_GPIO_TYPE_RESET :case INT3472_GPIO_TYPE_POWERDOWN : - ret =skl_int3472_map_gpio_to_sensor (int3472, agpio, func, polarity); + ret =skl_int3472_map_gpio_to_sensor (int3472, agpio, func, gpio_flags);if (ret) err_msg ="Failed to map GPIO pin to sensor\n" ;
@@ -244,7 +245,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,case INT3472_GPIO_TYPE_CLK_ENABLE :case INT3472_GPIO_TYPE_PRIVACY_LED :case INT3472_GPIO_TYPE_POWER_ENABLE : - gpio =skl_int3472_gpiod_get_from_temp_lookup (int3472, agpio, func, polarity); + gpio =skl_int3472_gpiod_get_from_temp_lookup (int3472, agpio, func, gpio_flags);if (IS_ERR (gpio)) { ret =PTR_ERR (gpio); err_msg ="Failed to get GPIO\n" ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 18/31 platform/x86: int3472: Call "reset" GPIO "enable" for INT347E
In reply to Sasha LevinFrom: Sakari Ailus <[email protected]>
[ Upstream commit 569617dbbd06286fb73f3f1c2ac91e51d863c7de ]
The DT bindings for ov7251 specify "enable" GPIO (xshutdown in documentation) but the int3472 indiscriminately provides this as a "reset" GPIO to sensor drivers. Take this into account by assigning it as "enable" with active high polarity for INT347E devices, i.e. ov7251. "reset" with active low polarity remains the default GPIO name for other devices.
--- drivers/platform/x86/intel/int3472/discrete.c | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-)
drivers/platform/x86/intel/int3472/discrete.c +48 -4
@@ -2,6 +2,7 @@/* Author: Dan Scally <[email protected]> */ #include <linux/acpi.h> +#include <linux/array_size.h> #include <linux/bitfield.h> #include <linux/device.h> #include <linux/gpio/consumer.h>
@@ -122,10 +123,53 @@ skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472,return desc; } -static void int3472_get_func_and_polarity (u8 type,const char **func, -unsigned long *gpio_flags) +/** +* struct int3472_gpio_map - Map GPIOs to whatever is expected by the +* sensor driver (as in DT bindings) +* @hid: The ACPI HID of the device without the instance number e.g. INT347E +* @type_from: The GPIO type from ACPI ?SDT +* @type_to: The assigned GPIO type, typically same as @type_from +* @func: The function, e.g. "enable" +* @polarity_low: GPIO_ACTIVE_LOW true if the @polarity_low is true, +* GPIO_ACTIVE_HIGH otherwise +*/ +struct int3472_gpio_map { +const char *hid; +u8 type_from; +u8 type_to; +bool polarity_low; +const char *func; +}; + +static const struct int3472_gpio_map int3472_gpio_map[] = { + {"INT347E" ,INT3472_GPIO_TYPE_RESET ,INT3472_GPIO_TYPE_RESET , false,"enable" }, +}; + +static void int3472_get_func_and_polarity (struct acpi_device *adev,u8 *type, +const char **func,unsigned long *gpio_flags) { -switch (type) { +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (int3472_gpio_map); i++) { +/* +* Map the firmware-provided GPIO to whatever a driver expects +* (as in DT bindings). First check if the type matches with the +* GPIO map, then further check that the device _HID matches. +*/ +if (*type != int3472_gpio_map[i].type_from) +continue ; + +if (!acpi_dev_hid_uid_match (adev, int3472_gpio_map[i].hid,NULL )) +continue ; + + *type = int3472_gpio_map[i].type_to; + *gpio_flags = int3472_gpio_map[i].polarity_low ? +GPIO_ACTIVE_LOW :GPIO_ACTIVE_HIGH ; + *func = int3472_gpio_map[i].func; +return ; + } + +switch (*type) {case INT3472_GPIO_TYPE_RESET : *func ="reset" ; *gpio_flags =GPIO_ACTIVE_LOW ;
@@ -218,7 +262,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, type =FIELD_GET (INT3472_GPIO_DSM_TYPE , obj->integer.value); -int3472_get_func_and_polarity (type, &func, &gpio_flags); +int3472_get_func_and_polarity (int3472->sensor, &type, &func, &gpio_flags); pin =FIELD_GET (INT3472_GPIO_DSM_PIN , obj->integer.value);if (pin != agpio->pin_table[0 ])
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 19/31 s390/cio: Fix CHPID "configure" attribute caching
In reply to Sasha LevinFrom: Peter Oberparleiter <[email protected]>
[ Upstream commit 32ae4a2992529e2c7934e422035fad1d9b0f1fb5 ]
In some environments, the SCLP firmware interface used to query a CHPID's configured state is not supported. On these environments, rapidly reading the corresponding sysfs attribute produces inconsistent results:
$ cat /sys/devices/css0/chp0.00/configure cat: /sys/devices/css0/chp0.00/configure: Operation not supported $ cat /sys/devices/css0/chp0.00/configure 3
This occurs for example when Linux is run as a KVM guest. The inconsistency is a result of CIO using cached results for generating the value of the "configure" attribute while failing to handle the situation where no data was returned by SCLP.
Fix this by not updating the cache-expiration timestamp when SCLP returns no data. With the fix applied, the system response is consistent:
$ cat /sys/devices/css0/chp0.00/configure cat: /sys/devices/css0/chp0.00/configure: Operation not supported $ cat /sys/devices/css0/chp0.00/configure cat: /sys/devices/css0/chp0.00/configure: Operation not supported
--- drivers/s390/cio/chp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/s390/cio/chp.c +2 -1
@@ -682,7 +682,8 @@ static int info_update(void)if (time_after (jiffies, chp_info_expires)) {/* Data is too old, update. */ rc =sclp_chp_read_info (&chp_info); - chp_info_expires = jiffies +CHP_INFO_UPDATE_INTERVAL ; +if (!rc) + chp_info_expires = jiffies +CHP_INFO_UPDATE_INTERVAL ; }mutex_unlock (&info_lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 20/31 thermal/cpufreq_cooling: Remove structure member documentation
In reply to Sasha LevinFrom: Daniel Lezcano <[email protected]>
[ Upstream commit a6768c4f92e152265590371975d44c071a5279c7 ]
The structure member documentation refers to a member which does not exist any more. Remove it.
--- drivers/thermal/cpufreq_cooling.c | 2 -- 1 file changed, 2 deletions(-)
drivers/thermal/cpufreq_cooling.c +0 -2
@@ -57,8 +57,6 @@ struct time_in_idle {* @max_level: maximum cooling level. One less than total number of valid * cpufreq frequencies. * @em: Reference on the Energy Model of the device -* @cdev: thermal_cooling_device pointer to keep track of the -* registered cooling device. * @policy: cpufreq policy. * @cooling_ops: cpufreq callbacks to thermal cooling device ops * @idle_time: idle time stats
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 21/31 um: virt-pci: don't use kmalloc()
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 5b166b782d327f4b66190cc43afd3be36f2b3b7a ]
This code can be called deep in the IRQ handling, for example, and then cannot normally use kmalloc(). Have its own pre-allocated memory and use from there instead so this doesn't occur. Only in the (very rare) case of memcpy_toio() we'd still need to allocate memory.
--- arch/um/drivers/virt-pci.c | 198 +++++++++++++++++++------------------ 1 file changed, 102 insertions(+), 96 deletions(-)
arch/um/drivers/virt-pci.c +102 -96
@@ -25,8 +25,10 @@#define MAX_IRQ_MSG_SIZE (sizeof(struct virtio_pcidev_msg) + sizeof(u32))#define NUM_IRQ_MSGS 10 -#define HANDLE_NO_FREE (ptr) ((void *)((unsigned long)(ptr) | 1)) -#define HANDLE_IS_NO_FREE (ptr) ((unsigned long)(ptr) & 1) +struct um_pci_message_buffer { +struct virtio_pcidev_msg hdr; +u8 data[8 ]; +};struct um_pci_device {struct virtio_device *vdev;
@@ -36,6 +38,11 @@ struct um_pci_device {struct virtqueue *cmd_vq, *irq_vq; +#define UM_PCI_WRITE_BUFS 20 +struct um_pci_message_buffer bufs[UM_PCI_WRITE_BUFS +1 ]; +void *extra_ptrs[UM_PCI_WRITE_BUFS +1 ]; +DECLARE_BITMAP (used_bufs,UM_PCI_WRITE_BUFS ); +#define UM_PCI_STAT_WAITING 0unsigned long status;
@@ -61,12 +68,40 @@ static unsigned long um_pci_msi_used[BITS_TO_LONGS(MAX_MSI_VECTORS)];static unsigned int um_pci_max_delay_us =40000 ;module_param_named (max_delay_us, um_pci_max_delay_us, uint,0644 ); -struct um_pci_message_buffer { -struct virtio_pcidev_msg hdr; -u8 data[8 ]; -}; +static int um_pci_get_buf (struct um_pci_device *dev,bool *posted) +{ +int i; + +for (i =0 ; i <UM_PCI_WRITE_BUFS ; i++) { +if (!test_and_set_bit (i, dev->used_bufs)) +return i; + } -static struct um_pci_message_buffer __percpu *um_pci_msg_bufs; + *posted = false; +return UM_PCI_WRITE_BUFS ; +} + +static void um_pci_free_buf (struct um_pci_device *dev,void *buf) +{ +int i; + +if (buf == &dev->bufs[UM_PCI_WRITE_BUFS ]) { +kfree (dev->extra_ptrs[UM_PCI_WRITE_BUFS ]); + dev->extra_ptrs[UM_PCI_WRITE_BUFS ] =NULL ; +return ; + } + +for (i =0 ; i <UM_PCI_WRITE_BUFS ; i++) { +if (buf == &dev->bufs[i]) { +kfree (dev->extra_ptrs[i]); + dev->extra_ptrs[i] =NULL ; +WARN_ON (!test_and_clear_bit (i, dev->used_bufs)); +return ; + } + } + +WARN_ON (1 ); +} static int um_pci_send_cmd(struct um_pci_device *dev, struct virtio_pcidev_msg *cmd,
@@ -82,7 +117,9 @@ static int um_pci_send_cmd(struct um_pci_device *dev, };struct um_pci_message_buffer *buf;int delay_count =0 ; +bool bounce_out;int ret, len; +int buf_idx;bool posted;if (WARN_ON (cmd_size <sizeof (*cmd) || cmd_size >sizeof (*buf)))
@@ -101,26 +138,28 @@ static int um_pci_send_cmd(struct um_pci_device *dev,break ; } - buf =get_cpu_var (um_pci_msg_bufs); -if (buf) -memcpy (buf, cmd, cmd_size); + bounce_out = !posted && cmd_size <=sizeof (*cmd) && + out && out_size <=sizeof (buf->data); -if (posted) { -u8 *ncmd =kmalloc (cmd_size + extra_size,GFP_ATOMIC ); - -if (ncmd) { -memcpy (ncmd, cmd, cmd_size); -if (extra) -memcpy (ncmd + cmd_size, extra, extra_size); - cmd = (void *)ncmd; - cmd_size += extra_size; - extra =NULL ; - extra_size =0 ; - }else { -/* try without allocating memory */ - posted = false; - cmd = (void *)buf; + buf_idx =um_pci_get_buf (dev, &posted); + buf = &dev->bufs[buf_idx]; +memcpy (buf, cmd, cmd_size); + +if (posted && extra && extra_size >sizeof (buf) - cmd_size) { + dev->extra_ptrs[buf_idx] =kmemdup (extra, extra_size, +GFP_ATOMIC ); + +if (!dev->extra_ptrs[buf_idx]) { +um_pci_free_buf (dev, buf); +return -ENOMEM ; } + extra = dev->extra_ptrs[buf_idx]; + }else if (extra && extra_size <=sizeof (buf) - cmd_size) { +memcpy ((u8 *)buf + cmd_size, extra, extra_size); + cmd_size += extra_size; + extra_size =0 ; + extra =NULL ; + cmd = (void *)buf; }else { cmd = (void *)buf; }
@@ -128,39 +167,40 @@ static int um_pci_send_cmd(struct um_pci_device *dev,sg_init_one (&out_sg, cmd, cmd_size);if (extra)sg_init_one (&extra_sg, extra, extra_size); -if (out) +/* allow stack for small buffers */ +if (bounce_out) +sg_init_one (&in_sg, buf->data, out_size); +else if (out)sg_init_one (&in_sg, out, out_size);/* add to internal virtio queue */ ret =virtqueue_add_sgs (dev->cmd_vq, sgs_list, extra ?2 :1 , out ?1 :0 , - posted ? cmd :HANDLE_NO_FREE (cmd), -GFP_ATOMIC ); + cmd,GFP_ATOMIC );if (ret) { -if (posted) -kfree (cmd); - goto out; +um_pci_free_buf (dev, buf); +return ret; }if (posted) {virtqueue_kick (dev->cmd_vq); - ret =0 ; - goto out; +return 0 ; }/* kick and poll for getting a response on the queue */ set_bit (UM_PCI_STAT_WAITING , &dev->status);virtqueue_kick (dev->cmd_vq); + ret =0 ;while (1 ) {void *completed =virtqueue_get_buf (dev->cmd_vq, &len); -if (completed ==HANDLE_NO_FREE (cmd)) +if (completed == buf)break ; -if (completed && !HANDLE_IS_NO_FREE (completed)) -kfree (completed); +if (completed) +um_pci_free_buf (dev, completed); if (WARN_ONCE(virtqueue_is_broken(dev->cmd_vq) || ++delay_count > um_pci_max_delay_us,
@@ -172,8 +212,11 @@ static int um_pci_send_cmd(struct um_pci_device *dev, }clear_bit (UM_PCI_STAT_WAITING , &dev->status); -out: -put_cpu_var (um_pci_msg_bufs); +if (bounce_out) +memcpy (out, buf->data, out_size); + +um_pci_free_buf (dev, buf); +return ret; }
@@ -187,20 +230,13 @@ static unsigned long um_pci_cfgspace_read(void *priv, unsigned int offset, .size = size, .addr = offset, }; -/* buf->data is maximum size - we may only use parts of it */ -struct um_pci_message_buffer *buf; -u8 *data; -unsigned long ret =ULONG_MAX ; -size_t bytes =sizeof (buf->data); +/* max 8, we might not use it all */ +u8 data[8 ];if (!dev)return ULONG_MAX ; - buf =get_cpu_var (um_pci_msg_bufs); - data = buf->data; - -if (buf) -memset (data,0xff , bytes); +memset (data,0xff ,sizeof (data));switch (size) {case 1 :
@@ -212,34 +248,26 @@ static unsigned long um_pci_cfgspace_read(void *priv, unsigned int offset,break ;default :WARN (1 ,"invalid config space read size %d\n" , size); - goto out; +return ULONG_MAX ; } -if (um_pci_send_cmd (dev, &hdr,sizeof (hdr),NULL ,0 , data, bytes)) - goto out; +if (um_pci_send_cmd (dev, &hdr,sizeof (hdr),NULL ,0 , data, size)) +return ULONG_MAX ;switch (size) {case 1 : - ret = data[0 ]; -break ; +return data[0 ];case 2 : - ret =le16_to_cpup ((void *)data); -break ; +return le16_to_cpup ((void *)data);case 4 : - ret =le32_to_cpup ((void *)data); -break ; +return le32_to_cpup ((void *)data);#ifdef CONFIG_64BIT case 8 : - ret =le64_to_cpup ((void *)data); -break ; +return le64_to_cpup ((void *)data);#endif default : -break ; +return ULONG_MAX ; } - -out: -put_cpu_var (um_pci_msg_bufs); -return ret; } static void um_pci_cfgspace_write(void *priv, unsigned int offset, int size,
@@ -312,13 +340,8 @@ static void um_pci_bar_copy_from(void *priv, void *buffer,static unsigned long um_pci_bar_read (void *priv,unsigned int offset,int size) { -/* buf->data is maximum size - we may only use parts of it */ -struct um_pci_message_buffer *buf; -u8 *data; -unsigned long ret =ULONG_MAX ; - - buf =get_cpu_var (um_pci_msg_bufs); - data = buf->data; +/* 8 is maximum size - we may only use parts of it */ +u8 data[8 ];switch (size) {case 1 :
@@ -330,33 +353,25 @@ static unsigned long um_pci_bar_read(void *priv, unsigned int offset,break ;default :WARN (1 ,"invalid config space read size %d\n" , size); - goto out; +return ULONG_MAX ; }um_pci_bar_copy_from (priv, data, offset, size);switch (size) {case 1 : - ret = data[0 ]; -break ; +return data[0 ];case 2 : - ret =le16_to_cpup ((void *)data); -break ; +return le16_to_cpup ((void *)data);case 4 : - ret =le32_to_cpup ((void *)data); -break ; +return le32_to_cpup ((void *)data);#ifdef CONFIG_64BIT case 8 : - ret =le64_to_cpup ((void *)data); -break ; +return le64_to_cpup ((void *)data);#endif default : -break ; +return ULONG_MAX ; } - -out: -put_cpu_var (um_pci_msg_bufs); -return ret; } static void um_pci_bar_copy_to(void *priv, unsigned int offset,
@@ -523,11 +538,8 @@ static void um_pci_cmd_vq_cb(struct virtqueue *vq)if (test_bit (UM_PCI_STAT_WAITING , &dev->status))return ; -while ((cmd =virtqueue_get_buf (vq, &len))) { -if (WARN_ON (HANDLE_IS_NO_FREE (cmd))) -continue ; -kfree (cmd); - } +while ((cmd =virtqueue_get_buf (vq, &len))) +um_pci_free_buf (dev, cmd); }static void um_pci_irq_vq_cb (struct virtqueue *vq)
@@ -1006,10 +1018,6 @@ static int __init um_pci_init(void) "No virtio device ID configured for PCI - no PCI support\n"))return 0 ; - um_pci_msg_bufs = alloc_percpu(struct um_pci_message_buffer); -if (!um_pci_msg_bufs) -return -ENOMEM ; - bridge =pci_alloc_host_bridge (0 );if (!bridge) { err = -ENOMEM ;
@@ -1070,7 +1078,6 @@ static int __init um_pci_init(void)pci_free_resource_list (&bridge->windows);pci_free_host_bridge (bridge); } -free_percpu (um_pci_msg_bufs);return err; }module_init (um_pci_init);
@@ -1082,6 +1089,5 @@ static void __exit um_pci_exit(void)irq_domain_remove (um_pci_inner_domain);pci_free_resource_list (&bridge->windows);pci_free_host_bridge (bridge); -free_percpu (um_pci_msg_bufs); }module_exit (um_pci_exit);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 22/31 um: virtio_uml: use raw spinlock
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit daa1a05ba431540097ec925d4e01d53ef29a98f1 ]
This is needed because at least in time-travel the code can be called directly from the deep architecture and IRQ handling code.
--- arch/um/drivers/virtio_uml.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/um/drivers/virtio_uml.c +4 -4
@@ -52,7 +52,7 @@ struct virtio_uml_device {struct platform_device *pdev;struct virtio_uml_platform_data *pdata; -spinlock_t sock_lock; +raw_spinlock_t sock_lock;int sock, req_fd, irq;u64 features;u64 protocol_features;
@@ -247,7 +247,7 @@ static int vhost_user_send(struct virtio_uml_device *vu_dev,if (request_ack) msg->header.flags |=VHOST_USER_FLAG_NEED_REPLY ; -spin_lock_irqsave (&vu_dev->sock_lock, flags); +raw_spin_lock_irqsave (&vu_dev->sock_lock, flags); rc =full_sendmsg_fds (vu_dev->sock, msg, size, fds, num_fds);if (rc <0 ) goto out;
@@ -267,7 +267,7 @@ static int vhost_user_send(struct virtio_uml_device *vu_dev, } out: -spin_unlock_irqrestore (&vu_dev->sock_lock, flags); +raw_spin_unlock_irqrestore (&vu_dev->sock_lock, flags);return rc; }
@@ -1220,7 +1220,7 @@ static int virtio_uml_probe(struct platform_device *pdev) goto error_free; vu_dev->sock = rc; -spin_lock_init (&vu_dev->sock_lock); +raw_spin_lock_init (&vu_dev->sock_lock); rc =vhost_user_init (vu_dev);if (rc)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 23/31 um: convert irq_lock to raw spinlock
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 96178631c3f53398044ed437010f7632ad764bf8 ]
Since this is deep in the architecture, and the code is called nested into other deep management code, this really needs to be a raw spinlock. Convert it.
--- arch/um/kernel/irq.c | 79 ++++++++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 32 deletions(-)
arch/um/kernel/irq.c +47 -32
@@ -52,7 +52,7 @@ struct irq_entry {bool sigio_workaround; }; -static DEFINE_SPINLOCK (irq_lock); +static DEFINE_RAW_SPINLOCK (irq_lock);static LIST_HEAD (active_fds); static DECLARE_BITMAP(irqs_allocated, UM_LAST_SIGNAL_IRQ);static bool irqs_suspended;
@@ -257,7 +257,7 @@ static struct irq_entry *get_irq_entry_by_fd(int fd)return NULL ; } -static void free_irq_entry (struct irq_entry *to_free,bool remove) +static void remove_irq_entry (struct irq_entry *to_free,bool remove) {if (!to_free)return ;
@@ -265,7 +265,6 @@ static void free_irq_entry(struct irq_entry *to_free, bool remove)if (remove)os_del_epoll_fd (to_free->fd);list_del (&to_free->list); -kfree (to_free); }static bool update_irq_entry (struct irq_entry *entry)
@@ -286,17 +285,19 @@ static bool update_irq_entry(struct irq_entry *entry)return false; } -static void update_or_free_irq_entry (struct irq_entry *entry) +static struct irq_entry *update_or_remove_irq_entry (struct irq_entry *entry) { -if (!update_irq_entry (entry)) -free_irq_entry (entry, false); +if (update_irq_entry (entry)) +return NULL ; +remove_irq_entry (entry, false); +return entry; }static int activate_fd (int irq,int fd,enum um_irq_type type,void *dev_id,void (*timetravel_handler)(int ,int ,void *,struct time_travel_event *)) { -struct irq_entry *irq_entry; +struct irq_entry *irq_entry, *to_free =NULL ;int err, events =os_event_mask (type);unsigned long flags;
@@ -304,9 +305,10 @@ static int activate_fd(int irq, int fd, enum um_irq_type type, void *dev_id,if (err <0 ) goto out; -spin_lock_irqsave (&irq_lock, flags); +raw_spin_lock_irqsave (&irq_lock, flags); irq_entry =get_irq_entry_by_fd (fd);if (irq_entry) { +already:/* cannot register the same FD twice with the same type */ if (WARN_ON (irq_entry->reg[type].events)) { err = -EALREADY ;
@@ -316,11 +318,22 @@ static int activate_fd(int irq, int fd, enum um_irq_type type, void *dev_id,/* temporarily disable to avoid IRQ-side locking */ os_del_epoll_fd (fd); }else { - irq_entry =kzalloc (sizeof (*irq_entry),GFP_ATOMIC ); -if (!irq_entry) { - err = -ENOMEM ; - goto out_unlock; +struct irq_entry *new; + +/* don't restore interrupts */ +raw_spin_unlock (&irq_lock); + new =kzalloc (sizeof (*irq_entry),GFP_ATOMIC ); +if (!new) { +local_irq_restore (flags); +return -ENOMEM ; } +raw_spin_lock (&irq_lock); + irq_entry =get_irq_entry_by_fd (fd); +if (irq_entry) { + to_free = new; + goto already; + } + irq_entry = new; irq_entry->fd = fd;list_add_tail (&irq_entry->list, &active_fds);maybe_sigio_broken (fd);
@@ -339,12 +352,11 @@ static int activate_fd(int irq, int fd, enum um_irq_type type, void *dev_id,#endif WARN_ON (!update_irq_entry (irq_entry)); -spin_unlock_irqrestore (&irq_lock, flags); - -return 0 ; + err =0 ; out_unlock: -spin_unlock_irqrestore (&irq_lock, flags); +raw_spin_unlock_irqrestore (&irq_lock, flags); out: +kfree (to_free);return err; }
@@ -358,19 +370,20 @@ void free_irq_by_fd(int fd)struct irq_entry *to_free;unsigned long flags; -spin_lock_irqsave (&irq_lock, flags); +raw_spin_lock_irqsave (&irq_lock, flags); to_free =get_irq_entry_by_fd (fd); -free_irq_entry (to_free, true); -spin_unlock_irqrestore (&irq_lock, flags); +remove_irq_entry (to_free, true); +raw_spin_unlock_irqrestore (&irq_lock, flags); +kfree (to_free); }EXPORT_SYMBOL (free_irq_by_fd);static void free_irq_by_irq_and_dev (unsigned int irq,void *dev) { -struct irq_entry *entry; +struct irq_entry *entry, *to_free =NULL ;unsigned long flags; -spin_lock_irqsave (&irq_lock, flags); +raw_spin_lock_irqsave (&irq_lock, flags);list_for_each_entry (entry, &active_fds, list) {enum um_irq_type i;
@@ -386,12 +399,13 @@ static void free_irq_by_irq_and_dev(unsigned int irq, void *dev)os_del_epoll_fd (entry->fd); reg->events =0 ; -update_or_free_irq_entry (entry); + to_free =update_or_remove_irq_entry (entry); goto out; } } out: -spin_unlock_irqrestore (&irq_lock, flags); +raw_spin_unlock_irqrestore (&irq_lock, flags); +kfree (to_free); }void deactivate_fd (int fd,int irqnum)
@@ -402,7 +416,7 @@ void deactivate_fd(int fd, int irqnum)os_del_epoll_fd (fd); -spin_lock_irqsave (&irq_lock, flags); +raw_spin_lock_irqsave (&irq_lock, flags); entry =get_irq_entry_by_fd (fd);if (!entry) goto out;
@@ -414,9 +428,10 @@ void deactivate_fd(int fd, int irqnum) entry->reg[i].events =0 ; } -update_or_free_irq_entry (entry); + entry =update_or_remove_irq_entry (entry); out: -spin_unlock_irqrestore (&irq_lock, flags); +raw_spin_unlock_irqrestore (&irq_lock, flags); +kfree (entry);ignore_sigio_fd (fd); }
@@ -546,7 +561,7 @@ void um_irqs_suspend(void) irqs_suspended = true; -spin_lock_irqsave (&irq_lock, flags); +raw_spin_lock_irqsave (&irq_lock, flags);list_for_each_entry (entry, &active_fds, list) {enum um_irq_type t;bool clear = true;
@@ -579,7 +594,7 @@ void um_irqs_suspend(void) !__ignore_sigio_fd (entry->fd); } } -spin_unlock_irqrestore (&irq_lock, flags); +raw_spin_unlock_irqrestore (&irq_lock, flags); }void um_irqs_resume (void )
@@ -588,7 +603,7 @@ void um_irqs_resume(void)unsigned long flags; -spin_lock_irqsave (&irq_lock, flags); +raw_spin_lock_irqsave (&irq_lock, flags);list_for_each_entry (entry, &active_fds, list) {if (entry->suspended) {int err =os_set_fd_async (entry->fd);
@@ -602,7 +617,7 @@ void um_irqs_resume(void) } } } -spin_unlock_irqrestore (&irq_lock, flags); +raw_spin_unlock_irqrestore (&irq_lock, flags); irqs_suspended = false;send_sigio_to_self ();
@@ -613,7 +628,7 @@ static int normal_irq_set_wake(struct irq_data *d, unsigned int on)struct irq_entry *entry;unsigned long flags; -spin_lock_irqsave (&irq_lock, flags); +raw_spin_lock_irqsave (&irq_lock, flags);list_for_each_entry (entry, &active_fds, list) {enum um_irq_type t;
@@ -628,7 +643,7 @@ static int normal_irq_set_wake(struct irq_data *d, unsigned int on) } } unlock: -spin_unlock_irqrestore (&irq_lock, flags); +raw_spin_unlock_irqrestore (&irq_lock, flags);return 0 ; }#else
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 24/31 LoongArch: Fix kernel_page_present() for KPRANGE/XKPRANGE
In reply to Sasha LevinFrom: Huacai Chen <[email protected]>
[ Upstream commit 619b52777a4972bdb6ddf86ac54c6f68a47b51c4 ]
Now kernel_page_present() always return true for KPRANGE/XKPRANGE addresses, this isn't correct because hibernation (ACPI S4) use it to distinguish whether a page is saveable. If all KPRANGE/XKPRANGE addresses are considered as saveable, then reserved memory such as EFI_RUNTIME_SERVICES_CODE / EFI_RUNTIME_SERVICES_DATA will also be saved and restored.
Fix this by returning true only if the KPRANGE/XKPRANGE address is in memblock.memory.
--- arch/loongarch/mm/pageattr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/loongarch/mm/pageattr.c +2 -1
@@ -3,6 +3,7 @@* Copyright (C) 2024 Loongson Technology Corporation Limited */ +#include <linux/memblock.h> #include <linux/pagewalk.h> #include <linux/pgtable.h> #include <asm/set_memory.h>
@@ -167,7 +168,7 @@ bool kernel_page_present(struct page *page)unsigned long addr = (unsigned long )page_address (page);if (addr < vm_map_base) -return true; +return memblock_is_memory (__pa (addr)); pgd =pgd_offset_k (addr);if (pgd_none (pgdp_get (pgd)))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 25/31 LoongArch: KVM: Set host with kernel mode when switch to VM mode
In reply to Sasha LevinFrom: Bibo Mao <[email protected]>
[ Upstream commit 3011b29ec5a33ec16502e687c4264d57416a8b1f ]
PRMD register is only meaningful on the beginning stage of exception entry, and it is overwritten with nested irq or exception.
When CPU runs in VM mode, interrupt need be enabled on host. And the mode for host had better be kernel mode rather than random or user mode.
When VM is running, the running mode with top command comes from CRMD register, and running mode should be kernel mode since kernel function is executing with perf command. It needs be consistent with both top and perf command.
--- arch/loongarch/kvm/switch.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kvm/switch.S +1 -1
@@ -85,7 +85,7 @@ * Guest CRMD comes from separate GCSR_CRMD register */ ori t0, zero, CSR_PRMD_PIE - csrxchg t0, t0, LOONGARCH_CSR_PRMD + csrwr t0, LOONGARCH_CSR_PRMD /* Set PVM bit to setup ertn to guest context */ ori t0, zero, CSR_GSTAT_PVM
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 26/31 arm64: amu: Delay allocating cpumask for AMU FIE support
In reply to Sasha LevinFrom: Beata Michalska <[email protected]>
[ Upstream commit d923782b041218ef3804b2fed87619b5b1a497f3 ]
For the time being, the amu_fie_cpus cpumask is being exclusively used by the AMU-related internals of FIE support and is guaranteed to be valid on every access currently made. Still the mask is not being invalidated on one of the error handling code paths, which leaves a soft spot with theoretical risk of UAF for CPUMASK_OFFSTACK cases. To make things sound, delay allocating said cpumask
(for CPUMASK_OFFSTACK) avoiding otherwise nasty sanitising case failing to register the cpufreq policy notifications.
--- arch/arm64/kernel/topology.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
arch/arm64/kernel/topology.c +10 -12
@@ -194,12 +194,19 @@ static void amu_fie_setup(const struct cpumask *cpus)int cpu;/* We are already set since the last insmod of cpufreq driver */ -if (unlikely (cpumask_subset (cpus, amu_fie_cpus))) +if (cpumask_available (amu_fie_cpus) && +unlikely (cpumask_subset (cpus, amu_fie_cpus)))return ; -for_each_cpu (cpu, cpus) { +for_each_cpu (cpu, cpus)if (!freq_counters_valid (cpu))return ; + +if (!cpumask_available (amu_fie_cpus) && + !zalloc_cpumask_var (&amu_fie_cpus,GFP_KERNEL )) { +WARN_ONCE (1 ,"Failed to allocate FIE cpumask for CPUs[%*pbl]\n" , +cpumask_pr_args (cpus)); +return ; }cpumask_or (amu_fie_cpus, amu_fie_cpus, cpus);
@@ -237,17 +244,8 @@ static struct notifier_block init_amu_fie_notifier = {static int __init init_amu_fie (void ) { -int ret; - -if (!zalloc_cpumask_var (&amu_fie_cpus,GFP_KERNEL )) -return -ENOMEM ; - - ret =cpufreq_register_notifier (&init_amu_fie_notifier, +return cpufreq_register_notifier (&init_amu_fie_notifier,CPUFREQ_POLICY_NOTIFIER ); -if (ret) -free_cpumask_var (amu_fie_cpus); - -return ret; }core_initcall (init_amu_fie);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 27/31 Xen/swiotlb: mark xen_swiotlb_fixup() __init
In reply to Sasha LevinFrom: Jan Beulich <[email protected]>
[ Upstream commit 75ad02318af2e4ae669e26a79f001bd5e1f97472 ]
It's sole user (pci_xen_swiotlb_init()) is __init, too.
Message-ID: <[email protected]>
--- drivers/xen/swiotlb-xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/swiotlb-xen.c +1 -1
@@ -111,7 +111,7 @@ static struct io_tlb_pool *xen_swiotlb_find_pool(struct device *dev, }#ifdef CONFIG_X86 -int xen_swiotlb_fixup (void *buf,unsigned long nslabs) +int __init xen_swiotlb_fixup (void *buf,unsigned long nslabs) {int rc;unsigned int order =get_order (IO_TLB_SEGSIZE <<IO_TLB_SHIFT );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 28/31 Bluetooth: L2CAP: Fix slab-use-after-free Read in l2cap_send_cmd
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit b4f82f9ed43aefa79bec2504ae8c29be0c0f5d1d ]
After the hci sync command releases l2cap_conn, the hci receive data work queue references the released l2cap_conn when sending to the upper layer. Add hci dev lock to the hci receive data work queue to synchronize the two.
[1]
BUG: KASAN: slab-use-after-free in l2cap_send_cmd+0x187/0x8d0 net/bluetooth/l2cap_core.c:954 Read of size 8 at addr ffff8880271a4000 by task kworker/u9:2/5837 CPU: 0 UID: 0 PID: 5837 Comm: kworker/u9:2 Not tainted 6.13.0-rc5-syzkaller-00163-gab75170520d4 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci1 hci_rx_work Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 l2cap_build_cmd net/bluetooth/l2cap_core.c:2964 [inline] l2cap_send_cmd+0x187/0x8d0 net/bluetooth/l2cap_core.c:954 l2cap_sig_send_rej net/bluetooth/l2cap_core.c:5502 [inline] l2cap_sig_channel net/bluetooth/l2cap_core.c:5538 [inline] l2cap_recv_frame+0x221f/0x10db0 net/bluetooth/l2cap_core.c:6817 hci_acldata_packet net/bluetooth/hci_core.c:3797 [inline] hci_rx_work+0x508/0xdb0 net/bluetooth/hci_core.c:4040 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 </TASK> Allocated by task 5837: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x243/0x390 mm/slub.c:4329 kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] l2cap_conn_add+0xa9/0x8e0 net/bluetooth/l2cap_core.c:6860 l2cap_connect_cfm+0x115/0x1090 net/bluetooth/l2cap_core.c:7239 hci_connect_cfm include/net/bluetooth/hci_core.h:2057 [inline] hci_remote_features_evt+0x68e/0xac0 net/bluetooth/hci_event.c:3726 hci_event_func net/bluetooth/hci_event.c:7473 [inline] hci_event_packet+0xac2/0x1540 net/bluetooth/hci_event.c:7525 hci_rx_work+0x3f3/0xdb0 net/bluetooth/hci_core.c:4035 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Freed by task 54: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:582 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2353 [inline] slab_free mm/slub.c:4613 [inline] kfree+0x196/0x430 mm/slub.c:4761 l2cap_connect_cfm+0xcc/0x1090 net/bluetooth/l2cap_core.c:7235 hci_connect_cfm include/net/bluetooth/hci_core.h:2057 [inline] hci_conn_failed+0x287/0x400 net/bluetooth/hci_conn.c:1266 hci_abort_conn_sync+0x56c/0x11f0 net/bluetooth/hci_sync.c:5603 hci_cmd_sync_work+0x22b/0x400 net/bluetooth/hci_sync.c:332 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
--- net/bluetooth/l2cap_core.c | 39 +++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-)
net/bluetooth/l2cap_core.c +34 -5
@@ -948,6 +948,16 @@ static u8 l2cap_get_ident(struct l2cap_conn *conn)return id; } +static void l2cap_send_acl (struct l2cap_conn *conn,struct sk_buff *skb, +u8 flags) +{ +/* Check if the hcon still valid before attempting to send */ +if (hci_conn_valid (conn->hcon->hdev, conn->hcon)) +hci_send_acl (conn->hchan, skb, flags); +else +kfree_skb (skb); +} +static void l2cap_send_cmd (struct l2cap_conn *conn,u8 ident,u8 code,u16 len,void *data) {
@@ -970,7 +980,7 @@ static void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len,bt_cb (skb)->force_active =BT_POWER_FORCE_ACTIVE_ON ; skb->priority =HCI_PRIO_MAX ; -hci_send_acl (conn->hchan, skb, flags); +l2cap_send_acl (conn, skb, flags); }static void l2cap_do_send (struct l2cap_chan *chan,struct sk_buff *skb)
@@ -1792,13 +1802,10 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)mutex_unlock (&conn->chan_lock); -hci_chan_del (conn->hchan); -if (conn->info_state &L2CAP_INFO_FEAT_MASK_REQ_SENT )cancel_delayed_work_sync (&conn->info_timer); hcon->l2cap_data =NULL ; - conn->hchan =NULL ;l2cap_conn_put (conn); }
@@ -1806,6 +1813,7 @@ static void l2cap_conn_free(struct kref *ref) { struct l2cap_conn *conn = container_of(ref, struct l2cap_conn, ref); +hci_chan_del (conn->hchan);hci_conn_put (conn->hcon);kfree (conn); }
@@ -7466,14 +7474,33 @@ static void l2cap_recv_reset(struct l2cap_conn *conn) conn->rx_len =0 ; } +static struct l2cap_conn *l2cap_conn_hold_unless_zero (struct l2cap_conn *c) +{ +BT_DBG ("conn %p orig refcnt %u" , c,kref_read (&c->ref)); + +if (!kref_get_unless_zero (&c->ref)) +return NULL ; + +return c; +} +void l2cap_recv_acldata (struct hci_conn *hcon,struct sk_buff *skb,u16 flags) { -struct l2cap_conn *conn = hcon->l2cap_data; +struct l2cap_conn *conn;int len; +/* Lock hdev to access l2cap_data to avoid race with l2cap_conn_del */ +hci_dev_lock (hcon->hdev); + + conn = hcon->l2cap_data; +if (!conn) conn =l2cap_conn_add (hcon); + conn =l2cap_conn_hold_unless_zero (conn); + +hci_dev_unlock (hcon->hdev); +if (!conn) goto drop;
@@ -7565,6 +7592,8 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)break ; } +l2cap_conn_put (conn); + drop:kfree_skb (skb); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 29/31 drm/tests: hdmi: Remove redundant assignments
In reply to Sasha LevinFrom: Maxime Ripard <[email protected]>
[ Upstream commit bb4f929a8875b4801db95b8cf3b2c527c1e475e0 ]
Some tests have the drm pointer assigned multiple times to the same value. Drop the redundant assignments.
--- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +0 -4
@@ -443,7 +443,6 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode_vic_1(struct kunit *test) mode =drm_kunit_display_mode_from_cea_vic (test, drm,1 );KUNIT_ASSERT_NOT_NULL (test, mode); - drm = &priv->drm; crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, mode, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -557,7 +556,6 @@ static void drm_test_check_broadcast_rgb_full_cea_mode_vic_1(struct kunit *test) mode =drm_kunit_display_mode_from_cea_vic (test, drm,1 );KUNIT_ASSERT_NOT_NULL (test, mode); - drm = &priv->drm; crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, mode, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -673,7 +671,6 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode_vic_1(struct kunit *te mode =drm_kunit_display_mode_from_cea_vic (test, drm,1 );KUNIT_ASSERT_NOT_NULL (test, mode); - drm = &priv->drm; crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, mode, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -1275,7 +1272,6 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test) rate = mode->clock *1500 ;KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); - drm = &priv->drm; crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, mode, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 30/31 drm/tests: hdmi: Reorder DRM entities variables assignment
In reply to Sasha LevinFrom: Maxime Ripard <[email protected]>
[ Upstream commit 6b6bfd63e1626ceedc738b2a06505aa5b46c1481 ]
The tests all deviate slightly in how they assign their local pointers to DRM entities. This makes refactoring pretty difficult, so let's just move the assignment as soon as the entities are allocated.
--- .../drm/tests/drm_hdmi_state_helper_test.c | 81 ++++++++++--------- 1 file changed, 42 insertions(+), 39 deletions(-)
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +42 -39
@@ -251,15 +251,16 @@ static void drm_test_check_broadcast_rgb_crtc_mode_changed(struct kunit *test) 8);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; + conn = &priv->connector; + ctx =drm_kunit_helper_acquire_ctx_alloc (test);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - conn = &priv->connector; preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -314,15 +315,16 @@ static void drm_test_check_broadcast_rgb_crtc_mode_not_changed(struct kunit *tes 8);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; + conn = &priv->connector; + ctx =drm_kunit_helper_acquire_ctx_alloc (test);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - conn = &priv->connector; preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -377,6 +379,8 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test) 8);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector;KUNIT_ASSERT_TRUE (test, conn->display_info.is_hdmi);
@@ -387,8 +391,6 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_NE (test,drm_match_cea_mode (preferred),1 ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -488,6 +490,8 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(struct kunit *test) 8);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector;KUNIT_ASSERT_TRUE (test, conn->display_info.is_hdmi);
@@ -498,8 +502,6 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_NE (test,drm_match_cea_mode (preferred),1 ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -603,6 +605,8 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode(struct kunit *test) 8);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector;KUNIT_ASSERT_TRUE (test, conn->display_info.is_hdmi);
@@ -613,8 +617,6 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_NE (test,drm_match_cea_mode (preferred),1 ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -720,6 +722,8 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test) 10);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
@@ -732,8 +736,6 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test) preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -794,6 +796,8 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test) 10);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
@@ -806,8 +810,6 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test) preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -865,6 +867,8 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test) 12);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_dvi_1080p,
@@ -880,8 +884,6 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test) preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -912,6 +914,8 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test) 8);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_200mhz,
@@ -925,8 +929,6 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_FALSE (test, preferred->flags &DRM_MODE_FLAG_DBLCLK ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -959,6 +961,8 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test) 10);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,
@@ -972,8 +976,6 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_FALSE (test, preferred->flags &DRM_MODE_FLAG_DBLCLK ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -1006,6 +1008,8 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test) 12);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,
@@ -1019,8 +1023,6 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_FALSE (test, preferred->flags &DRM_MODE_FLAG_DBLCLK ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -1057,15 +1059,16 @@ static void drm_test_check_hdmi_funcs_reject_rate(struct kunit *test) 8);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; + conn = &priv->connector; + ctx =drm_kunit_helper_acquire_ctx_alloc (test);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - conn = &priv->connector; preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -1113,6 +1116,8 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) 12);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
@@ -1136,8 +1141,6 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) rate =drm_hdmi_compute_mode_clock (preferred,10 ,HDMI_COLORSPACE_RGB );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1182,6 +1185,8 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test) 12);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
@@ -1208,8 +1213,6 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test) rate =drm_hdmi_compute_mode_clock (preferred,12 ,HDMI_COLORSPACE_YUV422 );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1305,6 +1308,8 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) 12);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
@@ -1336,8 +1341,6 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) rate =drm_hdmi_compute_mode_clock (preferred,12 ,HDMI_COLORSPACE_YUV422 );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1372,6 +1375,8 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test 12);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_200mhz,
@@ -1403,8 +1408,6 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test rate =drm_hdmi_compute_mode_clock (preferred,12 ,HDMI_COLORSPACE_YUV422 );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1438,6 +1441,8 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test 8);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,
@@ -1461,8 +1466,6 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test rate =drm_hdmi_compute_mode_clock (preferred,12 ,HDMI_COLORSPACE_RGB );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1498,6 +1501,8 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes 12);KUNIT_ASSERT_NOT_NULL (test, priv); + drm = &priv->drm; + crtc = priv->crtc; conn = &priv->connector; ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_340mhz,
@@ -1521,8 +1526,6 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes rate =drm_hdmi_compute_mode_clock (preferred,12 ,HDMI_COLORSPACE_RGB );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); - drm = &priv->drm; - crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 31/31 drm/tests: hdmi: Fix recursive locking
In reply to Sasha LevinFrom: Maxime Ripard <[email protected]>
[ Upstream commit 5d14c08a47460e8eedf0185a28b116420ea7f29d ]
The find_preferred_mode() functions takes the mode_config mutex, but due to the order most tests have, is called with the crtc_ww_class_mutex taken. This raises a warning for a circular dependency when running the tests with lockdep.
Reorder the tests to call find_preferred_mode before the acquire context has been created to avoid the issue.
--- .../drm/tests/drm_hdmi_state_helper_test.c | 114 +++++++++--------- 1 file changed, 57 insertions(+), 57 deletions(-)
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +57 -57
@@ -255,12 +255,12 @@ static void drm_test_check_broadcast_rgb_crtc_mode_changed(struct kunit *test) crtc = priv->crtc; conn = &priv->connector; - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -319,12 +319,12 @@ static void drm_test_check_broadcast_rgb_crtc_mode_not_changed(struct kunit *tes crtc = priv->crtc; conn = &priv->connector; - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -384,13 +384,13 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test) conn = &priv->connector;KUNIT_ASSERT_TRUE (test, conn->display_info.is_hdmi); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_NE (test,drm_match_cea_mode (preferred),1 ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -495,13 +495,13 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(struct kunit *test) conn = &priv->connector;KUNIT_ASSERT_TRUE (test, conn->display_info.is_hdmi); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_NE (test,drm_match_cea_mode (preferred),1 ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -610,13 +610,13 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode(struct kunit *test) conn = &priv->connector;KUNIT_ASSERT_TRUE (test, conn->display_info.is_hdmi); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_NE (test,drm_match_cea_mode (preferred),1 ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -730,12 +730,12 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test) ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz));KUNIT_ASSERT_GT (test, ret,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -804,12 +804,12 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test) ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz));KUNIT_ASSERT_GT (test, ret,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -878,12 +878,12 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test) info = &conn->display_info;KUNIT_ASSERT_FALSE (test, info->is_hdmi); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -922,13 +922,13 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test) ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz));KUNIT_ASSERT_GT (test, ret,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_FALSE (test, preferred->flags &DRM_MODE_FLAG_DBLCLK ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -969,13 +969,13 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test) ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz));KUNIT_ASSERT_GT (test, ret,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_FALSE (test, preferred->flags &DRM_MODE_FLAG_DBLCLK ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -1016,13 +1016,13 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test) ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz));KUNIT_ASSERT_GT (test, ret,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_FALSE (test, preferred->flags &DRM_MODE_FLAG_DBLCLK ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -1063,12 +1063,12 @@ static void drm_test_check_hdmi_funcs_reject_rate(struct kunit *test) crtc = priv->crtc; conn = &priv->connector; - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_ASSERT_EQ (test, ret,0 );
@@ -1128,9 +1128,6 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test)KUNIT_ASSERT_TRUE (test, info->is_hdmi);KUNIT_ASSERT_GT (test, info->max_tmds_clock,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_FALSE (test, preferred->flags &DRM_MODE_FLAG_DBLCLK );
@@ -1141,6 +1138,9 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) rate =drm_hdmi_compute_mode_clock (preferred,10 ,HDMI_COLORSPACE_RGB );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1197,9 +1197,6 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test)KUNIT_ASSERT_TRUE (test, info->is_hdmi);KUNIT_ASSERT_GT (test, info->max_tmds_clock,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);KUNIT_ASSERT_FALSE (test, preferred->flags &DRM_MODE_FLAG_DBLCLK );
@@ -1213,6 +1210,9 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test) rate =drm_hdmi_compute_mode_clock (preferred,12 ,HDMI_COLORSPACE_YUV422 );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1259,9 +1259,6 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test)KUNIT_ASSERT_TRUE (test, info->is_hdmi);KUNIT_ASSERT_GT (test, info->max_tmds_clock,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - mode =drm_kunit_display_mode_from_cea_vic (test, drm,1 );KUNIT_ASSERT_NOT_NULL (test, mode);
@@ -1275,6 +1272,9 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test) rate = mode->clock *1500 ;KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + crtc = priv->crtc; ret =light_up_connector (test, drm, crtc, conn, mode, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1320,9 +1320,6 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test)KUNIT_ASSERT_TRUE (test, info->is_hdmi);KUNIT_ASSERT_GT (test, info->max_tmds_clock,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);
@@ -1341,6 +1338,9 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) rate =drm_hdmi_compute_mode_clock (preferred,12 ,HDMI_COLORSPACE_YUV422 );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1387,9 +1387,6 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *testKUNIT_ASSERT_TRUE (test, info->is_hdmi);KUNIT_ASSERT_GT (test, info->max_tmds_clock,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);
@@ -1408,6 +1405,9 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test rate =drm_hdmi_compute_mode_clock (preferred,12 ,HDMI_COLORSPACE_YUV422 );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1453,9 +1453,6 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *testKUNIT_ASSERT_TRUE (test, info->is_hdmi);KUNIT_ASSERT_GT (test, info->max_tmds_clock,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);
@@ -1466,6 +1463,9 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test rate =drm_hdmi_compute_mode_clock (preferred,12 ,HDMI_COLORSPACE_RGB );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
@@ -1513,9 +1513,6 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tesKUNIT_ASSERT_TRUE (test, info->is_hdmi);KUNIT_ASSERT_GT (test, info->max_tmds_clock,0 ); - ctx =drm_kunit_helper_acquire_ctx_alloc (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - preferred =find_preferred_mode (conn);KUNIT_ASSERT_NOT_NULL (test, preferred);
@@ -1526,6 +1523,9 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes rate =drm_hdmi_compute_mode_clock (preferred,12 ,HDMI_COLORSPACE_RGB );KUNIT_ASSERT_LT (test, rate, info->max_tmds_clock *1000 ); + ctx =drm_kunit_helper_acquire_ctx_alloc (test); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + ret =light_up_connector (test, drm, crtc, conn, preferred, ctx);KUNIT_EXPECT_EQ (test, ret,0 );
Signature · 1 line
2.39.5