drm/amd: Add USBC connector ID
Subsystems (11)
Sasha Levin
maintainerPATCH 1/21 drm/amd: Add USBC connector ID
From: Aurabindo Pillai <[email protected]>
[ Upstream commit c5c948aa894a831f96fccd025e47186b1ee41615 ]
[Why&How] Add a dedicated AMDGPU specific ID for use with newer ASICs that support USB-C output
--- drivers/gpu/drm/amd/amdgpu/ObjectID.h | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/ObjectID.h +1 -0
@@ -119,6 +119,7 @@#define CONNECTOR_OBJECT_ID_eDP 0x14#define CONNECTOR_OBJECT_ID_MXM 0x15#define CONNECTOR_OBJECT_ID_LVDS_eDP 0x16 +#define CONNECTOR_OBJECT_ID_USBC 0x17/* deleted */
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/21 drm/amd/display: fix audio format not updated after edid updated
From: Charlene Liu <[email protected]>
[ Upstream commit 5e8a71cf13bc9184fee915b2220be71b4c6cac74 ]
[why]
for the case edid change only changed audio format. driver still need to update stream.
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2 -2
@@ -1546,8 +1546,8 @@ bool dc_is_stream_unchanged(if (old_stream->ignore_msa_timing_param != stream->ignore_msa_timing_param)return false; -// Only Have Audio left to check whether it is same or not. This is a corner case for Tiled sinks -if (old_stream->audio_info.mode_count != stream->audio_info.mode_count) +/*compare audio info*/ +if (memcmp (&old_stream->audio_info, &stream->audio_info,sizeof (stream->audio_info)) !=0 )return false;return true;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/21 drm/amd/display: Update VTEM Infopacket definition
In reply to Sasha LevinFrom: "Leo (Hanghong) Ma" <[email protected]>
[ Upstream commit c9fbf6435162ed5fb7201d1d4adf6585c6a8c327 ]
[Why & How]
The latest HDMI SPEC has updated the VTEM packet structure, so change the VTEM Infopacket defined in the driver side to align with the SPEC.
--- .../gpu/drm/amd/display/modules/info_packet/info_packet.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +3 -2
@@ -85,7 +85,8 @@//PB7 = MD0 #define MASK_VTEM_MD0__VRR_EN 0x01#define MASK_VTEM_MD0__M_CONST 0x02 -#define MASK_VTEM_MD0__RESERVED2 0x0C +#define MASK_VTEM_MD0__QMS_EN 0x04 +#define MASK_VTEM_MD0__RESERVED2 0x08#define MASK_VTEM_MD0__FVA_FACTOR_M1 0xF0//MD1
@@ -94,7 +95,7 @@//MD2 #define MASK_VTEM_MD2__BASE_REFRESH_RATE_98 0x03#define MASK_VTEM_MD2__RB 0x04 -#define MASK_VTEM_MD2__RESERVED3 0xF8 +#define MASK_VTEM_MD2__NEXT_TFR 0xF8//MD3 #define MASK_VTEM_MD3__BASE_REFRESH_RATE_07 0xFF
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/21 drm/amdkfd: Fix Incorrect VMIDs passed to HWS
In reply to Sasha LevinFrom: Tushar Patel <[email protected]>
[ Upstream commit b7dfbd2e601f3fee545bc158feceba4f340fe7cf ]
Compute-only GPUs have more than 8 VMIDs allocated to KFD. Fix this by passing correct number of VMIDs to HWS
v2: squash in warning fix (Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
@@ -633,7 +633,7 @@ MODULE_PARM_DESC(sched_policy,* Maximum number of processes that HWS can schedule concurrently. The maximum is the * number of VMIDs assigned to the HWS, which is also the default. */ -int hws_max_conc_proc =8 ; +int hws_max_conc_proc =-1 ;module_param (hws_max_conc_proc, int,0444 );MODULE_PARM_DESC (hws_max_conc_proc,"Max # processes HWS can execute concurrently when sched_policy=0 (0 = no concurrency, #VMIDs for KFD = Maximum(default))" );
drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -8
@@ -609,15 +609,10 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, - kfd->vm_info.first_vmid_kfd + 1;/* Verify module parameters regarding mapped process number*/ -if ((hws_max_conc_proc <0 ) - || (hws_max_conc_proc > kfd->vm_info.vmid_num_kfd)) { -dev_err (kfd_device, -"hws_max_conc_proc %d must be between 0 and %d, use %d instead\n" , - hws_max_conc_proc, kfd->vm_info.vmid_num_kfd, - kfd->vm_info.vmid_num_kfd); +if (hws_max_conc_proc >=0 ) + kfd->max_proc_per_quantum =min ((u32 )hws_max_conc_proc, kfd->vm_info.vmid_num_kfd); +else kfd->max_proc_per_quantum = kfd->vm_info.vmid_num_kfd; - }else - kfd->max_proc_per_quantum = hws_max_conc_proc;/* Allocate global GWS that is shared by all KFD processes */ if (hws_gws_support && amdgpu_amdkfd_alloc_gws(kfd->kgd,
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/21 drm/amdkfd: Check for potential null return of kmalloc_array()
In reply to Sasha LevinFrom: QintaoShen <[email protected]>
[ Upstream commit ebbb7bb9e80305820dc2328a371c1b35679f2667 ]
As the kmalloc_array() may return null, the 'event_waiters[i].wait' would lead to null-pointer dereference. Therefore, it is better to check the return value of kmalloc_array() to avoid this confusion.
--- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_events.c +2 -0
@@ -532,6 +532,8 @@ static struct kfd_event_waiter *alloc_event_waiters(uint32_t num_events) event_waiters =kmalloc_array (num_events,sizeof (struct kfd_event_waiter ),GFP_KERNEL ); +if (!event_waiters) +return NULL ;for (i =0 ; (event_waiters) && (i < num_events) ; i++) {init_wait (&event_waiters[i].wait);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/21 Drivers: hv: vmbus: Prevent load re-ordering when reading ring buffer
In reply to Sasha LevinFrom: Michael Kelley <[email protected]>
[ Upstream commit b6cae15b5710c8097aad26a2e5e752c323ee5348 ]
When reading a packet from a host-to-guest ring buffer, there is no memory barrier between reading the write index (to see if there is a packet to read) and reading the contents of the packet. The Hyper-V host uses store-release when updating the write index to ensure that writes of the packet data are completed first. On the guest side, the processor can reorder and read the packet data before the write index, and sometimes get stale packet data. Getting such stale packet data has been observed in a reproducible case in a VM on ARM64.
Fix this by using virt_load_acquire() to read the write index, ensuring that reads of the packet data cannot be reordered before it. Preventing such reordering is logically correct, and with this change, getting stale data can no longer be reproduced.
--- drivers/hv/ring_buffer.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/hv/ring_buffer.c +10 -1
@@ -378,7 +378,16 @@ int hv_ringbuffer_read(struct vmbus_channel *channel,static u32 hv_pkt_iter_avail (const struct hv_ring_buffer_info *rbi) {u32 priv_read_loc = rbi->priv_read_index; -u32 write_loc =READ_ONCE (rbi->ring_buffer->write_index); +u32 write_loc; + +/* +* The Hyper-V host writes the packet data, then uses +* store_release() to update the write_index. Use load_acquire() +* here to prevent loads of the packet data from being re-ordered +* before the read of the write_index and potentially getting +* stale data. +*/ + write_loc =virt_load_acquire (&rbi->ring_buffer->write_index);if (write_loc >= priv_read_loc)return write_loc - priv_read_loc;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 7/21 scsi: target: tcmu: Fix possible page UAF
In reply to Sasha LevinFrom: Xiaoguang Wang <[email protected]>
[ Upstream commit a6968f7a367f128d120447360734344d5a3d5336 ]
tcmu_try_get_data_page() looks up pages under cmdr_lock, but it does not take refcount properly and just returns page pointer. When tcmu_try_get_data_page() returns, the returned page may have been freed by tcmu_blocks_release().
We need to get_page() under cmdr_lock to avoid concurrent tcmu_blocks_release().
--- drivers/target/target_core_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/target/target_core_user.c +2 -1
@@ -1488,6 +1488,7 @@ static struct page *tcmu_try_get_block_page(struct tcmu_dev *udev, uint32_t dbi)mutex_lock (&udev->cmdr_lock); page =tcmu_get_block_page (udev, dbi);if (likely (page)) { +get_page (page);mutex_unlock (&udev->cmdr_lock);return page; }
@@ -1526,6 +1527,7 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf)/* For the vmalloc()ed cmd area pages */ addr = (void *)(unsigned long )info->mem[mi].addr + offset; page =vmalloc_to_page (addr); +get_page (page); }else {uint32_t dbi;
@@ -1536,7 +1538,6 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf)return VM_FAULT_SIGBUS ; } -get_page (page); vmf->page = page;return 0 ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/21 scsi: ibmvscsis: Increase INITIAL_SRP_LIMIT to 1024
In reply to Sasha LevinFrom: Tyrel Datwyler <[email protected]>
[ Upstream commit 0bade8e53279157c7cc9dd95d573b7e82223d78a ]
The adapter request_limit is hardcoded to be INITIAL_SRP_LIMIT which is currently an arbitrary value of 800. Increase this value to 1024 which better matches the characteristics of the typical IBMi Initiator that supports 32 LUNs and a queue depth of 32.
This change also has the secondary benefit of being a power of two as required by the kfifo API. Since, Commit ab9bb6318b09 ("Partially revert "kfifo: fix kfifo_alloc() and kfifo_init()"") the size of IU pool for each target has been rounded down to 512 when attempting to kfifo_init() those pools with the current request_limit size of 800.
--- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +1 -1
@@ -35,7 +35,7 @@#define IBMVSCSIS_VERSION "v0.2" -#define INITIAL_SRP_LIMIT 800 +#define INITIAL_SRP_LIMIT 1024#define DEFAULT_MAX_SECTORS 256#define MAX_TXU 1024 * 1024
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 9/21 net: micrel: fix KS8851_MLL Kconfig
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit c3efcedd272aa6dd5929e20cf902a52ddaa1197a ]
KS8851_MLL selects MICREL_PHY, which depends on PTP_1588_CLOCK_OPTIONAL, so make KS8851_MLL also depend on PTP_1588_CLOCK_OPTIONAL since 'select' does not follow any dependency chains.
Fixes kconfig warning and build errors:
WARNING: unmet direct dependencies detected for MICREL_PHY
Depends on [m]: NETDEVICES [=y] && PHYLIB [=y] && PTP_1588_CLOCK_OPTIONAL [=m] Selected by [y]:
- KS8851_MLL [=y] && NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_MICREL [=y] && HAS_IOMEM [=y]
ld: drivers/net/phy/micrel.o: in function `lan8814_ts_info':
micrel.c:(.text+0xb35): undefined reference to `ptp_clock_index'
ld: drivers/net/phy/micrel.o: in function `lan8814_probe':
micrel.c:(.text+0x2586): undefined reference to `ptp_clock_register'
--- drivers/net/ethernet/micrel/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/micrel/Kconfig +1 -0
@@ -37,6 +37,7 @@ config KS8851 config KS8851_MLL tristate "Micrel KS8851 MLL" depends on HAS_IOMEM + depends on PTP_1588_CLOCK_OPTIONAL select MII ---help--- This platform driver is for Micrel KS8851 Address/data bus
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/21 ata: libata-core: Disable READ LOG DMA EXT for Samsung 840 EVOs
In reply to Sasha LevinFrom: Christian Lamparter <[email protected]>
[ Upstream commit 5399752299396a3c9df6617f4b3c907d7aa4ded8 ]
Samsung' 840 EVO with the latest firmware (EXT0DB6Q) locks up with the a message: "READ LOG DMA EXT failed, trying PIO" during boot.
Initially this was discovered because it caused a crash with the sata_dwc_460ex controller on a WD MyBook Live DUO.
The reporter "Tice Rex" which has the unique opportunity that he has two Samsung 840 EVO SSD! One with the older firmware "EXT0BB0Q" which booted fine and didn't expose "READ LOG DMA EXT". But the newer/latest firmware "EXT0DB6Q" caused the headaches.
--- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ata/libata-core.c +3 -0
@@ -4580,6 +4580,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { ATA_HORKAGE_ZERO_AFTER_TRIM, }, {"Crucial_CT*MX100*" ,"MU01" ,ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, + { "Samsung SSD 840 EVO*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | +ATA_HORKAGE_NO_DMA_LOG | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Samsung SSD 840*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 11/21 gpu: ipu-v3: Fix dev_dbg frequency output
In reply to Sasha LevinFrom: Leo Ruan <[email protected]>
[ Upstream commit 070a88fd4a03f921b73a2059e97d55faaa447dab ]
This commit corrects the printing of the IPU clock error percentage if it is between -0.1% to -0.9%. For example, if the pixel clock requested is 27.2 MHz but only 27.0 MHz can be achieved the deviation is -0.8%. But the fixed point math had a flaw and calculated error of 0.2%.
Before:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error 0.2% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000Hz
After:
Clocks: IPU 270000000Hz DI 24716667Hz Needed 27200000Hz IPU clock can give 27000000 with divider 10, error -0.8% Want 27200000Hz IPU 270000000Hz DI 24716667Hz using IPU, 27000000Hz
--- drivers/gpu/ipu-v3/ipu-di.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/ipu-v3/ipu-di.c +3 -2
@@ -451,8 +451,9 @@ static void ipu_di_config_clock(struct ipu_di *di, error = rate / (sig->mode.pixelclock /1000 ); -dev_dbg (di->ipu->dev," IPU clock can give %lu with divider %u, error %d.%u%%\n" , - rate, div, (signed )(error -1000 ) /10 , error %10 ); +dev_dbg (di->ipu->dev," IPU clock can give %lu with divider %u, error %c%d.%d%%\n" , + rate, div, error <1000 ?'-' :'+' , +abs (error -1000 ) /10 ,abs (error -1000 ) %10 );/* Allow a 1% error */ if (error <1010 && error >=990 ) {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 12/21 regulator: wm8994: Add an off-on delay for WM8994 variant
In reply to Sasha LevinFrom: Jonathan Bakker <[email protected]>
[ Upstream commit 92d96b603738ec4f35cde7198c303ae264dd47cb ]
As per Table 130 of the wm8994 datasheet at [1], there is an off-on delay for LDO1 and LDO2. In the wm8958 datasheet [2], I could not find any reference to it. I could not find a wm1811 datasheet to double-check there, but as no one has complained presumably it works without it.
This solves the issue on Samsung Aries boards with a wm8994 where register writes fail when the device is powered off and back-on quickly.
[1] https://statics.cirrus.com/pubs/proDatasheet/WM8994_Rev4.6.pdf
[2] https://statics.cirrus.com/pubs/proDatasheet/WM8958_v3.5.pdf
--- drivers/regulator/wm8994-regulator.c | 42 ++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-)
drivers/regulator/wm8994-regulator.c +39 -3
@@ -71,6 +71,35 @@ static const struct regulator_ops wm8994_ldo2_ops = { };static const struct regulator_desc wm8994_ldo_desc[] = { + { + .name ="LDO1" , + .id =1 , + .type =REGULATOR_VOLTAGE , + .n_voltages =WM8994_LDO1_MAX_SELECTOR +1 , + .vsel_reg =WM8994_LDO_1 , + .vsel_mask =WM8994_LDO1_VSEL_MASK , + .ops = &wm8994_ldo1_ops, + .min_uV =2400000 , + .uV_step =100000 , + .enable_time =3000 , + .off_on_delay =36000 , + .owner =THIS_MODULE , + }, + { + .name ="LDO2" , + .id =2 , + .type =REGULATOR_VOLTAGE , + .n_voltages =WM8994_LDO2_MAX_SELECTOR +1 , + .vsel_reg =WM8994_LDO_2 , + .vsel_mask =WM8994_LDO2_VSEL_MASK , + .ops = &wm8994_ldo2_ops, + .enable_time =3000 , + .off_on_delay =36000 , + .owner =THIS_MODULE , + }, +}; + +static const struct regulator_desc wm8958_ldo_desc[] = { { .name ="LDO1" , .id =1 ,
@@ -172,9 +201,16 @@ static int wm8994_ldo_probe(struct platform_device *pdev)* regulator core and we need not worry about it on the * error path. */ - ldo->regulator =devm_regulator_register (&pdev->dev, - &wm8994_ldo_desc[id], - &config); +if (ldo->wm8994->type ==WM8994 ) { + ldo->regulator =devm_regulator_register (&pdev->dev, + &wm8994_ldo_desc[id], + &config); + }else { + ldo->regulator =devm_regulator_register (&pdev->dev, + &wm8958_ldo_desc[id], + &config); + } +if (IS_ERR (ldo->regulator)) { ret =PTR_ERR (ldo->regulator); dev_err(wm8994->dev, "Failed to register LDO%d: %d\n",
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 13/21 arm64: alternatives: mark patch_alternative() as `noinstr`
In reply to Sasha LevinFrom: Joey Gouly <[email protected]>
[ Upstream commit a2c0b0fbe01419f8f5d1c0b9c581631f34ffce8b ]
The alternatives code must be noinstr such that it does not patch itself, as the cache invalidation is only performed after all the alternatives have been applied.
Mark patch_alternative() as noinstr. Mark branch_insn_requires_update() and get_alt_insn() with __always_inline since they are both only called through patch_alternative().
Booting a kernel in QEMU TCG with KCSAN=y and ARM64_USE_LSE_ATOMICS=y caused a boot hang:
[ 0.241121] CPU: All CPU(s) started at EL2
The alternatives code was patching the atomics in __tsan_read4() from LL/SC atomics to LSE atomics.
The following fragment is using LL/SC atomics in the .text section:
| <__tsan_unaligned_read4+304>: ldxr x6, [x2] | <__tsan_unaligned_read4+308>: add x6, x6, x5 | <__tsan_unaligned_read4+312>: stxr w7, x6, [x2] | <__tsan_unaligned_read4+316>: cbnz w7, <__tsan_unaligned_read4+304>
This LL/SC atomic sequence was to be replaced with LSE atomics. However since the alternatives code was instrumentable, __tsan_read4() was being called after only the first instruction was replaced, which led to the following code in memory:
| <__tsan_unaligned_read4+304>: ldadd x5, x6, [x2] | <__tsan_unaligned_read4+308>: add x6, x6, x5 | <__tsan_unaligned_read4+312>: stxr w7, x6, [x2] | <__tsan_unaligned_read4+316>: cbnz w7, <__tsan_unaligned_read4+304>
This caused an infinite loop as the stxr instruction never completed successfully, so w7 was always 0.
--- arch/arm64/kernel/alternative.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/kernel/alternative.c +3 -3
@@ -41,7 +41,7 @@ bool alternative_is_applied(u16 cpufeature)/* * Check if the target PC is within an alternative block. */ -static bool branch_insn_requires_update (struct alt_instr *alt,unsigned long pc) +static __always_inline bool branch_insn_requires_update(struct alt_instr *alt, unsigned long pc) {unsigned long replptr = (unsigned long )ALT_REPL_PTR (alt);return !(pc >= replptr && pc <= (replptr + alt->alt_len));
@@ -49,7 +49,7 @@ static bool branch_insn_requires_update(struct alt_instr *alt, unsigned long pc)#define align_down (x, a) ((unsigned long)(x) & ~(((unsigned long)(a)) - 1)) -static u32 get_alt_insn (struct alt_instr *alt,__le32 *insnptr,__le32 *altinsnptr) +static __always_inline u32 get_alt_insn(struct alt_instr *alt, __le32 *insnptr, __le32 *altinsnptr) {u32 insn;
@@ -94,7 +94,7 @@ static u32 get_alt_insn(struct alt_instr *alt, __le32 *insnptr, __le32 *altinsnpreturn insn; } -static void patch_alternative (struct alt_instr *alt, +static noinstr void patch_alternative(struct alt_instr *alt,__le32 *origptr,__le32 *updptr,int nr_inst) {__le32 *replptr;
Signature · 7 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 14/21 tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry
In reply to Sasha LevinFrom: Steve Capper <[email protected]>
[ Upstream commit 697a1d44af8ba0477ee729e632f4ade37999249a ]
tlb_remove_huge_tlb_entry only considers PMD_SIZE and PUD_SIZE when updating the mmu_gather structure.
Unfortunately on arm64 there are two additional huge page sizes that need to be covered: CONT_PTE_SIZE and CONT_PMD_SIZE. Where an end-user attempts to employ contiguous huge pages, a VM_BUG_ON can be experienced due to the fact that the tlb structure hasn't been correctly updated by the relevant tlb_flush_p.._range() call from tlb_remove_huge_tlb_entry.
This patch adds inequality logic to the generic implementation of tlb_remove_huge_tlb_entry s.t. CONT_PTE_SIZE and CONT_PMD_SIZE are effectively covered on arm64. Also, as well as ptes, pmds and puds; p4ds are now considered too.
--- include/asm-generic/tlb.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
include/asm-generic/tlb.h +7 -3
@@ -547,10 +547,14 @@ static inline void tlb_flush_p4d_range(struct mmu_gather *tlb,#define tlb_remove_huge_tlb_entry (h, tlb, ptep, address) \ do { \ unsigned long _sz = huge_page_size(h); \ - if (_sz == PMD_SIZE) \ - tlb_flush_pmd_range(tlb, address, _sz); \ - else if (_sz == PUD_SIZE) \ + if (_sz >= P4D_SIZE) \ + tlb_flush_p4d_range(tlb, address, _sz); \ + else if (_sz >= PUD_SIZE) \ tlb_flush_pud_range(tlb, address, _sz); \ + else if (_sz >= PMD_SIZE) \ + tlb_flush_pmd_range(tlb, address, _sz); \ + else \ + tlb_flush_pte_range(tlb, address, _sz); \ __tlb_remove_tlb_entry(tlb, ptep, address); \ } while (0)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 15/21 net: usb: aqc111: Fix out-of-bounds accesses in RX fixup
In reply to Sasha LevinFrom: Marcin Kozlowski <[email protected]>
[ Upstream commit afb8e246527536848b9b4025b40e613edf776a9d ]
aqc111_rx_fixup() contains several out-of-bounds accesses that can be triggered by a malicious (or defective) USB device, in particular:
- The metadata array (desc_offset..desc_offset+2*pkt_count) can be out of bounds, causing OOB reads and (on big-endian systems) OOB endianness flips.
- A packet can overlap the metadata array, causing a later OOB endianness flip to corrupt data used by a cloned SKB that has already been handed off into the network stack.
- A packet SKB can be constructed whose tail is far beyond its end, causing out-of-bounds heap data to be considered part of the SKB's data.
Found doing variant analysis. Tested it with another driver (ax88179_178a), since I don't have a aqc111 device to test it, but the code looks very similar.
--- drivers/net/usb/aqc111.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/usb/aqc111.c +7 -2
@@ -1102,10 +1102,15 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)if (start_of_descs != desc_offset) goto err; -/* self check desc_offset from header*/ -if (desc_offset >= skb_len) +/* self check desc_offset from header and make sure that the +* bounds of the metadata array are inside the SKB +*/ +if (pkt_count *2 + desc_offset >= skb_len) goto err; +/* Packets must not overlap the metadata array */ +skb_trim (skb, desc_offset); +if (pkt_count ==0 ) goto err;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 16/21 drm/amd/display: Fix allocate_mst_payload assert on resume
In reply to Sasha LevinFrom: Roman Li <[email protected]>
[ Upstream commit f4346fb3edf7720db3f7f5e1cab1f667cd024280 ]
[Why]
On resume we do link detection for all non-MST connectors. MST is handled separately. However the condition for telling if connector is on mst branch is not enough for mst hub case. Link detection for mst branch link leads to mst topology reset. That causes assert in dc_link_allocate_mst_payload()
[How]
Use link type as indicator for mst link.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -1210,7 +1210,8 @@ static int dm_resume(void *handle)* this is the case when traversing through already created * MST connectors, should be skipped */ -if (aconnector->mst_port) +if (aconnector->dc_link && + aconnector->dc_link->type == dc_connection_mst_branch)continue ;mutex_lock (&aconnector->hpd_lock);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 17/21 powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit
In reply to Sasha LevinFrom: Kefeng Wang <[email protected]>
[ Upstream commit ffa0b64e3be58519ae472ea29a1a1ad681e32f48 ]
mpe: On 64-bit Book3E vmalloc space starts at 0x8000000000000000.
Because of the way __pa() works we have:
__pa(0x8000000000000000) == 0, and therefore virt_to_pfn(0x8000000000000000) == 0, and therefore virt_addr_valid(0x8000000000000000) == true
Which is wrong, virt_addr_valid() should be false for vmalloc space. In fact all vmalloc addresses that alias with a valid PFN will return true from virt_addr_valid(). That can cause bugs with hardened usercopy as described below by Kefeng Wang:
When running ethtool eth0 on 64-bit Book3E, a BUG occurred:
usercopy: Kernel memory exposure attempt detected from SLUB object not in SLUB page?! (offset 0, size 1048)!
kernel BUG at mm/usercopy.c:99
...
usercopy_abort+0x64/0xa0 (unreliable)
__check_heap_object+0x168/0x190
__check_object_size+0x1a0/0x200
dev_ethtool+0x2494/0x2b20
dev_ioctl+0x5d0/0x770
sock_do_ioctl+0xf0/0x1d0
sock_ioctl+0x3ec/0x5a0
__se_sys_ioctl+0xf0/0x160
system_call_exception+0xfc/0x1f0
system_call_common+0xf8/0x200The code shows below,
data = vzalloc(array_size(gstrings.len, ETH_GSTRING_LEN)); copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN))
The data is alloced by vmalloc(), virt_addr_valid(ptr) will return true on 64-bit Book3E, which leads to the panic.
As commit 4dd7554a6456 ("powerpc/64: Add VIRTUAL_BUG_ON checks for __va and __pa addresses") does, make sure the virt addr above PAGE_OFFSET in the virt_addr_valid() for 64-bit, also add upper limit check to make sure the virt is below high_memory.
Meanwhile, for 32-bit PAGE_OFFSET is the virtual address of the start of lowmem, high_memory is the upper low virtual address, the check is suitable for 32-bit, this will fix the issue mentioned in commit 602946ec2f90 ("powerpc: Set max_mapnr correctly") too.
On 32-bit there is a similar problem with high memory, that was fixed in commit 602946ec2f90 ("powerpc: Set max_mapnr correctly"), but that commit breaks highmem and needs to be reverted.
We can't easily fix __pa(), we have code that relies on its current behaviour. So for now add extra checks to virt_addr_valid().
For 64-bit Book3S the extra checks are not necessary, the combination of virt_to_pfn() and pfn_valid() should yield the correct result, but they are harmless.
--- arch/powerpc/include/asm/page.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/page.h +5 -1
@@ -132,7 +132,11 @@ static inline bool pfn_valid(unsigned long pfn)#define virt_to_page (kaddr) pfn_to_page(virt_to_pfn(kaddr))#define pfn_to_kaddr (pfn) __va((pfn) << PAGE_SHIFT) -#define virt_addr_valid (kaddr) pfn_valid(virt_to_pfn(kaddr)) +#define virt_addr_valid (vaddr) ({ \ + unsigned long _addr = (unsigned long)vaddr; \ + _addr >= PAGE_OFFSET && _addr < (unsigned long)high_memory && \ + pfn_valid(virt_to_pfn(_addr)); \ +})/* * On Book-E parts we need __va to parse the device tree and we can't
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 18/21 scsi: mvsas: Add PCI ID of RocketRaid 2640
In reply to Sasha LevinFrom: Alexey Galakhov <[email protected]>
[ Upstream commit 5f2bce1e222028dc1c15f130109a17aa654ae6e8 ]
The HighPoint RocketRaid 2640 is a low-cost SAS controller based on Marvell chip. The chip in question was already supported by the kernel, just the PCI ID of this particular board was missing.
--- drivers/scsi/mvsas/mv_init.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/mvsas/mv_init.c +1 -0
@@ -646,6 +646,7 @@ static struct pci_device_id mvs_pci_table[] = { { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1300), chip_1300 }, { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1320), chip_1320 }, { PCI_VDEVICE(ADAPTEC2, 0x0450), chip_6440 }, + { PCI_VDEVICE(TTI, 0x2640), chip_6440 }, { PCI_VDEVICE(TTI, 0x2710), chip_9480 }, { PCI_VDEVICE(TTI, 0x2720), chip_9480 }, { PCI_VDEVICE(TTI, 0x2721), chip_9480 },
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 19/21 scsi: megaraid_sas: Target with invalid LUN ID is deleted during scan
In reply to Sasha LevinFrom: Chandrakanth patil <[email protected]>
[ Upstream commit 56495f295d8e021f77d065b890fc0100e3f9f6d8 ]
The megaraid_sas driver supports single LUN for RAID devices. That is LUN
0. All other LUNs are unsupported. When a device scan on a logical target with invalid LUN number is invoked through sysfs, that target ends up getting removed.
Add LUN ID validation in the slave destroy function to avoid the target deletion.
--- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 7 +++++++ 2 files changed, 10 insertions(+)
drivers/scsi/megaraid/megaraid_sas.h +3 -0
@@ -2551,6 +2551,9 @@ struct megasas_instance_template {#define MEGASAS_IS_LOGICAL (sdev) \ ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1) +#define MEGASAS_IS_LUN_VALID (sdev) \ + (((sdev)->lun == 0) ? 1 : 0) +#define MEGASAS_DEV_INDEX (scp) \ (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ scp->device->id)
drivers/scsi/megaraid/megaraid_sas_base.c +7 -0
@@ -2102,6 +2102,9 @@ static int megasas_slave_alloc(struct scsi_device *sdev) goto scan_target; }return -ENXIO ; + }else if (!MEGASAS_IS_LUN_VALID (sdev)) { +sdev_printk (KERN_INFO , sdev,"%s: invalid LUN\n" , __func__); +return -ENXIO ; } scan_target:
@@ -2132,6 +2135,10 @@ static void megasas_slave_destroy(struct scsi_device *sdev) instance =megasas_lookup_instance (sdev->host->host_no);if (MEGASAS_IS_LOGICAL (sdev)) { +if (!MEGASAS_IS_LUN_VALID (sdev)) { +sdev_printk (KERN_INFO , sdev,"%s: invalid LUN\n" , __func__); +return ; + } ld_tgt_id =MEGASAS_TARGET_ID (sdev); instance->ld_tgtid_status[ld_tgt_id] =LD_TARGET_ID_DELETED ;if (megasas_dbg_lvl &LD_PD_DEBUG )
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 20/21 drivers: net: slip: fix NPD bug in sl_tx_timeout()
In reply to Sasha LevinFrom: Duoming Zhou <[email protected]>
[ Upstream commit ec4eb8a86ade4d22633e1da2a7d85a846b7d1798 ]
When a slip driver is detaching, the slip_close() will act to cleanup necessary resources and sl->tty is set to NULL in slip_close(). Meanwhile, the packet we transmit is blocked, sl_tx_timeout() will be called. Although slip_close() and sl_tx_timeout() use sl->lock to synchronize, we don`t judge whether sl->tty equals to NULL in sl_tx_timeout() and the null pointer dereference bug will happen.
(Thread 1) | (Thread 2)
| slip_close()
| spin_lock_bh(&sl->lock)
| ...
... | sl->tty = NULL //(1)
sl_tx_timeout() | spin_unlock_bh(&sl->lock)
spin_lock(&sl->lock); |
... | ...
tty_chars_in_buffer(sl->tty)|
if (tty->ops->..) //(2) |
... | synchronize_rcu()We set NULL to sl->tty in position (1) and dereference sl->tty in position (2).
This patch adds check in sl_tx_timeout(). If sl->tty equals to NULL, sl_tx_timeout() will goto out.
--- drivers/net/slip/slip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/slip/slip.c +1 -1
@@ -471,7 +471,7 @@ static void sl_tx_timeout(struct net_device *dev)spin_lock (&sl->lock);if (netif_queue_stopped (dev)) { -if (!netif_running (dev)) +if (!netif_running (dev) || !sl->tty) goto out;/* May be we must check transmitter timeout here ?
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 21/21 perf/imx_ddr: Fix undefined behavior due to shift overflowing the constant
In reply to Sasha LevinFrom: Borislav Petkov <[email protected]>
[ Upstream commit d02b4dd84e1a90f7f1444d027c0289bf355b0d5a ]
Fix:
In file included from <command-line>:0:0:
In function ‘ddr_perf_counter_enable’,
inlined from ‘ddr_perf_irq_handler’ at drivers/perf/fsl_imx8_ddr_perf.c:651:2:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_729’ \
declared with attribute error: FIELD_PREP: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
...
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- drivers/perf/fsl_imx8_ddr_perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/fsl_imx8_ddr_perf.c +1 -1
@@ -29,7 +29,7 @@#define CNTL_OVER_MASK 0xFFFFFFFE#define CNTL_CSV_SHIFT 24 -#define CNTL_CSV_MASK (0xFF << CNTL_CSV_SHIFT) +#define CNTL_CSV_MASK (0xFFU << CNTL_CSV_SHIFT)#define EVENT_CYCLES_ID 0#define EVENT_CYCLES_COUNTER 0
Signature · 7 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel