WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] ioemu: unmap INTx interrupt on hot-remove

To: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] ioemu: unmap INTx interrupt on hot-remove
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Thu, 26 Mar 2009 16:12:38 +1100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Wed, 25 Mar 2009 22:13:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20090313134807.66F0.27C06F64@xxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20090313134807.66F0.27C06F64@xxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
On Fri, Mar 13, 2009 at 01:59:24PM +0900, Yuji Shimada wrote:
> This patch unmaps INTx interrupt on hot-remove.
> 
> Please apply this patch after applying the following patch.
> 
>     [Xen-devel] [PATCH] ioemu: msi/msix clean up on hotplug remove
> 
> Thanks,
> --
> Yuji Shimada
> 
> 
> Signed-off-by: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>
> 
> diff --git a/hw/pass-through.c b/hw/pass-through.c
> index ee52960..4e7f447 100644
> --- a/hw/pass-through.c
> +++ b/hw/pass-through.c
> @@ -46,6 +46,8 @@ struct dpci_infos {
>  
>  } dpci_infos;
>  
> +char mapped_machine_irq[PT_NR_IRQS] = {0};

This only initialises the first element of mapped_machine_irq[] to 0.

> +
>  /* prototype */
>  static uint32_t pt_common_reg_init(struct pt_dev *ptdev,
>      struct pt_reg_info_tbl *reg, uint32_t real_offset);
> @@ -3657,6 +3659,7 @@ struct pt_dev * register_real_device(PCIBus *e_bus,
>          {
>              machine_irq = pirq;
>              assigned_device->machine_irq = pirq;
> +            mapped_machine_irq[machine_irq]++;
>          }
>      }
>  
> @@ -3737,6 +3740,19 @@ int unregister_real_device(int php_slot)
>      if (assigned_device->msix)
>          pt_msix_disable(assigned_device);
>  
> +    if (machine_irq)
> +    {
> +        mapped_machine_irq[machine_irq]--;
> +
> +        if (mapped_machine_irq[machine_irq] == 0)
> +        {
> +            rc = xc_physdev_unmap_pirq(xc_handle, domid, machine_irq);
> +
> +            if (rc < 0)
> +                PT_LOG("Error: Unmaping of interrupt failed! rc=%d\n", rc);
> +        }
> +    }
> +
>      /* delete all emulated config registers */
>      pt_config_delete(assigned_device);
>  
> diff --git a/hw/pass-through.h b/hw/pass-through.h
> index e86d311..6679fc2 100644
> --- a/hw/pass-through.h
> +++ b/hw/pass-through.h
> @@ -40,6 +40,7 @@
>  
>  #define PT_MACHINE_IRQ_AUTO (0xFFFFFFFF)
>  #define PT_VIRT_DEVFN_AUTO  (-1)
> +#define PT_NR_IRQS          (256)
>  
>  /* Misc PCI constants that should be moved to a separate library :) */
>  #define PCI_CONFIG_SIZE         (256)
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

-- 
Simon Horman
  VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
  H: www.vergenet.net/~horms/             W: www.valinux.co.jp/en


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel