Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2 First whack at amdgpu. Long way to go.
details: https://anonhg.NetBSD.org/src/rev/3ff23ce8a93e
branches: trunk
changeset: 1028410:3ff23ce8a93e
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 10:59:00 2021 +0000
description:
First whack at amdgpu. Long way to go.
diffstat:
sys/external/bsd/drm2/amdgpu/files.amdgpu | 15 +++-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acp.c | 36 ++++++++-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c | 10 +-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c | 12 ++-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c | 7 +-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c | 10 ++-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cgs.c | 6 +-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik.c | 6 +-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c | 33 ++++++++-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_csa.c | 6 +-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dma_buf.h | 7 +-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ras.h | 6 +-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ring.h | 8 +-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.h | 16 ++++-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_virt.h | 6 +-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_xgmi.c | 13 +++-
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_xgmi.h | 4 +-
sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 6 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/amdgpu_dc_helper.c | 5 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/basics/amdgpu_conversion.c | 6 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/bios/amdgpu_bios_parser.c | 6 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/bios/amdgpu_command_table.c | 6 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc.c | 6 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_debug.c | 12 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_hw_sequencer.c | 5 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_link.c | 12 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_link_dp.c | 15 ++-
sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_link_hwss.c | 10 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_resource.c | 20 +++++-
sys/external/bsd/drm2/dist/drm/amd/display/dc/dce/dce_audio.h | 6 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/dce100/amdgpu_dce100_resource.c | 24 ++++++-
sys/external/bsd/drm2/dist/drm/amd/display/dc/dce110/amdgpu_dce110_compressor.c | 6 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/dce110/amdgpu_dce110_hw_sequencer.c | 24 ++++++-
sys/external/bsd/drm2/dist/drm/amd/display/dc/dce110/amdgpu_dce110_mem_input_v.c | 13 +++-
sys/external/bsd/drm2/dist/drm/amd/display/dc/dce110/amdgpu_dce110_timing_generator.c | 6 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/dm_pp_smu.h | 6 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/dsc/amdgpu_dc_dsc.c | 8 +-
sys/external/bsd/drm2/dist/drm/amd/display/dc/inc/link_hwss.h | 4 +-
sys/external/bsd/drm2/dist/drm/amd/display/dmub/inc/dmub_rb.h | 4 +-
sys/external/bsd/drm2/dist/drm/amd/display/include/fixed31_32.h | 6 +-
sys/external/bsd/drm2/dist/drm/amd/include/amd_shared.h | 4 +-
sys/external/bsd/drm2/dist/drm/amd/include/kgd_kfd_interface.h | 6 +-
sys/external/bsd/drm2/dist/drm/amd/include/navi10_enum.h | 4 +-
sys/external/bsd/drm2/dist/drm/amd/include/vega10_enum.h | 4 +-
sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_amd_powerplay.c | 7 +-
sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_arcturus_ppt.c | 18 ++++-
sys/external/bsd/drm2/dist/drm/amd/powerplay/inc/hwmgr.h | 4 +-
sys/external/bsd/drm2/dist/drm/amd/powerplay/smumgr/amdgpu_ci_smumgr.c | 7 +-
sys/external/bsd/drm2/dist/include/drm/gpu_scheduler.h | 9 ++-
49 files changed, 362 insertions(+), 118 deletions(-)
diffs (truncated from 2201 to 300 lines):
diff -r f1c313977143 -r 3ff23ce8a93e sys/external/bsd/drm2/amdgpu/files.amdgpu
--- a/sys/external/bsd/drm2/amdgpu/files.amdgpu Sun Dec 19 10:58:43 2021 +0000
+++ b/sys/external/bsd/drm2/amdgpu/files.amdgpu Sun Dec 19 10:59:00 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.amdgpu,v 1.13 2021/12/19 10:56:39 riastradh Exp $
+# $NetBSD: files.amdgpu,v 1.14 2021/12/19 10:59:00 riastradh Exp $
version 20180827
@@ -31,9 +31,20 @@
makeoptions amdgpu "CPPFLAGS.amdgpu"+="-I$S/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm"
makeoptions amdgpu "CPPFLAGS.amdgpu"+="-I$S/external/bsd/drm2/dist/drm/amd/display/dmub/inc"
+makeoptions amdgpu "CPPFLAGS.amdgpu"+="-DCONFIG_DRM_AMD_ACP"
+
makeoptions amdgpu "CWARNFLAGS.amdgpu"+="-Wno-missing-field-initializers"
makeoptions amdgpu "CWARNFLAGS.amdgpu"+="-Wno-shadow"
makeoptions amdgpu "CWARNFLAGS.amdgpu"+="-Wno-pointer-arith"
+makeoptions amdgpu "CWARNFLAGS.amdgpu"+="-Wno-override-init"
+
+# Half the file strips const qualifier; file is small enough this is
+# not an issue.
+makeoptions amdgpu "CWARNFLAGS.amdgpu_arct_reg_init.c"+="-Wno-cast-qual"
+
+# -Wtype-limits raises warnings about code that is careful to avoid
+# overflow in arithmetic, which is the opposite of helpful. &@!#*
+makeoptions amdgpu "CWARNFLAGS.amdgpu_bo_list.c"+="-Wno-type-limits"
# Local additions.
file external/bsd/drm2/amdgpu/amdgpu_module.c amdgpu
@@ -298,7 +309,7 @@
file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_vega20_smumgr.c amdgpu
file external/bsd/drm2/dist/drm/amd/amdgpu/../powerplay/smumgr/amdgpu_vegam_smumgr.c amdgpu
file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acp.c amdgpu
-file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c amdgpu
+#file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c amdgpu
file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_afmt.c amdgpu
file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c amdgpu
file external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_arct_reg_init.c amdgpu
diff -r f1c313977143 -r 3ff23ce8a93e sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acp.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acp.c Sun Dec 19 10:58:43 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acp.c Sun Dec 19 10:59:00 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: amdgpu_acp.c,v 1.2 2021/12/18 23:44:58 riastradh Exp $ */
+/* $NetBSD: amdgpu_acp.c,v 1.3 2021/12/19 10:59:01 riastradh Exp $ */
/*
* Copyright 2015 Advanced Micro Devices, Inc.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_acp.c,v 1.2 2021/12/18 23:44:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_acp.c,v 1.3 2021/12/19 10:59:01 riastradh Exp $");
#include <linux/irqdomain.h>
#include <linux/pci.h>
@@ -122,6 +122,8 @@
return 0;
}
+#ifndef __NetBSD__ /* XXX amdgpu pm */
+
struct acp_pm_domain {
void *adev;
struct generic_pm_domain gpd;
@@ -181,6 +183,8 @@
return dev;
}
+#endif
+
/**
* acp_hw_init - start and test ACP block
*
@@ -220,6 +224,7 @@
acp_base = adev->rmmio_base;
+#ifndef __NetBSD__ /* XXX amdgpu pm */
adev->acp.acp_genpd = kzalloc(sizeof(struct acp_pm_domain), GFP_KERNEL);
if (adev->acp.acp_genpd == NULL)
return -ENOMEM;
@@ -232,7 +237,9 @@
adev->acp.acp_genpd->adev = adev;
pm_genpd_init(&adev->acp.acp_genpd->gpd, NULL, false);
+#endif
+#ifndef __NetBSD__ /* XXX amdgpu cell */
adev->acp.acp_cell = kcalloc(ACP_DEVS, sizeof(struct mfd_cell),
GFP_KERNEL);
@@ -240,6 +247,7 @@
r = -ENOMEM;
goto failure;
}
+#endif
adev->acp.acp_res = kcalloc(5, sizeof(struct resource), GFP_KERNEL);
if (adev->acp.acp_res == NULL) {
@@ -247,6 +255,9 @@
goto failure;
}
+#ifdef __NetBSD__ /* XXX amdgpu sound */
+ __USE(i2s_pdata);
+#else
i2s_pdata = kcalloc(3, sizeof(struct i2s_platform_data), GFP_KERNEL);
if (i2s_pdata == NULL) {
r = -ENOMEM;
@@ -294,6 +305,7 @@
i2s_pdata[2].snd_rates = SNDRV_PCM_RATE_8000_96000;
i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET;
i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET;
+#endif
adev->acp.acp_res[0].name = "acp2x_dma";
adev->acp.acp_res[0].flags = IORESOURCE_MEM;
@@ -320,6 +332,10 @@
adev->acp.acp_res[4].start = amdgpu_irq_create_mapping(adev, 162);
adev->acp.acp_res[4].end = adev->acp.acp_res[4].start;
+#ifdef __NetBSD__ /* XXX amdgpu cell */
+ __USE(dev);
+ __USE(i);
+#else
adev->acp.acp_cell[0].name = "acp_audio_dma";
adev->acp.acp_cell[0].num_resources = 5;
adev->acp.acp_cell[0].resources = &adev->acp.acp_res[0];
@@ -357,7 +373,7 @@
goto failure;
}
}
-
+#endif
/* Assert Soft reset of ACP */
val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET);
@@ -372,7 +388,7 @@
(val & ACP_SOFT_RESET__SoftResetAudDone_MASK))
break;
if (--count == 0) {
- dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
+ dev_err(pci_dev_dev(adev->pdev), "Failed to reset ACP\n");
r = -ETIMEDOUT;
goto failure;
}
@@ -390,7 +406,7 @@
if (val & (u32) 0x1)
break;
if (--count == 0) {
- dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
+ dev_err(pci_dev_dev(adev->pdev), "Failed to reset ACP\n");
r = -ETIMEDOUT;
goto failure;
}
@@ -443,7 +459,7 @@
(val & ACP_SOFT_RESET__SoftResetAudDone_MASK))
break;
if (--count == 0) {
- dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
+ dev_err(pci_dev_dev(adev->pdev), "Failed to reset ACP\n");
return -ETIMEDOUT;
}
udelay(100);
@@ -460,12 +476,17 @@
if (val & (u32) 0x1)
break;
if (--count == 0) {
- dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
+ dev_err(pci_dev_dev(adev->pdev), "Failed to reset ACP\n");
return -ETIMEDOUT;
}
udelay(100);
}
+#ifdef __NetBSD__ /* XXX amdgpu pm */
+ __USE(dev);
+ __USE(i);
+ __USE(ret);
+#else
for (i = 0; i < ACP_DEVS ; i++) {
dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i);
ret = pm_genpd_remove_device(dev);
@@ -475,6 +496,7 @@
}
mfd_remove_devices(adev->acp.parent);
+#endif
kfree(adev->acp.acp_res);
kfree(adev->acp.acp_genpd);
kfree(adev->acp.acp_cell);
diff -r f1c313977143 -r 3ff23ce8a93e sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c Sun Dec 19 10:58:43 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c Sun Dec 19 10:59:00 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: amdgpu_amdkfd.c,v 1.5 2021/12/19 10:56:50 riastradh Exp $ */
+/* $NetBSD: amdgpu_amdkfd.c,v 1.6 2021/12/19 10:59:01 riastradh Exp $ */
/*
* Copyright 2014 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_amdkfd.c,v 1.5 2021/12/19 10:56:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_amdkfd.c,v 1.6 2021/12/19 10:59:01 riastradh Exp $");
#include "amdgpu_amdkfd.h"
#include "amd_shared.h"
@@ -385,8 +385,12 @@
struct kfd_local_mem_info *mem_info)
{
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+#ifdef __NetBSD__
+ uint64_t address_mask = ~(uint64_t)0; /* XXX */
+#else
uint64_t address_mask = adev->dev->dma_mask ? ~*adev->dev->dma_mask :
~((1ULL << 32) - 1);
+#endif
resource_size_t aper_limit = adev->gmc.aper_base + adev->gmc.aper_size;
memset(mem_info, 0, sizeof(*mem_info));
@@ -400,7 +404,7 @@
}
mem_info->vram_width = adev->gmc.vram_width;
- pr_debug("Address base: %pap limit %pap public 0x%llx private 0x%llx\n",
+ pr_debug("Address base: %pap limit %pap public 0x%"PRIx64" private 0x%"PRIx64"\n",
&adev->gmc.aper_base, &aper_limit,
mem_info->local_mem_size_public,
mem_info->local_mem_size_private);
diff -r f1c313977143 -r 3ff23ce8a93e sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c Sun Dec 19 10:58:43 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c Sun Dec 19 10:59:00 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: amdgpu_atombios.c,v 1.6 2021/12/18 23:44:58 riastradh Exp $ */
+/* $NetBSD: amdgpu_atombios.c,v 1.7 2021/12/19 10:59:01 riastradh Exp $ */
/*
* Copyright 2007-8 Advanced Micro Devices, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_atombios.c,v 1.6 2021/12/18 23:44:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_atombios.c,v 1.7 2021/12/19 10:59:01 riastradh Exp $");
#include <drm/amdgpu_drm.h>
#include "amdgpu.h"
@@ -41,6 +41,8 @@
#include "atombios_encoders.h"
#include "bif/bif_4_1_d.h"
+#include <linux/nbsd-namespace.h>
+
static void amdgpu_atombios_lookup_i2c_gpio_quirks(struct amdgpu_device *adev,
ATOM_GPIO_I2C_ASSIGMENT *gpio,
u8 index)
@@ -1944,6 +1946,7 @@
return r;
}
+#ifdef CONFIG_SYSFS
static ssize_t amdgpu_atombios_get_vbios_version(struct device *dev,
struct device_attribute *attr,
char *buf)
@@ -1957,6 +1960,7 @@
static DEVICE_ATTR(vbios_version, 0444, amdgpu_atombios_get_vbios_version,
NULL);
+#endif
/**
* amdgpu_atombios_fini - free the driver info and callbacks for atombios
@@ -1978,7 +1982,9 @@
adev->mode_info.atom_context = NULL;
kfree(adev->mode_info.atom_card_info);
adev->mode_info.atom_card_info = NULL;
+#ifdef CONFIG_SYSFS
device_remove_file(adev->dev, &dev_attr_vbios_version);
+#endif
}
/**
@@ -2043,11 +2049,13 @@
amdgpu_atombios_allocate_fb_scratch(adev);
}
+#ifdef CONFIG_SYSFS
ret = device_create_file(adev->dev, &dev_attr_vbios_version);
if (ret) {
DRM_ERROR("Failed to create device file for VBIOS version\n");
return ret;
}
+#endif
return 0;
}
Home |
Main Index |
Thread Index |
Old Index