Skip to content

Commit 28b1c83

Browse files
committed
Merge ROCm 1.5.1 changes into roc-1.5.x
2 parents 757f29e + 8ca2ad0 commit 28b1c83

52 files changed

Lines changed: 15012 additions & 556 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

arch/arm64/configs/rock-dbg_defconfig

Lines changed: 4479 additions & 0 deletions
Large diffs are not rendered by default.

arch/powerpc/configs/rock-dbg_defconfig

Lines changed: 7821 additions & 0 deletions
Large diffs are not rendered by default.

arch/powerpc/platforms/powernv/pci-ioda.c

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,62 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
17171717
*/
17181718
}
17191719

1720+
static void pnv_pci_ioda_dma_sketchy_bypass(struct pnv_ioda_pe *pe)
1721+
{
1722+
/* Enable a transparent bypass into TVE #1 through DMA window 0 */
1723+
s64 rc;
1724+
u64 addr;
1725+
u64 tce_count;
1726+
u64 table_size;
1727+
u64 tce_order = 28; /* 256MB TCEs */
1728+
u64 window_size = memory_hotplug_max() + (1ULL << 32);
1729+
struct page *table_pages;
1730+
__be64 *tces;
1731+
1732+
window_size = roundup_pow_of_two(memory_hotplug_max() + (1ULL << 32));
1733+
tce_count = window_size >> tce_order;
1734+
table_size = tce_count << 3;
1735+
1736+
pr_debug("ruscur: table_size %016llx PAGE_SIZE %016lx\n",
1737+
table_size, PAGE_SIZE);
1738+
if (table_size < PAGE_SIZE) {
1739+
pr_debug("ruscur: set table_size to PAGE_SIZE\n");
1740+
table_size = PAGE_SIZE;
1741+
}
1742+
1743+
pr_debug("ruscur: tce_count %016llx table_size %016llx\n",
1744+
tce_count, table_size);
1745+
1746+
table_pages = alloc_pages_node(pe->phb->hose->node, GFP_KERNEL,
1747+
get_order(table_size));
1748+
1749+
pr_debug("ruscur: got table_pages %p\n", table_pages);
1750+
/* TODO null checking */
1751+
tces = page_address(table_pages);
1752+
pr_debug("ruscur: got tces %p\n", tces);
1753+
memset(tces, 0, table_size);
1754+
1755+
for (addr = 0; addr < memory_hotplug_max(); addr += (1 << tce_order)) {
1756+
pr_debug("ruscur: addr %016llx index %016llx\n", addr,
1757+
(addr + (1ULL << 32)) >> tce_order);
1758+
tces[(addr + (1ULL << 32)) >> tce_order] =
1759+
cpu_to_be64(addr | TCE_PCI_READ | TCE_PCI_WRITE);
1760+
}
1761+
1762+
rc = opal_pci_map_pe_dma_window(pe->phb->opal_id,
1763+
pe->pe_number,
1764+
/* reconfigure window 0 */
1765+
(pe->pe_number << 1) + 0,
1766+
1, /* level (unsure what this means) */
1767+
__pa(tces),
1768+
table_size,
1769+
1 << tce_order);
1770+
if (rc)
1771+
pe_err(pe, "OPAL error %llx in sketchy bypass\n", rc);
1772+
else
1773+
pe_info(pe, "ruscur's sketchy bypass worked, apparently\n");
1774+
}
1775+
17201776
static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
17211777
{
17221778
struct pci_controller *hose = pci_bus_to_host(pdev->bus);
@@ -1739,8 +1795,29 @@ static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
17391795
dev_info(&pdev->dev, "Using 64-bit DMA iommu bypass\n");
17401796
set_dma_ops(&pdev->dev, &dma_direct_ops);
17411797
} else {
1742-
dev_info(&pdev->dev, "Using 32-bit DMA via iommu\n");
1743-
set_dma_ops(&pdev->dev, &dma_iommu_ops);
1798+
/* Find out if we want to address more than 2G */
1799+
dev_info(&pdev->dev, "My dma_mask is %016llx\n", dma_mask);
1800+
if (dma_mask >> 32 /*&& pe->device_count == 1*/) {
1801+
/*
1802+
* TODO
1803+
* This mode shouldn't be used if the PE has any other
1804+
* device on it. Things will go wrong.
1805+
* We can't just check for device_count of 1 though,
1806+
* because of things like GPUs with audio devices and
1807+
* stuff like that. So we should walk the PE and check
1808+
* if everything else on it has the same vendor ID...?
1809+
*/
1810+
dev_info(&pdev->dev, "%d devices on my PE\n",
1811+
pe->device_count);
1812+
/* Set up the bypass mode */
1813+
pnv_pci_ioda_dma_sketchy_bypass(pe);
1814+
/* 4GB offset places us into TVE#1 */
1815+
set_dma_offset(&pdev->dev, (1ULL << 32));
1816+
set_dma_ops(&pdev->dev, &dma_direct_ops);
1817+
} else {
1818+
dev_info(&pdev->dev, "Using 32-bit DMA via iommu\n");
1819+
set_dma_ops(&pdev->dev, &dma_iommu_ops);
1820+
}
17441821
}
17451822
*pdev->dev.dma_mask = dma_mask;
17461823

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/list.h>
3030
#include <drm/drmP.h>
3131
#include <linux/dma-buf.h>
32+
#include <linux/pagemap.h>
3233
#include "amdgpu_amdkfd.h"
3334
#include "amdgpu_ucode.h"
3435
#include "gca/gfx_8_0_sh_mask.h"

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,9 @@ static const struct pci_device_id pciidlist[] = {
461461
{0x1002, 0x6861, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
462462
{0x1002, 0x6862, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
463463
{0x1002, 0x6863, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
464+
{0x1002, 0x6864, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
464465
{0x1002, 0x6867, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
466+
{0x1002, 0x6868, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
465467
{0x1002, 0x686c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
466468
{0x1002, 0x687f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
467469
{0, 0, 0}

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,7 @@ static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev,
867867

868868
pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
869869

870-
/* never 0 (full-speed), fuse or smc-controlled always */
871-
return sprintf(buf, "%i\n", pwm_mode == FDO_PWM_MODE_STATIC ? 1 : 2);
870+
return sprintf(buf, "%i\n", pwm_mode);
872871
}
873872

874873
static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
@@ -887,14 +886,7 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
887886
if (err)
888887
return err;
889888

890-
switch (value) {
891-
case 1: /* manual, percent-based */
892-
amdgpu_dpm_set_fan_control_mode(adev, FDO_PWM_MODE_STATIC);
893-
break;
894-
default: /* disable */
895-
amdgpu_dpm_set_fan_control_mode(adev, 0);
896-
break;
897-
}
889+
amdgpu_dpm_set_fan_control_mode(adev, value);
898890

899891
return count;
900892
}

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4846,8 +4846,11 @@ static int gfx_v8_0_kiq_init_register(struct amdgpu_ring *ring)
48464846
/* enable the doorbell if requested */
48474847
if (ring->use_doorbell) {
48484848
if ((adev->asic_type == CHIP_CARRIZO) ||
4849-
(adev->asic_type == CHIP_FIJI) ||
4850-
(adev->asic_type == CHIP_STONEY)) {
4849+
(adev->asic_type == CHIP_FIJI) ||
4850+
(adev->asic_type == CHIP_STONEY) ||
4851+
(adev->asic_type == CHIP_POLARIS10) ||
4852+
(adev->asic_type == CHIP_POLARIS11) ||
4853+
(adev->asic_type == CHIP_POLARIS12)) {
48514854
WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER,
48524855
AMDGPU_DOORBELL_KIQ << 2);
48534856
WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER,

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
395395
* in visible VRAM and the address space. Use at most
396396
* half of each. */
397397
uint64_t max_gtt_size = min(
398-
adev->mc.visible_vram_size / 8 * PAGE_SIZE / 2,
398+
adev->mc.visible_vram_size / 8 *
399+
AMDGPU_GPU_PAGE_SIZE / 2,
399400
1ULL << 39);
400401

401402
si_meminfo(&si);

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
562562
* in visible VRAM and the address space. Use at most
563563
* half of each. */
564564
uint64_t max_gtt_size = min(
565-
adev->mc.visible_vram_size / 8 * PAGE_SIZE / 2,
565+
adev->mc.visible_vram_size / 8 *
566+
AMDGPU_GPU_PAGE_SIZE / 2,
566567
1ULL << 39);
567568

568569
si_meminfo(&si);

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
468468
* half of each.
469469
*/
470470
uint64_t max_gtt_size = min(
471-
adev->mc.visible_vram_size / 8 * PAGE_SIZE / 2,
471+
adev->mc.visible_vram_size / 8 *
472+
AMDGPU_GPU_PAGE_SIZE / 2,
472473
1ULL << 39);
473474

474475
si_meminfo(&si);

0 commit comments

Comments
 (0)