[RFC Part2 v1 14/21] x86, hpet: Enhance HPET IRQ to support hierarchy irqdomain

Thomas Gleixner tglx at linutronix.de
Tue Sep 16 11:31:45 PDT 2014


On Thu, 11 Sep 2014, Jiang Liu wrote:
>  #ifdef CONFIG_HPET_TIMER
> +#define	HPET_DOMAIN_REMAPPED		0x80000000
> +
> +static inline int hpet_dev_id(struct irq_domain *domain)
> +{
> +	return (int)((long)domain->host_data & ~HPET_DOMAIN_REMAPPED);
> +}
> +
> +static inline bool hpet_remapped(struct irq_domain *domain)
> +{
> +	return (bool)((long)domain->host_data & HPET_DOMAIN_REMAPPED);
> +}

It's kinda odd to have this encoded in domain->host_data.

>  static int hpet_msi_set_affinity(struct irq_data *data,
>  				 const struct cpumask *mask, bool force)
>  {
> +	struct irq_data *parent = data->parent_data;
>  	struct irq_cfg *cfg = irqd_cfg(data);
>  	struct msi_msg msg;
> -	unsigned int dest;
>  	int ret;
>  
> -	ret = apic_set_affinity(data, mask, &dest);
> -	if (ret)
> -		return ret;
> -
> -	hpet_msi_read(data->handler_data, &msg);
> -
> -	msg.data &= ~MSI_DATA_VECTOR_MASK;
> -	msg.data |= MSI_DATA_VECTOR(cfg->vector);
> -	msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
> -	msg.address_lo |= MSI_ADDR_DEST_ID(dest);
> -
> -	hpet_msi_write(data->handler_data, &msg);
> +	ret = parent->chip->irq_set_affinity(parent, mask, force);
> +	/* No need to rewrite HPET registers if interrupt is remapped */
> +	if (ret >= 0 && !hpet_remapped(data->domain)) {

So we really should use irq_data->chip_data for this, i.e. storing

struct hpet_msi {
       struct msi_msg msg;
       bool remapped;
       /* whatever you need here */
};

> +		hpet_msi_read(data->handler_data, &msg);
> +		msg.data &= ~MSI_DATA_VECTOR_MASK;
> +		msg.data |= MSI_DATA_VECTOR(cfg->vector);
> +		msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
> +		msg.address_lo |= MSI_ADDR_DEST_ID(cfg->dest_apicid);

We need the same thing for MSI so this should be a helper function

   msi_update_msg(struct msi_msg *msg, struct irq_cfg *cfg)

> +		hpet_msi_write(data->handler_data, &msg);
> +	}
>  
> -	return IRQ_SET_MASK_OK_NOCOPY;
> +	return ret;
>  }
 
Thanks,

	tglx



More information about the linux-arm-kernel mailing list