[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: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 6 Sep 2021 16:11:42 +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=wk5cxx/2uXDEEOICbmsgCL4++M8We3UgJBTequBverE=; b=JY++zwrXZ0+4C5WT5U9jIgby+YwDfgNw78aWSOd99wQ89otkjr35/AozkHEcNnOnxjXB4e11e2HcCnfKVOsfSQ6AOnA3vnmQD8kKzSmWYWWdPplKM9U/eiasSsEb7lcy+fwu1cUGJ6W/7mqJQtG6Jn7QeeWsLXHZCEg/cnV0m4Gbwr5C+VGrDpQYhsDss6fcWNKJRLBL/Li5uNO/oaIxaytjemykk12009zqKP+sJpq+YKs2hHzrc66gp9sbw+3m9GC7m6pJmirhwxxx1rmFe5iiVm0yyhvKU58g2HyId9Z8g9YnZBnwdW6dzOTqKfQ8tRspAC0yAdZ65Mi1mZzMKw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZW2PYW0XbiG3aDIDg+hQ19vOBv4fnmnjGXayQrUFvRkxfZ/FzRDHSblJMs2hrF6flgYnY5THKFjpIn1oPulDbHZl5egkIY3kAtqLEYGCYHtmIBLv/0x6vVjqjwfu76kncEJHUaGonWSyvypMcKa7wh12p7qoWbsUcyBpb62gkAGHow3iJqqPsfTM6XmZe7RgrJxQhLctDlLqjv2jxtmGQ9le2Hyvzlk29J6OIVsaflqTUnqSYYdHXlj5ySx99C9odrGPqSP1Dpsi4bh8DE9oy0/LMv/zIZh4rwg7Cjg0xhKF4o+sVgS5tSWMYIX9Dr6pmE+gkub+LUFu6jzMUMqn7A==
- 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: Mon, 06 Sep 2021 14:11:57 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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));
> + 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. Further I'm not sure this is a
message we want in release builds - perhaps gdprintk()?
> + 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, I'd like to ask that you limit the
introduction of code that ends up dead there.
Jan
|