[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-4.21 v2] vpci/msix: improve handling of bogus MSI-X capabilities


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 8 Oct 2025 16:59:39 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SdrZEuNbT5FGOF2ASae5QkYCjvrjXbRZKa8qWbCWAVw=; b=JEd+RgaeTsGQmWPwPvpV89JHLBLIyhID4Gpcv8d66GV5IgewhByJz1Gi2BRLBEVTuWM7s0Io6eQRrTKfP6JWhgjK/X/sFXkL/ffm3kbePEU9JiOSu6HHDvEKpJdhpif39h3v03y9SjYNAi8jwNOC3wXrb9yGgumaw3/ZMjJlaA8AapgNEe4+i/e/9ipSYOCmqHfzT/XtdLb+2RrwTuO7R/2FkYpfLhUfje9P9/qQ9flqlFqSPSnmkW/xx5I5rUTulsG8DV7mmX1S/1Z7JtOoaGlmtJvKBK09lFXiIAbL/oJkQz0uec3EUAXWHvVD7ieJGtmnR9MDZD2P55kpNoS2/A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sLwhzoopvR5/BRXfhj6fpHZqKc0lCq386dxcVsi7H+FzoJGgV6dBHMpERl+NyRamzWQUzMzjIK7Gg6tpCY/l1k6Ot3tAOZ6H6SrZZpoAlCfH2n+zcqunnkt7ovQ5DcyOIDJnQBdUWK7YARW4yJBI5/7dB9ZWqLfJauqqjKLtS3KJY7phdiwkYSFDKuEMoyQtt/EOai3g0th+4DdxtuWObcnHm8glBlgLxUsmL+lCVij1mgnv9/2/xckFP8lh/O3hg08kEaIz/di1RfVH/xl0VKL6cCeibHFmDe2XERnHaxA1T121lLDw3Ju/7iigump3EB78TQqOteHCoX/l1aWogQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: oleksii.kurochko@xxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Delivery-date: Wed, 08 Oct 2025 15:00:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Oct 08, 2025 at 04:39:23PM +0200, Roger Pau Monne wrote:
> I've had the luck to come across a PCI card that exposes a MSI-X capability
> where the BIR of the vector and PBA tables points at a BAR that has 0 size.
> 
> This doesn't play nice with the code in vpci_make_msix_hole(), as it would
> still use the address of such empty BAR (0) and attempt to carve a hole in
> the p2m.  This leads to errors like the one below being reported by Xen:
> 
> d0v0 0000:22:00.0: existing mapping (mfn: 181c4300 type: 0) at 0 clobbers 
> MSIX MMIO area
> 
> And the device left unable to enable memory decoding due to the failure
> reported by vpci_make_msix_hole().
> 
> Introduce checking in init_msix() to ensure the BARs containing the MSI-X
> tables are usable.  This requires checking that the BIR points to a
> non-empty BAR, and the offset and size of the MSI-X tables can fit in the
> target BAR.
> 
> This fixes booting PVH dom0 on Supermicro AS -2126HS-TN severs with AMD
> EPYC 9965 processors.  The broken device is:
> 
> 22:00.0 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA 
> Controller [AHCI mode] (rev 93)
> 
> There are multiple of those integrated controllers in the system, all
> broken in the same way.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> Released-Acked-By: Oleksii Kurochko<oleksii.kurochko@xxxxxxxxx>
> ---
> Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
> Cc: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
> ---
> Changes since v1:
>  - Introduce a DEVICE BUG prefix.
>  - Remove extra newline.
>  - Fix typo in commit message.
> ---
>  xen/drivers/vpci/msix.c | 50 ++++++++++++++++++++++++++++++++++++-----
>  xen/include/xen/lib.h   |  3 +++
>  2 files changed, 48 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
> index 54a5070733aa..4ddcefbcb274 100644
> --- a/xen/drivers/vpci/msix.c
> +++ b/xen/drivers/vpci/msix.c
> @@ -675,6 +675,51 @@ static int cf_check init_msix(struct pci_dev *pdev)
>      if ( !msix )
>          return -ENOMEM;
>  
> +    msix->tables[VPCI_MSIX_TABLE] =
> +        pci_conf_read32(pdev->sbdf, msix_table_offset_reg(msix_offset));
> +    msix->tables[VPCI_MSIX_PBA] =
> +        pci_conf_read32(pdev->sbdf, msix_pba_offset_reg(msix_offset));
> +
> +    /* Check that the provided BAR is valid. */

I had the following local change that I forgot to update the patch
with before sending:

/* Check that the referenced BAR(s) regions are valid. */

I think this is a better wording.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.