From: Sasha Levin Date: Sun, 23 Aug 2020 01:16:34 +0000 (-0400) Subject: Fixes for 5.8 X-Git-Tag: v4.4.234~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=374491c672cc4e9a104cdbe377714fa58e16737e;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.8 Signed-off-by: Sasha Levin --- diff --git a/queue-5.8/drm-ast-initialize-dram-type-before-posting-gpu.patch b/queue-5.8/drm-ast-initialize-dram-type-before-posting-gpu.patch new file mode 100644 index 00000000000..487810cb64f --- /dev/null +++ b/queue-5.8/drm-ast-initialize-dram-type-before-posting-gpu.patch @@ -0,0 +1,62 @@ +From 46133ab87497e1418e45f43072dc09fdb0f3a96a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Jul 2020 14:53:52 +0200 +Subject: drm/ast: Initialize DRAM type before posting GPU + +From: Thomas Zimmermann + +[ Upstream commit 244d012801dae30c91983b360457c78d481584b0 ] + +Posting the GPU requires the correct DRAM type to be stored in +struct ast_private. Therefore first initialize the DRAM info and +then post the GPU. This restores the original order of instructions +in this function. + +Signed-off-by: Thomas Zimmermann +Reviewed-by: Sam Ravnborg +Acked-by: Benjamin Herrenschmidt +Fixes: bad09da6deab ("drm/ast: Fixed vram size incorrect issue on POWER") +Cc: Joel Stanley +Cc: Y.C. Chen +Cc: Benjamin Herrenschmidt +Cc: Dave Airlie +Cc: Thomas Zimmermann +Cc: Gerd Hoffmann +Cc: Daniel Vetter +Cc: Sam Ravnborg +Cc: Emil Velikov +Cc: "Y.C. Chen" +Cc: # v4.11+ +Link: https://patchwork.freedesktop.org/patch/msgid/20200716125353.31512-6-tzimmermann@suse.de +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/ast/ast_main.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c +index f48a9f62368c0..99c11b51f0207 100644 +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -458,9 +458,6 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) + + ast_detect_chip(dev, &need_post); + +- if (need_post) +- ast_post_gpu(dev); +- + ret = ast_get_dram_info(dev); + if (ret) + goto out_free; +@@ -469,6 +466,9 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) + ast->mclk, ast->dram_type, + ast->dram_bus_width, ast->vram_size); + ++ if (need_post) ++ ast_post_gpu(dev); ++ + ret = ast_mm_init(ast); + if (ret) + goto out_free; +-- +2.25.1 + diff --git a/queue-5.8/drm-ast-remove-unused-code-paths-for-ast-1180.patch b/queue-5.8/drm-ast-remove-unused-code-paths-for-ast-1180.patch new file mode 100644 index 00000000000..5bdf1245d6a --- /dev/null +++ b/queue-5.8/drm-ast-remove-unused-code-paths-for-ast-1180.patch @@ -0,0 +1,241 @@ +From 62eca09b44290cf7c81d67602599474194df9f7f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 17 Jun 2020 10:03:37 +0200 +Subject: drm/ast: Remove unused code paths for AST 1180 + +From: Thomas Zimmermann + +[ Upstream commit 05f13f5b5996d20a9819e0c6fd0cda4956c8aff9 ] + +The ast driver contains code paths for AST 1180 chips. The chip is not +supported and the rsp code has never been tested. Simplify the driver by +removing the AST 1180 code. + +Signed-off-by: Thomas Zimmermann +Reviewed-by: Daniel Vetter +Reviewed-by: Emil Velikov +Link: https://patchwork.freedesktop.org/patch/msgid/20200617080340.29584-2-tzimmermann@suse.de +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/ast/ast_drv.c | 1 - + drivers/gpu/drm/ast/ast_drv.h | 2 - + drivers/gpu/drm/ast/ast_main.c | 89 +++++++++++++++------------------- + drivers/gpu/drm/ast/ast_mode.c | 11 +---- + drivers/gpu/drm/ast/ast_post.c | 10 ++-- + 5 files changed, 43 insertions(+), 70 deletions(-) + +diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c +index b7ba22dddcad9..83509106f3ba9 100644 +--- a/drivers/gpu/drm/ast/ast_drv.c ++++ b/drivers/gpu/drm/ast/ast_drv.c +@@ -59,7 +59,6 @@ static struct drm_driver driver; + static const struct pci_device_id pciidlist[] = { + AST_VGA_DEVICE(PCI_CHIP_AST2000, NULL), + AST_VGA_DEVICE(PCI_CHIP_AST2100, NULL), +- /* AST_VGA_DEVICE(PCI_CHIP_AST1180, NULL), - don't bind to 1180 for now */ + {0, 0, 0}, + }; + +diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h +index 656d591b154b3..09f2659e29118 100644 +--- a/drivers/gpu/drm/ast/ast_drv.h ++++ b/drivers/gpu/drm/ast/ast_drv.h +@@ -52,7 +52,6 @@ + + #define PCI_CHIP_AST2000 0x2000 + #define PCI_CHIP_AST2100 0x2010 +-#define PCI_CHIP_AST1180 0x1180 + + + enum ast_chip { +@@ -64,7 +63,6 @@ enum ast_chip { + AST2300, + AST2400, + AST2500, +- AST1180, + }; + + enum ast_tx_chip { +diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c +index e5398e3dabe70..f48a9f62368c0 100644 +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -142,50 +142,42 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) + ast_detect_config_mode(dev, &scu_rev); + + /* Identify chipset */ +- if (dev->pdev->device == PCI_CHIP_AST1180) { +- ast->chip = AST1100; +- DRM_INFO("AST 1180 detected\n"); +- } else { +- if (dev->pdev->revision >= 0x40) { +- ast->chip = AST2500; +- DRM_INFO("AST 2500 detected\n"); +- } else if (dev->pdev->revision >= 0x30) { +- ast->chip = AST2400; +- DRM_INFO("AST 2400 detected\n"); +- } else if (dev->pdev->revision >= 0x20) { +- ast->chip = AST2300; +- DRM_INFO("AST 2300 detected\n"); +- } else if (dev->pdev->revision >= 0x10) { +- switch (scu_rev & 0x0300) { +- case 0x0200: +- ast->chip = AST1100; +- DRM_INFO("AST 1100 detected\n"); +- break; +- case 0x0100: +- ast->chip = AST2200; +- DRM_INFO("AST 2200 detected\n"); +- break; +- case 0x0000: +- ast->chip = AST2150; +- DRM_INFO("AST 2150 detected\n"); +- break; +- default: +- ast->chip = AST2100; +- DRM_INFO("AST 2100 detected\n"); +- break; +- } +- ast->vga2_clone = false; +- } else { +- ast->chip = AST2000; +- DRM_INFO("AST 2000 detected\n"); ++ if (dev->pdev->revision >= 0x40) { ++ ast->chip = AST2500; ++ DRM_INFO("AST 2500 detected\n"); ++ } else if (dev->pdev->revision >= 0x30) { ++ ast->chip = AST2400; ++ DRM_INFO("AST 2400 detected\n"); ++ } else if (dev->pdev->revision >= 0x20) { ++ ast->chip = AST2300; ++ DRM_INFO("AST 2300 detected\n"); ++ } else if (dev->pdev->revision >= 0x10) { ++ switch (scu_rev & 0x0300) { ++ case 0x0200: ++ ast->chip = AST1100; ++ DRM_INFO("AST 1100 detected\n"); ++ break; ++ case 0x0100: ++ ast->chip = AST2200; ++ DRM_INFO("AST 2200 detected\n"); ++ break; ++ case 0x0000: ++ ast->chip = AST2150; ++ DRM_INFO("AST 2150 detected\n"); ++ break; ++ default: ++ ast->chip = AST2100; ++ DRM_INFO("AST 2100 detected\n"); ++ break; + } ++ ast->vga2_clone = false; ++ } else { ++ ast->chip = AST2000; ++ DRM_INFO("AST 2000 detected\n"); + } + + /* Check if we support wide screen */ + switch (ast->chip) { +- case AST1180: +- ast->support_wide_screen = true; +- break; + case AST2000: + ast->support_wide_screen = false; + break; +@@ -469,15 +461,13 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) + if (need_post) + ast_post_gpu(dev); + +- if (ast->chip != AST1180) { +- ret = ast_get_dram_info(dev); +- if (ret) +- goto out_free; +- ast->vram_size = ast_get_vram_info(dev); +- DRM_INFO("dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", +- ast->mclk, ast->dram_type, +- ast->dram_bus_width, ast->vram_size); +- } ++ ret = ast_get_dram_info(dev); ++ if (ret) ++ goto out_free; ++ ast->vram_size = ast_get_vram_info(dev); ++ DRM_INFO("dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", ++ ast->mclk, ast->dram_type, ++ ast->dram_bus_width, ast->vram_size); + + ret = ast_mm_init(ast); + if (ret) +@@ -496,8 +486,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) + ast->chip == AST2200 || + ast->chip == AST2300 || + ast->chip == AST2400 || +- ast->chip == AST2500 || +- ast->chip == AST1180) { ++ ast->chip == AST2500) { + dev->mode_config.max_width = 1920; + dev->mode_config.max_height = 2048; + } else { +diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c +index 3a3a511670c9c..73fd76cec5120 100644 +--- a/drivers/gpu/drm/ast/ast_mode.c ++++ b/drivers/gpu/drm/ast/ast_mode.c +@@ -769,9 +769,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) + { + struct ast_private *ast = crtc->dev->dev_private; + +- if (ast->chip == AST1180) +- return; +- + /* TODO: Maybe control display signal generation with + * Sync Enable (bit CR17.7). + */ +@@ -793,16 +790,10 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) + static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, + struct drm_crtc_state *state) + { +- struct ast_private *ast = crtc->dev->dev_private; + struct ast_crtc_state *ast_state; + const struct drm_format_info *format; + bool succ; + +- if (ast->chip == AST1180) { +- DRM_ERROR("AST 1180 modesetting not supported\n"); +- return -EINVAL; +- } +- + if (!state->enable) + return 0; /* no mode checks if CRTC is being disabled */ + +@@ -1044,7 +1035,7 @@ static enum drm_mode_status ast_mode_valid(struct drm_connector *connector, + + if ((ast->chip == AST2100) || (ast->chip == AST2200) || + (ast->chip == AST2300) || (ast->chip == AST2400) || +- (ast->chip == AST2500) || (ast->chip == AST1180)) { ++ (ast->chip == AST2500)) { + if ((mode->hdisplay == 1920) && (mode->vdisplay == 1080)) + return MODE_OK; + +diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c +index 2d1b186197432..af0c8ebb009a1 100644 +--- a/drivers/gpu/drm/ast/ast_post.c ++++ b/drivers/gpu/drm/ast/ast_post.c +@@ -58,13 +58,9 @@ bool ast_is_vga_enabled(struct drm_device *dev) + struct ast_private *ast = dev->dev_private; + u8 ch; + +- if (ast->chip == AST1180) { +- /* TODO 1180 */ +- } else { +- ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT); +- return !!(ch & 0x01); +- } +- return false; ++ ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT); ++ ++ return !!(ch & 0x01); + } + + static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff }; +-- +2.25.1 + diff --git a/queue-5.8/drm-panel-simple-fix-inverted-v-h-sync-for-frida-frd.patch b/queue-5.8/drm-panel-simple-fix-inverted-v-h-sync-for-frida-frd.patch new file mode 100644 index 00000000000..799287191f0 --- /dev/null +++ b/queue-5.8/drm-panel-simple-fix-inverted-v-h-sync-for-frida-frd.patch @@ -0,0 +1,43 @@ +From e36906cf573ffb1e1c4552b36aae3f0bc7f2fabf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Jul 2020 14:56:46 +0200 +Subject: drm/panel-simple: Fix inverted V/H SYNC for Frida FRD350H54004 panel + +From: Paul Cercueil + +[ Upstream commit bad20a2dbfdfaf01560026909506b6ed69d65ba2 ] + +The FRD350H54004 panel was marked as having active-high VSYNC and HSYNC +signals, which sorts-of worked, but resulted in the picture fading out +under certain circumstances. + +Fix this issue by marking VSYNC and HSYNC signals active-low. + +v2: Rebase on drm-misc-next + +Fixes: 7b6bd8433609 ("drm/panel: simple: Add support for the Frida FRD350H54004 panel") +Cc: stable@vger.kernel.org # v5.5 +Signed-off-by: Paul Cercueil +Signed-off-by: Sam Ravnborg +Link: https://patchwork.freedesktop.org/patch/msgid/20200716125647.10964-1-paul@crapouillou.net +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/panel/panel-simple.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c +index 444b77490a42a..7debf2ca42522 100644 +--- a/drivers/gpu/drm/panel/panel-simple.c ++++ b/drivers/gpu/drm/panel/panel-simple.c +@@ -1717,7 +1717,7 @@ static const struct drm_display_mode frida_frd350h54004_mode = { + .vsync_end = 240 + 2 + 6, + .vtotal = 240 + 2 + 6 + 2, + .vrefresh = 60, +- .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC, ++ .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, + }; + + static const struct panel_desc frida_frd350h54004 = { +-- +2.25.1 + diff --git a/queue-5.8/drm-vgem-replace-opencoded-version-of-drm_gem_dumb_m.patch b/queue-5.8/drm-vgem-replace-opencoded-version-of-drm_gem_dumb_m.patch new file mode 100644 index 00000000000..1037a32d890 --- /dev/null +++ b/queue-5.8/drm-vgem-replace-opencoded-version-of-drm_gem_dumb_m.patch @@ -0,0 +1,83 @@ +From c803d37f9b8ea8b842fc9834571fef5b15343128 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Jul 2020 16:49:11 +0100 +Subject: drm/vgem: Replace opencoded version of drm_gem_dumb_map_offset() + +From: Chris Wilson + +[ Upstream commit 119c53d2d4044c59c450c4f5a568d80b9d861856 ] + +drm_gem_dumb_map_offset() now exists and does everything +vgem_gem_dump_map does and *ought* to do. + +In particular, vgem_gem_dumb_map() was trying to reject mmapping an +imported dmabuf by checking the existence of obj->filp. Unfortunately, +we always allocated an obj->filp, even if unused for an imported dmabuf. +Instead, the drm_gem_dumb_map_offset(), since commit 90378e589192 +("drm/gem: drm_gem_dumb_map_offset(): reject dma-buf"), uses the +obj->import_attach to reject such invalid mmaps. + +This prevents vgem from allowing userspace mmapping the dumb handle and +attempting to incorrectly fault in remote pages belonging to another +device, where there may not even be a struct page. + +v2: Use the default drm_gem_dumb_map_offset() callback + +Fixes: af33a9190d02 ("drm/vgem: Enable dmabuf import interfaces") +Signed-off-by: Chris Wilson +Reviewed-by: Daniel Vetter +Cc: # v4.13+ +Link: https://patchwork.freedesktop.org/patch/msgid/20200708154911.21236-1-chris@chris-wilson.co.uk +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/vgem/vgem_drv.c | 27 --------------------------- + 1 file changed, 27 deletions(-) + +diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c +index ec1a8ebb6f1bf..fa39d140adc6c 100644 +--- a/drivers/gpu/drm/vgem/vgem_drv.c ++++ b/drivers/gpu/drm/vgem/vgem_drv.c +@@ -230,32 +230,6 @@ static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev, + return 0; + } + +-static int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev, +- uint32_t handle, uint64_t *offset) +-{ +- struct drm_gem_object *obj; +- int ret; +- +- obj = drm_gem_object_lookup(file, handle); +- if (!obj) +- return -ENOENT; +- +- if (!obj->filp) { +- ret = -EINVAL; +- goto unref; +- } +- +- ret = drm_gem_create_mmap_offset(obj); +- if (ret) +- goto unref; +- +- *offset = drm_vma_node_offset_addr(&obj->vma_node); +-unref: +- drm_gem_object_put_unlocked(obj); +- +- return ret; +-} +- + static struct drm_ioctl_desc vgem_ioctls[] = { + DRM_IOCTL_DEF_DRV(VGEM_FENCE_ATTACH, vgem_fence_attach_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(VGEM_FENCE_SIGNAL, vgem_fence_signal_ioctl, DRM_RENDER_ALLOW), +@@ -446,7 +420,6 @@ static struct drm_driver vgem_driver = { + .fops = &vgem_driver_fops, + + .dumb_create = vgem_gem_dumb_create, +- .dumb_map_offset = vgem_gem_dumb_map, + + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, +-- +2.25.1 + diff --git a/queue-5.8/khugepaged-adjust-vm_bug_on_mm-in-__khugepaged_enter.patch b/queue-5.8/khugepaged-adjust-vm_bug_on_mm-in-__khugepaged_enter.patch new file mode 100644 index 00000000000..f9f125ebdfc --- /dev/null +++ b/queue-5.8/khugepaged-adjust-vm_bug_on_mm-in-__khugepaged_enter.patch @@ -0,0 +1,51 @@ +From 43c159cee5104271916d5874fde94c96d84714cf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Aug 2020 17:42:02 -0700 +Subject: khugepaged: adjust VM_BUG_ON_MM() in __khugepaged_enter() + +From: Hugh Dickins + +[ Upstream commit f3f99d63a8156c7a4a6b20aac22b53c5579c7dc1 ] + +syzbot crashes on the VM_BUG_ON_MM(khugepaged_test_exit(mm), mm) in +__khugepaged_enter(): yes, when one thread is about to dump core, has set +core_state, and is waiting for others, another might do something calling +__khugepaged_enter(), which now crashes because I lumped the core_state +test (known as "mmget_still_valid") into khugepaged_test_exit(). I still +think it's best to lump them together, so just in this exceptional case, +check mm->mm_users directly instead of khugepaged_test_exit(). + +Fixes: bbe98f9cadff ("khugepaged: khugepaged_test_exit() check mmget_still_valid()") +Reported-by: syzbot +Signed-off-by: Hugh Dickins +Signed-off-by: Andrew Morton +Acked-by: Yang Shi +Cc: "Kirill A. Shutemov" +Cc: Andrea Arcangeli +Cc: Song Liu +Cc: Mike Kravetz +Cc: Eric Dumazet +Cc: [4.8+] +Link: http://lkml.kernel.org/r/alpine.LSU.2.11.2008141503370.18085@eggly.anvils +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + mm/khugepaged.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mm/khugepaged.c b/mm/khugepaged.c +index ac04b332a373a..1d6a9b0b6a9fd 100644 +--- a/mm/khugepaged.c ++++ b/mm/khugepaged.c +@@ -466,7 +466,7 @@ int __khugepaged_enter(struct mm_struct *mm) + return -ENOMEM; + + /* __khugepaged_exit() must not run from under us */ +- VM_BUG_ON_MM(khugepaged_test_exit(mm), mm); ++ VM_BUG_ON_MM(atomic_read(&mm->mm_users) == 0, mm); + if (unlikely(test_and_set_bit(MMF_VM_HUGEPAGE, &mm->flags))) { + free_mm_slot(mm_slot); + return 0; +-- +2.25.1 + diff --git a/queue-5.8/series b/queue-5.8/series new file mode 100644 index 00000000000..f26e7921d64 --- /dev/null +++ b/queue-5.8/series @@ -0,0 +1,5 @@ +drm-vgem-replace-opencoded-version-of-drm_gem_dumb_m.patch +drm-panel-simple-fix-inverted-v-h-sync-for-frida-frd.patch +drm-ast-remove-unused-code-paths-for-ast-1180.patch +drm-ast-initialize-dram-type-before-posting-gpu.patch +khugepaged-adjust-vm_bug_on_mm-in-__khugepaged_enter.patch