[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 10:26:58 +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=XbfbMu4AIYc02eVv1Yja5SXVJWTZIYj33ovk8QlUmAQ=; b=OSWUzDzK9XPc7vTUnEJpMr4mHGdHQkFdZnDFCTdmf4wEh0s7lVIxPxi3LqRhnp0fD/br7PRKkzcuv4sxtD0xuINJFyXf1P4mSf8FCz9AwlQwZ5S3wq6++lotzVu6yMyvEEhNE80W9Lt65X4dsAfIN3911JzxckmM8Pfa9FHiXlyowdwYXtw5Rgrag25KKJ1PIGYJUnnzc1cHzdrkJHsuaRIUIi/0rVI78UATMuEwtQeaQzrWCjNaqjs7v+eAFJVUmRYkWIpONZeSQTONWrecSiyEvbQsc3Wgdt5z9+rOVQIp/MZGgp8iEd8yRyg22Qf0+fZ0p/b/JTr/rib1b2lxxA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RKe/xMwgeBuP3DkXwGX/vys0yJksINQWcHdm/M/B/geQHF4NHE3P9AXf2F6tU6ML/UOHg9H5Aty4OtX0P0QHGzA6mWXPSWYWQ7NJHTwViR8JUWsj9CROy9JKYME0N2HzBVWkpfbSPY1Gsw/9oPza3E9NiT0X3X9w7RTKNWfp2ozMt/tla29XaNZy/HRjcjI6/L+AHlF2cFD3vnR0XF0n5dWEEtBDkhJo/dXro63EmKbx9VL288FukXkbKLBsD2UrYKwfAmwhSlyWVVloxGdtJA995tOxFHFBAF1EcgOHzNdn85MorXDter+lWgFJITPFd/eT0dxHNMx1BGzoNc3fdw==
- 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 08:27:07 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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.
Jan
|