drm/cirrus: NULL-check pipe->plane.state->fb in cirrus_pipe_update()
Subsystems (15)
Sasha Levin
maintainerPATCH 1/29 drm/cirrus: NULL-check pipe->plane.state->fb in cirrus_pipe_update()
From: Alexandr Sapozhnikov <[email protected]>
[ Upstream commit 7245e629dcaaf308f1868aeffa218e9849c77893 ]
After having been compared to NULL value at cirrus.c:455, pointer 'pipe->plane.state->fb' is passed as 1st parameter in call to function 'cirrus_fb_blit_rect' at cirrus.c:461, where it is dereferenced at cirrus.c:316.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
v2:
* aligned commit message to line-length limits
--- drivers/gpu/drm/tiny/cirrus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tiny/cirrus.c +1 -1
@@ -455,7 +455,7 @@ static void cirrus_pipe_update(struct drm_simple_display_pipe *pipe,if (state->fb && cirrus->cpp !=cirrus_cpp (state->fb))cirrus_mode_set (cirrus, &crtc->mode, state->fb); -if (drm_atomic_helper_damage_merged (old_state, state, &rect)) +if (state->fb &&drm_atomic_helper_damage_merged (old_state, state, &rect))cirrus_fb_blit_rect (state->fb, &shadow_plane_state->data[0 ], &rect); }
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 2/29 HID: cp2112: Fix driver not registering GPIO IRQ chip as threaded
From: Danny Kaehn <[email protected]>
[ Upstream commit 37f5b858a66543b2b67c0288280af623985abc29 ]
The CP2112 generates interrupts from a polling routine on a thread, and can only support threaded interrupts. This patch configures the gpiochip irq chip with this flag, disallowing consumers to request a hard IRQ from this driver, which resulted in a segfault previously.
--- drivers/hid/hid-cp2112.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-cp2112.c +1 -0
@@ -1354,6 +1354,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) girq->parents =NULL ; girq->default_type =IRQ_TYPE_NONE ; girq->handler = handle_simple_irq; + girq->threaded = true; ret =gpiochip_add_data (&dev->gc, dev);if (ret <0 ) {
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 3/29 ca8210: fix mac_len negative array access
In reply to Sasha LevinFrom: Alexander Aring <[email protected]>
[ Upstream commit 6c993779ea1d0cccdb3a5d7d45446dd229e610a3 ]
This patch fixes a buffer overflow access of skb->data if ieee802154_hdr_peek_addrs() fails.
--- drivers/net/ieee802154/ca8210.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ieee802154/ca8210.c +2 -0
@@ -1913,6 +1913,8 @@ static int ca8210_skb_tx(* packet */ mac_len =ieee802154_hdr_peek_addrs (skb, &header); +if (mac_len <0 ) +return mac_len; secspec.security_level = header.sec.level; secspec.key_id_mode = header.sec.key_id_mode;
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 4/29 HID: logitech-hidpp: Add support for Logitech MX Master 3S mouse
In reply to Sasha LevinFrom: Rafał Szalecki <[email protected]>
[ Upstream commit db50f7a3983f0154e730f1147ef729e0c5c2f90c ]
Add signature for the Logitech MX Master 3S mouse over Bluetooth.
--- drivers/hid/hid-logitech-hidpp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-logitech-hidpp.c +2 -0
@@ -4378,6 +4378,8 @@ static const struct hid_device_id hidpp_devices[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e) }, { /* MX Master 3 mouse over Bluetooth */ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb023) }, + { /* MX Master 3S mouse over Bluetooth */ + HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb034) }, {} };
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 5/29 HID: intel-ish-hid: ipc: Fix potential use-after-free in work function
In reply to Sasha LevinFrom: Reka Norman <[email protected]>
[ Upstream commit 8ae2f2b0a28416ed2f6d8478ac8b9f7862f36785 ]
When a reset notify IPC message is received, the ISR schedules a work function and passes the ISHTP device to it via a global pointer ishtp_dev. If ish_probe() fails, the devm-managed device resources including ishtp_dev are freed, but the work is not cancelled, causing a use-after-free when the work function tries to access ishtp_dev. Use devm_work_autocancel() instead, so that the work is automatically cancelled if probe fails.
--- drivers/hid/intel-ish-hid/ipc/ipc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/hid/intel-ish-hid/ipc/ipc.c +8 -1
@@ -5,6 +5,7 @@* Copyright (c) 2014-2016, Intel Corporation. */ +#include <linux/devm-helpers.h> #include <linux/sched.h> #include <linux/spinlock.h> #include <linux/delay.h>
@@ -621,7 +622,6 @@ static void recv_ipc(struct ishtp_device *dev, uint32_t doorbell_val)case MNG_RESET_NOTIFY :if (!ishtp_dev) { ishtp_dev = dev; -INIT_WORK (&fw_reset_work, fw_reset_work_fn); }schedule_work (&fw_reset_work);break ;
@@ -940,6 +940,7 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev) {struct ishtp_device *dev;int i; +int ret; dev = devm_kzalloc(&pdev->dev, sizeof(struct ishtp_device) + sizeof(struct ish_hw),
@@ -975,6 +976,12 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev)list_add_tail (&tx_buf->link, &dev->wr_free_list); } + ret =devm_work_autocancel (&pdev->dev, &fw_reset_work, fw_reset_work_fn); +if (ret) { +dev_err (dev->devc,"Failed to initialise FW reset work\n" ); +return NULL ; + } + dev->ops = &ish_hw_ops; dev->devc = &pdev->dev; dev->mtu =IPC_PAYLOAD_SIZE -sizeof (struct ishtp_msg_hdr );
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 6/29 m68k: mm: Fix systems with memory at end of 32-bit address space
In reply to Sasha LevinFrom: Kars de Jong <[email protected]>
[ Upstream commit 0d9fad91abfd723ea5070a46d98a9f4496c93ba9 ]
The calculation of end addresses of memory chunks overflowed to 0 when a memory chunk is located at the end of 32-bit address space. This is the case for the HP300 architecture.
--- arch/m68k/mm/motorola.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/m68k/mm/motorola.c +5 -5
@@ -437,7 +437,7 @@ void __init paging_init(void) } min_addr = m68k_memory[0 ].addr; - max_addr = min_addr + m68k_memory[0 ].size; + max_addr = min_addr + m68k_memory[0 ].size -1 ;memblock_add_node (m68k_memory[0 ].addr, m68k_memory[0 ].size,0 ,MEMBLOCK_NONE );for (i =1 ; i < m68k_num_memory;) {
@@ -452,21 +452,21 @@ void __init paging_init(void) }memblock_add_node (m68k_memory[i].addr, m68k_memory[i].size, i,MEMBLOCK_NONE ); - addr = m68k_memory[i].addr + m68k_memory[i].size; + addr = m68k_memory[i].addr + m68k_memory[i].size -1 ;if (addr > max_addr) max_addr = addr; i++; } m68k_memoffset = min_addr -PAGE_OFFSET ; - m68k_virt_to_node_shift =fls (max_addr - min_addr -1 ) -6 ; + m68k_virt_to_node_shift =fls (max_addr - min_addr) -6 ;module_fixup (NULL , __start_fixup, __stop_fixup);flush_icache (); - high_memory =phys_to_virt (max_addr); + high_memory =phys_to_virt (max_addr) +1 ; min_low_pfn = availmem >>PAGE_SHIFT ; - max_pfn = max_low_pfn = max_addr >>PAGE_SHIFT ; + max_pfn = max_low_pfn = (max_addr >>PAGE_SHIFT ) +1 ;/* Reserve kernel text/data/bss and the memory allocated in head.S */ memblock_reserve (m68k_memory[0 ].addr, availmem - m68k_memory[0 ].addr);
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 7/29 m68k: Only force 030 bus error if PC not in exception table
In reply to Sasha LevinFrom: Michael Schmitz <[email protected]>
[ Upstream commit e36a82bebbf7da814530d5a179bef9df5934b717 ]
__get_kernel_nofault() does copy data in supervisor mode when forcing a task backtrace log through /proc/sysrq_trigger. This is expected cause a bus error exception on e.g. NULL pointer dereferencing when logging a kernel task has no workqueue associated. This bus error ought to be ignored.
Our 030 bus error handler is ill equipped to deal with this:
Whenever ssw indicates a kernel mode access on a data fault, we don't even attempt to handle the fault and instead always send a SEGV signal (or panic). As a result, the check for exception handling at the fault PC (buried in send_sig_fault() which gets called from do_page_fault() eventually) is never used.
In contrast, both 040 and 060 access error handlers do not care whether a fault happened on supervisor mode access, and will call do_page_fault() on those, ultimately honoring the exception table.
Add a check in bus_error030 to call do_page_fault() in case we do have an entry for the fault PC in our exception table.
I had attempted a fix for this earlier in 2019 that did rely on testing pagefault_disabled() (see link below) to achieve the same thing, but this patch should be more generic.
Tested on 030 Atari Falcon.
--- arch/m68k/kernel/traps.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/m68k/kernel/traps.c +3 -1
@@ -30,6 +30,7 @@#include <linux/init.h> #include <linux/ptrace.h> #include <linux/kallsyms.h> +#include <linux/extable.h> #include <asm/setup.h> #include <asm/fpu.h>
@@ -545,7 +546,8 @@ static inline void bus_error030 (struct frame *fp) errorcode |=2 ;if (mmusr & (MMU_I |MMU_WP )) { -if (ssw &4 ) { +/* We might have an exception table for this PC */ +if (ssw &4 && !search_exception_tables (fp->ptregs.pc)) { pr_err("Data %s fault at %#010lx in %s (pc=%#lx)\n", ssw & RW ? "read" : "write", fp->un.fmtb.daddr,
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 8/29 selftests/bpf: check that modifier resolves after pointer
In reply to Sasha LevinFrom: Lorenz Bauer <[email protected]>
[ Upstream commit dfdd608c3b365f0fd49d7e13911ebcde06b9865b ]
Add a regression test that ensures that a VAR pointing at a modifier which follows a PTR (or STRUCT or ARRAY) is resolved correctly by the datasec validator.
--- tools/testing/selftests/bpf/prog_tests/btf.c | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+)
tools/testing/selftests/bpf/prog_tests/btf.c +28 -0
@@ -879,6 +879,34 @@ static struct btf_raw_test raw_tests[] = { .btf_load_err = true, .err_str = "Invalid elem", }, +{ + .descr = "var after datasec, ptr followed by modifier", + .raw_types = { + /* .bss section */ /* [1] */ + BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_DATASEC, 0, 2), + sizeof(void*)+4), + BTF_VAR_SECINFO_ENC(4, 0, sizeof(void*)), + BTF_VAR_SECINFO_ENC(6, sizeof(void*), 4), + /* int */ /* [2] */ + BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), + /* int* */ /* [3] */ + BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 2), + BTF_VAR_ENC(NAME_TBD, 3, 0), /* [4] */ + /* const int */ /* [5] */ + BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_CONST, 0, 0), 2), + BTF_VAR_ENC(NAME_TBD, 5, 0), /* [6] */ + BTF_END_RAW, + }, + .str_sec = "\0a\0b\0c\0", + .str_sec_size = sizeof("\0a\0b\0c\0"), + .map_type = BPF_MAP_TYPE_ARRAY, + .map_name = ".bss", + .key_size = sizeof(int), + .value_size = sizeof(void*)+4, + .key_type_id = 0, + .value_type_id = 1, + .max_entries = 1, +}, /* Test member exceeds the size of struct. * * struct A {
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 9/29 scsi: target: iscsi: Fix an error message in iscsi_check_key()
In reply to Sasha LevinFrom: Maurizio Lombardi <[email protected]>
[ Upstream commit 6cc55c969b7ce8d85e09a636693d4126c3676c11 ]
The first half of the error message is printed by pr_err(), the second half is printed by pr_debug(). The user will therefore see only the first part of the message and will miss some useful information.
--- drivers/target/iscsi/iscsi_target_parameters.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/target/iscsi/iscsi_target_parameters.c +7 -5
@@ -1262,18 +1262,20 @@ static struct iscsi_param *iscsi_check_key(return param;if (!(param->phase & phase)) { -pr_err ("Key \"%s\" may not be negotiated during " , - param->name); +char *phase_name; +switch (phase) {case PHASE_SECURITY : -pr_debug ("Security phase.\n" ); + phase_name ="Security" ;break ;case PHASE_OPERATIONAL : -pr_debug ("Operational phase.\n" ); + phase_name ="Operational" ;break ;default : -pr_debug ("Unknown phase.\n" ); + phase_name ="Unknown" ; } +pr_err ("Key \"%s\" may not be negotiated during %s phase.\n" , + param->name, phase_name);return NULL ; }
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 10/29 scsi: qla2xxx: Add option to disable FC2 Target support
In reply to Sasha LevinFrom: Daniel Wagner <[email protected]>
[ Upstream commit 877b03795fcf29ff2e2351f7e574ecc9b9c51732 ]
Commit 44c57f205876 ("scsi: qla2xxx: Changes to support FCP2 Target") added support for FC2 Targets. Unfortunately, there are older setups which break with this new feature enabled.
Allow to disable it via module option.
--- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_init.c | 3 ++- drivers/scsi/qla2xxx/qla_os.c | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_gbl.h +1 -0
@@ -192,6 +192,7 @@ extern int ql2xsecenable;extern int ql2xenforce_iocb_limit;extern int ql2xabts_wait_nvme;extern u32 ql2xnvme_queues; +extern int ql2xfc2target;extern int qla2x00_loop_reset (scsi_qla_host_t *);extern void qla2x00_abort_all_cmds (scsi_qla_host_t *,int );
drivers/scsi/qla2xxx/qla_init.c +2 -1
@@ -1841,7 +1841,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea)case RSCN_PORT_ADDR : fcport =qla2x00_find_fcport_by_nportid (vha, &ea->id,1 );if (fcport) { -if (fcport->flags &FCF_FCP2_DEVICE && +if (ql2xfc2target && + fcport->flags &FCF_FCP2_DEVICE &&atomic_read (&fcport->state) ==FCS_ONLINE ) { ql_dbg(ql_dbg_disc, vha, 0x2115, "Delaying session delete for FCP2 portid=%06x %8phC ",
drivers/scsi/qla2xxx/qla_os.c +9 -1
@@ -360,6 +360,13 @@ MODULE_PARM_DESC(ql2xnvme_queues,"1 - Minimum number of queues supported\n" "8 - Default value"); +int ql2xfc2target =1 ; +module_param (ql2xfc2target, int,0444 ); +MODULE_PARM_DESC (qla2xfc2target, +"Enables FC2 Target support. " +"0 - FC2 Target support is disabled. " +"1 - FC2 Target support is enabled (default)." ); +static struct scsi_transport_template *qla2xxx_transport_template =NULL ;struct scsi_transport_template *qla2xxx_transport_vport_template =NULL ;
@@ -4076,7 +4083,8 @@ qla2x00_mark_all_devices_lost(scsi_qla_host_t *vha) "Mark all dev lost\n");list_for_each_entry (fcport, &vha->vp_fcports, list) { -if (fcport->loop_id !=FC_NO_LOOP_ID && +if (ql2xfc2target && + fcport->loop_id !=FC_NO_LOOP_ID && (fcport->flags &FCF_FCP2_DEVICE ) && fcport->port_type ==FCT_TARGET && !qla2x00_reset_active (vha)) {
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 11/29 scsi: hisi_sas: Check devm_add_action() return value
In reply to Sasha LevinFrom: Kang Chen <[email protected]>
[ Upstream commit 06d1a90de60208054cca15ef200138cfdbb642a9 ]
In case devm_add_action() fails, check it in the caller of interrupt_preinit_v3_hw().
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -2
@@ -2448,8 +2448,7 @@ static int interrupt_preinit_v3_hw(struct hisi_hba *hisi_hba) hisi_hba->cq_nvecs = vectors -BASE_VECTORS_V3_HW ; shost->nr_hw_queues = hisi_hba->cq_nvecs; -devm_add_action (&pdev->dev, hisi_sas_v3_free_vectors, pdev); -return 0 ; +return devm_add_action (&pdev->dev, hisi_sas_v3_free_vectors, pdev); }static int interrupt_init_v3_hw (struct hisi_hba *hisi_hba)
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 12/29 scsi: ufs: core: Add soft dependency on governor_simpleondemand
In reply to Sasha LevinFrom: Adrien Thierry <[email protected]>
[ Upstream commit 2ebe16155dc8bd4e602cad5b5f65458d2eaa1a75 ]
The ufshcd driver uses simpleondemand governor for devfreq. Add it to the list of ufshcd softdeps to allow userspace initramfs tools like dracut to automatically pull the governor module into the initramfs together with UFS drivers.
--- drivers/ufs/core/ufshcd.c | 1 + 1 file changed, 1 insertion(+)
drivers/ufs/core/ufshcd.c +1 -0
@@ -10074,4 +10074,5 @@ module_exit(ufshcd_core_exit);MODULE_AUTHOR ("Santosh Yaragnavi <[email protected]>" );MODULE_AUTHOR ("Vinayak Holikatti <[email protected]>" );MODULE_DESCRIPTION ("Generic UFS host controller driver Core" ); +MODULE_SOFTDEP ("pre: governor_simpleondemand" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 13/29 scsi: lpfc: Check kzalloc() in lpfc_sli4_cgn_params_read()
In reply to Sasha LevinFrom: Justin Tee <[email protected]>
[ Upstream commit 312320b0e0ec21249a17645683fe5304d796aec1 ]
If kzalloc() fails in lpfc_sli4_cgn_params_read(), then we rely on lpfc_read_object()'s routine to NULL check pdata.
Currently, an early return error is thrown from lpfc_read_object() to protect us from NULL ptr dereference, but the errno code is -ENODEV.
Change the errno code to a more appropriate -ENOMEM.
--- drivers/scsi/lpfc/lpfc_init.c | 2 ++ drivers/scsi/lpfc/lpfc_sli.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +2 -0
@@ -7234,6 +7234,8 @@ lpfc_sli4_cgn_params_read(struct lpfc_hba *phba)/* Find out if the FW has a new set of congestion parameters. */ len =sizeof (struct lpfc_cgn_param ); pdata =kzalloc (len,GFP_KERNEL ); +if (!pdata) +return -ENOMEM ; ret =lpfc_read_object (phba, (char *)LPFC_PORT_CFG_NAME , pdata, len);
drivers/scsi/lpfc/lpfc_sli.c +0 -4
@@ -22096,10 +22096,6 @@ lpfc_read_object(struct lpfc_hba *phba, char *rdobject, uint32_t *datap,struct lpfc_dmabuf *pcmd;u32 rd_object_name[LPFC_MBX_OBJECT_NAME_LEN_DW ] = {0 }; -/* sanity check on queue memory */ -if (!datap) -return -ENODEV ; - mbox =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (!mbox)return -ENOMEM ;
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 14/29 scsi: lpfc: Avoid usage of list iterator variable after loop
In reply to Sasha LevinFrom: Jakob Koschel <[email protected]>
[ Upstream commit 2850b23e9f9ae3696e472d2883ea1b43aafa884e ]
If the &epd_pool->list is empty when executing lpfc_get_io_buf_from_expedite_pool() the function would return an invalid pointer. Even in the case if the list is guaranteed to be populated, the iterator variable should not be used after the loop to be more robust for future changes.
Linus proposed to avoid any use of the list iterator variable after the loop, in the attempt to move the list iterator variable declaration into the macro to avoid any potential misuse after the loop [1].
--- drivers/scsi/lpfc/lpfc_sli.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +4 -4
@@ -21886,20 +21886,20 @@ lpfc_get_io_buf_from_private_pool(struct lpfc_hba *phba,static struct lpfc_io_buf *lpfc_get_io_buf_from_expedite_pool (struct lpfc_hba *phba) { -struct lpfc_io_buf *lpfc_ncmd; +struct lpfc_io_buf *lpfc_ncmd =NULL , *iter;struct lpfc_io_buf *lpfc_ncmd_next;unsigned long iflag;struct lpfc_epd_pool *epd_pool; epd_pool = &phba->epd_pool; - lpfc_ncmd =NULL ;spin_lock_irqsave (&epd_pool->lock, iflag);if (epd_pool->count >0 ) { -list_for_each_entry_safe (lpfc_ncmd, lpfc_ncmd_next, +list_for_each_entry_safe (iter, lpfc_ncmd_next, &epd_pool->list, list) { -list_del (&lpfc_ncmd->list); +list_del (&iter->list); epd_pool->count--; + lpfc_ncmd = iter;break ; } }
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 15/29 scsi: mpi3mr: ioctl timeout when disabling/enabling interrupt
In reply to Sasha LevinFrom: Ranjan Kumar <[email protected]>
[ Upstream commit 02ca7da2919ada525fb424640205110e24646b50 ]
As part of Task Management handling, the driver will disable and enable the MSIx index zero which belongs to the Admin reply queue. During this transition the driver loses some interrupts and this leads to Admin request and ioctl timeouts.
After enabling the interrupts, poll the Admin reply queue to avoid timeouts.
--- drivers/scsi/mpi3mr/mpi3mr.h | 3 +++ drivers/scsi/mpi3mr/mpi3mr_fw.c | 12 ++++++++++-- drivers/scsi/mpi3mr/mpi3mr_os.c | 1 + 3 files changed, 14 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +3 -0
@@ -903,6 +903,7 @@ struct scmd_priv {* @admin_reply_ephase:Admin reply queue expected phase * @admin_reply_base: Admin reply queue base virtual address * @admin_reply_dma: Admin reply queue base dma address +* @admin_reply_q_in_use: Queue is handled by poll/ISR * @ready_timeout: Controller ready timeout * @intr_info: Interrupt cookie pointer * @intr_info_count: Number of interrupt cookies
@@ -1056,6 +1057,7 @@ struct mpi3mr_ioc {u8 admin_reply_ephase;void *admin_reply_base;dma_addr_t admin_reply_dma; +atomic_t admin_reply_q_in_use;u32 ready_timeout;
@@ -1391,4 +1393,5 @@ void mpi3mr_add_event_wait_for_device_refresh(struct mpi3mr_ioc *mrioc);void mpi3mr_flush_drv_cmds (struct mpi3mr_ioc *mrioc);void mpi3mr_flush_cmds_for_unrecovered_controller (struct mpi3mr_ioc *mrioc);void mpi3mr_free_enclosure_list (struct mpi3mr_ioc *mrioc); +int mpi3mr_process_admin_reply_q (struct mpi3mr_ioc *mrioc);#endif /*MPI3MR_H_INCLUDED*/
drivers/scsi/mpi3mr/mpi3mr_fw.c +10 -2
@@ -415,7 +415,7 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc, le64_to_cpu(scsi_reply->sense_data_buffer_address)); } -static int mpi3mr_process_admin_reply_q (struct mpi3mr_ioc *mrioc) +int mpi3mr_process_admin_reply_q (struct mpi3mr_ioc *mrioc) {u32 exp_phase = mrioc->admin_reply_ephase;u32 admin_reply_ci = mrioc->admin_reply_ci;
@@ -423,12 +423,17 @@ static int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc)u64 reply_dma =0 ;struct mpi3_default_reply_descriptor *reply_desc; +if (!atomic_add_unless (&mrioc->admin_reply_q_in_use,1 ,1 )) +return 0 ; + reply_desc = (struct mpi3_default_reply_descriptor *)mrioc->admin_reply_base + admin_reply_ci;if ((le16_to_cpu (reply_desc->reply_flags) & -MPI3_REPLY_DESCRIPT_FLAGS_PHASE_MASK ) != exp_phase) +MPI3_REPLY_DESCRIPT_FLAGS_PHASE_MASK ) != exp_phase) { +atomic_dec (&mrioc->admin_reply_q_in_use);return 0 ; + } do { if (mrioc->unrecoverable)
@@ -454,6 +459,7 @@ static int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc)writel (admin_reply_ci, &mrioc->sysif_regs->admin_reply_queue_ci); mrioc->admin_reply_ci = admin_reply_ci; mrioc->admin_reply_ephase = exp_phase; +atomic_dec (&mrioc->admin_reply_q_in_use);return num_admin_replies; }
@@ -2605,6 +2611,7 @@ static int mpi3mr_setup_admin_qpair(struct mpi3mr_ioc *mrioc) mrioc->admin_reply_ci =0 ; mrioc->admin_reply_ephase =1 ; mrioc->admin_reply_base =NULL ; +atomic_set (&mrioc->admin_reply_q_in_use,0 );if (!mrioc->admin_req_base) { mrioc->admin_req_base = dma_alloc_coherent(&mrioc->pdev->dev,
@@ -4156,6 +4163,7 @@ void mpi3mr_memset_buffers(struct mpi3mr_ioc *mrioc)memset (mrioc->admin_req_base,0 , mrioc->admin_req_q_sz);if (mrioc->admin_reply_base)memset (mrioc->admin_reply_base,0 , mrioc->admin_reply_q_sz); +atomic_set (&mrioc->admin_reply_q_in_use,0 );if (mrioc->init_cmds.reply) {memset (mrioc->init_cmds.reply,0 ,sizeof (*mrioc->init_cmds.reply));
drivers/scsi/mpi3mr/mpi3mr_os.c +1 -0
@@ -3720,6 +3720,7 @@ int mpi3mr_issue_tm(struct mpi3mr_ioc *mrioc, u8 tm_type,mpi3mr_poll_pend_io_completions (mrioc);mpi3mr_ioc_enable_intr (mrioc);mpi3mr_poll_pend_io_completions (mrioc); +mpi3mr_process_admin_reply_q (mrioc); }switch (tm_type) {case MPI3_SCSITASKMGMT_TASKTYPE_TARGET_RESET :
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 16/29 scsi: mpi3mr: Driver unload crashes host when enhanced logging is enabled
In reply to Sasha LevinFrom: Ranjan Kumar <[email protected]>
[ Upstream commit 5b06a7169c59ce0c77ef8b9c82aa07c478f82aac ]
Prevent driver from trying to dereference a NULL pointer in a debug print while removing a device during driver unload.
--- drivers/scsi/mpi3mr/mpi3mr_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr_transport.c +2 -1
@@ -1552,7 +1552,8 @@ static void mpi3mr_sas_port_remove(struct mpi3mr_ioc *mrioc, u64 sas_address,list_for_each_entry_safe (mr_sas_phy, next_phy, &mr_sas_port->phy_list, port_siblings) { -if ((mrioc->logging_level &MPI3_DEBUG_TRANSPORT_INFO )) +if ((!mrioc->stop_drv_processing) && + (mrioc->logging_level &MPI3_DEBUG_TRANSPORT_INFO )) dev_info(&mr_sas_port->port->dev, "remove: sas_address(0x%016llx), phy(%d)\n", (unsigned long long)
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 17/29 scsi: mpi3mr: Wait for diagnostic save during controller init
In reply to Sasha LevinFrom: Ranjan Kumar <[email protected]>
[ Upstream commit 0a319f1629495d27879b7ebf6eee62b8cf6e4c37 ]
If a controller reset operation is triggered to recover the controller from a fault state, then wait for the snapdump to be saved in the firmware region before proceeding to reset the controller.
--- drivers/scsi/mpi3mr/mpi3mr_fw.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr_fw.c +18 -1
@@ -1198,7 +1198,7 @@ mpi3mr_revalidate_factsdata(struct mpi3mr_ioc *mrioc)*/ static int mpi3mr_bring_ioc_ready (struct mpi3mr_ioc *mrioc) { -u32 ioc_config, ioc_status, timeout; +u32 ioc_config, ioc_status, timeout, host_diagnostic;int retval =0 ;enum mpi3mr_iocstate ioc_state;u64 base_info;
@@ -1252,6 +1252,23 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc) retval, mpi3mr_iocstate_name(ioc_state)); }if (ioc_state !=MRIOC_STATE_RESET ) { +if (ioc_state ==MRIOC_STATE_FAULT ) { + timeout =MPI3_SYSIF_DIAG_SAVE_TIMEOUT *10 ; +mpi3mr_print_fault_info (mrioc); +do { + host_diagnostic = +readl (&mrioc->sysif_regs->host_diagnostic); +if (!(host_diagnostic & +MPI3_SYSIF_HOST_DIAG_SAVE_IN_PROGRESS )) +break ; +if (!pci_device_is_present (mrioc->pdev)) { + mrioc->unrecoverable =1 ; +ioc_err (mrioc,"controller is not present at the bringup\n" ); + goto out_device_not_present; + } +msleep (100 ); + }while (--timeout); + }mpi3mr_print_fault_info (mrioc);ioc_info (mrioc,"issuing soft reset to bring to reset state\n" ); retval = mpi3mr_issue_reset(mrioc,
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 18/29 scsi: mpi3mr: Return proper values for failures in firmware init path
In reply to Sasha LevinFrom: Ranjan Kumar <[email protected]>
[ Upstream commit ba8a9ba41fbde250fd8b0ed1e5dad0dc9318df46 ]
Return proper non-zero return values for all the cases when the controller initialization and re-initialization fails.
--- drivers/scsi/mpi3mr/mpi3mr_fw.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_fw.c +9 -2
@@ -3841,8 +3841,10 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)dprint_init (mrioc,"allocating config page buffers\n" ); mrioc->cfg_page =dma_alloc_coherent (&mrioc->pdev->dev,MPI3MR_DEFAULT_CFG_PAGE_SZ , &mrioc->cfg_page_dma,GFP_KERNEL ); -if (!mrioc->cfg_page) +if (!mrioc->cfg_page) { + retval =-1 ; goto out_failed_noretry; + } mrioc->cfg_page_sz =MPI3MR_DEFAULT_CFG_PAGE_SZ ;
@@ -3904,8 +3906,10 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)dprint_init (mrioc,"allocating memory for throttle groups\n" ); sz =sizeof (struct mpi3mr_throttle_group_info ); mrioc->throttle_groups =kcalloc (mrioc->num_io_throttle_group, sz,GFP_KERNEL ); -if (!mrioc->throttle_groups) +if (!mrioc->throttle_groups) { + retval =-1 ; goto out_failed_noretry; + } } retval =mpi3mr_enable_events (mrioc);
@@ -3925,6 +3929,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)mpi3mr_memset_buffers (mrioc); goto retry_init; } + retval =-1 ; out_failed_noretry:ioc_err (mrioc,"controller initialization failed\n" ); mpi3mr_issue_reset(mrioc, MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT,
@@ -4037,6 +4042,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume)ioc_err (mrioc,"cannot create minimum number of operational queues expected:%d created:%d\n" , mrioc->shost->nr_hw_queues, mrioc->num_op_reply_q); + retval =-1 ; goto out_failed_noretry; }
@@ -4103,6 +4109,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume)mpi3mr_memset_buffers (mrioc); goto retry_init; } + retval =-1 ; out_failed_noretry:ioc_err (mrioc,"controller %s is failed\n" , (is_resume)?"resume" :"re-initialization" );
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 19/29 scsi: mpi3mr: NVMe command size greater than 8K fails
In reply to Sasha LevinFrom: Ranjan Kumar <[email protected]>
[ Upstream commit 4f297e856a7b5da2f2c66a12e739666e23943560 ]
A wrong variable is checked while populating PRP entries in the PRP page and this results in failure. No PRP entries in the PRP page were successfully created and any NVMe Encapsulated commands with PRP of size greater than 8K failed.
--- drivers/scsi/mpi3mr/mpi3mr_app.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_app.c +2 -2
@@ -886,7 +886,7 @@ static int mpi3mr_build_nvme_prp(struct mpi3mr_ioc *mrioc,* each time through the loop. */ *prp_entry =cpu_to_le64 (dma_addr); -if (*prp1_entry & sgemod_mask) { +if (*prp_entry & sgemod_mask) {dprint_bsg_err (mrioc,"%s: PRP address collides with SGE modifier\n" , __func__);
@@ -895,7 +895,7 @@ static int mpi3mr_build_nvme_prp(struct mpi3mr_ioc *mrioc, *prp_entry &= ~sgemod_mask; *prp_entry |= sgemod_val; prp_entry++; - prp_entry_dma++; + prp_entry_dma += prp_size; }/*
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 20/29 scsi: mpi3mr: Bad drive in topology results kernel crash
In reply to Sasha LevinFrom: Ranjan Kumar <[email protected]>
[ Upstream commit 8e45183978d64699df639e795235433a60f35047 ]
When the SAS Transport Layer support is enabled and a device exposed to the OS by the driver fails INQUIRY commands, the driver frees up the memory allocated for an internal HBA port data structure. However, in some places, the reference to the freed memory is not cleared. When the firmware sends the Device Info change event for the same device again, the freed memory is accessed and that leads to memory corruption and OS crash.
--- drivers/scsi/mpi3mr/mpi3mr_transport.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_transport.c +7 -5
@@ -2358,15 +2358,16 @@ int mpi3mr_report_tgtdev_to_sas_transport(struct mpi3mr_ioc *mrioc, tgtdev->host_exposed =1 ;if (!mpi3mr_sas_port_add (mrioc, tgtdev->dev_handle, sas_address_parent, hba_port)) { - tgtdev->host_exposed =0 ; retval =-1 ; - }else if ((!tgtdev->starget)) { -if (!mrioc->is_driver_loading) + }else if ((!tgtdev->starget) && (!mrioc->is_driver_loading)) {mpi3mr_sas_port_remove (mrioc, sas_address, sas_address_parent, hba_port); - tgtdev->host_exposed =0 ; retval =-1 ; } +if (retval) { + tgtdev->dev_spec.sas_sata_inf.hba_port =NULL ; + tgtdev->host_exposed =0 ; + }return retval; }
@@ -2395,6 +2396,7 @@ void mpi3mr_remove_tgtdev_from_sas_transport(struct mpi3mr_ioc *mrioc,mpi3mr_sas_port_remove (mrioc, sas_address, sas_address_parent, hba_port); tgtdev->host_exposed =0 ; + tgtdev->dev_spec.sas_sata_inf.hba_port =NULL ; }/**
@@ -2451,7 +2453,7 @@ static u8 mpi3mr_get_port_id_by_rphy(struct mpi3mr_ioc *mrioc, struct sas_rphy * tgtdev =__mpi3mr_get_tgtdev_by_addr_and_rphy (mrioc, rphy->identify.sas_address, rphy); -if (tgtdev) { +if (tgtdev && tgtdev->dev_spec.sas_sata_inf.hba_port) { port_id = tgtdev->dev_spec.sas_sata_inf.hba_port->port_id;mpi3mr_tgtdev_put (tgtdev);
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 21/29 scsi: storvsc: Handle BlockSize change in Hyper-V VHD/VHDX file
In reply to Sasha LevinFrom: Michael Kelley <[email protected]>
[ Upstream commit 11d9874c4204a785f43d899a1ab12f9dc8d9de3e ]
Hyper-V uses a VHD or VHDX file on the host as the underlying storage for a virtual disk. The VHD/VHDX file format is a sparse format where real disk space on the host is assigned in chunks that the VHD/VHDX file format calls the BlockSize. This BlockSize is not to be confused with the 512-byte (or 4096-byte) sector size of the underlying storage device. The default block size for a new VHD/VHDX file is 32 Mbytes. When a guest VM touches any disk space within a 32 Mbyte chunk of the VHD/VHDX file, Hyper-V allocates 32 Mbytes of real disk space for that section of the VHD/VHDX. Similarly, if a discard operation is done that covers an entire 32 Mbyte chunk, Hyper-V will free the real disk space for that portion of the VHD/VHDX. This BlockSize is surfaced in Linux as the "discard_granularity" in /sys/block/sd<x>/queue, which makes sense.
Hyper-V also has differencing disks that can overlay a VHD/VHDX file to capture changes to the VHD/VHDX while preserving the original VHD/VHDX. One example of this differencing functionality is for VM snapshots. When a snapshot is created, a differencing disk is created. If the snapshot is rolled back, Hyper-V can just delete the differencing disk, and the VM will see the original disk contents at the time the snapshot was taken. Differencing disks are used in other scenarios as well.
The BlockSize for a differencing disk defaults to 2 Mbytes, not 32 Mbytes. The smaller default is used because changes to differencing disks are typically scattered all over, and Hyper-V doesn't want to allocate 32 Mbytes of real disk space for a stray write here or there. The smaller BlockSize provides more efficient use of real disk space.
When a differencing disk is added to a VHD/VHDX, Hyper-V reports UNIT_ATTENTION with a sense code indicating "Operating parameters have changed", because the value of discard_granularity should be changed to 2 Mbytes. When the differencing disk is removed, discard_granularity should be changed back to 32 Mbytes. However, current code simply reports a message from scsi_report_sense() and the value of /sys/block/sd<x>/queue/discard_granularity is not updated. The message isn't very actionable by a sysadmin.
Fix this by having the storvsc driver check for the sense code indicating that the underly VHD/VHDX block size has changed, and do a rescan of the device to pick up the new discard_granularity. With this change the entire transition to/from differencing disks is handled automatically and transparently, with no confusing messages being output.
--- drivers/scsi/storvsc_drv.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/scsi/storvsc_drv.c +16 -0
@@ -987,6 +987,22 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb, goto do_work; } +/* +* Check for "Operating parameters have changed" +* due to Hyper-V changing the VHD/VHDX BlockSize +* when adding/removing a differencing disk. This +* causes discard_granularity to change, so do a +* rescan to pick up the new granularity. We don't +* want scsi_report_sense() to output a message +* that a sysadmin wouldn't know what to do with. +*/ +if ((asc ==0x3f ) && (ascq !=0x03 ) && + (ascq !=0x0e )) { + process_err_fn = storvsc_device_scan; +set_host_byte (scmnd,DID_REQUEUE ); + goto do_work; + } +/* * Otherwise, let upper layer deal with the * error when sense message is present
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 22/29 platform/x86: ISST: Increase range of valid mail box commands
In reply to Sasha LevinFrom: Srinivas Pandruvada <[email protected]>
[ Upstream commit 95ecf90158522269749f1b7ce98b1eed66ca087b ]
A new command CONFIG_TDP_GET_RATIO_INFO is added, with sub command type of 0x0C. The previous range of valid sub commands was from 0x00 to 0x0B. Change the valid range from 0x00 to 0x0C.
--- drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel/speed_select_if/isst_if_common.c +1 -1
@@ -47,7 +47,7 @@ struct isst_cmd_set_req_type {static const struct isst_valid_cmd_ranges isst_valid_cmds[] = { {0xD0 ,0x00 ,0x03 }, - {0x7F ,0x00 ,0x0B }, + {0x7F ,0x00 ,0x0C }, {0x7F ,0x10 ,0x12 }, {0x7F ,0x20 ,0x23 }, {0x94 ,0x03 ,0x03 },
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 23/29 platform/x86: int3472: Add GPIOs to Surface Go 3 Board data
In reply to Sasha LevinFrom: Daniel Scally <[email protected]>
[ Upstream commit e8059d393158e927e36898aca89986a52025b9f3 ]
Add the INT347E GPIO lookup table to the board data for the Surface Go 3. This is necessary to allow the ov7251 IR camera to probe properly on that platform.
--- drivers/platform/x86/intel/int3472/tps68470_board_data.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/intel/int3472/tps68470_board_data.c +3 -2
@@ -159,9 +159,10 @@ static const struct int3472_tps68470_board_data surface_go_tps68470_board_data =static const struct int3472_tps68470_board_data surface_go3_tps68470_board_data = { .dev_name ="i2c-INT3472:01" , .tps68470_regulator_pdata = &surface_go_tps68470_pdata, - .n_gpiod_lookups =1 , + .n_gpiod_lookups =2 , .tps68470_gpio_lookup_tables = { - &surface_go_int347a_gpios + &surface_go_int347a_gpios, + &surface_go_int347e_gpios, }, };
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 24/29 net: usb: cdc_mbim: avoid altsetting toggling for Telit FE990
In reply to Sasha LevinFrom: Enrico Sau <[email protected]>
[ Upstream commit 418383e6ed6b4624a54ec05c535f13d184fbf33b ]
Add quirk CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE for Telit FE990 0x1081 composition in order to avoid bind error.
--- drivers/net/usb/cdc_mbim.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/usb/cdc_mbim.c +5 -0
@@ -665,6 +665,11 @@ static const struct usb_device_id mbim_devs[] = { .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, }, +/* Telit FE990 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1081, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), + .driver_info = (unsigned long )&cdc_mbim_info_avoid_altsetting_toggle, + }, + /* default entry */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), .driver_info = (unsigned long)&cdc_mbim_info_zlp,
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 25/29 net: usb: qmi_wwan: add Telit 0x1080 composition
In reply to Sasha LevinFrom: Enrico Sau <[email protected]>
[ Upstream commit 382e363d5bed0cec5807b35761d14e55955eee63 ]
Add the following Telit FE990 composition:
0x1080: tty, adb, rmnet, tty, tty, tty, tty
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1363,6 +1363,7 @@ static const struct usb_device_id products[] = { {QMI_QUIRK_SET_DTR(0x1bc7, 0x1057, 2)}, /* Telit FN980 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1060, 2)}, /* Telit LN920 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1070, 2)}, /* Telit FN990 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1080, 2)}, /* Telit FE990 */ {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 26/29 drm/amd/display: Update clock table to include highest clock setting
In reply to Sasha LevinFrom: Swapnil Patel <[email protected]>
[ Upstream commit 2d99a7ec25cf456cd3680eb314d6454138e5aa64 ]
[Why]
Currently, the clk manager matches SocVoltage with voltage from fused settings (dfPstate clock table). And then corresponding clocks are selected.
However in certain situations, this leads to clk manager not including at least one entry with highest supported clock setting.
[How]
Update the clk manager to include at least one entry with highest supported clock setting.
--- .../display/dc/clk_mgr/dcn301/vg_clk_mgr.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c +18 -1
@@ -529,6 +529,19 @@ static struct clk_bw_params vg_bw_params = { }; +static uint32_t find_max_clk_value (const uint32_t clocks[],uint32_t num_clocks) +{ +uint32_t max =0 ; +int i; + +for (i =0 ; i < num_clocks; ++i) { +if (clocks[i] > max) + max = clocks[i]; + } + +return max; +} +static unsigned int find_dcfclk_for_voltage (const struct vg_dpm_clocks *clock_table,unsigned int voltage) {
@@ -572,12 +585,16 @@ static void vg_clk_mgr_helper_populate_bw_params( bw_params->clk_table.num_entries = j +1 ; -for (i =0 ; i < bw_params->clk_table.num_entries; i++, j--) { +for (i =0 ; i < bw_params->clk_table.num_entries -1 ; i++, j--) { bw_params->clk_table.entries[i].fclk_mhz = clock_table->DfPstateTable[j].fclk; bw_params->clk_table.entries[i].memclk_mhz = clock_table->DfPstateTable[j].memclk; bw_params->clk_table.entries[i].voltage = clock_table->DfPstateTable[j].voltage; bw_params->clk_table.entries[i].dcfclk_mhz =find_dcfclk_for_voltage (clock_table, clock_table->DfPstateTable[j].voltage); } + bw_params->clk_table.entries[i].fclk_mhz = clock_table->DfPstateTable[j].fclk; + bw_params->clk_table.entries[i].memclk_mhz = clock_table->DfPstateTable[j].memclk; + bw_params->clk_table.entries[i].voltage = clock_table->DfPstateTable[j].voltage; + bw_params->clk_table.entries[i].dcfclk_mhz =find_max_clk_value (clock_table->DcfClocks,VG_NUM_DCFCLK_DPM_LEVELS ); bw_params->vram_type = bios_info->memory_type; bw_params->num_channels = bios_info->ma_channel_number;
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 27/29 sh: sanitize the flags on sigreturn
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 573b22ccb7ce9ab7f0539a2e11a9d3609a8783f5 ]
We fetch %SR value from sigframe; it might have been modified by signal handler, so we can't trust it with any bits that are not modifiable in user mode.
--- arch/sh/include/asm/processor_32.h | 1 + arch/sh/kernel/signal_32.c | 3 +++ 2 files changed, 4 insertions(+)
arch/sh/include/asm/processor_32.h +1 -0
@@ -50,6 +50,7 @@#define SR_FD 0x00008000#define SR_MD 0x40000000 +#define SR_USER_MASK 0x00000303 // M, Q, S, T bits/* * DSP structure and data */
arch/sh/kernel/signal_32.c +3 -0
@@ -115,6 +115,7 @@ static int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *r0_p) { unsigned int err = 0; +unsigned int sr = regs->sr & ~SR_USER_MASK ;#define COPY (x) err |= __get_user(regs->x, &sc->sc_##x)COPY (regs[1 ]);
@@ -130,6 +131,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *r0_pCOPY (sr);COPY (pc);#undef COPY + regs->sr = (regs->sr &SR_USER_MASK ) | sr; +#ifdef CONFIG_SH_FPU if (boot_cpu_data.flags &CPU_HAS_FPU ) {int owned_fp;
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 28/29 drm/amdgpu: Fix call trace warning and hang when removing amdgpu device
In reply to Sasha LevinFrom: lyndonli <[email protected]>
[ Upstream commit 93bb18d2a873d2fa9625c8ea927723660a868b95 ]
On GPUs with RAS enabled, below call trace and hang are observed when shutting down device.
v2: use DRM device unplugged flag instead of shutdown flag as the check to prevent memory wipe in shutdown stage.
[ +0.000000] RIP: 0010:amdgpu_vram_mgr_fini+0x18d/0x1c0 [amdgpu] [ +0.000001] PKRU: 55555554
[ +0.000001] Call Trace:
[ +0.000001] <TASK>
[ +0.000002] amdgpu_ttm_fini+0x140/0x1c0 [amdgpu]
[ +0.000183] amdgpu_bo_fini+0x27/0xa0 [amdgpu]
[ +0.000184] gmc_v11_0_sw_fini+0x2b/0x40 [amdgpu]
[ +0.000163] amdgpu_device_fini_sw+0xb6/0x510 [amdgpu] [ +0.000152] amdgpu_driver_release_kms+0x16/0x30 [amdgpu] [ +0.000090] drm_dev_release+0x28/0x50 [drm]
[ +0.000016] devm_drm_dev_init_release+0x38/0x60 [drm] [ +0.000011] devm_action_release+0x15/0x20
[ +0.000003] release_nodes+0x40/0xc0
[ +0.000001] devres_release_all+0x9e/0xe0
[ +0.000001] device_unbind_cleanup+0x12/0x80
[ +0.000003] device_release_driver_internal+0xff/0x160 [ +0.000001] driver_detach+0x4a/0x90
[ +0.000001] bus_remove_driver+0x6c/0xf0
[ +0.000001] driver_unregister+0x31/0x50
[ +0.000001] pci_unregister_driver+0x40/0x90
[ +0.000003] amdgpu_exit+0x15/0x120 [amdgpu]
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
@@ -1312,7 +1312,7 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo)if (!bo->resource || bo->resource->mem_type !=TTM_PL_VRAM || !(abo->flags &AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE ) || - adev->in_suspend || adev->shutdown) + adev->in_suspend ||drm_dev_is_unplugged (adev_to_drm (adev)))return ;if (WARN_ON_ONCE (!dma_resv_trylock (bo->base.resv)))
Signature · 1 line
2.39.2
Sasha Levin
maintainerPATCH 29/29 drm/amd: Fix initialization mistake for NBIO 7.3.0
In reply to Sasha LevinFrom: Mario Limonciello <[email protected]>
[ Upstream commit 1717cc5f2962a4652c76ed3858b499ccae6c277c ]
The same strapping initialization issue that happened on NBIO 7.5.1 appears to be happening on NBIO 7.3.0.
Apply the same fix to 7.3.0 as well.
Note: This workaround relies upon the integrated GPU being enabled in BIOS. If the integrated GPU is disabled in BIOS a different workaround will be required.
--- drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +9 -5
@@ -382,11 +382,6 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)if (def != data)WREG32_PCIE_PORT (SOC15_REG_OFFSET (NBIO ,0 , regBIF1_PCIE_MST_CTRL_3), data);break ; -case IP_VERSION (7 ,5 ,1 ): - data =RREG32_SOC15 (NBIO ,0 , regRCC_DEV2_EPF0_STRAP2); - data &= ~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK ; -WREG32_SOC15 (NBIO ,0 , regRCC_DEV2_EPF0_STRAP2, data); - fallthrough;default : def = data =RREG32_PCIE_PORT (SOC15_REG_OFFSET (NBIO ,0 , regPCIE_CONFIG_CNTL)); data = REG_SET_FIELD(data, PCIE_CONFIG_CNTL,
@@ -399,6 +394,15 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)break ; } +switch (adev->ip_versions[NBIO_HWIP ][0 ]) { +case IP_VERSION (7 ,3 ,0 ): +case IP_VERSION (7 ,5 ,1 ): + data =RREG32_SOC15 (NBIO ,0 , regRCC_DEV2_EPF0_STRAP2); + data &= ~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK ; +WREG32_SOC15 (NBIO ,0 , regRCC_DEV2_EPF0_STRAP2, data); +break ; + } +if (amdgpu_sriov_vf (adev)) adev->rmmio_remap.reg_offset =SOC15_REG_OFFSET (NBIO ,0 , regBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL) <<2 ;
Signature · 1 line
2.39.2