Skip to contentSkip to conversation

idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM

PATCH In review Sasha Levin 2 participants 14 messages Aug 22, 2023 – Sep 4, 2023

Subsystems (6)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

PATCH 1/10 idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM

From: Baoquan He <[email protected]>

[ Upstream commit b1e213a9e31c20206f111ec664afcf31cbfe0dbb ]

On s390 systems (aka mainframes), it has classic channel devices for networking and permanent storage that are currently even more common than PCI devices. Hence it could have a fully functional s390 kernel with CONFIG_PCI=n, then the relevant iomem mapping functions [including ioremap(), devm_ioremap(), etc.] are not available.

Here let FSL_EDMA and INTEL_IDMA64 depend on HAS_IOMEM so that it won't be built to cause below compiling error if PCI is unset.

--------
ERROR: modpost: "devm_platform_ioremap_resource" [drivers/dma/fsl-edma.ko] undefined!
ERROR: modpost: "devm_platform_ioremap_resource" [drivers/dma/idma64.ko] undefined!
--------

---
 drivers/dma/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/dma/Kconfig +2 -0
index b64ae02c26f8c..81de833ccd041 100644
@@ -210,6 +210,7 @@ config FSL_DMA
 config FSL_EDMA
 	tristate "Freescale eDMA engine support"
 	depends on OF
+	depends on HAS_IOMEM
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
 	help
@@ -279,6 +280,7 @@ config IMX_SDMA
 
 config INTEL_IDMA64
 	tristate "Intel integrated DMA 64-bit support"
+	depends on HAS_IOMEM
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
 	help
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH 2/10 platform/x86/amd/pmf: Fix unsigned comparison with less than zero

From: Yang Li <[email protected]>

[ Upstream commit 785c00993dc4c4bb2f7b0f3a3f29c03a6f7aab2e ]

The return value from the call to amd_pmf_get_pprof_modes() is int. However, the return value is being assigned to an unsigned char variable 'mode', so making 'mode' an int.

silence the warning:
./drivers/platform/x86/amd/pmf/sps.c:183:5-9: WARNING: Unsigned expression compared with zero: mode < 0

---
 drivers/platform/x86/amd/pmf/sps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/amd/pmf/sps.c +2 -1
index fd448844de206..b2cf62937227c 100644
@@ -121,7 +121,8 @@ int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf)
 
 int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev)
 {
-	u8 mode, flag = 0;
+	u8 flag = 0;
+	int mode;
 	int src;
 
 	mode = amd_pmf_get_pprof_modes(dev);
Signature · 1 line
2.40.1
author maintainer
#2 lore raw

PATCH 3/10 scsi: lpfc: Remove reftag check in DIF paths

In reply to Sasha Levin

From: Justin Tee <[email protected]>

[ Upstream commit 8eebf0e84f0614cebc7347f7bbccba4056d77d42 ]

When preparing protection DIF I/O for DMA, the driver obtains reference tags from scsi_prot_ref_tag(). Previously, there was a wrong assumption that an all 0xffffffff value meant error and thus the driver failed the I/O. This patch removes the evaluation code and accepts whatever the upper layer returns.

---
 drivers/scsi/lpfc/lpfc_scsi.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +3 -17
index 7a1563564df7f..7aac9fc719675 100644
@@ -109,8 +109,6 @@ lpfc_sli4_set_rsp_sgl_last(struct lpfc_hba *phba,
 	}
 }
 
