Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

milk-v add amdgpu support #8

Open
wants to merge 1 commit into
base: k1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arch/riscv/boot/dts/spacemit/k1-x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -2287,8 +2287,8 @@
#address-cells = <3>;
#size-cells = <2>;
ranges = <0x01000000 0x0 0xb7002000 0 0xb7002000 0x0 0x100000>,
<0x42000000 0x0 0xa0000000 0 0xa0000000 0x0 0x10000000>,
<0x02000000 0x0 0xb0000000 0 0xb0000000 0x0 0x7000000>;
<0x42000000 0x0 0xa0000000 0 0xa0000000 0x0 0x12000000>,
<0x02000000 0x0 0xb2000000 0 0xb2000000 0x0 0x5000000>;
interconnects = <&dram_range2>;
interconnect-names = "dma-mem";

Expand Down
4 changes: 4 additions & 0 deletions arch/riscv/configs/k1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,10 @@ CONFIG_VIDEO_LINLON_K1X=y
CONFIG_DRM=y
CONFIG_DRM_RADEON=m
CONFIG_DRM_RADEON_USERPTR=y
CONFIG_DRM_AMDGPU=m
CONFIG_DRM_AMDGPU_SI=y
CONFIG_DRM_AMDGPU_CIK=y
CONFIG_DRM_AMDGPU_USERPTR=y
CONFIG_DRM_SPACEMIT=y
CONFIG_SPACEMIT_MIPI_PANEL=y
CONFIG_SPACEMIT_HDMI=y
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_buffer_object *bo,
caching = ttm_write_combined;
else
caching = ttm_cached;

caching = ttm_write_combined;
/* allocate space for the uninitialized page entries */
if (ttm_sg_tt_init(&gtt->ttm, bo, page_flags, caching)) {
kfree(gtt);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,13 +871,13 @@ static int gmc_v10_0_sw_init(struct amdgpu_ip_block *ip_block)
*/
adev->gmc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */

r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(32));
if (r) {
dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n");
return r;
}

adev->need_swiotlb = drm_need_swiotlb(44);
adev->need_swiotlb = drm_need_swiotlb(32);

r = gmc_v10_0_mc_init(adev);
if (r)
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,13 +800,13 @@ static int gmc_v11_0_sw_init(struct amdgpu_ip_block *ip_block)
*/
adev->gmc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */

r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(32));
if (r) {
dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n");
return r;
}

adev->need_swiotlb = drm_need_swiotlb(44);
adev->need_swiotlb = drm_need_swiotlb(32);

r = gmc_v11_0_mc_init(adev);
if (r)
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,12 @@ static int gmc_v6_0_sw_init(struct amdgpu_ip_block *ip_block)

adev->gmc.mc_mask = 0xffffffffffULL;

r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(40));
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(32));
if (r) {
dev_warn(adev->dev, "No suitable DMA available.\n");
return r;
}
adev->need_swiotlb = drm_need_swiotlb(40);
adev->need_swiotlb = drm_need_swiotlb(32);

r = gmc_v6_0_init_microcode(adev);
if (r) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,12 +1014,12 @@ static int gmc_v7_0_sw_init(struct amdgpu_ip_block *ip_block)
*/
adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */

r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(40));
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(32));
if (r) {
pr_warn("No suitable DMA available\n");
return r;
}
adev->need_swiotlb = drm_need_swiotlb(40);
adev->need_swiotlb = drm_need_swiotlb(32);

r = gmc_v7_0_init_microcode(adev);
if (r) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,12 +1127,12 @@ static int gmc_v8_0_sw_init(struct amdgpu_ip_block *ip_block)
*/
adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */

r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(40));
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(32));
if (r) {
pr_warn("No suitable DMA available\n");
return r;
}
adev->need_swiotlb = drm_need_swiotlb(40);
adev->need_swiotlb = drm_need_swiotlb(32);

r = gmc_v8_0_init_microcode(adev);
if (r) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -2206,12 +2206,12 @@ static int gmc_v9_0_sw_init(struct amdgpu_ip_block *ip_block)
IP_VERSION(9, 4, 2) ?
48 :
44;
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(dma_addr_bits));
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(32));
if (r) {
dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n");
return r;
}
adev->need_swiotlb = drm_need_swiotlb(dma_addr_bits);
adev->need_swiotlb = drm_need_swiotlb(32);

r = gmc_v9_0_mc_init(adev);
if (r)
Expand Down
2 changes: 2 additions & 0 deletions drivers/pci/setup-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
min_align = calculate_mem_align(aligns, max_order);
min_align = max(min_align, win_align);
size0 = calculate_memsize(size, min_size, 0, 0, resource_size(b_res), min_align);
if (size0 == 0x18000000U)
size0 = 0x12000000U; //should be enought for rx560
add_align = max(min_align, add_align);

if (bus->self && size0 &&
Expand Down