[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH V7 03/11] vpci/header: implement guest BAR register handlers


  • To: Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 27 Jul 2022 12:15:01 +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=fI5OjZMBjxRFOx5Eo+MCYD+WJsXwTXC2IsyNyarfdbA=; b=SE7iKzRAX/qDU7O+uFNTZMvPJHsJS8vCp/uZrj54xXLmDeZQ8pg21QvUveq0D25lS2TXjUjaYu8PWmv+FW8wX+khOhF0xfu2AKH6XEq+/T/3U2zXdcaUlHDQrrlJZNHvwfKkuQufBv3ym9wOh2rTKk6FZTW+RkN/17heAOy/y8oRasQ+sol347w1wcb+EBW4NaR1OOsqtWV6qzXAzeOVrv+fW9NYaVMzx9qd+6aX6ced6Pmv6/jA3IH6gyOQcARFjkRWpoTCWss7cUcejHtS+QidQEXM7A5XjCchFanYo54TtjO+cN7LHmIqMwYa+XGHYG/5LjWI7/yIcJZ+gJIpdA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BwuctuR748CPoWeAkQR37So0HkDskZ1xqTbsRyQiVb6uka/y5J6lsZYFsEg5Qw4MN9LoZVo5ZS2bDfIIIjOuBkLjpMqd5uk3Vz7DPwQviyDlU7vVITbkvXLKwCSP5tP48Kt9Dv1NmsSAAfJpg9VxXEZQ6krHpCXFUN8goRFV5txiiS0Np7gtPfsoNmoVAT9Aw23dV4zwKQ8tHps1ZczgvVow/7C6q7sx/dRQYQoU/cZS/dAf0v8Rld8s/5wFt0gjeXy70uSJFLMnavf855c8qQL6E6S5tnVI0cPfElFM5jfEsgkJ+pgZR4jBhObAL3sNRYFD5oaWNsfHK2c1bc7ODQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 27 Jul 2022 10:15:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.07.2022 19:42, Oleksandr Tyshchenko wrote:
> @@ -527,6 +592,17 @@ static int cf_check init_bars(struct pci_dev *pdev)
>          if ( (val & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO )
>          {
>              bars[i].type = VPCI_BAR_IO;
> +
> +#ifndef CONFIG_X86
> +            if ( !is_hwdom )
> +            {
> +                rc = vpci_add_register(pdev->vpci, empty_bar_read, NULL,
> +                                       reg, 4, &bars[i]);
> +                if ( rc )
> +                    goto fail;
> +            }
> +#endif

Since long term this can't be correct, it wants a TODO comment put next
to it.

> @@ -553,34 +635,47 @@ static int cf_check init_bars(struct pci_dev *pdev)
>          bars[i].size = size;
>          bars[i].prefetchable = val & PCI_BASE_ADDRESS_MEM_PREFETCH;
>  
> -        rc = vpci_add_register(pdev->vpci, vpci_hw_read32, bar_write, reg, 4,
> -                               &bars[i]);
> +        rc = vpci_add_register(pdev->vpci,
> +                               is_hwdom ? vpci_hw_read32 : guest_bar_read,
> +                               is_hwdom ? bar_write : guest_bar_write,
> +                               reg, 4, &bars[i]);
>          if ( rc )
> -        {
> -            pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd);
> -            return rc;
> -        }
> +            goto fail;
>      }
>  
> -    /* Check expansion ROM. */
> -    rc = pci_size_mem_bar(pdev->sbdf, rom_reg, &addr, &size, PCI_BAR_ROM);
> -    if ( rc > 0 && size )
> +    /* Check expansion ROM: we do not handle ROM for guests. */
> +    if ( is_hwdom )

This again can't be right long-term. Personally I'd prefer if the code
was (largely) left as is, with adjustments (with suitable TODO comments)
made on a much smaller scope only. But I'm not the maintainer of this
code - Roger may have a different view on this.

Jan



 


Rackspace

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