[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 04/11] vpci/header: Add and remove register handlers dynamically
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Wed, 13 Oct 2021 17:38:58 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R+JNnufgiK5AL08zA4CP6OX/9w2Or/DdvDM7ylSGL20=; b=GmrgI6zMyIuHjAWggYi0NuKK0ycWm8S5uh/uqS7TtiBxkZlD3WN6kb70JM0f2QAvk9bO0ielNNCa4R97eyZTC3+U6vhDBHV2zzVr/eA8VZnaVcnw7Rd+ATHCaeaOw6KdtlftlFMYSasm3zBr1moasgN7eYO81jTl78PnmF/x+GV0h8ciLOLrr6S3adzfe5FRhTTT9uJC+gXj0o3KhYr8T+3Hws/LWLf1el5ZHOCAq/ldbS+k640dSq1IBSJKIrfVd8vtOSGlU8Y5NlvI2c5dcsm1II7pHWgA3KsHpSiAEDD9v3DDFICydAU5P1d4/3c2VV9n7pMjqzYjCbNqi0Sxbw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=So2Prlqsh+zUHHG9R41Pu3tA1zJk5EShub5uH8QarMVNgHdKak4aZT+DXHka8LRFhtDbzdpZsPNv9l9Z7CoxhVpirdGnKlYSIwbcuz7Uhpxpt2YtKe38j9KWY2Wy0DhOZ48p4zuyCI2c+EufdhW3lUWDDwsHr4v7fec7eYLQeAOpQRAV6D+cEUsQ/xyVwKdY843cX3tpTlAGXP26fZEQzvce1dDaDf9ohs6mGC4ZdOcHo2iCR75C6JR1mazKFyFpQqnpv/dGm84zoOjcwYPv06DE/gfofZj+UqB1hNOgTmtOkuO4v8AAC3Dolb548/0XYgZwl9CO+zXXgfJ4oNpHAA==
- Authentication-results: esa5.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>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 13 Oct 2021 15:39:29 +0000
- Ironport-data: A9a23:XWyCRKommodg7Md2FH3N7lSOBwNeBmIDYxIvgKrLsJaIsI4StFCzt garIBnSMvmKajejfdl+YIiz80kB6pHSnN9gHlQ+qyxmRilD8puZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlZT4vE2xbuKU5NTsY0idfic5Dnd84f5fs7Rh2Ncx2YHiW1jlV e7a+KUzBnf0g1aYDUpMg06zgEsHUCPa4W5wUvQWPJinjXeG/5UnJMt3yZKZdhMUdrJ8DO+iL 9sv+Znilo/vE7XBPfv++lrzWhVirrc/pmFigFIOM0SpqkAqSiDfTs/XnRfTAKtao2zhojx/9 DlCnbfqSlksOfDApOY6fBxGQxtjA7Z/wbCSdBBTseTLp6HHW37lwvEoB0AqJ4wIvO1wBAmi9 9RBdmpLNErawbvrnvTrEYGAhex6RCXvFJkYtXx6iynQEN4tQIzZQrWM7thdtNs1rp0SQ6mCO JJAA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U7dTpaPJfLhRknqmjllUKtGGwq6YdwTCLj tLJXR/TG/16y/pq94cxhijUeYnGODaF0fVfaGaa9dVPEfYlo8rDqqPo/uAm1Zntt/rksDu+mDM eqSFH4XUUZMtBCFY7MYIg5ZlNP+yvVDq3Oexmd1Q1FIlKtnEY1DysQ5a6qZtm6lokwwfKw4bJx YEA2QfehrbIEe2GxUeEBzoS2
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Thu, Oct 07, 2021 at 09:22:36AM +0200, Jan Beulich wrote:
> On 04.10.2021 07:58, Oleksandr Andrushchenko wrote:
> >
> >
> > On 01.10.21 16:26, Jan Beulich wrote:
> >> On 30.09.2021 09:52, Oleksandr Andrushchenko wrote:
> >>> @@ -445,14 +456,25 @@ static void rom_write(const struct pci_dev *pdev,
> >>> unsigned int reg,
> >>> rom->addr = val & PCI_ROM_ADDRESS_MASK;
> >>> }
> >>>
> >>> -static int add_bar_handlers(const struct pci_dev *pdev)
> >>> +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;
> >>> +}
> >>> +
> >>> +static int add_bar_handlers(const struct pci_dev *pdev, bool is_hwdom)
> >> I remain unconvinced that this boolean is the best way to go here,
> > I can remove "bool is_hwdom" and have the checks like:
> >
> > static int add_bar_handlers(const struct pci_dev *pdev)
> > {
> > ...
> > if ( is_hardware_domain(pdev->domain) )
> > rc = vpci_add_register(pdev->vpci, vpci_hw_read16, cmd_write,
> > PCI_COMMAND, 2, header);
> > else
> > rc = vpci_add_register(pdev->vpci, vpci_hw_read16, guest_cmd_write,
> > PCI_COMMAND, 2, header);
> > Is this going to be better?
>
> Marginally (plus you'd need to prove that pdev->domain can never be NULL
> when making it here).
I think it would an anomaly to try to setup vPCI handlers for a device
without pdev->domain being set. I'm quite sure other vPCI code already
relies on pdev->domain being set.
As I said in another reply I'm not convinced though that splitting
add_bar_handlers is the right thing to do.
Thanks, Roger.
|