mbox series

[v3,0/2] vfio/spapr: Fix L2 crash with PCI device passthrough

Message ID 20250408124042.2695955-1-amachhiw@linux.ibm.com (mailing list archive)
Headers show
Series vfio/spapr: Fix L2 crash with PCI device passthrough | expand

Message

Amit Machhiwal April 8, 2025, 12:40 p.m. UTC
Hi,

This patch series addresses two aspects in vfio_spapr_create_window() that
includes the enhancement in error handling in this function and also fixes an
issue with KVM guests (L2) inside a pSeries logical partition (LPAR) with larger
memory configurations and PCI device passthrough.

The structure of the patch series is as below:

1. The first patch introduces structured error reporting in
   `vfio_spapr_create_window()` by adding an `Error **` parameter. This allows
   better propagation of failure details to the caller.

2. The second patch fixes a crash observed when booting an L2 KVM guest inside a
   pSeries LPAR with memory more than 128 GB and PCI device passthrough. The
   crash occurs due a check in KVM preventing multi-level TCEs because of not
   being supported by PowerVM hypervisor. This patch ensures that such
   configurations are avoided by first checking the supported number of levels
   returned by the `VFIO_IOMMU_SPAPR_TCE_GET_INFO` ioctl.

The fix has been tested with KVM guests on PowerVM and bare-metal enviroments
with memory sizes up to 390 GB and 450 GB respectively.

Thanks,
Amit

Changes in v3:
  * Change vfio_spapr_create_window() to return bool
  * Replace error_setg() with error_setg_errono() in vfio_spapr_create_window()
  * Pass errp instead of local Error object in vfio_spapr_create_window()
    while calling from vfio_spapr_add_section_window()
  * Modified patch #2 subject

Changes in v2:
  * Link: https://lore.kernel.org/all/20250407143119.1304513-1-amachhiw@linux.ibm.com/
  * Added Error ** parameter in vfio_spapr_create_window() for enhanced error
    handling with error_setg() and friends

v1: https://lore.kernel.org/all/20250404091721.2653539-1-amachhiw@linux.ibm.com/

Amit Machhiwal (2):
  vfio/spapr: Enhance error handling in vfio_spapr_create_window()
  vfio/spapr: Fix L2 crash with PCI device passthrough and memory > 128G

 hw/vfio/spapr.c | 69 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 43 insertions(+), 26 deletions(-)


base-commit: dfaecc04c46d298e9ee81bd0ca96d8754f1c27ed

Comments

Cédric Le Goater April 9, 2025, 10 a.m. UTC | #1
On 4/8/25 14:40, Amit Machhiwal wrote:
> Hi,
> 
> This patch series addresses two aspects in vfio_spapr_create_window() that
> includes the enhancement in error handling in this function and also fixes an
> issue with KVM guests (L2) inside a pSeries logical partition (LPAR) with larger
> memory configurations and PCI device passthrough.
> 
> The structure of the patch series is as below:
> 
> 1. The first patch introduces structured error reporting in
>     `vfio_spapr_create_window()` by adding an `Error **` parameter. This allows
>     better propagation of failure details to the caller.
> 
> 2. The second patch fixes a crash observed when booting an L2 KVM guest inside a
>     pSeries LPAR with memory more than 128 GB and PCI device passthrough. The
>     crash occurs due a check in KVM preventing multi-level TCEs because of not
>     being supported by PowerVM hypervisor. This patch ensures that such
>     configurations are avoided by first checking the supported number of levels
>     returned by the `VFIO_IOMMU_SPAPR_TCE_GET_INFO` ioctl.
> 
> The fix has been tested with KVM guests on PowerVM and bare-metal enviroments
> with memory sizes up to 390 GB and 450 GB respectively.
> 
> Thanks,
> Amit
> 
> Changes in v3:
>    * Change vfio_spapr_create_window() to return bool
>    * Replace error_setg() with error_setg_errono() in vfio_spapr_create_window()
>    * Pass errp instead of local Error object in vfio_spapr_create_window()
>      while calling from vfio_spapr_add_section_window()
>    * Modified patch #2 subject
> 
> Changes in v2:
>    * Link: https://lore.kernel.org/all/20250407143119.1304513-1-amachhiw@linux.ibm.com/
>    * Added Error ** parameter in vfio_spapr_create_window() for enhanced error
>      handling with error_setg() and friends
> 
> v1: https://lore.kernel.org/all/20250404091721.2653539-1-amachhiw@linux.ibm.com/
> 
> Amit Machhiwal (2):
>    vfio/spapr: Enhance error handling in vfio_spapr_create_window()
>    vfio/spapr: Fix L2 crash with PCI device passthrough and memory > 128G
> 
>   hw/vfio/spapr.c | 69 ++++++++++++++++++++++++++++++-------------------
>   1 file changed, 43 insertions(+), 26 deletions(-)
> 
> 
> base-commit: dfaecc04c46d298e9ee81bd0ca96d8754f1c27ed


Applied to vfio-next.

Thanks,

C.