All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Han, Weidong" <weidong.han@intel.com>
To: 'Simon Horman' <horms@verge.net.au>,
	'Xen-devel' <xen-devel@lists.xensource.com>
Cc: 'Yuji Shimada' <shimada-yxb@necst.nec.co.jp>,
	'Keir Fraser' <keir.fraser@eu.citrix.com>
Subject: RE: [rfc 1/2] pt_irq_time_out() should act on all machine_irq
Date: Tue, 10 Mar 2009 15:40:21 +0800	[thread overview]
Message-ID: <715D42877B251141A38726ABF5CABF2C0195B5C568@pdsmsx503.ccr.corp.intel.com> (raw)
In-Reply-To: <20090309091434.543270605@vergenet.net>

Simon Horman wrote:
> In pt_irq_time_out() the following code loops through all used
> guest_gsi:
> 
>     list_for_each_entry ( digl, &irq_map->digl_list, list )
>     {
>         guest_gsi = digl->gsi;
>         machine_gsi = dpci->girq[guest_gsi].machine_gsi;
> 	...
>     }
> 
> And a little later on machine_gsi is used.
> That is the last machine_gsi found is used,
> rather than all of the machine_gsi that are found.
> 
> This seems to be incorrect to me,
> but I am unsure of how to test this.
>

Timer is set for each machine GSI, so all the machine_gsi found in loop are the same. More than one devices may share machine GSI, but assume they won't share guest gsi. digl_list contains all guest GSIs which are correspond to this a machine GSI.

Now you want pass-throughed devices share guest gsi, you needs to change it obviously. Your below change looks fine for me.

Regards,
Weidong

 
> This code appears to have been introduced in
> "vt-d: Support intra-domain shared interrupt" by Weidong Han.
> 
> Cc: Weidong Han <weidong.han@intel.com>
> Cc: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
> Signed-off-by: Simon Horman <horms@verge.net.au>
> 
> Index: xen-unstable.hg/xen/drivers/passthrough/io.c
> ===================================================================
> --- xen-unstable.hg.orig/xen/drivers/passthrough/io.c	2009-03-09
> 12:44:48.000000000 +1100 +++
> xen-unstable.hg/xen/drivers/passthrough/io.c	2009-03-09
>      12:58:28.000000000 +1100 @@ -37,6 +37,9 @@ static void
>      pt_irq_time_out(void *data) struct hvm_irq_dpci *dpci = NULL;
>      struct dev_intx_gsi_link *digl; uint32_t device, intx;
> +    DECLARE_BITMAP(machine_gsi_map, NR_IRQS);
> +
> +    bitmap_zero(machine_gsi_map, NR_IRQS);
> 
>      spin_lock(&irq_map->dom->event_lock);
> 
> @@ -46,16 +49,31 @@ static void pt_irq_time_out(void *data)
>      {
>          guest_gsi = digl->gsi;
>          machine_gsi = dpci->girq[guest_gsi].machine_gsi;
> +        set_bit(machine_gsi, machine_gsi_map);
>          device = digl->device;
>          intx = digl->intx;
>          hvm_pci_intx_deassert(irq_map->dom, device, intx);
>      }
> 
> -    clear_bit(machine_gsi, dpci->dirq_mask);
> -    vector = domain_irq_to_vector(irq_map->dom, machine_gsi);
> -    dpci->mirq[machine_gsi].pending = 0;
> +    for ( machine_gsi = find_first_bit(machine_gsi_map, NR_IRQS);
> +          machine_gsi < NR_IRQS;
> +          machine_gsi = find_next_bit(machine_gsi_map, NR_IRQS,
> +                                      machine_gsi + 1) )
> +    {
> +        clear_bit(machine_gsi, dpci->dirq_mask);
> +        vector = domain_irq_to_vector(irq_map->dom, machine_gsi);
> +        dpci->mirq[machine_gsi].pending = 0;
> +    }
> +
>      spin_unlock(&irq_map->dom->event_lock);
> -    pirq_guest_eoi(irq_map->dom, machine_gsi);
> +
> +    for ( machine_gsi = find_first_bit(machine_gsi_map, NR_IRQS);
> +          machine_gsi < NR_IRQS;
> +          machine_gsi = find_next_bit(machine_gsi_map, NR_IRQS,
> +                                      machine_gsi + 1) )
> +    {
> +        pirq_guest_eoi(irq_map->dom, machine_gsi);
> +    }
>  }
> 
>  int pt_irq_create_bind_vtd(
> 
> --

  reply	other threads:[~2009-03-10  7:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-09  9:01 [rfc 0/2] allow pass-through devices to share GSI Simon Horman
2009-03-09  9:01 ` [rfc 1/2] pt_irq_time_out() should act on all machine_irq Simon Horman
2009-03-10  7:40   ` Han, Weidong [this message]
2009-03-10  7:46     ` Simon Horman
2009-03-09  9:01 ` [rfc 2/2] allow pass-through devices to share GSI Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=715D42877B251141A38726ABF5CABF2C0195B5C568@pdsmsx503.ccr.corp.intel.com \
    --to=weidong.han@intel.com \
    --cc=horms@verge.net.au \
    --cc=keir.fraser@eu.citrix.com \
    --cc=shimada-yxb@necst.nec.co.jp \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.