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

Re: [PATCH v2 7/8] x86/dpci: move hvm_dpci_isairq_eoi() to generic HVM code


  • To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 12 Jan 2023 13:22:24 +0100
  • 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=jua8+qvyFxdva6AeLg6ip2uyjypLjH77n/jmxwE62sk=; b=ZyBq0oZLxxJdnrIYJewalSn7MMi5NZRt4PFTaQ3eYDr4CkDVBrU/GzbcwqRHaWHc4KqnHo7Cte78onWU92ihsGSUVQoJCz57Ie0t8XR9E5w/J3Uv2PRUQl2f9EzwifoNe5G7iF4dXlDoZekwNtjxFWh+GH2IPSl0Viu+4Y3GlOqNGeSE7COAtVFkTTwb2FQNtCDrtU7YfBQ4ANs9SE+moKkpiYKV1dz3RF06dcdJavI4stZ3ADZX3k1FqkULTPLAqZtdT/bZFx/q1Ay/XAzryh6tvFhyirOhchj0Br0lmI7HslEjcasrvZDvOkJS7Tz+9ODNK/1fJ+V/7UcK4V1Ojw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SSYaqlJZiJcbqW9ZYVHAlai7FWzSM0Hh0rcVqvyifVRNnVIgiJx1zJxq+DrTXHNsjJs16z0AfOyExobjaNL5i+TsWhMfQJ0zttLz+g1Go3tIDdrI/Y0XMDjfIq39z2sP4P4fztUQXyw40yUme/Dy2EdveHJtz3ABRKBhXMhkmMQz4uKr44Z9d/uroa/L6CNzusXcw7gMPY6491tadsp6qnQQ0YlhSEoawEX2NjwwG1zkMwkVORo5ufQToeya+Jk9IBmuTkMLgElgyNRCat8SBHHq8Js8nWs7DyNjuPu5UidlwI6M+A2qiQS27MgEqE+fgaVijtow4JPaLRsS2eeUxA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Kevin Tian <kevin.tian@xxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 12 Jan 2023 12:22:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04.01.2023 09:45, Xenia Ragiadakou wrote:
> The function hvm_dpci_isairq_eoi() has no dependencies on VT-d driver code
> and can be moved from xen/drivers/passthrough/vtd/x86/hvm.c to
> xen/drivers/passthrough/x86/hvm.c, along with the corresponding copyrights.
> 
> Remove the now empty xen/drivers/passthrough/vtd/x86/hvm.c.
> 
> Since the funcion is used only in this file, declare it static.
> 
> No functional change intended.
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
with a couple of cosmetic suggestions since you're touching this code
anyway:

> @@ -924,6 +925,48 @@ static void hvm_gsi_eoi(struct domain *d, unsigned int 
> gsi)
>      hvm_pirq_eoi(pirq);
>  }
>  
> +static int cf_check _hvm_dpci_isairq_eoi(
> +    struct domain *d, struct hvm_pirq_dpci *pirq_dpci, void *arg)
> +{
> +    struct hvm_irq *hvm_irq = hvm_domain_irq(d);

I think this could become pointer-to-const.

> +    unsigned int isairq = (long)arg;
> +    const struct dev_intx_gsi_link *digl;
> +
> +    list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
> +    {
> +        unsigned int link = hvm_pci_intx_link(digl->device, digl->intx);
> +
> +        if ( hvm_irq->pci_link.route[link] == isairq )
> +        {
> +            hvm_pci_intx_deassert(d, digl->device, digl->intx);
> +            if ( --pirq_dpci->pending == 0 )
> +                pirq_guest_eoi(dpci_pirq(pirq_dpci));
> +        }
> +    }
> +
> +    return 0;
> +}
> +
> +static void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq)
> +{
> +    struct hvm_irq_dpci *dpci = NULL;

And this too.

> +    ASSERT(isairq < NR_ISAIRQS);
> +    if ( !is_iommu_enabled(d) )

A blank line between the above two would be nice.

> +        return;
> +
> +    write_lock(&d->event_lock);
> +
> +    dpci = domain_get_irq_dpci(d);
> +
> +    if ( dpci && test_bit(isairq, dpci->isairq_map) )
> +    {
> +        /* Multiple mirq may be mapped to one isa irq */
> +        pt_pirq_iterate(d, _hvm_dpci_isairq_eoi, (void *)(long)isairq);
> +    }
> +    write_unlock(&d->event_lock);

For symmetry with code above this could to with a blank line ahead of it.

Jan



 


Rackspace

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