From: Jan Beulich <jbeulich@suse.com>
To: Michal Orzel <michal.orzel@arm.com>,
Oleksandr Andrushchenko <andr2000@gmail.com>
Cc: julien@xen.org, sstabellini@kernel.org,
oleksandr_tyshchenko@epam.com, volodymyr_babchuk@epam.com,
Artem_Mygaiev@epam.com, roger.pau@citrix.com,
bertrand.marquis@arm.com, rahul.singh@arm.com,
Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 10/11] vpci: Add initial support for virtual PCI bus topology
Date: Tue, 28 Sep 2021 09:59:19 +0200 [thread overview]
Message-ID: <66cc2b43-eedf-5d58-bf93-5047ecf9ac7b@suse.com> (raw)
In-Reply-To: <6a760126-ba6e-bdf7-97a3-205d75d3d99f@arm.com>
On 28.09.2021 09:48, Michal Orzel wrote:
> On 23.09.2021 14:55, Oleksandr Andrushchenko wrote:
>> --- a/xen/drivers/passthrough/pci.c
>> +++ b/xen/drivers/passthrough/pci.c
>> @@ -833,6 +833,63 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn)
>> return ret;
>> }
>>
>> +static struct vpci_dev *pci_find_virtual_device(const struct domain *d,
>> + const struct pci_dev *pdev)
>> +{
>> + struct vpci_dev *vdev;
>> +
>> + list_for_each_entry ( vdev, &d->vdev_list, list )
>> + if ( vdev->pdev == pdev )
>> + return vdev;
>> + return NULL;
>> +}
>> +
>> +int pci_add_virtual_device(struct domain *d, const struct pci_dev *pdev)
>> +{
>> + struct vpci_dev *vdev;
>> +
>> + ASSERT(!pci_find_virtual_device(d, pdev));
>> +
>> + /* Each PCI bus supports 32 devices/slots at max. */
>> + if ( d->vpci_dev_next > 31 )
>> + return -ENOSPC;
>> +
>> + vdev = xzalloc(struct vpci_dev);
>> + if ( !vdev )
>> + return -ENOMEM;
>> +
>> + /* We emulate a single host bridge for the guest, so segment is always 0. */
>> + *(u16*) &vdev->seg = 0;
> Empty line hear would improve readability due to the asterisks being so close to each other.
> Apart from that:
> Reviewed-by: Michal Orzel <michal.orzel@arm.com>
>> + /*
>> + * The bus number is set to 0, so virtual devices are seen
>> + * as embedded endpoints behind the root complex.
>> + */
>> + *((u8*) &vdev->bus) = 0;
>> + *((u8*) &vdev->devfn) = PCI_DEVFN(d->vpci_dev_next++, 0);
All of these casts are (a) malformed and (b) unnecessary in the first
place, afaics at least.
Jan
next prev parent reply other threads:[~2021-09-28 7:59 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-23 12:54 [PATCH v2 00/11] PCI devices passthrough on Arm, part 3 Oleksandr Andrushchenko
2021-09-23 12:54 ` [PATCH v2 01/11] vpci: Make vpci registers removal a dedicated function Oleksandr Andrushchenko
2021-09-28 11:15 ` Michal Orzel
2021-09-23 12:54 ` [PATCH v2 02/11] vpci: Add hooks for PCI device assign/de-assign Oleksandr Andrushchenko
2021-09-29 9:35 ` Michal Orzel
2021-09-23 12:54 ` [PATCH v2 03/11] vpci/header: Move register assignments from init_bars Oleksandr Andrushchenko
2021-09-23 12:54 ` [PATCH v2 04/11] vpci/header: Add and remove register handlers dynamically Oleksandr Andrushchenko
2021-09-23 12:54 ` [PATCH v2 05/11] vpci/header: Implement guest BAR register handlers Oleksandr Andrushchenko
2021-09-29 9:27 ` Michal Orzel
2021-09-23 12:54 ` [PATCH v2 06/11] vpci/header: Handle p2m range sets per BAR Oleksandr Andrushchenko
2021-09-23 12:54 ` [PATCH v2 07/11] vpci/header: program p2m with guest BAR view Oleksandr Andrushchenko
2021-09-29 8:13 ` Michal Orzel
2021-09-29 8:16 ` Jan Beulich
2021-09-29 8:24 ` Oleksandr Andrushchenko
2021-09-29 8:36 ` Jan Beulich
2021-09-29 8:58 ` Oleksandr Andrushchenko
2021-09-29 8:16 ` Oleksandr Andrushchenko
2021-09-23 12:54 ` [PATCH v2 08/11] vpci/header: Emulate PCI_COMMAND register for guests Oleksandr Andrushchenko
2021-09-28 7:34 ` Michal Orzel
2021-09-23 12:54 ` [PATCH v2 09/11] vpci/header: Reset the command register when adding devices Oleksandr Andrushchenko
2021-09-28 7:38 ` Michal Orzel
2021-09-23 12:55 ` [PATCH v2 10/11] vpci: Add initial support for virtual PCI bus topology Oleksandr Andrushchenko
2021-09-28 7:48 ` Michal Orzel
2021-09-28 7:59 ` Jan Beulich [this message]
2021-09-28 8:17 ` Michal Orzel
2021-09-28 12:58 ` Oleksandr Andrushchenko
2021-09-29 9:03 ` Oleksandr Andrushchenko
2021-09-29 9:09 ` Jan Beulich
2021-09-29 11:56 ` Oleksandr Andrushchenko
2021-09-29 12:54 ` Jan Beulich
2021-09-29 13:16 ` Oleksandr Andrushchenko
2021-09-29 13:23 ` Jan Beulich
2021-09-29 13:49 ` Oleksandr Andrushchenko
2021-09-29 14:07 ` Jan Beulich
2021-09-29 14:16 ` Oleksandr Andrushchenko
2021-09-23 12:55 ` [PATCH v2 11/11] xen/arm: Translate virtual PCI bus topology for guests Oleksandr Andrushchenko
2021-09-27 11:31 ` Jan Beulich
2021-09-27 12:08 ` Oleksandr Andrushchenko
2021-09-27 13:34 ` Jan Beulich
2021-09-27 13:43 ` Oleksandr Andrushchenko
2021-09-27 13:51 ` Jan Beulich
2021-09-27 14:04 ` Oleksandr Andrushchenko
2021-09-27 14:16 ` Jan Beulich
2021-09-27 14:20 ` Oleksandr Andrushchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=66cc2b43-eedf-5d58-bf93-5047ecf9ac7b@suse.com \
--to=jbeulich@suse.com \
--cc=Artem_Mygaiev@epam.com \
--cc=andr2000@gmail.com \
--cc=bertrand.marquis@arm.com \
--cc=julien@xen.org \
--cc=michal.orzel@arm.com \
--cc=oleksandr_andrushchenko@epam.com \
--cc=oleksandr_tyshchenko@epam.com \
--cc=rahul.singh@arm.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=volodymyr_babchuk@epam.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).