Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 36f53d6

Browse files
committed
Merge tag 'drm-misc-fixes-2024-05-16' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next
Short summary of fixes pull: nouveau: - use tile_mode and pte_kind for VM_BIND bo allocations Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20240516072658.GA8395@linux.fritz.box
2 parents 32a0bb7 + aed9a1a commit 36f53d6

File tree

11 files changed

+112
-85
lines changed

11 files changed

+112
-85
lines changed

drivers/gpu/drm/drm_connector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2940,7 +2940,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
29402940
dev->mode_config.max_width,
29412941
dev->mode_config.max_height);
29422942
else
2943-
drm_dbg_kms(dev, "User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM master, demoting to read-only probe",
2943+
drm_dbg_kms(dev, "User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM master, demoting to read-only probe\n",
29442944
connector->base.id, connector->name);
29452945
}
29462946

drivers/gpu/drm/imagination/pvr_fw_mips.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
#include "pvr_rogue_mips.h"
88

99
#include <asm/page.h>
10+
#include <linux/math.h>
1011
#include <linux/types.h>
1112

1213
/* Forward declaration from pvr_gem.h. */
1314
struct pvr_gem_object;
1415

15-
#define PVR_MIPS_PT_PAGE_COUNT ((ROGUE_MIPSFW_MAX_NUM_PAGETABLE_PAGES * ROGUE_MIPSFW_PAGE_SIZE_4K) \
16-
>> PAGE_SHIFT)
16+
#define PVR_MIPS_PT_PAGE_COUNT DIV_ROUND_UP(ROGUE_MIPSFW_MAX_NUM_PAGETABLE_PAGES * ROGUE_MIPSFW_PAGE_SIZE_4K, PAGE_SIZE)
17+
1718
/**
1819
* struct pvr_fw_mips_data - MIPS-specific data
1920
*/

drivers/gpu/drm/meson/meson_dw_hdmi.c

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
#define HHI_HDMI_CLK_CNTL 0x1cc /* 0x73 */
107107
#define HHI_HDMI_PHY_CNTL0 0x3a0 /* 0xe8 */
108108
#define HHI_HDMI_PHY_CNTL1 0x3a4 /* 0xe9 */
109+
#define PHY_CNTL1_INIT 0x03900000
110+
#define PHY_INVERT BIT(17)
109111
#define HHI_HDMI_PHY_CNTL2 0x3a8 /* 0xea */
110112
#define HHI_HDMI_PHY_CNTL3 0x3ac /* 0xeb */
111113
#define HHI_HDMI_PHY_CNTL4 0x3b0 /* 0xec */
@@ -130,6 +132,8 @@ struct meson_dw_hdmi_data {
130132
unsigned int addr);
131133
void (*dwc_write)(struct meson_dw_hdmi *dw_hdmi,
132134
unsigned int addr, unsigned int data);
135+
u32 cntl0_init;
136+
u32 cntl1_init;
133137
};
134138

135139
struct meson_dw_hdmi {
@@ -384,26 +388,6 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
384388
dw_hdmi_bus_fmt_is_420(hdmi))
385389
mode_is_420 = true;
386390

387-
/* Enable clocks */
388-
regmap_update_bits(priv->hhi, HHI_HDMI_CLK_CNTL, 0xffff, 0x100);
389-
390-
/* Bring HDMITX MEM output of power down */
391-
regmap_update_bits(priv->hhi, HHI_MEM_PD_REG0, 0xff << 8, 0);
392-
393-
/* Bring out of reset */
394-
dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_SW_RESET, 0);
395-
396-
/* Enable internal pixclk, tmds_clk, spdif_clk, i2s_clk, cecclk */
397-
dw_hdmi_top_write_bits(dw_hdmi, HDMITX_TOP_CLK_CNTL,
398-
0x3, 0x3);
399-
400-
/* Enable cec_clk and hdcp22_tmdsclk_en */
401-
dw_hdmi_top_write_bits(dw_hdmi, HDMITX_TOP_CLK_CNTL,
402-
0x3 << 4, 0x3 << 4);
403-
404-
/* Enable normal output to PHY */
405-
dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12));
406-
407391
/* TMDS pattern setup */
408392
if (mode->clock > 340000 && !mode_is_420) {
409393
dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01,
@@ -425,20 +409,6 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
425409
/* Setup PHY parameters */
426410
meson_hdmi_phy_setup_mode(dw_hdmi, mode, mode_is_420);
427411

428-
/* Setup PHY */
429-
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
430-
0xffff << 16, 0x0390 << 16);
431-
432-
/* BIT_INVERT */
433-
if (dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
434-
dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxm-dw-hdmi") ||
435-
dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-g12a-dw-hdmi"))
436-
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
437-
BIT(17), 0);
438-
else
439-
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
440-
BIT(17), BIT(17));
441-
442412
/* Disable clock, fifo, fifo_wr */
443413
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0);
444414

