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

Re: [PATCH v5 4/5] [FUTURE] xen/arm: enable vPCI for domUs


  • To: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 6 Nov 2023 10:26:41 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; 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=vYN8ptyLz54paeRSlbGwEqaXGw/wC7h0IBeHgj9h1s4=; b=ho61lZ2wuidXz7G8eJlFWqqfECy/D6/YlywT/nNv84yBVsnWbAjD73fNkv1Ad2Pryu2bMLDmUtHS0ciBeaEfabz8OdP+3aC9PIHVkcIke10jQXHKshn15nvAzo1I5H998G3jsIShTowsW1MuZwnwQ7ihaFC3LEqNrn1X0RhB/NAmoXP+C90xWKNJU/3I3Mwp9uTqTBywHuvZKx0oFaYkWQQECGD0XsTwGs0yWR9IrLajobZ+yi3Uql6ikyC9m0hQOSLmfsJN+qrE1OchPgzgZwMMOp3CJ1ceh5HRNuP+WoKv7/4ssxhycCkNP1Tp2O0bhABOfLqSaJFjrwEaKlYYKQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N+hhP/IwJA4L6TWf6wmCSJQgF5LKgn9yLKccza0ORFd05xZS9chSpPeLjKxYfmaeakYiDxcroYGAp3kkXGVpylPDEPbb5xRyoVCMFZ/d+2amGvlGd5huwRrqaNPzafOPBBz0rmcVH5yIG3yFA6CMdKqGjvw7kHLbDSuGPjFnj4rLyJABHjfPvozi4YFiyPoV6hGhEvGYc6CJs/17SMlxWTqLIrdmDpJe7v0A5JuxzkUAjsKBnUa/8warMWxRKIk4ONctheLuzX3lC6vAszcVrSC/uYqi0chEw/67XO2rqnAaTuX7JXZ7ruy83q2ffK6y++/XDEf8G7dKQNItEhESDA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 06 Nov 2023 09:26:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 02.11.2023 20:59, Stewart Hildebrand wrote:
> --- a/xen/arch/x86/include/asm/domain.h
> +++ b/xen/arch/x86/include/asm/domain.h
> @@ -503,6 +503,15 @@ struct arch_domain
>  #define has_vpit(d)        (!!((d)->arch.emulation_flags & X86_EMU_PIT))
>  #define has_pirq(d)        (!!((d)->arch.emulation_flags & X86_EMU_USE_PIRQ))
>  
> +#define is_pvh_domain(d) ({                                  \
> +    unsigned int _emflags = (d)->arch.emulation_flags;       \
> +    IS_ENABLED(CONFIG_HVM) &&                                \
> +        ((_emflags == X86_EMU_LAPIC) ||                      \
> +         (_emflags == (X86_EMU_LAPIC | X86_EMU_IOAPIC))); })

I'm not convinced we want to re-introduce such a predicate; it'll be at
risk of going stale when the boundary between HVM and PVH becomes more
"fuzzy".

> +/* PCI passthrough may be backed by qemu for non-PVH domains */
> +#define arch_needs_vpci(d) is_pvh_domain(d)

Wouldn't we want to check for exactly what the comment alludes to then,
i.e. whether the domain has any (specific?) device model attached?

> --- a/xen/include/xen/domain.h
> +++ b/xen/include/xen/domain.h
> @@ -51,8 +51,17 @@ void arch_get_domain_info(const struct domain *d,
>  
>  #define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem)
>  
> -#define has_vpci(d) (((d)->options & XEN_DOMCTL_CDF_vpci) && \
> -                     IS_ENABLED(CONFIG_HAS_VPCI))
> +#define has_vpci(d) ({                                                       
>  \
> +    const struct domain *_d = (d);                                           
>  \
> +    bool _has_vpci = false;                                                  
>  \
> +    if ( (_d->options & XEN_DOMCTL_CDF_vpci) && IS_ENABLED(CONFIG_HAS_VPCI) 
> ) \
> +    {                                                                        
>  \
> +        if ( is_hardware_domain(_d) )                                        
>  \
> +            _has_vpci = true;                                                
>  \
> +        else if ( IS_ENABLED(CONFIG_HAS_VPCI_GUEST_SUPPORT) )                
>  \
> +            _has_vpci = true;                                                
>  \
> +    }                                                                        
>  \
> +    _has_vpci; })

This is a commonly executed check, and as such wants to remain as simple as
possible. Wouldn't it be better anyway to prevent XEN_DOMCTL_CDF_vpci getting
set for a domain which cannot possibly have vPCI?

Jan



 


Rackspace

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