<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@DengXian";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi Christian,<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:10.0pt">Do you mean, for passthrough mode, the desktop is rendered by our asic, but enduser is trying to remove the driver by hot plug?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best wishes<o:p></o:p></p>
<p class="MsoNormal">Emily Deng<o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Koenig, Christian <Christian.Koenig@amd.com> <br>
<b>Sent:</b> Wednesday, September 18, 2019 4:44 PM<br>
<b>To:</b> Deng, Emily <Emily.Deng@amd.com><br>
<b>Cc:</b> Zhang, Jack (Jian) <Jack.Zhang1@amd.com>; amd-gfx@lists.freedesktop.org; Teng, Rui <Rui.Teng@amd.com>; Cui, Flora <Flora.Cui@amd.com><br>
<b>Subject:</b> RE: [PATCH] drm/amdgpu/sriov: omit fbcon error under sriov or passthrough<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi Emily,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Yeah, exactly that's the problem: In some cases the driver can be unloaded while it is still in use!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">See we added this error message because endusers tried to use PCIe hot plug to unload the driver to use the hardware for paththrough.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">But this will completely nuke your desktop, even when amdgpu is only a secondary device like in the qxl case.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I don't see a way to distingt the two cases and what Jack is doing is unfortunate not the common one.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Christian.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Am 18.09.2019 10:08 schrieb "Deng, Emily" <<a href="mailto:Emily.Deng@amd.com">Emily.Deng@amd.com</a>>:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p>Hi Christian,<o:p></o:p></p>
<p> 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?<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>Best wishes<o:p></o:p></p>
<p>Emily Deng<o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p><b>From:</b> Koenig, Christian <<a href="mailto:Christian.Koenig@amd.com">Christian.Koenig@amd.com</a>>
<br>
<b>Sent:</b> Wednesday, September 18, 2019 3:54 PM<br>
<b>To:</b> Zhang, Jack (Jian) <<a href="mailto:Jack.Zhang1@amd.com">Jack.Zhang1@amd.com</a>><br>
<b>Cc:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>; Teng, Rui <<a href="mailto:Rui.Teng@amd.com">Rui.Teng@amd.com</a>>; Deng, Emily <<a href="mailto:Emily.Deng@amd.com">Emily.Deng@amd.com</a>>; Cui, Flora <<a href="mailto:Flora.Cui@amd.com">Flora.Cui@amd.com</a>><br>
<b>Subject:</b> RE: [PATCH] drm/amdgpu/sriov: omit fbcon error under sriov or passthrough<o:p></o:p></p>
</div>
</div>
<p> <o:p></o:p></p>
<div>
<div>
<p>Hi Jack,<o:p></o:p></p>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>Well that believe is unfortunately completely wrong.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>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.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>So the patch is a clear NAK. Driver unload is not supposed to work even under SRIOV.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>Regards,<o:p></o:p></p>
</div>
<div>
<p>Christian.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
</div>
<div>
<p> <o:p></o:p></p>
<div>
<p>Am 18.09.2019 09:32 schrieb "Zhang, Jack (Jian)" <<a href="mailto:Jack.Zhang1@amd.com">Jack.Zhang1@amd.com</a>>:<o:p></o:p></p>
</div>
</div>
</div>
<div>
<p style="margin-bottom:12.0pt">Hi, Christian and folks,<br>
<br>
In virtual machines(such virt-manager), there's always a virtual graphics device existed like "qxl" as the default gfx device.<br>
So under such condition, we believe it's reasonable to unload amdgpu driver as it is not treated as the default fbcon device.<br>
<br>
Would you please help to review this patch?<br>
<br>
Best wishes,<br>
Jack<br>
<br>
-----Original Message-----<br>
From: Jack Zhang <<a href="mailto:Jack.Zhang1@amd.com">Jack.Zhang1@amd.com</a>> <br>
Sent: Wednesday, September 18, 2019 3:25 PM<br>
To: <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
Cc: Zhang, Jack (Jian) <<a href="mailto:Jack.Zhang1@amd.com">Jack.Zhang1@amd.com</a>><br>
Subject: [PATCH] drm/amdgpu/sriov: omit fbcon error under sriov or passthrough<br>
<br>
In virtual machine, there would be a qxl or cirrus graphics device as the default master fbcon device.<br>
<br>
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.<br>
<br>
Signed-off-by: Jack Zhang <<a href="mailto:Jack.Zhang1@amd.com">Jack.Zhang1@amd.com</a>><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++--<br>
1 file changed, 3 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
index 420888e..ada2b25 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
@@ -1103,8 +1103,9 @@ static void<br>
amdgpu_pci_remove(struct pci_dev *pdev) {<br>
struct drm_device *dev = pci_get_drvdata(pdev);<br>
-<br>
- DRM_ERROR("Device removal is currently not supported outside of fbcon\n");<br>
+ struct amdgpu_device *adev = dev->dev_private;<br>
+ if (!amdgpu_sriov_vf(adev) && !amdgpu_passthrough(adev))<br>
+ DRM_ERROR("Device removal is currently not supported outside of <br>
+fbcon\n");<br>
drm_dev_unplug(dev);<br>
drm_dev_put(dev);<br>
pci_disable_device(pdev);<br>
--<br>
2.7.4<o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>