@@ -492,7 +462,9 @@ static void dw_hdmi_phy_disable(struct dw_hdmi *hdmi,
492462

493463
DRM_DEBUG_DRIVER("\n");
494464

495-
regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0);
465+
/* Fallback to init mode */
466+
regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL1, dw_hdmi->data->cntl1_init);
467+
regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, dw_hdmi->data->cntl0_init);
496468
}
497469

498470
static enum drm_connector_status dw_hdmi_read_hpd(struct dw_hdmi *hdmi,
@@ -610,18 +582,31 @@ static const struct regmap_config meson_dw_hdmi_regmap_config = {
610582
.fast_io = true,
611583
};
612584

613-
static const struct meson_dw_hdmi_data meson_dw_hdmi_gx_data = {
585+
static const struct meson_dw_hdmi_data meson_dw_hdmi_gxbb_data = {
614586
.top_read = dw_hdmi_top_read,
615587
.top_write = dw_hdmi_top_write,
616588
.dwc_read = dw_hdmi_dwc_read,
617589
.dwc_write = dw_hdmi_dwc_write,
590+
.cntl0_init = 0x0,
591+
.cntl1_init = PHY_CNTL1_INIT | PHY_INVERT,
592+
};
593+
594+
static const struct meson_dw_hdmi_data meson_dw_hdmi_gxl_data = {
595+
.top_read = dw_hdmi_top_read,
596+
.top_write = dw_hdmi_top_write,
597+
.dwc_read = dw_hdmi_dwc_read,
598+
.dwc_write = dw_hdmi_dwc_write,
599+
.cntl0_init = 0x0,
600+
.cntl1_init = PHY_CNTL1_INIT,
618601
};
619602

620603
static const struct meson_dw_hdmi_data meson_dw_hdmi_g12a_data = {
621604
.top_read = dw_hdmi_g12a_top_read,
622605
.top_write = dw_hdmi_g12a_top_write,
623606
.dwc_read = dw_hdmi_g12a_dwc_read,
624607
.dwc_write = dw_hdmi_g12a_dwc_write,
608+
.cntl0_init = 0x000b4242, /* Bandgap */
609+
.cntl1_init = PHY_CNTL1_INIT,
625610
};
626611

627612
static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
@@ -656,6 +641,13 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
656641
meson_dw_hdmi->data->top_write(meson_dw_hdmi,
657642
HDMITX_TOP_CLK_CNTL, 0xff);
658643

644+
/* Enable normal output to PHY */
645+
meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12));
646+
647+
/* Setup PHY */
648+
regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL1, meson_dw_hdmi->data->cntl1_init);
649+
regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, meson_dw_hdmi->data->cntl0_init);
650+
659651
/* Enable HDMI-TX Interrupt */
660652
meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_INTR_STAT_CLR,
661653
HDMITX_TOP_INTR_CORE);
@@ -865,11 +857,11 @@ static const struct dev_pm_ops meson_dw_hdmi_pm_ops = {
865857

866858
static const struct of_device_id meson_dw_hdmi_of_table[] = {
867859
{ .compatible = "amlogic,meson-gxbb-dw-hdmi",
868-
.data = &meson_dw_hdmi_gx_data },
860+
.data = &meson_dw_hdmi_gxbb_data },
869861
{ .compatible = "amlogic,meson-gxl-dw-hdmi",
870-
.data = &meson_dw_hdmi_gx_data },
862+
.data = &meson_dw_hdmi_gxl_data },
871863
{ .compatible = "amlogic,meson-gxm-dw-hdmi",
872-
.data = &meson_dw_hdmi_gx_data },
864+
.data = &meson_dw_hdmi_gxl_data },
873865
{ .compatible = "amlogic,meson-g12a-dw-hdmi",
874866
.data = &meson_dw_hdmi_g12a_data },
875867
{ }

drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ struct nvkm_gsp_mem {
1515
};
1616

1717
struct nvkm_gsp_radix3 {
18-
struct nvkm_gsp_mem mem[3];
18+
struct nvkm_gsp_mem lvl0;
19+
struct nvkm_gsp_mem lvl1;
20+
struct sg_table lvl2;
1921
};
2022

2123
int nvkm_gsp_sg(struct nvkm_device *, u64 size, struct sg_table *);

drivers/gpu/drm/nouveau/nvkm/core/firmware.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ nvkm_firmware_dtor(struct nvkm_firmware *fw)
205205
break;
206206
case NVKM_FIRMWARE_IMG_DMA:
207207
nvkm_memory_unref(&memory);
208-
dma_free_coherent(fw->device->dev, sg_dma_len(&fw->mem.sgl), fw->img, fw->phys);
208+
dma_unmap_single(fw->device->dev, fw->phys, sg_dma_len(&fw->mem.sgl),
209+
DMA_TO_DEVICE);
210+
kfree(fw->img);
209211
break;
210212
case NVKM_FIRMWARE_IMG_SGT:
211213
nvkm_memory_unref(&memory);
@@ -235,14 +237,17 @@ nvkm_firmware_ctor(const struct nvkm_firmware_func *func, const char *name,
235237
fw->img = kmemdup(src, fw->len, GFP_KERNEL);
236238
break;
237239
case NVKM_FIRMWARE_IMG_DMA: {
238-
dma_addr_t addr;
239-
240240
len = ALIGN(fw->len, PAGE_SIZE);
241241

242-
fw->img = dma_alloc_coherent(fw->device->dev, len, &addr, GFP_KERNEL);
243-
if (fw->img) {
244-
memcpy(fw->img, src, fw->len);
245-
fw->phys = addr;
242+
fw->img = kmalloc(len, GFP_KERNEL);
243+
if (!fw->img)
244+
return -ENOMEM;
245+
246+
memcpy(fw->img, src, fw->len);
247+
fw->phys = dma_map_single(fw->device->dev, fw->img, len, DMA_TO_DEVICE);
248+
if (dma_mapping_error(fw->device->dev, fw->phys)) {
249+
kfree(fw->img);
250+
return -EFAULT;
246251
}
247252

248253
sg_init_one(&fw->mem.sgl, fw->img, len);

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ r535_gsp_wpr_meta_init(struct nvkm_gsp *gsp)
16241624
meta->magic = GSP_FW_WPR_META_MAGIC;
16251625
meta->revision = GSP_FW_WPR_META_REVISION;
16261626

1627-
meta->sysmemAddrOfRadix3Elf = gsp->radix3.mem[0].addr;
1627+
meta->sysmemAddrOfRadix3Elf = gsp->radix3.lvl0.addr;
16281628
meta->sizeOfRadix3Elf = gsp->fb.wpr2.elf.size;
16291629

16301630
meta->sysmemAddrOfBootloader = gsp->boot.fw.addr;
@@ -1919,8 +1919,9 @@ nvkm_gsp_sg(struct nvkm_device *device, u64 size, struct sg_table *sgt)
19191919
static void
19201920
nvkm_gsp_radix3_dtor(struct nvkm_gsp *gsp, struct nvkm_gsp_radix3 *rx3)
19211921
{
1922-
for (int i = ARRAY_SIZE(rx3->mem) - 1; i >= 0; i--)
1923-
nvkm_gsp_mem_dtor(gsp, &rx3->mem[i]);
1922+
nvkm_gsp_sg_free(gsp->subdev.device, &rx3->lvl2);
1923+
nvkm_gsp_mem_dtor(gsp, &rx3->lvl1);
1924+
nvkm_gsp_mem_dtor(gsp, &rx3->lvl0);
19241925
}
19251926

19261927
/**
@@ -1960,36 +1961,60 @@ static int
19601961
nvkm_gsp_radix3_sg(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size,
19611962
struct nvkm_gsp_radix3 *rx3)
19621963
{
1963-
u64 addr;
1964+
struct sg_dma_page_iter sg_dma_iter;
1965+
struct scatterlist *sg;
1966+
size_t bufsize;
1967+
u64 *pte;
1968+
int ret, i, page_idx = 0;
19641969

1965-
for (int i = ARRAY_SIZE(rx3->mem) - 1; i >= 0; i--) {
1966-
u64 *ptes;
1967-
size_t bufsize;
1968-
int ret, idx;
1970+
ret = nvkm_gsp_mem_ctor(gsp, GSP_PAGE_SIZE, &rx3->lvl0);
1971+
if (ret)
1972+
return ret;
19691973

1970-
bufsize = ALIGN((size / GSP_PAGE_SIZE) * sizeof(u64), GSP_PAGE_SIZE);
1971-
ret = nvkm_gsp_mem_ctor(gsp, bufsize, &rx3->mem[i]);
1972-
if (ret)
1973-
return ret;
1974+
ret = nvkm_gsp_mem_ctor(gsp, GSP_PAGE_SIZE, &rx3->lvl1);
1975+
if (ret)
1976+
goto lvl1_fail;
19741977

1975-
ptes = rx3->mem[i].data;
1976-
if (i == 2) {
1977-
struct scatterlist *sgl;
1978+
// Allocate level 2
1979+
bufsize = ALIGN((size / GSP_PAGE_SIZE) * sizeof(u64), GSP_PAGE_SIZE);
1980+
ret = nvkm_gsp_sg(gsp->subdev.device, bufsize, &rx3->lvl2);
1981+
if (ret)
1982+
goto lvl2_fail;
19781983

1979-
for_each_sgtable_dma_sg(sgt, sgl, idx) {
1980-
for (int j = 0; j < sg_dma_len(sgl) / GSP_PAGE_SIZE; j++)
1981-
*ptes++ = sg_dma_address(sgl) + (GSP_PAGE_SIZE * j);
1982-
}
1983-
} else {
1984-
for (int j = 0; j < size / GSP_PAGE_SIZE; j++)
1985-
*ptes++ = addr + GSP_PAGE_SIZE * j;
1984+
// Write the bus address of level 1 to level 0
1985+
pte = rx3->lvl0.data;
1986+
*pte = rx3->lvl1.addr;
1987+
1988+
// Write the bus address of each page in level 2 to level 1
1989+
pte = rx3->lvl1.data;
1990+
for_each_sgtable_dma_page(&rx3->lvl2, &sg_dma_iter, 0)
1991+
*pte++ = sg_page_iter_dma_address(&sg_dma_iter);
1992+
1993+
// Finally, write the bus address of each page in sgt to level 2
1994+
for_each_sgtable_sg(&rx3->lvl2, sg, i) {
1995+
void *sgl_end;
1996+
1997+
pte = sg_virt(sg);
1998+
sgl_end = (void *)pte + sg->length;
1999+
2000+
for_each_sgtable_dma_page(sgt, &sg_dma_iter, page_idx) {
2001+
*pte++ = sg_page_iter_dma_address(&sg_dma_iter);
2002+
page_idx++;
2003+
2004+
// Go to the next scatterlist for level 2 if we've reached the end
2005+
if ((void *)pte >= sgl_end)
2006+
break;
19862007
}
2008+
}
19872009

1988-
size = rx3->mem[i].size;
1989-
addr = rx3->mem[i].addr;
2010+
if (ret) {
2011+
lvl2_fail:
2012+
nvkm_gsp_mem_dtor(gsp, &rx3->lvl1);
2013+
lvl1_fail:
2014+
nvkm_gsp_mem_dtor(gsp, &rx3->lvl0);
19902015
}
19912016

1992-
return 0;
2017+
return ret;
19932018
}
19942019

19952020
int
@@ -2021,7 +2046,7 @@ r535_gsp_fini(struct nvkm_gsp *gsp, bool suspend)
20212046
sr = gsp->sr.meta.data;
20222047
sr->magic = GSP_FW_SR_META_MAGIC;
20232048
sr->revision = GSP_FW_SR_META_REVISION;
2024-
sr->sysmemAddrOfSuspendResumeData = gsp->sr.radix3.mem[0].addr;
2049+
sr->sysmemAddrOfSuspendResumeData = gsp->sr.radix3.lvl0.addr;
20252050
sr->sizeOfSuspendResumeData = len;
20262051

20272052
mbox0 = lower_32_bits(gsp->sr.meta.addr);

drivers/gpu/drm/panel/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ config DRM_PANEL_ILITEK_IL9322
177177

178178
config DRM_PANEL_ILITEK_ILI9341
179179
tristate "Ilitek ILI9341 240x320 QVGA panels"
180-
depends on OF && SPI
180+
depends on SPI
181181
select DRM_KMS_HELPER
182182
select DRM_GEM_DMA_HELPER
183183
depends on BACKLIGHT_CLASS_DEVICE

drivers/gpu/drm/panel/panel-ilitek-ili9341.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
#include <linux/bitops.h>
2323
#include <linux/delay.h>
2424
#include <linux/gpio/consumer.h>
25+
#include <linux/mod_devicetable.h>
2526
#include <linux/module.h>
26-
#include <linux/of.h>
27+
#include <linux/property.h>
2728
#include <linux/regulator/consumer.h>
2829
#include <linux/spi/spi.h>
2930

@@ -421,7 +422,7 @@ static int ili9341_dpi_prepare(struct drm_panel *panel)
421422

422423
ili9341_dpi_init(ili);
423424

424-
return ret;
425+
return 0;
425426
}
426427

427428
static int ili9341_dpi_enable(struct drm_panel *panel)
@@ -691,7 +692,7 @@ static int ili9341_dpi_probe(struct spi_device *spi, struct gpio_desc *dc,
691692
* Every new incarnation of this display must have a unique
692693
* data entry for the system in this driver.
693694
*/
694-
ili->conf = of_device_get_match_data(dev);
695+
ili->conf = device_get_match_data(dev);
695696
if (!ili->conf) {
696697
dev_err(dev, "missing device configuration\n");
697698
return -ENODEV;
@@ -714,18 +715,18 @@ static int ili9341_probe(struct spi_device *spi)
714715

715716
reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
716717
if (IS_ERR(reset))
717-
dev_err(dev, "Failed to get gpio 'reset'\n");
718+
return dev_err_probe(dev, PTR_ERR(reset), "Failed to get gpio 'reset'\n");
718719

719720
dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW);
720721
if (IS_ERR(dc))
721-
dev_err(dev, "Failed to get gpio 'dc'\n");
722+
return dev_err_probe(dev, PTR_ERR(dc), "Failed to get gpio 'dc'\n");
722723

723724
if (!strcmp(id->name, "sf-tc240t-9370-t"))
724725
return ili9341_dpi_probe(spi, dc, reset);
725726
else if (!strcmp(id->name, "yx240qv29"))
726727
return ili9341_dbi_probe(spi, dc, reset);
727728

728-
return -1;
729+
return -ENODEV;
729730
}
730731

731732
static void ili9341_remove(struct spi_device *spi)

drivers/gpu/drm/ttm/ttm_tt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
9393
*/
9494
if (bdev->pool.use_dma_alloc && cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) {
9595
page_flags |= TTM_TT_FLAG_DECRYPTED;
96-
drm_info(ddev, "TT memory decryption enabled.");
96+
drm_info_once(ddev, "TT memory decryption enabled.");
9797
}
9898

9999
bo->ttm = bdev->funcs->ttm_tt_create(bo, page_flags);

0 commit comments

Comments
 (0)