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

Re: [PATCH 7/9] vpci/header: program p2m with guest BAR view


  • To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 9 Sep 2021 11:40:56 +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; bh=wlMga0mUYNhs7SvP6Ti5KthRY5hVV+M0UFQXOq92hf8=; b=f3pbn/1XUwxZecJSNIR4fL/9LJqlt2rJHF+QkI0F8JcpMGhxT+GtPQYN+eg+21raeo9AsdCqpjgK9eLLJC4UAB2K4K2XXA8GQasTNWynjQjAyeyT6UiZepyVMRg4S7FvgmYdd3yvHvw65xoonvvjs3hd3QUF8v7EmkSJVFPZlYd3co3+NdxFKErRFnS/rd6ZkxE3DTvUWclqJy6Qz3fcGX3jDdzIOYomx9qRo8vaXe8LapeWPPoWvxbeNbfUadt6H7CaOvovxRwL1rKTADdgX1ki+S8tW+qrvHMVV104EBOh98WE8vu80jsBNR2MjX5OXCYzzjwCdbWULNsFqp4YuA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=INuQQql2Y59ieJUv3ntsMtni+/+HABtKMYu+GLZKXhNZOX9O2XmTnE0CThsOBu+FTc4S50P4HVoiyA8xRswRgc3KFaBMg5K5vfGOcMoe6Jv84uuTWvSSRr1Z5fdWjIpZN9zLt73/EvAWbMxO154bZqexW1QiRrmHO1liTOGfMFX2JbNW5pcZ+LGyvJPUl2F0qV94wwEp4Ng7+AdEX2UonFJgtFeUosgORugkodRDEc07iP1zvLjW62MT4zXt43PnhQhgSVhVU2k34tLv2JAbnPGJiGrWk6woUouoeNHETvqEcUSXhYTWggbeZuB3bT5q7jgd00Vw6+NTowLeyPwrYg==
  • 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" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 09 Sep 2021 09:41:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.09.2021 11:16, Oleksandr Andrushchenko wrote:
> 
> On 09.09.21 11:26, Jan Beulich wrote:
>> On 09.09.2021 08:13, Oleksandr Andrushchenko wrote:
>>> On 06.09.21 17:51, Jan Beulich wrote:
>>>> On 03.09.2021 12:08, Oleksandr Andrushchenko wrote:
>>>>> @@ -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 regions which may be a part of that 
>>>>> BAR,
>>>>> +         * e.g. when a single BAR is used for both MMIO and MSI.
>>>>> +         * In this case MSI 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));
>>>> I may be missing something, but don't you need to adjust "size" then
>>>> as well?
>>> No, as range sets get consumed we have e and s updated accordingly,
>>> so each time size represents the right value.
>> It feels like something's wrong with the rangeset construction then:
>> Either it represents _all_ holes (including degenerate ones at the
>> start of end of a range), or none of them.
> 
> The resulting range set only has the MMIOs in it. While constructing the 
> range set
> we cut off MSI-X out of it (make holes). But finally it only has the ranges 
> that we
> need to map/unmap.

And then why is there a need to adjust start_gfn?

Jan




 


Rackspace

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