[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: Jan Beulich <jbeulich@xxxxxxxx>, Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Thu, 9 Sep 2021 09:53:38 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=Aa779dZMNrHLiJ6/fJbdM9JNUroII9N4XsxRLIy+C3A=; b=iXMb9uaWF9sbazoSJF5Qy0fTwMh1p245pgEvD50+oIlZwrgDTn9wXGb1xmNAmzAc6R6F96fQet/wk/cp0/CvqVueUovHi/Q8dXp5i+2QU+5kYWoUfuy+OzCwiYKCflsRuxnoCEWx+Yl66qDh31wnsgB7QuG1dwK3ncmOPgIb5P7k12LE65VQEJfL97lJBi+MKDb8CI3OYxqpBqv+4DT63bacU400fKnp1lXd8tiJAaNU2AFA9MT5d1vktrOEBfR6RXGjkU2xECVRKVl8AQjvYW9kZl0pzXuXNalN9Ck7mguQUts8DXDJ/1QCc0jaKfbglAp6o4stidGmsgT2TJOj2g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aSiP+RDkk3DSKYoR4Vi8KHpglHz8yClcE76tr782TgQXzsvxvyz/QIebyeusHrfaxPr5sa24q90Rvq+Nh5b/c1DmK4W10eQ48N+BbTvCzK5o8ONCQmkKoAbfYoYI6KQK4MIhWXXTzpSiwa1ZnZlzloaP+iZk2fAeV7vPIPECUOk3444zBQeMhzEu7kxyZYjIVySrgdICcvCQ1ji0xv2js2WRdtcymaNMpHTSdaRvjfmBPiul0wWhueXEyqhCUzph4K1MlBmi4YicafyHX1LzauHP9Y6ezFToG2S9BtLGtd/vSS+StDIagUKCdVgeDCiIupy9LvCZwbrUplKI7RAwvA==
  • Authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=epam.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:53:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXoKxowwaOW1OR4UKei+2TOBJan6uXHAEAgAQmJoCAACVpAIAADfgAgAAGsgCAAAOLgA==
  • Thread-topic: [PATCH 7/9] vpci/header: program p2m with guest BAR view

On 09.09.21 12:40, Jan Beulich wrote:
> 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?

Because of the holes: the range set's private data can only hold BARs start MFN

and start GFN. It doesn't have a list of start_{mfn|gfn} which describe each 
range,

but only the start_{mfn|gfn} of the whole range set, e.g. where the BAR starts

So, because of the holes we need to adjust the starting addresses:

0. MMIO0 <- we pass start_mfn and start_gfn pointing to the BAR start

1. MSI-X <- hole

2. MMIO1 <- need to adjust start_mfn and start_gfn with respect to the hole 
above

>
> Jan
>
Thank you,

Oleksandr

 


Rackspace

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