Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 22628C433F5 for ; Wed, 9 Mar 2022 20:17:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.288083.488519 (Exim 4.92) (envelope-from ) id 1nS2kL-0004qi-UD; Wed, 09 Mar 2022 20:17:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 288083.488519; Wed, 09 Mar 2022 20:17:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nS2kL-0004qb-RO; Wed, 09 Mar 2022 20:17:21 +0000 Received: by outflank-mailman (input) for mailman id 288083; Wed, 09 Mar 2022 20:17:21 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nS2kL-0004qV-C5 for xen-devel@lists.xenproject.org; Wed, 09 Mar 2022 20:17:21 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nS2kK-0004GI-Ur; Wed, 09 Mar 2022 20:17:20 +0000 Received: from 54-240-197-225.amazon.com ([54.240.197.225] helo=[10.95.155.231]) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nS2kK-0002du-P5; Wed, 09 Mar 2022 20:17:20 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID; bh=DeOcCELI9sG6axh7pTB3g2EfK53JgnjI3EtSfGxe3YA=; b=Yf/O325E0LxEDkqlCjYTtwXJfc wrywoaIO4vG0JHQsthtntO+wjuT9R/To4NknkJoNZyNWsjcDLxhZ6dNeXWxv7ocaMYNhvkxiLO3XB Y+DmDA0/98HDcrjEQtXbbBfuh8/sFK9hgSrzUOyoq77U62LmKBvstHMQQ/SQmYsZGpdA=; Message-ID: <55fb729a-c52e-0cca-3fa0-96dbffdee6de@xen.org> Date: Wed, 9 Mar 2022 20:17:18 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH 10/36] xen/arch: check color selection function To: Marco Solieri , xen-devel@lists.xenproject.org Cc: Andrew Cooper , George Dunlap , Jan Beulich , Stefano Stabellini , Wei Liu , Marco Solieri , Andrea Bastoni , Luca Miccio References: <20220304174701.1453977-1-marco.solieri@minervasys.tech> <20220304174701.1453977-11-marco.solieri@minervasys.tech> From: Julien Grall In-Reply-To: <20220304174701.1453977-11-marco.solieri@minervasys.tech> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On 04/03/2022 17:46, Marco Solieri wrote: > From: Luca Miccio > > Dom0 color configuration is parsed in the Xen command line. Add an > helper function to check the user selection. If no configuration is > provided by the user, all the available colors supported by the > hardware will be assigned to dom0. From the commit message, I was expecting the function to be used. Can this be introduced when you introduce its user? > > Signed-off-by: Luca Miccio > Signed-off-by: Marco Solieri > --- > xen/arch/arm/coloring.c | 17 +++++++++++++++++ > xen/arch/arm/include/asm/coloring.h | 8 ++++++++ > 2 files changed, 25 insertions(+) > > diff --git a/xen/arch/arm/coloring.c b/xen/arch/arm/coloring.c > index f6e6d09477..382d558021 100644 > --- a/xen/arch/arm/coloring.c > +++ b/xen/arch/arm/coloring.c > @@ -179,6 +179,23 @@ uint32_t *setup_default_colors(uint32_t *col_num) > return NULL; > } > > +bool check_domain_colors(struct domain *d) > +{ > + int i; > + bool ret = false; > + > + if ( !d ) > + return ret; > + > + if ( d->max_colors > max_col_num ) > + return ret; > + > + for ( i = 0; i < d->max_colors; i++ ) > + ret |= (d->colors[i] > (max_col_num - 1)); > + > + return !ret; > +} > + > bool __init coloring_init(void) > { > int i; > diff --git a/xen/arch/arm/include/asm/coloring.h b/xen/arch/arm/include/asm/coloring.h > index 8f24acf082..fdd46448d7 100644 > --- a/xen/arch/arm/include/asm/coloring.h > +++ b/xen/arch/arm/include/asm/coloring.h > @@ -26,8 +26,16 @@ > #define MAX_COLORS_CELLS 4 > > #ifdef CONFIG_COLORING > +#include > + > bool __init coloring_init(void); > > +/* > + * Check colors of a given domain. > + * Return true if check passed, false otherwise. > + */ > +bool check_domain_colors(struct domain *d); > + > /* > * Return an array with default colors selection and store the number of > * colors in @param col_num. The array selection will be equal to the dom0 -- Julien Grall