[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 06/13] vpci/header: implement guest BAR register handlers
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Tue, 8 Feb 2022 10:29:37 +0100
- 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=HPHEHagKqtJ19nwbHuNeVG1QMZljMg6SFdCo8Bt4izU=; b=HvxbjjVisHhKbHaCuWe2P6CzwQRSM65bDpehDAMXQMl/Yv6j1XoM9hU0WMhAi8xglWnIEg6OFmoj0+aiVcYwzcQNCVDiz5PwHlr1tUpICCoGjI8Xj39UGySTUdGsQH7mMfvHuccLvQOEDpt/dx/fOs/7Atfgec4wAfg5pL2BQwtT0u5L0bZdUuBn0oyJdJ3sHajeMaUp5AtJuBY5IgM6wP0zPjvncrxI0VHZtCa+yRREbatp8ZANdyrmL5YSvDE8AoqnK+pMWvtPXFTATfGgwTVWpMGZxgk06V+2iRUb4hp9wQowIKs4LriyjrpRTtP8aCuyM36YRSyQ+6BkEf1zPg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M8IU2EC9GLickhKyrTYOQFHbZEoDrgTKngEfAaR3MmBCB5sBw11KyM+CHOWdGmGxe6aMKjqcRwceLXEUXv9tHEUm7jrIUKpyX35oUMnl7mqleMCOYYvCJnnSm/WUCf6QjHOH1NaQaERYNZwk0PDd0CtAqWkd7VLy+HucuSFm480BqB75z+gGSzyGFBYVkBx5QE/76Zck4P7pk9sODgpRFHatVsErsnxr4lXcE23DnYrry9Iv9ygIQFlF+dBd1gVfbwedyMc57RZLNMtN5aMjYytQXzbB/4hdV5snfbu4WFIDuC7u9NLRNrtXYkyHhk9LjYADZyFTaD/YAB0NAKqrmQ==
- Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@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>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 08 Feb 2022 09:29:53 +0000
- Ironport-data: A9a23:MkfzsKhOzCTcoyvrGVR1XK/fX161QBYKZh0ujC45NGQN5FlHY01je htvWDrXbv6IYDehe91ya4W28B9S7ZHUxoRhQVFkqSFhHi4b9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oAMKRCQ7InQLlbGILes1htZGEk0GE/NtTo5w7Rj2tQw0YDga++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1imKOoEjg7NZGcs+kWDhB+DzF4Ar9/reqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE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V xLd4MReNJWIJNjhTAwbKj06Y7nRzvoTgDTTs6g4eR2o+C9t8bObekxOJB3Q2jdFJb54Pdp9k +csscIb8SKljR8uPorUhyxY7T3UfHcBT78mptcRB4qy0lgnzVRLYJr9DC7q4c7QN4UQYxdye jLN3fjMnbVRwEbGYkEfL3mV0LoPn4kKtTBL0EQGewaDlO3ai6JlxxZW6zk2EFhYl00Vz+JpN 2F3HERpPqHSrSxwjc1OUm3wSQFMABqVph74x1cTzTCLSkCpUirGLXEnOPbL90ccqjoOcj9e9 bCe6WDkTTe1I52hgnpsARZo+675UNh81gzeg8T2Tc2KEq4zbSfhnqLzN3EDrAHqAJ9piUDKz QWwED2ctUEv2fYsnpAG
- Ironport-hdrordr: A9a23:N8cTYaHmlo/l6rT2pLqEMMeALOsnbusQ8zAXPhhKOHlomszxra +TdYcgpHvJYVcqKQodcL+7Scq9qB/nmKKdgrNhR4tKPjOW2ldARbsKheCJ/9SKIUPDH5tmtZ uIBJIeNDSfNzRHZI3BkW6F+p4bsb+62bHtj+LX1W1sQgFhY7xh6QARMHfjLqRZfng/OaYE
- Ironport-sdr: ka7va5Z7RricQ7rok5L/fp/uHhwQkaPkQPZRRoV5b5jG5u54bFE8Cvs6ty7Hab2kRj6tQfDxkr O0tD4T27qGw5JONdk2iU1oq/XUOMpXVWDwwnbcb0OmVD/hFEyWryCNZUftpwRW6T3YnUQ47eEW N2RMjPinsSsrBkxtnflANE9ox4jfDDEML42Tyd5yCNM7SalicYfCXrfP/tmBc5R7zhXa8Gnut1 zkUtMWS7Dj/bJONfHKQmcIQmyTYpntNlERb9j3t6qcD2xsj9Pcq89WbMt+TmieiHs+mxMBh/fX vsa0sjcNRtMudXWLjtfyhH0k
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Tue, Feb 08, 2022 at 10:16:59AM +0100, Jan Beulich wrote:
> On 08.02.2022 09:06, Oleksandr Andrushchenko wrote:
> >
> >
> > On 07.02.22 19:06, Jan Beulich wrote:
> >> On 04.02.2022 07:34, Oleksandr Andrushchenko wrote:
> >>> +static uint32_t guest_bar_ignore_read(const struct pci_dev *pdev,
> >>> + unsigned int reg, void *data)
> >>> +{
> >>> + return 0;
> >>> +}
> >>> +
> >>> +static int bar_ignore_access(const struct pci_dev *pdev, unsigned int
> >>> reg,
> >>> + struct vpci_bar *bar)
> >>> +{
> >>> + if ( is_hardware_domain(pdev->domain) )
> >>> + return 0;
> >>> +
> >>> + return vpci_add_register(pdev->vpci, guest_bar_ignore_read, NULL,
> >>> + reg, 4, bar);
> >>> +}
> >> For these two functions: I'm not sure "ignore" is an appropriate
> >> term here. unused_bar_read() and unused_bar() maybe? Or,
> >> considering we already have VPCI_BAR_EMPTY, s/unused/empty/ ? I'm
> >> also not sure we really need the is_hardware_domain() check here:
> >> Returning 0 for Dom0 is going to be fine as well; there's no need
> >> to fetch the value from actual hardware. The one exception might
> >> be for devices with buggy BAR behavior ...
> > Well, I think this should be ok, so then
> > - s/guest_bar_ignore_read/empty_bar_read
> > - s/bar_ignore_access/empty_bar
>
> Hmm, seeing it, I don't think empty_bar() is a good function name.
> setup_empty_bar() or empty_bar_setup() would make more clear what
> the function's purpose is.
I don't think you require an empty_bar_setup helper, the code there is
trivial can be open coded in init_bars directly IMO.
>
> > - no is_hardware_domain check
>
> Please wait a little to see whether Roger has any input on this aspect.
I think for the hw domain we should allow access to the BAR even if Xen
has found it empty. Adding the ignore handlers for dom0 shouldn't make
any difference, but we never know whether some quirky hardware could
make use of that.
Thanks, Roger.
|