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

Re: [PATCH v9 16/16] xen/arm: vpci: permit access to guest vpci space


  • To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Mon, 25 Sep 2023 20:12:03 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=epam.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Bb4xPjnQOpvsJw0rFGoaYpZrwT8pVinI7f6de7Tfvi0=; b=dONiJJFD3hYICEQVFaYsJoRHP/OsCL7sWlJ69r7Pd1NI7RQgVRAgMEY+E/eMy4KHh9NHPUPoK02F7vPdjV9bMq8mOlSWwjmcphSfASnpoyaJ6kL6rmH8BWfY866UvXaKwpJw68w1dqsYXvHF3U8DPIleuSjnspzZ9HbfC+M6OzmPapNMCRSkkfumUBMc4lAIsdTx1vGyO3MUj7oLoy6WjCkX36RzHQFECj2dAmwih5m3f0BuNql8GZSdMTrOyFc7xmli/QnmfTUM/fvlsCWpABeadjIcs7PDUBovOxQvEncpWGWehxBBljeELWQHIpNeUk4kWnhUNMpvIX/d38mCsw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kmbz9bTHomc+Um/ngCsyHcX1Or6Aa6YMFt57c8ubT0pUp/i5GUdqSWxw7qLokCqCcptujEwH+awwrDuvOGCQrr2raOwlEuKtXKQeAFDpjROJqL3ilFa41jzBA5US69iC1QSOK2kPKhGB+5rTfg9HNLrRTy2ks5Yq5nW8INvWcuuaOtpVyFoMwl3uyXd/Xj04vzKcVzfIyxYeYioc6CdJLLhc36ExXGapEkfKGt6aihj6OlQHmtOESh13mvqgAu5p2pOoYFnpZfxsSmogjlFO1HfKMN67EDKvmBdqZJ99uCMOUe5dQ3+9gwUm6v6jyX1H/vS8I35RDH4JZ/1eE6jP6g==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 26 Sep 2023 00:12:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 8/29/23 19:19, Volodymyr Babchuk wrote:
> From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
> 
> Move iomem_caps initialization earlier (before arch_domain_create()).
> 
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
> ---
> This is sort of a follow-up to:
> 
>   baa6ea700386 ("vpci: add permission checks to map_range()")
> 
> I don't believe we need a fixes tag since this depends on the vPCI p2m BAR
> patches.
> ---
>  xen/arch/arm/vpci.c | 6 ++++++
>  xen/common/domain.c | 4 +++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c
> index 01b50d435e..fb5361276f 100644
> --- a/xen/arch/arm/vpci.c
> +++ b/xen/arch/arm/vpci.c
> @@ -2,6 +2,7 @@
>  /*
>   * xen/arch/arm/vpci.c
>   */
> +#include <xen/iocap.h>
>  #include <xen/sched.h>
>  #include <xen/vpci.h>
> 
> @@ -119,8 +120,13 @@ int domain_vpci_init(struct domain *d)
>              return ret;
>      }
>      else
> +    {
>          register_mmio_handler(d, &vpci_mmio_handler,
>                                GUEST_VPCI_ECAM_BASE, GUEST_VPCI_ECAM_SIZE, 
> NULL);
> +        iomem_permit_access(d, paddr_to_pfn(GUEST_VPCI_MEM_ADDR),
> +                            paddr_to_pfn(PAGE_ALIGN(GUEST_VPCI_MEM_ADDR +
> +                                                    GUEST_VPCI_MEM_SIZE - 
> 1)));

We should also permit access to GUEST_VPCI_PREFETCH_MEM_ADDR

> +    }
> 
>      return 0;
>  }
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index 9b04a20160..11a48ba7e4 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -695,6 +695,9 @@ struct domain *domain_create(domid_t domid,
>          radix_tree_init(&d->pirq_tree);
>      }
> 
> +    if ( !is_idle_domain(d) )
> +        d->iomem_caps = rangeset_new(d, "I/O Memory", 
> RANGESETF_prettyprint_hex);
> +
>      if ( (err = arch_domain_create(d, config, flags)) != 0 )
>          goto fail;
>      init_status |= INIT_arch;
> @@ -704,7 +707,6 @@ struct domain *domain_create(domid_t domid,
>          watchdog_domain_init(d);
>          init_status |= INIT_watchdog;
> 
> -        d->iomem_caps = rangeset_new(d, "I/O Memory", 
> RANGESETF_prettyprint_hex);
>          d->irq_caps   = rangeset_new(d, "Interrupts", 0);
>          if ( !d->iomem_caps || !d->irq_caps )
>              goto fail;
> --
> 2.41.0



 


Rackspace

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