[PATCH 07/11] vfio/igd: Allow hotplugging with OpRegion enabled

Tomita Moeko posted 11 patches 6 months, 4 weeks ago
There is a newer version of this series
[PATCH 07/11] vfio/igd: Allow hotplugging with OpRegion enabled
Posted by Tomita Moeko 6 months, 4 weeks ago
OpRegion is exposed to guest as a read-only fw_cfg item, so hotplugging
with it wouldn't cause issues. Since OpRegion needs to be set up by
guest firmware, a guest reboot is typically required. For linux guests,
i915 driver is able to mock VBT [1] when OpRegion is not present, the
reboot may not required.

Still, hotplugging IGD devices is highly discouraged.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bb1d132935c2f87cd261eb559759fe49d5e5dc43

Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
---
 hw/vfio/igd.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index e94ed7029a..e3ff86d0e6 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -549,10 +549,6 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
 
     /* Setup OpRegion access */
     if ((vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION)) {
-        if (vdev->pdev.qdev.hotplugged) {
-            error_setg(errp, "OpRegion is not supported on hotplugged device");
-            goto error;
-        }
         if (!vfio_pci_igd_opregion_init(vdev, opregion, errp)) {
             goto error;
         }
-- 
2.47.2
Re: [PATCH 07/11] vfio/igd: Allow hotplugging with OpRegion enabled
Posted by Alex Williamson 6 months, 3 weeks ago
On Tue, 22 Apr 2025 00:31:07 +0800
Tomita Moeko <tomitamoeko@gmail.com> wrote:

> OpRegion is exposed to guest as a read-only fw_cfg item, so hotplugging
> with it wouldn't cause issues. Since OpRegion needs to be set up by
> guest firmware, a guest reboot is typically required. For linux guests,
> i915 driver is able to mock VBT [1] when OpRegion is not present, the
> reboot may not required.
> 
> Still, hotplugging IGD devices is highly discouraged.

So why exactly are we doing this... ?

Thanks,
Alex
 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bb1d132935c2f87cd261eb559759fe49d5e5dc43
> 
> Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
> ---
>  hw/vfio/igd.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
> index e94ed7029a..e3ff86d0e6 100644
> --- a/hw/vfio/igd.c
> +++ b/hw/vfio/igd.c
> @@ -549,10 +549,6 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
>  
>      /* Setup OpRegion access */
>      if ((vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION)) {
> -        if (vdev->pdev.qdev.hotplugged) {
> -            error_setg(errp, "OpRegion is not supported on hotplugged device");
> -            goto error;
> -        }
>          if (!vfio_pci_igd_opregion_init(vdev, opregion, errp)) {
>              goto error;
>          }
Re: [PATCH 07/11] vfio/igd: Allow hotplugging with OpRegion enabled
Posted by Tomita Moeko 6 months, 3 weeks ago
On 4/25/25 06:57, Alex Williamson wrote:
> On Tue, 22 Apr 2025 00:31:07 +0800
> Tomita Moeko <tomitamoeko@gmail.com> wrote:
> 
>> OpRegion is exposed to guest as a read-only fw_cfg item, so hotplugging
>> with it wouldn't cause issues. Since OpRegion needs to be set up by
>> guest firmware, a guest reboot is typically required. For linux guests,
>> i915 driver is able to mock VBT [1] when OpRegion is not present, the
>> reboot may not required.
>>
>> Still, hotplugging IGD devices is highly discouraged.
> 
> So why exactly are we doing this... ?
> 
> Thanks,
> Alex

Just out of curiosity :) will remove it in v2.

Thanks,
Moeko

>  
>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bb1d132935c2f87cd261eb559759fe49d5e5dc43
>>
>> Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
>> ---
>>  hw/vfio/igd.c | 4 ----
>>  1 file changed, 4 deletions(-)
>>
>> diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
>> index e94ed7029a..e3ff86d0e6 100644
>> --- a/hw/vfio/igd.c
>> +++ b/hw/vfio/igd.c
>> @@ -549,10 +549,6 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
>>  
>>      /* Setup OpRegion access */
>>      if ((vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION)) {
>> -        if (vdev->pdev.qdev.hotplugged) {
>> -            error_setg(errp, "OpRegion is not supported on hotplugged device");
>> -            goto error;
>> -        }
>>          if (!vfio_pci_igd_opregion_init(vdev, opregion, errp)) {
>>              goto error;
>>          }
>