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

Re: [PATCH v2] xen: introduce XENFEAT_direct_mapped and XENFEAT_not_direct_mapped



On 26.02.2021 23:52, Stefano Stabellini wrote:
> Introduce two feature flags to tell the domain whether it is
> direct-mapped or not. It allows the guest kernel to make informed
> decisions on things such as swiotlb-xen enablement.
> 
> The introduction of both flags (XENFEAT_direct_mapped and
> XENFEAT_not_direct_mapped) allows the guest kernel to avoid any
> guesswork if one of the two is present, or fallback to the current
> checks if neither of them is present.
> 
> XENFEAT_direct_mapped is always set for not auto-translated guests.
> 
> For auto-translated guests, only Dom0 on ARM is direct-mapped. Also,
> see is_domain_direct_mapped() which refers to auto-translated guests:
> xen/include/asm-arm/domain.h:is_domain_direct_mapped
> xen/include/asm-x86/domain.h:is_domain_direct_mapped
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
preferably with one cosmetic aspect taken care of:

> --- a/xen/common/kernel.c
> +++ b/xen/common/kernel.c
> @@ -560,6 +560,10 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) 
> arg)
>                               (1U << XENFEAT_hvm_callback_vector) |
>                               (has_pirq(d) ? (1U << XENFEAT_hvm_pirqs) : 0);
>  #endif
> +            if ( is_domain_direct_mapped(d) || !paging_mode_translate(d) )

While I realize the left side of the || is what you're after,
I'd generally see the more common/universal/whatever-you-want-
to-call-it condition be checked first, and the most special
purpose one last. IOW I'd prefer if both side of the || could
be swapped.

Jan



 


Rackspace

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