drm/amdgpu: Toggle msix after FLR for sriov
Subsystems (2)
PATCH 1/1 drm/amdgpu: Toggle msix after FLR for sriov
From: "Emily.Deng" <[email protected]>
For vf assigned to guest VM, after FLR, the msix table will be reset. As the flr is done on host driver. The qemu and vfio driver don't know this, and the msix is still enable from qemu and vfio driver side. So if want to re-setup the msix table, first need to disable and re-enable the msix from guest VM side or the qemu will do nothing as it thought the msix is already enabled.
v2:
Change name with amdgpu_irq prefix, remove #ifdef.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +14 -0
@@ -277,6 +277,17 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } +static void amdgpu_irq_restore_msix (struct amdgpu_device *adev) +{ +u16 ctrl; + +pci_read_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , &ctrl); + ctrl &= ~PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); + ctrl |=PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); +} +/** * amdgpu_irq_init - initialize interrupt handling *
@@ -558,6 +569,9 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) {int i, j, k; +if (amdgpu_sriov_vf (adev)) +amdgpu_irq_restore_msix (adev); +for (i =0 ; i <AMDGPU_IRQ_CLIENTID_MAX ; ++i) {if (!adev->irq.client[i].sources)continue ;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
Ping ......
Quoted 60 lines
-----Original Message-----
From: Emily Deng <[email protected]>
Sent: Tuesday, March 30, 2021 5:43 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH] drm/amdgpu: Toggle msix after FLR for sriovFrom: "Emily.Deng" <[email protected]>
For vf assigned to guest VM, after FLR, the msix table will be reset. As the flr is done on host driver. The qemu and vfio driver don't know this, and the msix is still enable from qemu and vfio driver side.
So if want to re-setup the msix table, first need to disable and re-enable the msix from guest VM side or the qemu will do nothing as it thought the msix is already enabled.v2:
Change name withamdgpu_irqprefix, remove #ifdef.Signed-off-by Emily.Deng <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c| 14 ++++++++++++++1 file changed, 14 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +10
-0@@ -277,6 +277,17 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } +static void amdgpu_irq_restore_msix (struct amdgpu_device *adev) { +u16 ctrl; + +pci_read_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , &ctrl); +ctrl &= ~PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); +ctrl |=PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap + +PCI_MSIX_FLAGS , ctrl); } +/**
*amdgpu_irq_init- initialize interrupt handling *drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +3
-1@@ -558,6 +569,9 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) {int i, j, k; +if (amdgpu_sriov_vf (adev)) +amdgpu_irq_restore_msix (adev); +for (i =0 ; i <AMDGPU_IRQ_CLIENTID_MAX ; ++i) {if (!adev->irq.client[i].sources)continue ; --
Quoted 1 line
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
Ping ......
Quoted 60 lines
-----Original Message-----
From: Emily Deng <[email protected]>
Sent: Tuesday, March 30, 2021 5:43 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH] drm/amdgpu: Toggle msix after FLR for sriovFrom: "Emily.Deng" <[email protected]>
For vf assigned to guest VM, after FLR, the msix table will be reset. As the flr is done on host driver. The qemu and vfio driver don't know this, and the msix is still enable from qemu and vfio driver side.
So if want to re-setup the msix table, first need to disable and re-enable the msix from guest VM side or the qemu will do nothing as it thought the msix is already enabled.v2:
Change name withamdgpu_irqprefix, remove #ifdef.Signed-off-by Emily.Deng <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c| 14 ++++++++++++++1 file changed, 14 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +10
-0@@ -277,6 +277,17 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } +static void amdgpu_irq_restore_msix (struct amdgpu_device *adev) { +u16 ctrl; + +pci_read_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , &ctrl); +ctrl &= ~PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); +ctrl |=PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap + +PCI_MSIX_FLAGS , ctrl); } +/**
*amdgpu_irq_init- initialize interrupt handling *drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +3
-1@@ -558,6 +569,9 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) {int i, j, k; +if (amdgpu_sriov_vf (adev)) +amdgpu_irq_restore_msix (adev); +for (i =0 ; i <AMDGPU_IRQ_CLIENTID_MAX ; ++i) {if (!adev->irq.client[i].sources)continue ; --
Quoted 1 line
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
Hi Monk,
Could you help to review this patch?
Best wishes
Emily Deng
Quoted 63 lines
-----Original Message-----
From: Deng, Emily <[email protected]>
Sent: Wednesday, March 31, 2021 5:02 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: Toggle msix after FLR for sriov[AMD Official Use Only - Internal Distribution Only]
Ping ......
Quoted 53 lines
-----Original Message-----
From: Emily Deng <[email protected]>
Sent: Tuesday, March 30, 2021 5:43 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH] drm/amdgpu: Toggle msix after FLR for sriovFrom: "Emily.Deng" <[email protected]>
For vf assigned to guest VM, after FLR, the msix table will be reset. As the flr is done on host driver. The qemu and vfio driver don't know this, and the msix is still enable from qemu and vfio driver side. So if want to re-setup the msix table, first need to disable and re-enable the msix from guest VM side or the qemu will do nothing as it thought the msix is already enabled.
v2:
Change name withamdgpu_irqprefix, remove #ifdef.Signed-off-by Emily.Deng <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c| 14 ++++++++++++++1 file changed, 14 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +10
-0@@ -277,6 +277,17 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } +static void amdgpu_irq_restore_msix (struct amdgpu_device *adev) { +u16 ctrl; + +pci_read_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , &ctrl); +ctrl &= ~PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); +ctrl |=PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap + +PCI_MSIX_FLAGS , ctrl); } +/**
*amdgpu_irq_init- initialize interrupt handling *drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0
-0@@ -558,6 +569,9 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) {int i, j, k;
Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +3
-0+if (amdgpu_sriov_vf (adev)) +amdgpu_irq_restore_msix (adev); +for (i = 0; i <
AMDGPU_IRQ_CLIENTID_MAX; ++i) { if (!adev->irq.client[i].sources) continue; --
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Liu, Monk
Reviewed-by[AMD Official Use Only - Internal Distribution Only]
Thanks
------------------------------------------
Monk Liu | Cloud-GPU Core team
------------------------------------------
-----Original Message-----
From: Deng, Emily <[email protected]>
Sent: Thursday, April 1, 2021 2:04 PM
To: Liu, Monk <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH] drm/amdgpu: Toggle msix after FLR for sriov
[AMD Official Use Only - Internal Distribution Only]
Hi Monk,
Could you help to review this patch?
Best wishes
Emily Deng
Quoted 63 lines
-----Original Message-----
From: Deng, Emily <[email protected]>
Sent: Wednesday, March 31, 2021 5:02 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: Toggle msix after FLR for sriov[AMD Official Use Only - Internal Distribution Only]
Ping ......
Quoted 53 lines
-----Original Message-----
From: Emily Deng <[email protected]>
Sent: Tuesday, March 30, 2021 5:43 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH] drm/amdgpu: Toggle msix after FLR for sriovFrom: "Emily.Deng" <[email protected]>
For vf assigned to guest VM, after FLR, the msix table will be reset. As the flr is done on host driver. The qemu and vfio driver don't know this, and the msix is still enable from qemu and vfio driver side. So if want to re-setup the msix table, first need to disable and re-enable the msix from guest VM side or the qemu will do nothing as it thought the msix is already enabled.
v2:
Change name withamdgpu_irqprefix, remove #ifdef.Signed-off-by Emily.Deng <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c| 14 ++++++++++++++1 file changed, 14 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +10
-0@@ -277,6 +277,17 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } +static void amdgpu_irq_restore_msix (struct amdgpu_device *adev) { +u16 ctrl; + +pci_read_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , &ctrl); +ctrl &= ~PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); +ctrl |=PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap + +PCI_MSIX_FLAGS , ctrl); } +/**
*amdgpu_irq_init- initialize interrupt handling *drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0
-0@@ -558,6 +569,9 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) {int i, j, k;
Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +3
-0+if (amdgpu_sriov_vf (adev)) +amdgpu_irq_restore_msix (adev); +for (i = 0; i <
AMDGPU_IRQ_CLIENTID_MAX; ++i) { if (!adev->irq.client[i].sources) continue; --
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 40 lines · Emily Deng
From: "Emily.Deng" <[email protected]>
For vf assigned to guest VM, after FLR, the msix table will be reset. As the flr is done on host driver. The qemu and vfio driver don't know this, and the msix is still enable from qemu and vfio driver side. So if want to re-setup the msix table, first need to disable and re-enable the msix from guest VM side or the qemu will do nothing as it thought the msix is already enabled.
v2:
Change name withamdgpu_irqprefix, remove #ifdef.Signed-off-by Emily.Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +11
-0@@ -277,6 +277,17 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } +static void amdgpu_irq_restore_msix (struct amdgpu_device *adev) +{ +u16 ctrl; + +pci_read_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , &ctrl); + ctrl &= ~PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); + ctrl |=PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); +} +/** * amdgpu_irq_init - initialize interrupt handling *
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) · line 577
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +3
-0@@ -558,6 +569,9 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) {int i, j, k; +if (amdgpu_sriov_vf (adev)) +amdgpu_irq_restore_msix (adev); +for (i =0 ; i <AMDGPU_IRQ_CLIENTID_MAX ; ++i) {if (!adev->irq.client[i].sources)continue ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx