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

Re: [PATCH 4/9] vpci/header: Add and remove register handlers dynamically


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Tue, 7 Sep 2021 10:11:00 +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=kOiM5RsD5xxn92IuFKhIqw2Sf/NDbqDaoMJ/mC9j85M=; b=DQUtEpCZ0CF8enRDwPyWE+B0y3al16aWwMUO/fxnuogthTpmy/lUo9uYUeJCgUuA7SJGMkTtZSwNusvU56Xhtrkyc37OBeEHW21hZekDzr5me93vKwloiK3XF5GSa45klvbamHmSdna30VHbbOvwFlrCZHcZb45hkIH7VOlXtq7g4nm77lO361wTyXzj052mW7Y0ghXqudxtOqjYekcJ0jukxudb1/R+b5peTNnmjjcg8Q8/VN9xfvzNCoY6yfSHmLbMihOF7idwYFyJep4Lh1ShuwxKWIY+4YntO3ZUFZejsDDV1MZpq0Ec30RiRH37Qk3YB51vdT4RSEH1RW2thA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VVksJoTbHstAgAfeQGTuaTIT9aTYz4kxR0iSFSePZVbsJfR2Vbq6ZedSm3jACcBA9cWtR0PtZTFnJeEk7FNMzsMdjhCEkr9LaYXiXW+vfXDXZZlagIgwVuQX2RAsY73Oz/2go6EBx7cxAVzLQ7jeCQdm4jB3wAvBDkmmgcpFveIH8uNITWpteXdevt7yow5TMW/8ZZeC40PA2pO0Skx5vUYNjH0H1j069C4x6VKzPb5fMbYOon/71UklYWNh7NIjzy5G8gqVZn98Hk1X9xQEwQuaqAd3FEHbVgOnjUtHv/4IkwXCkVLwvhVxRMzxZ0NiVHYTDsSvLkrRcTAOyRnNSQ==
  • 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: Tue, 07 Sep 2021 10:11:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXoKusySJnLVveGkulaWKrBZdXpKuXEOQAgAFPE4A=
  • Thread-topic: [PATCH 4/9] vpci/header: Add and remove register handlers dynamically

On 06.09.21 17:11, Jan Beulich wrote:
> On 03.09.2021 12:08, Oleksandr Andrushchenko wrote:
>> @@ -593,6 +625,36 @@ static int init_bars(struct pci_dev *pdev)
>>   }
>>   REGISTER_VPCI_INIT(init_bars, VPCI_PRIORITY_MIDDLE);
>>   
>> +int vpci_bar_add_handlers(const struct domain *d, struct pci_dev *pdev)
>> +{
>> +    int rc;
>> +
>> +    /* Remove previously added registers. */
>> +    vpci_remove_device_registers(pdev);
>> +
>> +    /* It only makes sense to add registers for hwdom or guest domain. */
>> +    if ( d->domain_id >= DOMID_FIRST_RESERVED )
>> +        return 0;
>> +
>> +    if ( is_hardware_domain(d) )
>> +        rc = add_bar_handlers(pdev, true);
>> +    else
>> +        rc = add_bar_handlers(pdev, false);
>      rc = add_bar_handlers(pdev, is_hardware_domain(d));
Indeed, thank you ;)
>
>> +    if ( rc )
>> +        gprintk(XENLOG_ERR,
>> +            "%pp: failed to add BAR handlers for dom%d\n", &pdev->sbdf,
>> +            d->domain_id);
> Please use %pd and correct indentation. Logging the error code might
> also help some in diagnosing issues.
Sure, I'll change it to %pd
>   Further I'm not sure this is a
> message we want in release builds
Why not?
>   - perhaps gdprintk()?
I'll change if we decide so
>
>> +    return rc;
>> +}
>> +
>> +int vpci_bar_remove_handlers(const struct domain *d, struct pci_dev *pdev)
>> +{
>> +    /* Remove previously added registers. */
>> +    vpci_remove_device_registers(pdev);
>> +    return 0;
>> +}
> Also - in how far is the goal of your work to also make vPCI work for
> x86 DomU-s? If that's not a goal
It is not, unfortunately. The goal is not to break x86 and to enable Arm
> , I'd like to ask that you limit the
> introduction of code that ends up dead there.

What's wrong with this function even if it is a one-liner?

This way we have a pair vpci_bar_add_handlers/vpci_bar_remove_handlers

and if I understood correctly you suggest 
vpci_bar_add_handlers/vpci_remove_device_registers?

What would we gain from that, but yet another secret knowledge that in order

to remove BAR handlers one needs to call vpci_remove_device_registers

while I would personally expect to call vpci_bar_add_handlers' counterpart,

vpci_remove_device_registers namely.

> Jan
>
Thank you,

Oleksandr

 


Rackspace

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