drm/amdgpu/sriov: omit fbcon error under sriov or passthrough

Submitted by Deng, Emily on Sept. 18, 2019, 9:24 a.m.

Details

Message ID MN2PR12MB2975249E263CA40AD28DD5AA8F8E0@MN2PR12MB2975.namprd12.prod.outlook.com
State New
Headers show
Series "drm/amdgpu/sriov: omit fbcon error under sriov or passthrough" ( rev: 6 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Deng, Emily Sept. 18, 2019, 9:24 a.m.
Hi Christian,
Do you mean, for passthrough mode, the desktop is rendered by our asic, but enduser is trying to remove the driver by hot plug?

Best wishes
Emily Deng
From: Koenig, Christian <Christian.Koenig@amd.com>

Sent: Wednesday, September 18, 2019 4:44 PM
To: Deng, Emily <Emily.Deng@amd.com>
Cc: Zhang, Jack (Jian) <Jack.Zhang1@amd.com>; amd-gfx@lists.freedesktop.org; Teng, Rui <Rui.Teng@amd.com>; Cui, Flora <Flora.Cui@amd.com>
Subject: RE: [PATCH] drm/amdgpu/sriov: omit fbcon error under sriov or passthrough

Hi Emily,

Yeah, exactly that's the problem: In some cases the driver can be unloaded while it is still in use!

See we added this error message because endusers tried to use PCIe hot plug to unload the driver to use the hardware for paththrough.

But this will completely nuke your desktop, even when amdgpu is only a secondary device like in the qxl case.

Jack is using the correct way of doing it, e.g. using "modprobe -r" or rmmod. Both commands check the use count before unloading the driver instances.

I don't see a way to distingt the two cases and what Jack is doing is unfortunate not the common one.

Regards,
Christian.


Am 18.09.2019 10:08 schrieb "Deng, Emily" <Emily.Deng@amd.com<mailto:Emily.Deng@amd.com>>:

Hi Christian,

     Before unloading driver, user must sure there is not any userspace to use of amdgpu, if not, it will report driver is in use. And the unloading driver is a feature about amdgpu driver which will be easier to replace driver without rebooting VM. Do you think it has any issue about driver unloading path?



Best wishes

Emily Deng

From: Koenig, Christian <Christian.Koenig@amd.com<mailto:Christian.Koenig@amd.com>>

Sent: Wednesday, September 18, 2019 3:54 PM
To: Zhang, Jack (Jian) <Jack.Zhang1@amd.com<mailto:Jack.Zhang1@amd.com>>
Cc: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>; Teng, Rui <Rui.Teng@amd.com<mailto:Rui.Teng@amd.com>>; Deng, Emily <Emily.Deng@amd.com<mailto:Emily.Deng@amd.com>>; Cui, Flora <Flora.Cui@amd.com<mailto:Flora.Cui@amd.com>>
Subject: RE: [PATCH] drm/amdgpu/sriov: omit fbcon error under sriov or passthrough



Hi Jack,



Well that believe is unfortunately completely wrong.



The point is that ANY use of amdgpu by userspace will prevent correct driver unload, that qxl is used for the fbcon doesn't change anything here.



So the patch is a clear NAK. Driver unload is not supposed to work even under SRIOV.



Regards,

Christian.







Am 18.09.2019 09:32 schrieb "Zhang, Jack (Jian)" <Jack.Zhang1@amd.com<mailto:Jack.Zhang1@amd.com>>:

Hi, Christian and folks,

In virtual machines(such virt-manager), there's always a virtual graphics device existed like "qxl" as the default gfx device.
So under such condition, we believe it's reasonable to unload amdgpu driver as it is not treated as the default fbcon device.

Would you please help to review this patch?

Best wishes,
Jack

-----Original Message-----
From: Jack Zhang <Jack.Zhang1@amd.com<mailto:Jack.Zhang1@amd.com>>

Sent: Wednesday, September 18, 2019 3:25 PM
To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>
Cc: Zhang, Jack (Jian) <Jack.Zhang1@amd.com<mailto:Jack.Zhang1@amd.com>>
Subject: [PATCH] drm/amdgpu/sriov: omit fbcon error under sriov or passthrough

In virtual machine, there would be a qxl or cirrus graphics device as the default master fbcon device.

So for PF(passthrough mode) or SRIOV VF, it is reasonable to unload amdgpu driver. Amdgpu doesn't have to be the only fbcon device under this condition.

Signed-off-by: Jack Zhang <Jack.Zhang1@amd.com<mailto:Jack.Zhang1@amd.com>>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

2.7.4

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 420888e..ada2b25 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1103,8 +1103,9 @@  static void
 amdgpu_pci_remove(struct pci_dev *pdev)  {
         struct drm_device *dev = pci_get_drvdata(pdev);
-
-       DRM_ERROR("Device removal is currently not supported outside of fbcon\n");
+       struct amdgpu_device *adev = dev->dev_private;
+       if (!amdgpu_sriov_vf(adev) && !amdgpu_passthrough(adev))
+               DRM_ERROR("Device removal is currently not supported outside of
+fbcon\n");
         drm_dev_unplug(dev);
         drm_dev_put(dev);
         pci_disable_device(pdev);
--