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

Re: [PATCH v3 07/11] vpci/header: program p2m with guest BAR view


  • To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 1 Oct 2021 15:38:20 +0200
  • 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=kmm97YkAc0S+VpA1HX4CbzpqfCrFhQlyQfEIZZkjp68=; b=FlQZTl9Iqs6kF7h1M83sItMjkOIMjtWXIDsm9JUCAbSTMksWz1eqU7EuwQaDMJGK5yOIRX1Z4mBfiKGTtdOTiAmn8dW7Uw24exD6k9WcQ6SDiC5wOUdiFDgaQt7ITW+Q5bt/PQAEs+DXq0z/R2RfJ1d+2gnQFEN+tQg7Z2ptfCRielfsTm3b00owrvp6Jv8oDM5T5WDxzvBQL5raCN+0bIohU31GpDnbwiD6JCPvYTwyb5/sHyscvg7vkVWheNvNyHlnDZtutDOmVoZolB3k83GTdzMRIA80clpJuezQhrs9mzQUMPh5FTylo5D4HdTQa1nbNsySnIYZDItttHp6pQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bawwOhO4hek9Kss+TpavW3diqwKvfyE7DNqlsasrAtN6B0Ay4N1l+ICY2rr9HiI5Q0FEvLXMp26gTDmIyuD72M8tvKUiw3ZmRLUvPNPqpBh5NT0SyS/bwMNuxtwzN4wvd8R587VczDUG6eAlqx+lklmVQIAspx8OX7b4ML58x/WQiMgqTl937La2ZaZbFGg6bAQcHXLLsNTh6sYNIBcYBiCGP9KQCZUhA47oGWmyLZYJDj7BX+OsQD1mzsJUo4Nr39AeutUM3VFmn6UnE/wTCQ+8eB00MYyvvr9ZgnQ7+nTgDPlVuGynXKn9gnyLrcvQ0IhdbJppYU4oKBCiA9AqnA==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: julien@xxxxxxx, sstabellini@xxxxxxxxxx, oleksandr_tyshchenko@xxxxxxxx, volodymyr_babchuk@xxxxxxxx, Artem_Mygaiev@xxxxxxxx, roger.pau@xxxxxxxxxx, bertrand.marquis@xxxxxxx, rahul.singh@xxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 01 Oct 2021 13:38:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 30.09.2021 09:52, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> 
> Take into account guest's BAR view and program its p2m accordingly:
> gfn is guest's view of the BAR and mfn is the physical BAR value as set
> up by the host bridge in the hardware domain.
> This way hardware doamin sees physical BAR values and guest sees
> emulated ones.
> 
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>

Just a couple of nits, as I remain unconvinced of the rangeset related
choice in the earlier patch.

> @@ -37,12 +41,28 @@ static int map_range(unsigned long s, unsigned long e, 
> void *data,
>                       unsigned long *c)
>  {
>      const struct map_data *map = data;
> +    gfn_t start_gfn;
>      int rc;
>  
>      for ( ; ; )
>      {
>          unsigned long size = e - s + 1;
>  
> +        /*
> +         * Any BAR may have holes in its memory we want to map, e.g.
> +         * we don't want to map MSI-X regions which may be a part of that 
> BAR,
> +         * e.g. when a single BAR is used for both MMIO and MSI-X.

This second "e.g." seems, to me at least, quite redundant with the first
one.

> +         * In this case MSI-X regions are subtracted from the mapping, but
> +         * map->start_gfn still points to the very beginning of the BAR.
> +         * So if there is a hole present then we need to adjust start_gfn
> +         * to reflect the fact of that substraction.
> +         */
> +        start_gfn = gfn_add(map->start_gfn, s - mfn_x(map->start_mfn));
> +
> +        printk(XENLOG_G_DEBUG

Do you really mean this to be active even in release builds? Might get
quite noisy ...

> +               "%smap [%lx, %lx] -> %#"PRI_gfn" for d%d\n",

%pd please in new or altered code.

Jan




 


Rackspace

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