[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: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 7 Oct 2021 09:22:36 +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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=s0lzn+ru2kljmp/kH5rZue5gIcI9Tn6Yh6XnzBWROIw=; b=VpAyVdA+LhyTxsL3NHtpIE0mvKQGSr7zZ/DydiiAOgOQt3Gto1bUDmGBV2GkbdFWPnjRhUji4tYJ6qHYoZaeZh5nNw6XNAwhbuRfH3Kcc4iY9uG7q778dnDQ9nYs2xVarJfcLEaveSYfVJYPVz30xHvvhKf3uH4PXY9LPKOtIb14Q2S1BQt4dSY63WlVOVnSHU1u3fJTX7yT3Chul+OE1bfZD2LRj9FVDDkNcb3CZ8zeLA49Sftfy2TrcX1kry+AXOaQhh2Xu2mI8GVElRTXhwxZlxGqCqpNvL+HLSuHKKLQAePmzh5knr69sfc+regfGhFFsxvBl/n3u0QsVTaKhQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aTvFIa/TX6Jm4va9oVehmEafsIMDO3vCHwKLFld82OmzRNy5Bb7P5GG6hwGOhi31mG74i0EZIOcmWsHC1/mmhU9fQPMxTQNB0oaubU+Ry4UxHP515GlV7p/gU1KiYbI4eTu43n1DOeBDWuA6XFetO2Q2APwQMaLORIob5rdsXUHpTw8jXCBd6w3zMRy/4xjMTM+K0nakuPVTqFmFialXUdxB1v9l3N6LthcgWPANezq9qxoZkZv+EcdviaffDaEg1Wb5m6i/B0wli8GjN5gZ6III9pE8ZZ1Ph/QTZZS6KNOqHQTU0I0n75qfmWME+nHiWxap5IUxJGEfAWZgSM5nRg==
  • 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" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 07 Oct 2021 07:22:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 remain unconvinced" was rather referring to our
prior discussion.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.