[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 <andr2000@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 1 Oct 2021 15:26:41 +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=XXYUFjcGJFQCjxv4Au0IkJJBheckl/vMH4V+bUlEVUU=; b=GI83HN3xHdLbj0Rw9QDNvciXOshYaqUkXWo0spdqnhXg0+44h2inKVpWu+mStgDNtXaR3tGUoWAj2GCvZG8DFJfZi8JCsE8S4Woe03sO0XwiXVBFlR/GOw/jFCDnw1yZwL7ZkLsJ4N5BaBSoh6DywODi8yBcW9fd+59h5KbX5wbM2/uMdYxV+wHMoHMVnZ3x+HVGmF4I7FvttVEj1a0eCDN+lS4rWy85GM93BKSpU1sUS5iGOUzZeorbkR7v4BmAKw95EqfCU/4j/d+48yTar+aGfMZk1vdHZD+kqBD5pC2RaxGK9wYOSqOyRFaxQMBuAVT5kcZplaSyMUov9fnBgA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oFXK3gB9xzb1aJK2KstEPu8el19w5K5boCJiF2U/Z1StXt413/6lmIftG27ZA0N2xtdtb4LM7eW1bYSzxX82KeZ2nZwkLYjgmzp03himKP05aRZppOUSaVXSN0nCOrD0Oo4Xb2wJnWB3pGCkelS3BEQih0Pt4+qHsnPNL3XZNlyiMF5qvn3QAe269wqqg7tOOhUEnTLWaAVyuZQ9myIqziVq/34IWnOFPhgEnFKIF5VOaxWmFjl04ZB83jnGWvZ1S2W5Q14D0SwR/ly330wTa2IV322v3WEMet9mQ3vTbcJ3K84zbRI4ui4JY2uyaH/AhZGhrWLcyAjSuuLpQX4bdw==
  • 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, sstabellini@xxxxxxxxxx, oleksandr_tyshchenko@xxxxxxxx, volodymyr_babchuk@xxxxxxxx, Artem_Mygaiev@xxxxxxxx, roger.pau@xxxxxxxxxx, bertrand.marquis@xxxxxxx, rahul.singh@xxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 01 Oct 2021 13:27:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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, but
I'll leave the decision there to Roger. Just a couple of nits:

> @@ -593,6 +625,30 @@ static int init_bars(struct pci_dev *pdev)
>  }
>  REGISTER_VPCI_INIT(init_bars, VPCI_PRIORITY_MIDDLE);
>  
> +#ifdef CONFIG_HAS_VPCI_GUEST_SUPPORT
> +int vpci_bar_add_handlers(const struct domain *d, const struct pci_dev *pdev)
> +{
> +    int rc;
> +
> +    /* Remove previously added registers. */
> +    vpci_remove_device_registers(pdev);
> +
> +    rc = add_bar_handlers(pdev, is_hardware_domain(d));
> +    if ( rc )
> +        gdprintk(XENLOG_ERR,
> +                 "%pp: failed to add BAR handlers for dom%pd: %d\n",

Only %pd please, as that already expands to d<num>.

> +                 &pdev->sbdf, d, rc);
> +    return rc;

Blank line please ahead of the main return statement of a function.

Jan




 


Rackspace

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