From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35651C2BA19 for ; Wed, 15 Apr 2020 09:13:18 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F95A206E9 for ; Wed, 15 Apr 2020 09:13:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F95A206E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jOe6R-0004As-BA; Wed, 15 Apr 2020 09:13:03 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jOe6P-0004An-9U for xen-devel@lists.xenproject.org; Wed, 15 Apr 2020 09:13:01 +0000 X-Inumbo-ID: 4da57f60-7ef9-11ea-b4f4-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4da57f60-7ef9-11ea-b4f4-bc764e2007e4; Wed, 15 Apr 2020 09:13:00 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B7BDAAE48; Wed, 15 Apr 2020 09:12:58 +0000 (UTC) Subject: Re: [PATCH 01/12] xen: introduce xen_dom_flags To: Stefano Stabellini References: <20200415010255.10081-1-sstabellini@kernel.org> From: Jan Beulich Message-ID: Date: Wed, 15 Apr 2020 11:12:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200415010255.10081-1-sstabellini@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: julien@xen.org, Wei Liu , George Dunlap , andrew.cooper3@citrix.com, Ian Jackson , Dario Faggioli , xen-devel@lists.xenproject.org, Stefano Stabellini , Volodymyr_Babchuk@epam.com, =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 15.04.2020 03:02, Stefano Stabellini wrote: > We are passing an extra special boolean flag at domain creation to > specify whether we want to the domain to be privileged (i.e. dom0) or > not. Another flag will be introduced later in this series. > > Introduce a new struct xen_dom_flags and move the privileged flag to it. > Other flags will be added to struct xen_dom_flags. I'm unsure whether introducing a 2nd structure is worth it here. We could as well define some internal-use-only flags for struct xen_domctl_createdomain's respective field. > --- a/xen/arch/x86/domain.c > +++ b/xen/arch/x86/domain.c > @@ -529,7 +529,8 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags) > } > > int arch_domain_create(struct domain *d, > - struct xen_domctl_createdomain *config) > + struct xen_domctl_createdomain *config, > + struct xen_dom_flags *flags) const (also elsewhere)? > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c > @@ -706,6 +706,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) > .max_maptrack_frames = -1, > }; > const char *hypervisor_name; > + struct xen_dom_flags flags = { !pv_shim }; Here and elsewhere please use field designators right away, even if there's only a single field now. > @@ -363,7 +363,7 @@ struct domain *domain_create(domid_t domid, > ASSERT(is_system_domain(d) ? config == NULL : config != NULL); > > /* Sort out our idea of is_control_domain(). */ > - d->is_privileged = is_priv; > + d->is_privileged = flags ? flags->is_priv : false; Stray double blanks. > --- a/xen/common/domctl.c > +++ b/xen/common/domctl.c > @@ -364,6 +364,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) > bool_t copyback = 0; > struct xen_domctl curop, *op = &curop; > struct domain *d; > + struct xen_dom_flags flags ={ false }; Missing blank. > --- a/xen/include/xen/domain.h > +++ b/xen/include/xen/domain.h > @@ -63,8 +63,13 @@ void arch_vcpu_destroy(struct vcpu *v); > int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset); > void unmap_vcpu_info(struct vcpu *v); > > +struct xen_dom_flags { > + bool is_priv; Use a single bit bitfield instead? May even want to consider passing this struct by value then. Jan