-#define LPFC_INVALID_REFTAG ((u32)-1)
-
 /**
  * lpfc_rampdown_queue_depth - Post RAMP_DOWN_QUEUE event to worker thread
  * @phba: The Hba for which this call is being executed.
@@ -978,8 +976,6 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 
 	sgpe = scsi_prot_sglist(sc);
 	lba = scsi_prot_ref_tag(sc);
-	if (lba == LPFC_INVALID_REFTAG)
-		return 0;
 
 	/* First check if we need to match the LBA */
 	if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) {
@@ -1560,8 +1556,6 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 
 	/* extract some info from the scsi command for pde*/
 	reftag = scsi_prot_ref_tag(sc);
-	if (reftag == LPFC_INVALID_REFTAG)
-		goto out;
 
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
 	rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
@@ -1723,8 +1717,6 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 	/* extract some info from the scsi command */
 	blksize = scsi_prot_interval(sc);
 	reftag = scsi_prot_ref_tag(sc);
-	if (reftag == LPFC_INVALID_REFTAG)
-		goto out;
 
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
 	rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
@@ -1954,8 +1946,6 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 
 	/* extract some info from the scsi command for pde*/
 	reftag = scsi_prot_ref_tag(sc);
-	if (reftag == LPFC_INVALID_REFTAG)
-		goto out;
 
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
 	rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
@@ -2155,8 +2145,6 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 	/* extract some info from the scsi command */
 	blksize = scsi_prot_interval(sc);
 	reftag = scsi_prot_ref_tag(sc);
-	if (reftag == LPFC_INVALID_REFTAG)
-		goto out;
 
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
 	rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
@@ -2748,8 +2736,6 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
 
 		src = (struct scsi_dif_tuple *)sg_virt(sgpe);
 		start_ref_tag = scsi_prot_ref_tag(cmd);
-		if (start_ref_tag == LPFC_INVALID_REFTAG)
-			goto out;
 		start_app_tag = src->app_tag;
 		len = sgpe->length;
 		while (src && protsegcnt) {
@@ -3495,11 +3481,11 @@ lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba,
 			     scsi_cmnd->sc_data_direction);
 
 	lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
-			"9084 Cannot setup S/G List for HBA"
-			"IO segs %d/%d SGL %d SCSI %d: %d %d\n",
+			"9084 Cannot setup S/G List for HBA "
+			"IO segs %d/%d SGL %d SCSI %d: %d %d %d\n",
 			lpfc_cmd->seg_cnt, lpfc_cmd->prot_seg_cnt,
 			phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt,
-			prot_group_type, num_sge);
+			prot_group_type, num_sge, ret);
 
 	lpfc_cmd->seg_cnt = 0;
 	lpfc_cmd->prot_seg_cnt = 0;
Signature · 1 line
2.40.1
author maintainer
#3 lore raw

PATCH 4/10 scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock

In reply to Sasha Levin

From: Chengfeng Ye <[email protected]>

[ Upstream commit dd64f80587190265ca8a0f4be6c64c2fda6d3ac2 ]

As &qedi_percpu->p_work_lock is acquired by hard IRQ qedi_msix_handler(), other acquisitions of the same lock under process context should disable IRQ, otherwise deadlock could happen if the IRQ preempts the execution while the lock is held in process context on the same CPU.

qedi_cpu_offline() is one such function which acquires the lock in process context.

[Deadlock Scenario]
qedi_cpu_offline()

    ->spin_lock(&p->p_work_lock)
        <irq>
        ->qedi_msix_handler()
        ->edi_process_completions()
        ->spin_lock_irqsave(&p->p_work_lock, flags); (deadlock here)

This flaw was found by an experimental static analysis tool I am developing for IRQ-related deadlocks.

The tentative patch fix the potential deadlock by spin_lock_irqsave() under process context.

---
 drivers/scsi/qedi/qedi_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/qedi/qedi_main.c +3 -2
index 9fd68d362698f..2ee109fb65616 100644
@@ -1977,8 +1977,9 @@ static int qedi_cpu_offline(unsigned int cpu)
 	struct qedi_percpu_s *p = this_cpu_ptr(&qedi_percpu);
 	struct qedi_work *work, *tmp;
 	struct task_struct *thread;
+	unsigned long flags;
 
-	spin_lock_bh(&p->p_work_lock);
+	spin_lock_irqsave(&p->p_work_lock, flags);
 	thread = p->iothread;
 	p->iothread = NULL;
 
@@ -1989,7 +1990,7 @@ static int qedi_cpu_offline(unsigned int cpu)
 			kfree(work);
 	}
 
-	spin_unlock_bh(&p->p_work_lock);
+	spin_unlock_irqrestore(&p->p_work_lock, flags);
 	if (thread)
 		kthread_stop(thread);
 	return 0;
Signature · 1 line
2.40.1
author maintainer
#4 lore raw

PATCH 5/10 net: hns3: restore user pause configure when disable autoneg

In reply to Sasha Levin

From: Jian Shen <[email protected]>

[ Upstream commit 15159ec0c831b565820c2de05114ea1b4cf07681 ]

Restore the mac pause state to user configuration when autoneg is disabled

---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 5 ++++-
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c   | 2 +-
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h   | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +4 -1
index 6af2273f227c2..84ecd8b9be48c 100644
@@ -10936,9 +10936,12 @@ int hclge_cfg_flowctrl(struct hclge_dev *hdev)
 	u32 rx_pause, tx_pause;
 	u8 flowctl;
 
