[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers
- To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Date: Mon, 31 Jan 2022 10:40:47 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kH4XBHUf9FGsP2w6C3p6QN2RpRm/h2jV8LgjptuoLRA=; b=g9ezCphUPRtSKyYrmLwF0WNeU5f5sz+Os6GzOJ32UIWP248jpG8bv7zLjKqzaO8FYeZFEuZpI1CMvWpxNfIQeIIUTh+IAHawX6aDtzWNnPnab6dnJ1ih9A4AfoFzrKl4pC872vKbRTccY3yAN5xZoxqiOxrrJoIn1UqxxTKZFcPJsn99FJHVAM2DzK5L7bIx9tqa22SwXOMtImlr8IRrHEIMj9yB6ZEsB3KsqfgZCg79ekV0/AR0aTTtk/Vc4OuAr+9cvCdlBgVG+GX27FjrYRLZvc8Gz0KagBrUGPfClQgEH3DrpDixr5Sgm4gR3J8hfpx6tjKNw54/v6UOKRW+qg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oEDSngHGW7Fj+msqshwImQN8b5O+xmSZqrlop7Laq/5GWfOGR70hnu9mX/L4vNoCOA3/CCEhvz/kusf7b4cQO5hoAC+892h1yP+a+0wUQ8AyGderKmkWvtthQyxCkRcowlY54QNhHnkpKmqywV+GrmqtbAF4fS0Yp3p+hELPkpLlICugh6Lb2dWR9u6E7YzxsYgOYwgtpV4RJk3XYhs2E/xWAL7PY7K+neYlkeyq/y3gCilJLVcIUXYQUKpfI2lLUTpHXyQQ6Y/YeBUuTBcuCFkWRtwcf9ezxBjONRfvru4DQBWph6cBxLvzwQc7znPsWKV7ppFY7/jCjK9c8h/gSQ==
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Delivery-date: Mon, 31 Jan 2022 10:41:11 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHX4ewHyWAyD811HEGp8pIjUuVWNaxfndGAgB2tWgCAAA7+AA==
- Thread-topic: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers
On 31.01.22 11:47, Oleksandr Andrushchenko wrote:
> Hi, Roger!
>
> On 12.01.22 14:35, Roger Pau Monné wrote:
>>
>>> +static void guest_rom_write(const struct pci_dev *pdev, unsigned int reg,
>>> + uint32_t val, void *data)
>>> +{
>>> +}
>>> +
>>> +static uint32_t guest_rom_read(const struct pci_dev *pdev, unsigned int
>>> reg,
>>> + void *data)
>>> +{
>>> + return 0xffffffff;
>>> +}
>> There should be no need for those handlers. As said elsewhere: for
>> guests registers not explicitly handled should return ~0 for reads and
>> drop writes, which is what you are proposing here.
> Yes, you are right: I can see in vpci_read that we end up reading ~0 if no
> handler exists (which is what I do here with guest_rom_read). But I am not
> that
> sure about the dropped writes:
>
> void vpci_write(pci_sbdf_t sbdf, unsigned int reg, unsigned int size,
> uint32_t data)
> {
> unsigned int data_offset = 0;
>
> [snip]
>
> if ( data_offset < size )
> /* Tailing gap, write the remaining. */
> vpci_write_hw(sbdf, reg + data_offset, size - data_offset,
> data >> (data_offset * 8));
>
> so it looks like for the un-handled writes we still reach the HW register.
> Could you please tell if the code above needs improvement (like checking
> if the write was handled) or I still need to provide a write handler, e.g.
> guest_rom_write here?
Hm, but the same applies to the reads as well... And this is no surprise,
as for the guests I can see that it accesses all the configuration space
registers that I don't handle. Without that I would have guests unable
to properly setup a PCI device being passed through... And this is why
I have a big TODO in this series describing unhandled registers.
So, it seems that I do need to provide those handlers which I need to
drop writes and return ~0 on reads.
|