firmware: dmi: Use the proper accessor for the version field
Subsystems (6)
Sasha Levin
maintainerPATCH 4/16 drm/gem: Fix GEM handle release errors
In reply to Sasha LevinFrom: Jeffy Chen <[email protected]>
[ Upstream commit ea2aa97ca37a9044ade001aef71dbc06318e8d44 ]
Currently we are assuming a one to one mapping between dmabuf and GEM handle when releasing GEM handles.
But that is not always true, since we would create extra handles for the GEM obj in cases like gem_open() and getfb{,2}().
A similar issue was reported at:
https://lore.kernel.org/all/[email protected]/
Another problem is that the imported dmabuf might not always have gem_obj->dma_buf set, which would cause leaks in drm_gem_remove_prime_handles().
Let's fix these for now by using handle to find the exact map to remove.
--- drivers/gpu/drm/drm_gem.c | 17 +---------------- drivers/gpu/drm/drm_internal.h | 4 ++-- drivers/gpu/drm/drm_prime.c | 20 ++++++++++++-------- 3 files changed, 15 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_gem.c +1 -16
@@ -166,21 +166,6 @@ void drm_gem_private_object_init(struct drm_device *dev, }EXPORT_SYMBOL (drm_gem_private_object_init); -static void -drm_gem_remove_prime_handles (struct drm_gem_object *obj,struct drm_file *filp) -{ -/* -* Note: obj->dma_buf can't disappear as long as we still hold a -* handle reference in obj->handle_count. -*/ -mutex_lock (&filp->prime.lock); -if (obj->dma_buf) { -drm_prime_remove_buf_handle_locked (&filp->prime, - obj->dma_buf); - } -mutex_unlock (&filp->prime.lock); -} -/** * drm_gem_object_handle_free - release resources bound to userspace handles * @obj: GEM object to clean up.
@@ -254,7 +239,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)else if (dev->driver->gem_close_object) dev->driver->gem_close_object (obj, file_priv); -drm_gem_remove_prime_handles (obj, file_priv); +drm_prime_remove_buf_handle (&file_priv->prime, id);drm_vma_node_revoke (&obj->vma_node, file_priv);drm_gem_object_handle_put_unlocked (obj);
drivers/gpu/drm/drm_internal.h +2 -2
@@ -86,8 +86,8 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,void drm_prime_init_file_private (struct drm_prime_file_private *prime_fpriv);void drm_prime_destroy_file_private (struct drm_prime_file_private *prime_fpriv); -void drm_prime_remove_buf_handle_locked (struct drm_prime_file_private *prime_fpriv, -struct dma_buf *dma_buf); +void drm_prime_remove_buf_handle (struct drm_prime_file_private *prime_fpriv, +uint32_t handle);/* drm_drv.c */ struct drm_minor *drm_minor_acquire (unsigned int minor_id);
drivers/gpu/drm/drm_prime.c +12 -8
@@ -187,29 +187,33 @@ static int drm_prime_lookup_buf_handle(struct drm_prime_file_private *prime_fprireturn -ENOENT ; } -void drm_prime_remove_buf_handle_locked (struct drm_prime_file_private *prime_fpriv, -struct dma_buf *dma_buf) +void drm_prime_remove_buf_handle (struct drm_prime_file_private *prime_fpriv, +uint32_t handle) {struct rb_node *rb; - rb = prime_fpriv->dmabufs.rb_node; +mutex_lock (&prime_fpriv->lock); + + rb = prime_fpriv->handles.rb_node;while (rb) {struct drm_prime_member *member; - member = rb_entry(rb, struct drm_prime_member, dmabuf_rb); -if (member->dma_buf == dma_buf) { + member = rb_entry(rb, struct drm_prime_member, handle_rb); +if (member->handle == handle) {rb_erase (&member->handle_rb, &prime_fpriv->handles);rb_erase (&member->dmabuf_rb, &prime_fpriv->dmabufs); -dma_buf_put (dma_buf); +dma_buf_put (member->dma_buf);kfree (member); -return ; - }else if (member->dma_buf < dma_buf) { +break ; + }else if (member->handle < handle) { rb = rb->rb_right; }else { rb = rb->rb_left; } } + +mutex_unlock (&prime_fpriv->lock); }void drm_prime_init_file_private (struct drm_prime_file_private *prime_fpriv)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/16 drm/amdgpu: Move psp_xgmi_terminate call from amdgpu_xgmi_remove_device to psp_hw_fini
In reply to Sasha LevinFrom: YiPeng Chai <[email protected]>
[ Upstream commit 9d705d7741ae70764f3d6d87e67fad3b5c30ffd0 ]
V1:
The amdgpu_xgmi_remove_device function will send unload command to psp through psp ring to terminate xgmi, but psp ring has been destroyed in psp_hw_fini.
V2:
1. Change the commit title.
2. Restore amdgpu_xgmi_remove_device to its original calling location. Move psp_xgmi_terminate call from amdgpu_xgmi_remove_device to psp_hw_fini.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
@@ -2146,6 +2146,9 @@ static int psp_hw_fini(void *handle)psp_rap_terminate (psp);psp_dtm_terminate (psp);psp_hdcp_terminate (psp); + +if (adev->gmc.xgmi.num_physical_nodes >1 ) +psp_xgmi_terminate (psp); }psp_asd_unload (psp);
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -1
@@ -622,7 +622,7 @@ int amdgpu_xgmi_remove_device(struct amdgpu_device *adev)amdgpu_put_xgmi_hive (hive); } -return psp_xgmi_terminate (&adev->psp); +return 0 ; }int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 7/16 drm/radeon: add a force flush to delay work when radeon
In reply to Sasha LevinFrom: Zhenneng Li <[email protected]>
[ Upstream commit f461950fdc374a3ada5a63c669d997de4600dffe ]
Although radeon card fence and wait for gpu to finish processing current batch rings, there is still a corner case that radeon lockup work queue may not be fully flushed, and meanwhile the radeon_suspend_kms() function has called pci_set_power_state() to put device in D3hot state.
Per PCI spec rev 4.0 on 5.3.1.4.1 D3hot State.
Quoted 3 lines
Configuration and Message requests are the only TLPs accepted by a Function in the D3hot state. All other received Requests must be handled as Unsupported Requests, and all received Completions may optionally be handled as Unexpected Completions.
This issue will happen in following logs:
Unable to handle kernel paging request at virtual address 00008800e0008010
CPU 0 kworker/0:3(131): Oops 0
pc = [<ffffffff811bea5c>] ra = [<ffffffff81240844>] ps = 0000 Tainted: G W
pc is at si_gpu_check_soft_reset+0x3c/0x240
ra is at si_dma_is_lockup+0x34/0xd0
v0 = 0000000000000000 t0 = fff08800e0008010 t1 = 0000000000010000 t2 = 0000000000008010 t3 = fff00007e3c00000 t4 = fff00007e3c00258 t5 = 000000000000ffff t6 = 0000000000000001 t7 = fff00007ef078000 s0 = fff00007e3c016e8 s1 = fff00007e3c00000 s2 = fff00007e3c00018 s3 = fff00007e3c00000 s4 = fff00007fff59d80 s5 = 0000000000000000 s6 = fff00007ef07bd98 a0 = fff00007e3c00000 a1 = fff00007e3c016e8 a2 = 0000000000000008 a3 = 0000000000000001 a4 = 8f5c28f5c28f5c29 a5 = ffffffff810f4338 t8 = 0000000000000275 t9 = ffffffff809b66f8 t10 = ff6769c5d964b800 t11= 000000000000b886 pv = ffffffff811bea20 at = 0000000000000000 gp = ffffffff81d89690 sp = 00000000aa814126 Disabling lock debugging due to kernel taint Trace: [<ffffffff81240844>] si_dma_is_lockup+0x34/0xd0 [<ffffffff81119610>] radeon_fence_check_lockup+0xd0/0x290 [<ffffffff80977010>] process_one_work+0x280/0x550 [<ffffffff80977350>] worker_thread+0x70/0x7c0 [<ffffffff80977410>] worker_thread+0x130/0x7c0 [<ffffffff80982040>] kthread+0x200/0x210 [<ffffffff809772e0>] worker_thread+0x0/0x7c0 [<ffffffff80981f8c>] kthread+0x14c/0x210 [<ffffffff80911658>] ret_from_kernel_thread+0x18/0x20 [<ffffffff80981e40>] kthread+0x0/0x210 Code: ad3e0008 43f0074a ad7e0018 ad9e0020 8c3001e8 40230101 <88210000> 4821ed21
So force lockup work queue flush to fix this problem.
--- drivers/gpu/drm/radeon/radeon_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +3 -0
@@ -1623,6 +1623,9 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,if (r) {/* delay GPU reset to resume */ radeon_fence_driver_force_completion (rdev, i); + }else { +/* finish executing delayed work */ +flush_delayed_work (&rdev->fence_drv[i].lockup_work); } }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/16 drm/amdgpu: Check num_gfx_rings for gfx v9_0 rb setup.
In reply to Sasha LevinFrom: Candice Li <[email protected]>
[ Upstream commit c351938350ab9b5e978dede2c321da43de7eb70c ]
No need to set up rb when no gfx rings.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
@@ -2570,7 +2570,8 @@ static void gfx_v9_0_constants_init(struct amdgpu_device *adev)gfx_v9_0_tiling_mode_table_init (adev); -gfx_v9_0_setup_rb (adev); +if (adev->gfx.num_gfx_rings) +gfx_v9_0_setup_rb (adev);gfx_v9_0_get_cu_info (adev, &adev->gfx.cu_info); adev->gfx.config.db_debug2 =RREG32_SOC15 (GC ,0 , mmDB_DEBUG2);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 14/16 fbdev: fb_pm2fb: Avoid potential divide by zero error
In reply to Sasha LevinFrom: Letu Ren <[email protected]>
[ Upstream commit 19f953e7435644b81332dd632ba1b2d80b1e37af ]
In do_fb_ioctl() of fbmem.c, if cmd is FBIOPUT_VSCREENINFO, var will be copied from user, then go through fb_set_var() and info->fbops->fb_check_var() which could may be pm2fb_check_var(). Along the path, var->pixclock won't be modified. This function checks whether reciprocal of var->pixclock is too high. If var->pixclock is zero, there will be a divide by zero error. So, it is necessary to check whether denominator is zero to avoid crash. As this bug is found by Syzkaller, logs are listed below.
divide error in pm2fb_check_var
Call Trace: <TASK> fb_set_var+0x367/0xeb0 drivers/video/fbdev/core/fbmem.c:1015 do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110 fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189
--- drivers/video/fbdev/pm2fb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/video/fbdev/pm2fb.c +5 -0
@@ -616,6 +616,11 @@ static int pm2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)return -EINVAL ; } +if (!var->pixclock) { +DPRINTK ("pixclock is zero\n" ); +return -EINVAL ; + } +if (PICOS2KHZ (var->pixclock) >PM2_MAX_PIXCLOCK ) {DPRINTK ("pixclock too high (%ldKHz)\n" ,PICOS2KHZ (var->pixclock));
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 15/16 fbdev: chipsfb: Add missing pci_disable_device() in chipsfb_pci_init()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 07c55c9803dea748d17a054000cbf1913ce06399 ]
Add missing pci_disable_device() in error path in chipsfb_pci_init().
--- drivers/video/fbdev/chipsfb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/chipsfb.c +1 -0
@@ -430,6 +430,7 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) err_release_fb:framebuffer_release (p); err_disable: +pci_disable_device (dp); err_out:return rc; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 16/16 drm/amdgpu: mmVM_L2_CNTL3 register not initialized correctly
In reply to Sasha LevinFrom: Qu Huang <[email protected]>
[ Upstream commit b8983d42524f10ac6bf35bbce6a7cc8e45f61e04 ]
The mmVM_L2_CNTL3 register is not assigned an initial value
--- drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +1 -0
@@ -178,6 +178,7 @@ static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev) tmp =REG_SET_FIELD (tmp,VM_L2_CNTL2 ,INVALIDATE_L2_CACHE ,1 );WREG32_SOC15 (MMHUB ,0 , mmVM_L2_CNTL2, tmp); + tmp = mmVM_L2_CNTL3_DEFAULT;if (adev->gmc.translate_further) { tmp =REG_SET_FIELD (tmp,VM_L2_CNTL3 ,BANK_SELECT ,12 ); tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3,
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/16 arm64: cacheinfo: Fix incorrect assignment of signed error value to unsigned fw_level
In reply to Sasha LevinFrom: Sudeep Holla <[email protected]>
[ Upstream commit e75d18cecbb3805895d8ed64da4f78575ec96043 ]
Though acpi_find_last_cache_level() always returned signed value and the document states it will return any errors caused by lack of a PPTT table, it never returned negative values before.
Commit 0c80f9e165f8 ("ACPI: PPTT: Leave the table mapped for the runtime usage") however changed it by returning -ENOENT if no PPTT was found. The value returned from acpi_find_last_cache_level() is then assigned to unsigned fw_level.
It will result in the number of cache leaves calculated incorrectly as a huge value which will then cause the following warning from __alloc_pages as the order would be great than MAX_ORDER because of incorrect and huge cache leaves value.
| WARNING: CPU: 0 PID: 1 at mm/page_alloc.c:5407 __alloc_pages+0x74/0x314 | Modules linked in: | CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.19.0-10393-g7c2a8d3ac4c0 #73 | pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) | pc : __alloc_pages+0x74/0x314 | lr : alloc_pages+0xe8/0x318 | Call trace: | __alloc_pages+0x74/0x314 | alloc_pages+0xe8/0x318 | kmalloc_order_trace+0x68/0x1dc | __kmalloc+0x240/0x338 | detect_cache_attributes+0xe0/0x56c | update_siblings_masks+0x38/0x284 | store_cpu_topology+0x78/0x84 | smp_prepare_cpus+0x48/0x134 | kernel_init_freeable+0xc4/0x14c | kernel_init+0x2c/0x1b4 | ret_from_fork+0x10/0x20
Fix the same by changing fw_level to be signed integer and return the error from init_cache_level() early in case of error.
--- arch/arm64/kernel/cacheinfo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/kernel/cacheinfo.c +5 -1
@@ -45,7 +45,8 @@ static void ci_leaf_init(struct cacheinfo *this_leaf,int init_cache_level (unsigned int cpu) { -unsigned int ctype, level, leaves, fw_level; +unsigned int ctype, level, leaves; +int fw_level;struct cpu_cacheinfo *this_cpu_ci =get_cpu_cacheinfo (cpu);for (level =1 , leaves =0 ; level <=MAX_CACHE_LEVEL ; level++) {
@@ -63,6 +64,9 @@ int init_cache_level(unsigned int cpu)else fw_level =acpi_find_last_cache_level (cpu); +if (fw_level <0 ) +return fw_level; +if (level < fw_level) {/* * some external caches not specified in CLIDR_EL1
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 11/16 arm64/signal: Raise limit on stack frames
In reply to Sasha LevinFrom: Mark Brown <[email protected]>
[ Upstream commit 7ddcaf78e93c9282b4d92184f511b4d5bee75355 ]
The signal code has a limit of 64K on the size of a stack frame that it will generate, if this limit is exceeded then a process will be killed if it receives a signal. Unfortunately with the advent of SME this limit is too small - the maximum possible size of the ZA register alone is 64K. This is not an issue for practical systems at present but is easily seen using virtual platforms.
Raise the limit to 256K, this is substantially more than could be used by any current architecture extension.
--- arch/arm64/kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/signal.c +1 -1
@@ -91,7 +91,7 @@ static size_t sigframe_size(struct rt_sigframe_user_layout const *user)* not taken into account. This limit is not a guarantee and is * NOT ABI. */ -#define SIGFRAME_MAXSZ SZ_64K +#define SIGFRAME_MAXSZ SZ_256Kstatic int __sigframe_alloc (struct rt_sigframe_user_layout *user,unsigned long *offset,size_t size,bool extend)
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 3/16 scsi: megaraid_sas: Fix double kfree()
In reply to Sasha LevinFrom: Guixin Liu <[email protected]>
[ Upstream commit 8c499e49240bd93628368c3588975cfb94169b8b ]
When allocating log_to_span fails, kfree(instance->ctrl_context) is called twice. Remove redundant call.
--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +0 -1
@@ -5198,7 +5198,6 @@ megasas_alloc_fusion_context(struct megasas_instance *instance)if (!fusion->log_to_span) {dev_err (&instance->pdev->dev,"Failed from %s %d\n" , __func__, __LINE__); -kfree (instance->ctrl_context);return -ENOMEM ; } }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 13/16 net/core/skbuff: Check the return value of skb_copy_bits()
In reply to Sasha LevinFrom: lily <[email protected]>
[ Upstream commit c624c58e08b15105662b9ab9be23d14a6b945a49 ]
skb_copy_bits() could fail, which requires a check on the return value.
--- net/core/skbuff.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/core/skbuff.c +2 -3
@@ -3986,9 +3986,8 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,SKB_GSO_CB (nskb)->csum_start =skb_headroom (nskb) + doffset; }else { -skb_copy_bits (head_skb, offset, -skb_put (nskb, len), - len); +if (skb_copy_bits (head_skb, offset,skb_put (nskb, len), len)) + goto err; }continue ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 1/16 firmware: dmi: Use the proper accessor for the version field
From: Andy Shevchenko <[email protected]>
[ Upstream commit d2139dfca361a1f5bfc4d4a23455b1a409a69cd4 ]
The byte at offset 6 represents length. Don't take it and drop it immediately by using proper accessor, i.e. get_unaligned_be24().
[JD: Change the subject to something less frightening]
--- drivers/firmware/dmi_scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/dmi_scan.c +1 -1
@@ -629,7 +629,7 @@ static int __init dmi_smbios3_present(const u8 *buf) {if (memcmp (buf,"_SM3_" ,5 ) ==0 && buf[6 ] <32 &&dmi_checksum (buf, buf[6 ])) { - dmi_ver =get_unaligned_be32 (buf +6 ) &0xFFFFFF ; + dmi_ver =get_unaligned_be24 (buf +7 ); dmi_num =0 ;/* No longer specified */ dmi_len =get_unaligned_le32 (buf +12 ); dmi_base =get_unaligned_le64 (buf +16 );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/16 scsi: qla2xxx: Disable ATIO interrupt coalesce for quad port ISP27XX
From: Tony Battersby <[email protected]>
[ Upstream commit 53661ded2460b414644532de6b99bd87f71987e9 ]
This partially reverts commit d2b292c3f6fd ("scsi: qla2xxx: Enable ATIO interrupt handshake for ISP27XX")
For some workloads where the host sends a batch of commands and then pauses, ATIO interrupt coalesce can cause some incoming ATIO entries to be ignored for extended periods of time, resulting in slow performance, timeouts, and aborted commands.
Disable interrupt coalesce and re-enable the dedicated ATIO MSI-X interrupt.
--- drivers/scsi/qla2xxx/qla_target.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +2 -8
@@ -6817,14 +6817,8 @@ qlt_24xx_config_rings(struct scsi_qla_host *vha)if (ha->flags.msix_enabled) {if (IS_QLA83XX (ha) ||IS_QLA27XX (ha) ||IS_QLA28XX (ha)) { -if (IS_QLA2071 (ha)) { -/* 4 ports Baker: Enable Interrupt Handshake */ - icb->msix_atio =0 ; - icb->firmware_options_2 |=cpu_to_le32 (BIT_26 ); - }else { - icb->msix_atio =cpu_to_le16 (msix->entry); - icb->firmware_options_2 &=cpu_to_le32 (~BIT_26 ); - } + icb->msix_atio =cpu_to_le16 (msix->entry); + icb->firmware_options_2 &=cpu_to_le32 (~BIT_26 );ql_dbg (ql_dbg_init, vha,0xf072 ,"Registering ICB vector 0x%x for atio que.\n" , msix->entry);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 9/16 parisc: Add runtime check to prevent PA2.0 kernels on PA1.x machines
In reply to Sasha LevinFrom: Helge Deller <[email protected]>
[ Upstream commit 591d2108f3abc4db9f9073cae37cf3591fd250d6 ]
If a 32-bit kernel was compiled for PA2.0 CPUs, it won't be able to run on machines with PA1.x CPUs. Add a check and bail out early if a PA1.x machine is detected.
--- arch/parisc/kernel/head.S | 43 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-)
arch/parisc/kernel/head.S +42 -1
@@ -22,7 +22,7 @@ #include <linux/init.h> #include <linux/pgtable.h> - .level PA_ASM_LEVEL + .level 1.1 __INITDATA ENTRY(boot_args)
@@ -69,6 +69,47 @@ $bss_loop: stw,ma %arg2,4(%r1) stw,ma %arg3,4(%r1) +#if !defined(CONFIG_64BIT) && defined(CONFIG_PA20) + /* This 32-bit kernel was compiled for PA2.0 CPUs. Check current CPU + * and halt kernel if we detect a PA1.x CPU. */ + ldi 32,%r10 + mtctl %r10,%cr11 + .level 2.0 + mfctl,w %cr11,%r10 + .level 1.1 + comib,<>,n 0,%r10,$cpu_ok + + load32 PA(msg1),%arg0 + ldi msg1_end-msg1,%arg1 +$iodc_panic: + copy %arg0, %r10 + copy %arg1, %r11 + load32 PA(init_stack),%sp +#define MEM_CONS 0x3A0 + ldw MEM_CONS+32(%r0),%arg0 // HPA + ldi ENTRY_IO_COUT,%arg1 + ldw MEM_CONS+36(%r0),%arg2 // SPA + ldw MEM_CONS+8(%r0),%arg3 // layers + load32 PA(__bss_start),%r1 + stw %r1,-52(%sp) // arg4 + stw %r0,-56(%sp) // arg5 + stw %r10,-60(%sp) // arg6 = ptr to text + stw %r11,-64(%sp) // arg7 = len + stw %r0,-68(%sp) // arg8 + load32 PA(.iodc_panic_ret), %rp + ldw MEM_CONS+40(%r0),%r1 // ENTRY_IODC + bv,n (%r1) +.iodc_panic_ret: + b . /* wait endless with ... */ + or %r10,%r10,%r10 /* qemu idle sleep */ +msg1: .ascii "Can't boot kernel which was built for PA8x00 CPUs on this machine.\r\n" +msg1_end: + +$cpu_ok: +#endif + + .level PA_ASM_LEVEL + /* Initialize startup VM. Just map first 16/32 MB of memory */ load32 PA(swapper_pg_dir),%r4 mtctl %r4,%cr24 /* Initialize kernel root pointer */
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 12/16 fec: Restart PPS after link state change
In reply to Sasha LevinFrom: Csókás Bence <[email protected]>
[ Upstream commit f79959220fa5fbda939592bf91c7a9ea90419040 ]
On link state change, the controller gets reset, causing PPS to drop out and the PHC to lose its time and calibration. So we restart it if needed, restoring calibration and time registers.
Changes since v2:
* Add fec_ptp_save_state()/fec_ptp_restore_state()
* Use ktime_get_real_ns()
* Use BIT() macro
Changes since v1:
* More ECR #define's
* Stop PPS in fec_ptp_stop()
--- drivers/net/ethernet/freescale/fec.h | 10 ++++++ drivers/net/ethernet/freescale/fec_main.c | 42 ++++++++++++++++++++--- drivers/net/ethernet/freescale/fec_ptp.c | 29 ++++++++++++++++ 3 files changed, 77 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/fec.h +10 -0
@@ -593,6 +593,13 @@ struct fec_enet_private {int pps_enable;unsigned int next_counter; +struct { +struct timespec64 ts_phc; +u64 ns_sys; +u32 at_corr; +u8 at_inc_corr; + } ptp_saved_state; +u64 ethtool_stats[]; };
@@ -603,5 +610,8 @@ void fec_ptp_disable_hwts(struct net_device *ndev);int fec_ptp_set (struct net_device *ndev,struct ifreq *ifr);int fec_ptp_get (struct net_device *ndev,struct ifreq *ifr); +void fec_ptp_save_state (struct fec_enet_private *fep); +int fec_ptp_restore_state (struct fec_enet_private *fep); +/****************************************************************************/ #endif /* FEC_H */
drivers/net/ethernet/freescale/fec_main.c +38 -4
89 lines not on this page · raw message
drivers/net/ethernet/freescale/fec_ptp.c +29 -0
@@ -638,7 +638,36 @@ void fec_ptp_stop(struct platform_device *pdev)struct net_device *ndev =platform_get_drvdata (pdev);struct fec_enet_private *fep =netdev_priv (ndev); +if (fep->pps_enable) +fec_ptp_enable_pps (fep,0 ); +cancel_delayed_work_sync (&fep->time_keep);if (fep->ptp_clock)ptp_clock_unregister (fep->ptp_clock); } + +void fec_ptp_save_state (struct fec_enet_private *fep) +{ +u32 atime_inc_corr; + +fec_ptp_gettime (&fep->ptp_caps, &fep->ptp_saved_state.ts_phc); + fep->ptp_saved_state.ns_sys =ktime_get_ns (); + + fep->ptp_saved_state.at_corr =readl (fep->hwp +FEC_ATIME_CORR ); + atime_inc_corr =readl (fep->hwp +FEC_ATIME_INC ) &FEC_T_INC_CORR_MASK ; + fep->ptp_saved_state.at_inc_corr = (u8)(atime_inc_corr >>FEC_T_INC_CORR_OFFSET ); +} + +int fec_ptp_restore_state (struct fec_enet_private *fep) +{ +u32 atime_inc =readl (fep->hwp +FEC_ATIME_INC ) &FEC_T_INC_MASK ; +u64 ns_sys; + +writel (fep->ptp_saved_state.at_corr, fep->hwp +FEC_ATIME_CORR ); + atime_inc |= ((u32 )fep->ptp_saved_state.at_inc_corr) <<FEC_T_INC_CORR_OFFSET ; +writel (atime_inc, fep->hwp +FEC_ATIME_INC ); + + ns_sys =ktime_get_ns () - fep->ptp_saved_state.ns_sys; +timespec64_add_ns (&fep->ptp_saved_state.ts_phc, ns_sys); +return fec_ptp_settime (&fep->ptp_caps, &fep->ptp_saved_state.ts_phc); +}
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/16 parisc: ccio-dma: Handle kmalloc failure in ccio_init_resources()
In reply to Sasha LevinFrom: Li Qiong <[email protected]>
[ Upstream commit d46c742f827fa2326ab1f4faa1cccadb56912341 ]
As the possible failure of the kmalloc(), it should be better to fix this error path, check and return '-ENOMEM' error code.
--- drivers/parisc/ccio-dma.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/parisc/ccio-dma.c +8 -3
@@ -1380,15 +1380,17 @@ ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr) } } -static void __init ccio_init_resources (struct ioc *ioc) +static int __init ccio_init_resources (struct ioc *ioc) {struct resource *res = ioc->mmio_region;char *name =kmalloc (14 ,GFP_KERNEL ); - +if (unlikely (!name)) +return -ENOMEM ;snprintf (name,14 ,"GSC Bus [%d/]" , ioc->hw_path);ccio_init_resource (res, name, &ioc->ioc_regs->io_io_low);ccio_init_resource (res +1 , name, &ioc->ioc_regs->io_io_low_hv); +return 0 ; } static int new_ioc_area(struct resource *res, unsigned long size,
@@ -1543,7 +1545,10 @@ static int __init ccio_probe(struct parisc_device *dev)return -ENOMEM ; }ccio_ioc_init (ioc); -ccio_init_resources (ioc); +if (ccio_init_resources (ioc)) { +kfree (ioc); +return -ENOMEM ; + } hppa_dma_ops = &ccio_ops; hba =kzalloc (sizeof (*hba),GFP_KERNEL );
Signature · 1 line
2.35.1