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

Re: [PATCH v3 6/6] vPCI: re-init extended-capability lists when MMCFG availability changed


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 29 Jan 2026 16:40:23 +0100
  • 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=4dwL8rrY/y++f5OGvSXoGfG00JAjbmmn1Q+mF9wl2pA=; b=XFrRzp86MQDoe02ZIec0XqGkY6xJwGN/fQK41WzqiVJia6z765S2lyROjpgQyVTDYxezIlOAxkXf6dGNT48r7kOJMYu0JwaXc/mf/mzXrm9HJEAtoOIhvhLMB7yNx3QN6cNuyAYeJ8w+sXaTGX5qGU0f3Wa1TW5qNATwBT7qFp8t+8W3rQWcej2DdJuszIwOdTz04OEzuLHu8cq8iKFu3iff0wdghIn2pBAQ0M2HxGwUd13nuof3rse55Rv85qXI+SLALEfsGk64yEe0hzQ+K2LI/IPohi8IBDsaYPN/9+nU9nDkQuSySJHbOwbI7tj6W+zx9zOfh7DFId578R4j+A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rRDQiOQofRzgWsRb6++YbTm+raasV/Puw5g6wUqlQTk1Gy2/uF6b89IoPHL0MfCbp5GVSJEfagb2VoT2pwHXYY5tJQzkn17gC3uY+cxifaG7teNX/as5E4IoOZ978mAj+WFSn61ber8EAfpFSuHa2y/C0vU5/pChOg6uqP38oRJVlCVznQ1i0+H4jIdNtgTHzhF3BsMp3ihihBOGW3hnml/ytUatgVN76i47uIQHKM9CyTT+5tru44C+QQWbsgQ17yrTIWzuSkbINvWELCyDnBQfWrgwLyxJSNxiiyJKbOAxgOq0OFcCwB3bY2tSDAo8knXniSBXRjxGHF9ql8Bzew==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Delivery-date: Thu, 29 Jan 2026 15:40:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Jan 29, 2026 at 02:10:34PM +0100, Jan Beulich wrote:
> When Dom0 informs up about MMCFG usability, this may change whether
> extended capabilities are available (accessible) for devices. Zap what
> might be on record, and re-initialize the list.
> 
> No synchronization is added for the case where devices may already be in
> use. That'll need sorting when (a) DomU support was added and (b) DomU-s
> may run already while Dom0 / hwdom still boots (dom0less, Hyperlaunch).
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> vpci_reinit_ext_capability_list()'s return value isn't checked, as it
> doesn't feel quite right to fail the hypercall because of this. At the
> same time it also doesn't feel quite right to have the function return
> "void". Thoughts?
> ---
> v3: New.
> 
> --- a/xen/arch/x86/physdev.c
> +++ b/xen/arch/x86/physdev.c
> @@ -8,6 +8,8 @@
>  #include <xen/guest_access.h>
>  #include <xen/iocap.h>
>  #include <xen/serial.h>
> +#include <xen/vpci.h>
> +
>  #include <asm/current.h>
>  #include <asm/io_apic.h>
>  #include <asm/msi.h>
> @@ -169,7 +171,10 @@ int cf_check physdev_check_pci_extcfg(st
>  
>      ASSERT(pdev->seg == info->segment);
>      if ( pdev->bus >= info->start_bus && pdev->bus <= info->end_bus )
> +    {
>          pci_check_extcfg(pdev);
> +        vpci_reinit_ext_capability_list(pdev);
> +    }
>  
>      return 0;
>  }
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -869,6 +869,18 @@ static int vpci_init_ext_capability_list
>      return 0;
>  }
>  
> +int vpci_reinit_ext_capability_list(const struct pci_dev *pdev)
> +{
> +    if ( !pdev->vpci )
> +        return 0;
> +
> +    if ( vpci_remove_registers(pdev->vpci, PCI_CFG_SPACE_SIZE,
> +                               PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) )
> +        ASSERT_UNREACHABLE();
> +
> +    return vpci_init_ext_capability_list(pdev);

Isn't this missing the possible addition or removal of managed
extended capabilities?  IOW: on removal of access to the extended
space the vPCI managed capabilties that have is_ext == true should
call their ->cleanup() hooks, and on discovery of MMCFG access we
should call the ->init() hooks?

Thanks, Roger.



 


Rackspace

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