Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'drm-fixes-2022-01-07' of git://anongit.freedesktop.org/drm/drm

Pull drm fixes from Dave Airlie:
"There is only the amdgpu runtime pm regression fix in here:

amdgpu:

- suspend/resume fix

- fix runtime PM regression"

* tag 'drm-fixes-2022-01-07' of git://anongit.freedesktop.org/drm/drm:
drm/amdgpu: disable runpm if we are the primary adapter
fbdev: fbmem: add a helper to determine if an aperture is used by a fw fb
drm/amd/pm: keep the BACO feature enabled for suspend

+90 -1
+1
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 1077 1077 bool runpm; 1078 1078 bool in_runpm; 1079 1079 bool has_pr3; 1080 + bool is_fw_fb; 1080 1081 1081 1082 bool pm_sysfs_en; 1082 1083 bool ucode_sysfs_en;
+28
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 39 39 #include <linux/mmu_notifier.h> 40 40 #include <linux/suspend.h> 41 41 #include <linux/cc_platform.h> 42 + #include <linux/fb.h> 42 43 43 44 #include "amdgpu.h" 44 45 #include "amdgpu_irq.h" ··· 1891 1890 1892 1891 static const struct drm_driver amdgpu_kms_driver; 1893 1892 1893 + static bool amdgpu_is_fw_framebuffer(resource_size_t base, 1894 + resource_size_t size) 1895 + { 1896 + bool found = false; 1897 + #if IS_REACHABLE(CONFIG_FB) 1898 + struct apertures_struct *a; 1899 + 1900 + a = alloc_apertures(1); 1901 + if (!a) 1902 + return false; 1903 + 1904 + a->ranges[0].base = base; 1905 + a->ranges[0].size = size; 1906 + 1907 + found = is_firmware_framebuffer(a); 1908 + kfree(a); 1909 + #endif 1910 + return found; 1911 + } 1912 + 1894 1913 static int amdgpu_pci_probe(struct pci_dev *pdev, 1895 1914 const struct pci_device_id *ent) 1896 1915 { ··· 1919 1898 unsigned long flags = ent->driver_data; 1920 1899 int ret, retry = 0, i; 1921 1900 bool supports_atomic = false; 1901 + bool is_fw_fb; 1902 + resource_size_t base, size; 1922 1903 1923 1904 /* skip devices which are owned by radeon */ 1924 1905 for (i = 0; i < ARRAY_SIZE(amdgpu_unsupported_pciidlist); i++) { ··· 1989 1966 } 1990 1967 #endif 1991 1968 1969 + base = pci_resource_start(pdev, 0); 1970 + size = pci_resource_len(pdev, 0); 1971 + is_fw_fb = amdgpu_is_fw_framebuffer(base, size); 1972 + 1992 1973 /* Get rid of things like offb */ 1993 1974 ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, &amdgpu_kms_driver); 1994 1975 if (ret) ··· 2005 1978 adev->dev = &pdev->dev; 2006 1979 adev->pdev = pdev; 2007 1980 ddev = adev_to_drm(adev); 1981 + adev->is_fw_fb = is_fw_fb; 2008 1982 2009 1983 if (!supports_atomic) 2010 1984 ddev->driver_features &= ~DRIVER_ATOMIC;
+6
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
··· 206 206 adev->runpm = true; 207 207 break; 208 208 } 209 + /* XXX: disable runtime pm if we are the primary adapter 210 + * to avoid displays being re-enabled after DPMS. 211 + * This needs to be sorted out and fixed properly. 212 + */ 213 + if (adev->is_fw_fb) 214 + adev->runpm = false; 209 215 if (adev->runpm) 210 216 dev_info(adev->dev, "Using BACO for runtime pm\n"); 211 217 }
+7 -1
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 1400 1400 { 1401 1401 struct amdgpu_device *adev = smu->adev; 1402 1402 int ret = 0; 1403 + /* 1404 + * TODO: (adev->in_suspend && !adev->in_s0ix) is added to pair 1405 + * the workaround which always reset the asic in suspend. 1406 + * It's likely that workaround will be dropped in the future. 1407 + * Then the change here should be dropped together. 1408 + */ 1403 1409 bool use_baco = !smu->is_apu && 1404 - ((amdgpu_in_reset(adev) && 1410 + (((amdgpu_in_reset(adev) || (adev->in_suspend && !adev->in_s0ix)) && 1405 1411 (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) || 1406 1412 ((adev->in_runpm || adev->in_s4) && amdgpu_asic_supports_baco(adev))); 1407 1413
+47
drivers/video/fbdev/core/fbmem.c
··· 1763 1763 EXPORT_SYMBOL(remove_conflicting_framebuffers); 1764 1764 1765 1765 /** 1766 + * is_firmware_framebuffer - detect if firmware-configured framebuffer matches 1767 + * @a: memory range, users of which are to be checked 1768 + * 1769 + * This function checks framebuffer devices (initialized by firmware/bootloader) 1770 + * which use memory range described by @a. If @a matchesm the function returns 1771 + * true, otherwise false. 1772 + */ 1773 + bool is_firmware_framebuffer(struct apertures_struct *a) 1774 + { 1775 + bool do_free = false; 1776 + bool found = false; 1777 + int i; 1778 + 1779 + if (!a) { 1780 + a = alloc_apertures(1); 1781 + if (!a) 1782 + return false; 1783 + 1784 + a->ranges[0].base = 0; 1785 + a->ranges[0].size = ~0; 1786 + do_free = true; 1787 + } 1788 + 1789 + mutex_lock(&registration_lock); 1790 + /* check all firmware fbs and kick off if the base addr overlaps */ 1791 + for_each_registered_fb(i) { 1792 + struct apertures_struct *gen_aper; 1793 + 1794 + if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE)) 1795 + continue; 1796 + 1797 + gen_aper = registered_fb[i]->apertures; 1798 + if (fb_do_apertures_overlap(gen_aper, a)) { 1799 + found = true; 1800 + break; 1801 + } 1802 + } 1803 + mutex_unlock(&registration_lock); 1804 + 1805 + if (do_free) 1806 + kfree(a); 1807 + 1808 + return found; 1809 + } 1810 + EXPORT_SYMBOL(is_firmware_framebuffer); 1811 + 1812 + /** 1766 1813 * remove_conflicting_pci_framebuffers - remove firmware-configured framebuffers for PCI devices 1767 1814 * @pdev: PCI device 1768 1815 * @name: requesting driver name
+1
include/linux/fb.h
··· 610 610 const char *name); 611 611 extern int remove_conflicting_framebuffers(struct apertures_struct *a, 612 612 const char *name, bool primary); 613 + extern bool is_firmware_framebuffer(struct apertures_struct *a); 613 614 extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); 614 615 extern int fb_show_logo(struct fb_info *fb_info, int rotate); 615 616 extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);