Re: [PATCH 3/3] VT-d: use msi_compose_msg()

Zhang, Xiantao
Wed, 12 Sep 2012 09:56:48 -0000

Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>, Thanks!
Xiantao

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Tuesday, September 11, 2012 8:36 PM
> To: xen-devel
> Cc: Zhang, Xiantao
> Subject: [PATCH 3/3] VT-d: use msi_compose_msg()
>
> ... instead of open coding it.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1079,22 +1079,11 @@ static void dma_msi_set_affinity(struct
>          return;
>      }
>
> -    memset(&msg, 0, sizeof(msg));
> -    msg.data = MSI_DATA_VECTOR(desc->arch.vector) & 0xff;
> -    msg.data |= 1 << 14;
> -    msg.data |= (INT_DELIVERY_MODE != dest_LowestPrio) ?
> -        MSI_DATA_DELIVERY_FIXED:
> -        MSI_DATA_DELIVERY_LOWPRI;
> -
> -    /* Follow MSI setting */
> +    msi_compose_msg(desc, &msg);
> +    /* Are these overrides really needed? */
>      if (x2apic_enabled)
>          msg.address_hi = dest & 0xFFFFFF00;
> -    msg.address_lo = (MSI_ADDRESS_HEADER <<
> (MSI_ADDRESS_HEADER_SHIFT + 8));
> -    msg.address_lo |= INT_DEST_MODE ? MSI_ADDR_DESTMODE_LOGIC:
> -                    MSI_ADDR_DESTMODE_PHYS;
> -    msg.address_lo |= (INT_DELIVERY_MODE != dest_LowestPrio) ?
> -                    MSI_ADDR_REDIRECTION_CPU:
> -                    MSI_ADDR_REDIRECTION_LOWPRI;
> +    msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
>      msg.address_lo |= MSI_ADDR_DEST_ID(dest & 0xff);  #else
>      memset(&msg, 0, sizeof(msg));
>
>