-	if (!phydev->link || !phydev->autoneg)
+	if (!phydev->link)
 		return 0;
 
+	if (!phydev->autoneg)
+		return hclge_mac_pause_setup_hw(hdev);
+
 	local_advertising = linkmode_adv_to_lcl_adv_t(phydev->advertising);
 
 	if (phydev->pause)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +1 -1
index 150f146fa24fb..8b40c6b4ee53e 100644
@@ -1549,7 +1549,7 @@ static int hclge_bp_setup_hw(struct hclge_dev *hdev, u8 tc)
 	return 0;
 }
 
-static int hclge_mac_pause_setup_hw(struct hclge_dev *hdev)
+int hclge_mac_pause_setup_hw(struct hclge_dev *hdev)
 {
 	bool tx_en, rx_en;
 
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +1 -0
index dd6f1fd486cf2..251e808456208 100644
@@ -242,6 +242,7 @@ int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap,
 			   u8 pfc_bitmap);
 int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx);
 int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr);
+int hclge_mac_pause_setup_hw(struct hclge_dev *hdev);
 void hclge_pfc_rx_stats_get(struct hclge_dev *hdev, u64 *stats);
 void hclge_pfc_tx_stats_get(struct hclge_dev *hdev, u64 *stats);
 int hclge_tm_qs_shaper_cfg(struct hclge_vport *vport, int max_tx_rate);
Signature · 1 line
2.40.1
author maintainer
#5 lore raw

PATCH 6/10 drm/amd/pm: skip the RLC stop when S0i3 suspend for SMU v13.0.4/11

In reply to Sasha Levin

From: Tim Huang <[email protected]>

[ Upstream commit 730d44e1fa306a20746ad4a85da550662aed9daa ]

For SMU v13.0.4/11, driver does not need to stop RLC for S0i3, the firmwares will handle that properly.

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -2
index d191ff52d4f06..a664a0a284784 100644
@@ -1562,9 +1562,9 @@ static int smu_disable_dpms(struct smu_context *smu)
 
 	/*
 	 * For SMU 13.0.4/11, PMFW will handle the features disablement properly
-	 * for gpu reset case. Driver involvement is unnecessary.
+	 * for gpu reset and S0i3 cases. Driver involvement is unnecessary.
 	 */
-	if (amdgpu_in_reset(adev)) {
+	if (amdgpu_in_reset(adev) || adev->in_s0ix) {
 		switch (adev->ip_versions[MP1_HWIP][0]) {
 		case IP_VERSION(13, 0, 4):
 		case IP_VERSION(13, 0, 11):
Signature · 1 line
2.40.1
author maintainer
#6 lore raw

PATCH 7/10 drm/amdgpu: Match against exact bootloader status

In reply to Sasha Levin

From: Lijo Lazar <[email protected]>

[ Upstream commit d3de41ee5febe5c2d9989fe9810bce2bb54a3a8e ]

On PSP v13.x ASICs, boot loader will set only the MSB to 1 and clear the least significant bits for any command submission. Hence match against the exact register value, otherwise a register value of all 0xFFs also could falsely indicate that boot loader is ready. Also, from PSP v13.0.6 and newer, bits[7:0] will be used to indicate command error status.

---
 drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +8 -7
index 8c5fa4b7b68a2..c7cb30efe43de 100644
@@ -147,14 +147,15 @@ static int psp_v13_0_wait_for_bootloader(struct psp_context *psp)
 	int ret;
 	int retry_loop;
 
+	/* Wait for bootloader to signify that it is ready having bit 31 of
+	 * C2PMSG_35 set to 1. All other bits are expected to be cleared.
+	 * If there is an error in processing command, bits[7:0] will be set.
+	 * This is applicable for PSP v13.0.6 and newer.
+	 */
 	for (retry_loop = 0; retry_loop < 10; retry_loop++) {
-		/* Wait for bootloader to signify that is
-		    ready having bit 31 of C2PMSG_35 set to 1 */
-		ret = psp_wait_for(psp,
-				   SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_35),
-				   0x80000000,
-				   0x80000000,
-				   false);
+		ret = psp_wait_for(
+			psp, SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_35),
+			0x80000000, 0xffffffff, false);
 
 		if (ret == 0)
 			return 0;
Signature · 1 line
2.40.1
author maintainer
#7 lore raw

PATCH 8/10 drm/amdkfd: ignore crat by default

In reply to Sasha Levin

From: Alex Deucher <[email protected]>

[ Upstream commit a6dea2d64ff92851e68cd4e20a35f6534286e016 ]

We are dropping the IOMMUv2 path, so no need to enable this. It's often buggy on consumer platforms anyway.

---
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0 -4
index e45c6bc8d10bb..a9fa4772b2d35 100644
@@ -1543,11 +1543,7 @@ static bool kfd_ignore_crat(void)
 	if (ignore_crat)
 		return true;
 
-#ifndef KFD_SUPPORT_IOMMU_V2
 	ret = true;
-#else
-	ret = false;
-#endif
 
 	return ret;
 }
Signature · 1 line
2.40.1
#8 lore raw

RE: [PATCH AUTOSEL 6.1 08/10] drm/amdkfd: ignore crat by default

[Public]

Quoted 11 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Tuesday, August 22, 2023 7:36 AM
To: [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>; Mike Lothian <[email protected]>; Sasha Levin <[email protected]>; Pan, Xinhui <[email protected]>; [email protected]; [email protected]; amd- [email protected]; [email protected]
Subject: [PATCH AUTOSEL 6.1 08/10] drm/amdkfd: ignore crat by default

Quoted 6 lines

From: Alex Deucher <[email protected]>

[ Upstream commit a6dea2d64ff92851e68cd4e20a35f6534286e016 ]

We are dropping the IOMMUv2 path, so no need to enable this. It's often buggy on consumer platforms anyway.

This is not needed for stable.

Alex

Quoted 29 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0 -5
index e45c6bc8d10bb..a9fa4772b2d35 100644
@@ -1543,11 +1543,7 @@ static bool kfd_ignore_crat(void)
      if (ignore_crat)
              return true;
 
-#ifndef KFD_SUPPORT_IOMMU_V2
      ret = true;
-#else
-     ret = false;
-#endif
 
      return ret;
 }
--

2.40.1

author maintainer
#9 lore raw

Re: [PATCH AUTOSEL 6.1 08/10] drm/amdkfd: ignore crat by default

Quoted 15 lines · Alexander

[Public]

Quoted 13 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Tuesday, August 22, 2023 7:36 AM
To: [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>; Mike Lothian <[email protected]>; Sasha Levin <[email protected]>; Pan, Xinhui <[email protected]>; [email protected]; [email protected]; amd- [email protected]; [email protected]
Subject: [PATCH AUTOSEL 6.1 08/10] drm/amdkfd: ignore crat by default

From: Alex Deucher <[email protected]>

Quoted 7 lines
Quoted 4 lines

[ Upstream commit a6dea2d64ff92851e68cd4e20a35f6534286e016 ]

We are dropping the IOMMUv2 path, so no need to enable this. It's often buggy on consumer platforms anyway.

This is not needed for stable.

Dropped this and the other ones you've pointed out, thanks!

Signature · 2 lines
Thanks,
Sasha
author maintainer
#10 lore raw

PATCH 9/10 drm/amdkfd: disable IOMMUv2 support for KV/CZ

In reply to Sasha Levin

From: Alex Deucher <[email protected]>

[ Upstream commit 616f92d188ee7142a95a52068efdbea82645f859 ]

Use the dGPU path instead. There were a lot of platform issues with IOMMU in general on these chips due to windows not enabling IOMMU at the time. The dGPU path has been used for a long time with newer APUs and works fine. This also paves the way to simplify the driver significantly.

v2: use the dGPU queue manager functions

---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c               | 6 ------
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 8 +-------
 2 files changed, 1 insertion(+), 13 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -6
index 27820f0a282d1..4cc5debdd119b 100644
@@ -216,10 +216,6 @@ static void kfd_device_info_init(struct kfd_dev *kfd,
 		    asic_type != CHIP_TONGA)
 			kfd->device_info.supports_cwsr = true;
 
-		if (asic_type == CHIP_KAVERI ||
-		    asic_type == CHIP_CARRIZO)
-			kfd->device_info.needs_iommu_device = true;
-
 		if (asic_type != CHIP_HAWAII && !vf)
 			kfd->device_info.needs_pci_atomics = true;
 	}
@@ -233,7 +229,6 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
 	uint32_t gfx_target_version = 0;
 
 	switch (adev->asic_type) {
-#ifdef KFD_SUPPORT_IOMMU_V2
 #ifdef CONFIG_DRM_AMDGPU_CIK
 	case CHIP_KAVERI:
 		gfx_target_version = 70000;
@@ -246,7 +241,6 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
 		if (!vf)
 			f2g = &gfx_v8_kfd2kgd;
 		break;
-#endif
 #ifdef CONFIG_DRM_AMDGPU_CIK
 	case CHIP_HAWAII:
 		gfx_target_version = 70001;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -7
index c06ada0844ba1..5616a722578f5 100644
@@ -2335,18 +2335,12 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev)
 	}
 
 	switch (dev->adev->asic_type) {
-	case CHIP_CARRIZO:
-		device_queue_manager_init_vi(&dqm->asic_ops);
-		break;
-
 	case CHIP_KAVERI:
-		device_queue_manager_init_cik(&dqm->asic_ops);
-		break;
-
 	case CHIP_HAWAII:
 		device_queue_manager_init_cik_hawaii(&dqm->asic_ops);
 		break;
 
+	case CHIP_CARRIZO:
 	case CHIP_TONGA:
 	case CHIP_FIJI:
 	case CHIP_POLARIS10:
Signature · 1 line
2.40.1
#11 lore raw

RE: [PATCH AUTOSEL 6.1 09/10] drm/amdkfd: disable IOMMUv2 support for KV/CZ

[Public]

Quoted 12 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Tuesday, August 22, 2023 7:36 AM
To: [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>; Mike Lothian <[email protected]>; Sasha Levin <[email protected]>; Pan, Xinhui <[email protected]>; [email protected]; [email protected]; amd- [email protected]; [email protected]
Subject: [PATCH AUTOSEL 6.1 09/10] drm/amdkfd: disable IOMMUv2 support for KV/CZ

Quoted 8 lines

From: Alex Deucher <[email protected]>

[ Upstream commit 616f92d188ee7142a95a52068efdbea82645f859 ]

Use the dGPU path instead. There were a lot of platform issues with IOMMU in general on these chips due to windows not enabling IOMMU at the time. The dGPU path has been used for a long time with newer APUs and works fine. This also paves the way to simplify the driver significantly.

This is not needed for stable.

Alex

Quoted 75 lines

v2: use the dGPU queue manager functions

---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c               | 6 ------
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 8 +-------
 2 files changed, 1 insertion(+), 13 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -5
index 27820f0a282d1..4cc5debdd119b 100644
@@ -216,10 +216,6 @@ static void kfd_device_info_init(struct kfd_dev *kfd,
                  asic_type != CHIP_TONGA)
                      kfd->device_info.supports_cwsr = true;
 
-             if (asic_type == CHIP_KAVERI ||
-                 asic_type == CHIP_CARRIZO)
-                     kfd->device_info.needs_iommu_device = true;
-
              if (asic_type != CHIP_HAWAII && !vf)
                      kfd->device_info.needs_pci_atomics = true;
      }
@@ -233,7 +229,6 @@ struct kfd_dev *kgd2kfd_probe(struct
 amdgpu_device *adev, bool vf)
      uint32_t gfx_target_version = 0;
 
      switch (adev->asic_type) {
-#ifdef KFD_SUPPORT_IOMMU_V2
 #ifdef CONFIG_DRM_AMDGPU_CIK
      case CHIP_KAVERI:
              gfx_target_version = 70000;
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -1
@@ -246,7 +241,6 @@ struct kfd_dev *kgd2kfd_probe(struct
 amdgpu_device *adev, bool vf)
              if (!vf)
                      f2g = &gfx_v8_kfd2kgd;
              break;
-#endif
 #ifdef CONFIG_DRM_AMDGPU_CIK
      case CHIP_HAWAII:
              gfx_target_version = 70001;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -7
index c06ada0844ba1..5616a722578f5 100644
@@ -2335,18 +2335,12 @@ struct device_queue_manager
 *device_queue_manager_init(struct kfd_dev *dev)
      }
 
      switch (dev->adev->asic_type) {
-     case CHIP_CARRIZO:
-             device_queue_manager_init_vi(&dqm->asic_ops);
-             break;
-
      case CHIP_KAVERI:
-             device_queue_manager_init_cik(&dqm->asic_ops);
-             break;
-
      case CHIP_HAWAII:
              device_queue_manager_init_cik_hawaii(&dqm->asic_ops);
              break;
 
+     case CHIP_CARRIZO:
      case CHIP_TONGA:
      case CHIP_FIJI:

case CHIP_POLARIS10:
--
2.40.1

author maintainer
#12 lore raw

PATCH 10/10 drm/amdkfd: disable IOMMUv2 support for Raven

In reply to Sasha Levin

From: Alex Deucher <[email protected]>

[ Upstream commit 091ae5473f96ced844af6ba39b94757359b12348 ]

Use the dGPU path instead. There were a lot of platform issues with IOMMU in general on these chips due to windows not enabling IOMMU at the time. The dGPU path has been used for a long time with newer APUs and works fine. This also paves the way to simplify the driver significantly.

---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -7
index 4cc5debdd119b..af18378e58d9f 100644
@@ -185,11 +185,6 @@ static void kfd_device_info_init(struct kfd_dev *kfd,
 
 		kfd_device_info_set_event_interrupt_class(kfd);
 
-		/* Raven */
-		if (gc_version == IP_VERSION(9, 1, 0) ||
-		    gc_version == IP_VERSION(9, 2, 2))
-			kfd->device_info.needs_iommu_device = true;
-
 		if (gc_version < IP_VERSION(11, 0, 0)) {
 			/* Navi2x+, Navi1x+ */
 			if (gc_version == IP_VERSION(10, 3, 6))
@@ -287,7 +282,6 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
 			gfx_target_version = 90000;
 			f2g = &gfx_v9_kfd2kgd;
 			break;
-#ifdef KFD_SUPPORT_IOMMU_V2
 		/* Raven */
 		case IP_VERSION(9, 1, 0):
 		case IP_VERSION(9, 2, 2):
@@ -295,7 +289,6 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
 			if (!vf)
 				f2g = &gfx_v9_kfd2kgd;
 			break;
-#endif
 		/* Vega12 */
 		case IP_VERSION(9, 2, 1):
 			gfx_target_version = 90004;
Signature · 1 line
2.40.1
#13 lore raw

RE: [PATCH AUTOSEL 6.1 10/10] drm/amdkfd: disable IOMMUv2 support for Raven

[Public]

Quoted 12 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Tuesday, August 22, 2023 7:36 AM
To: [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>; Mike Lothian <[email protected]>; Sasha Levin <[email protected]>; Pan, Xinhui <[email protected]>; [email protected]; [email protected]; amd- [email protected]; [email protected]
Subject: [PATCH AUTOSEL 6.1 10/10] drm/amdkfd: disable IOMMUv2 support for Raven

Quoted 8 lines

From: Alex Deucher <[email protected]>

[ Upstream commit 091ae5473f96ced844af6ba39b94757359b12348 ]

Use the dGPU path instead. There were a lot of platform issues with IOMMU in general on these chips due to windows not enabling IOMMU at the time. The dGPU path has been used for a long time with newer APUs and works fine. This also paves the way to simplify the driver significantly.

This is not needed for stable.

Alex

Quoted 47 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -5
index 4cc5debdd119b..af18378e58d9f 100644
@@ -185,11 +185,6 @@ static void kfd_device_info_init(struct kfd_dev *kfd,
 
              kfd_device_info_set_event_interrupt_class(kfd);
 
-             /* Raven */
-             if (gc_version == IP_VERSION(9, 1, 0) ||
-                 gc_version == IP_VERSION(9, 2, 2))
-                     kfd->device_info.needs_iommu_device = true;
-
              if (gc_version < IP_VERSION(11, 0, 0)) {
                      /* Navi2x+, Navi1x+ */
                      if (gc_version == IP_VERSION(10, 3, 6)) @@ -287,7
+282,6 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev,

bool vf)

                      gfx_target_version = 90000;
                      f2g = &gfx_v9_kfd2kgd;
                      break;
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -2
-#ifdef KFD_SUPPORT_IOMMU_V2
              /* Raven */
              case IP_VERSION(9, 1, 0):
              case IP_VERSION(9, 2, 2):
@@ -295,7 +289,6 @@ struct kfd_dev *kgd2kfd_probe(struct
 amdgpu_device *adev, bool vf)
                      if (!vf)
                              f2g = &gfx_v9_kfd2kgd;
                      break;
-#endif
              /* Vega12 */
              case IP_VERSION(9, 2, 1):
                      gfx_target_version = 90004;

--
2.40.1