public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Mark Maule <maule@sgi.com>
Cc: linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH 2/4] msi vector targeting abstractions
Date: Wed, 21 Dec 2005 18:56:37 +0000	[thread overview]
Message-ID: <20051221185637.GA13210@infradead.org> (raw)
In-Reply-To: <20051221184348.5003.7540.53186@attica.americas.sgi.com>

On Wed, Dec 21, 2005 at 12:42:41PM -0600, Mark Maule wrote:
> Abstract portions of the MSI core for platforms that do not use standard
> APIC interrupt controllers.  This is implemented through a set of callouts
> which default to current behavior, but which can be overridden by calling
> msi_register_callouts() in the platform msi init code.

we tend to calls these _ops or _operations instead of _callouts.
Also I'd suggest to not keep the generic ones where they are but
in a separate file and let the existing plattforms calls msi_register()
with the ops table for those.  This keeps the interface symmetric instead
of favouring the first implementation.

> @@ -89,10 +91,25 @@
>  }
>  
>  #ifdef CONFIG_SMP
> +static void msi_target_generic(unsigned int vector,
> +			       unsigned int dest_cpu,
> +			       uint32_t *address_hi,	/* in/out */
> +			       uint32_t *address_lo)	/* in/out */

Please try to use u32 instead of uint32_t everywhere.  Dito for other
sizes and signed types.

> +{
> +	struct msg_address address;
> +
> +	address.lo_address.value = *address_lo;
> +	address.lo_address.value &= MSI_ADDRESS_DEST_ID_MASK;
> +	address.lo_address.value |> +		(cpu_physical_id(dest_cpu) << MSI_TARGET_CPU_SHIFT);
> +
> +	*address_lo = address.lo_address.value;
> +}

Why do we need the full struct msg_address here?  What about just:

static void msi_target_apic(unsigned int vector, unsigned int dest_cpu,
			    u32 *address_hi, u32 *address_lo)
{
	u32 addr = *address_lo;

	addr &= MSI_ADDRESS_DEST_ID_MASK;
	addr |= (cpu_physical_id(dest_cpu) << MSI_TARGET_CPU_SHIFT);

	*address_lo = addr;
}

> +	(*msi_callouts.msi_teardown)(vector);
> +

just
	msi_ops.teardown(vector);

> +union msg_data {
> +	struct {
>  #if defined(__LITTLE_ENDIAN_BITFIELD)
> -	__u32	vector		:  8;
> -	__u32	delivery_mode	:  3;	/* 000b: FIXED | 001b: lowest prior */
> -	__u32	reserved_1	:  3;
> -	__u32	level		:  1;	/* 0: deassert | 1: assert */
> -	__u32	trigger		:  1;	/* 0: edge | 1: level */
> -	__u32	reserved_2	: 16;
> +		__u32	vector		:  8;
> +		__u32	delivery_mode	:  3;	/* 000b: FIXED */
> +						/* 001b: lowest prior */
> +		__u32	reserved_1	:  3;
> +		__u32	level		:  1;	/* 0: deassert | 1: assert */
> +		__u32	trigger		:  1;	/* 0: edge | 1: level */
> +		__u32	reserved_2	: 16;
>  #elif defined(__BIG_ENDIAN_BITFIELD)
> -	__u32	reserved_2	: 16;
> -	__u32	trigger		:  1;	/* 0: edge | 1: level */
> -	__u32	level		:  1;	/* 0: deassert | 1: assert */
> -	__u32	reserved_1	:  3;
> -	__u32	delivery_mode	:  3;	/* 000b: FIXED | 001b: lowest prior */
> -	__u32	vector		:  8;
> +		__u32	reserved_2	: 16;
> +		__u32	trigger		:  1;	/* 0: edge | 1: level */
> +		__u32	level		:  1;	/* 0: deassert | 1: assert */
> +		__u32	reserved_1	:  3;
> +		__u32	delivery_mode	:  3;	/* 000b: FIXED */
> +						/* 001b: lowest prior */
> +		__u32	vector		:  8;
>  #else
>  #error "Bitfield endianness not defined! Check your byteorder.h"
>  #endif
> +	}u;
> +	__u32 value;
>  } __attribute__ ((packed));


While you're cleaning things up, could you please kill the horrible abuse
of bitfields for H/W structures and do proper masking instead.


  reply	other threads:[~2005-12-21 18:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-21 18:42 [PATCH 0/4] msi abstractions and support for altix Mark Maule
2005-12-21 18:42 ` [PATCH 1/4] msi archetecture init hook Mark Maule
2005-12-21 18:53   ` Matthew Wilcox
2005-12-21 19:03     ` Mark Maule
2005-12-21 19:40   ` Matthew Wilcox
2005-12-21 18:42 ` [PATCH 2/4] msi vector targeting abstractions Mark Maule
2005-12-21 18:56   ` Christoph Hellwig [this message]
2005-12-21 19:17     ` Mark Maule
2005-12-21 19:05   ` Matthew Wilcox
2005-12-21 19:17     ` linux-os (Dick Johnson)
2005-12-21 19:33     ` Mark Maule
2005-12-22 10:36       ` Christoph Hellwig
2005-12-22 13:59         ` Mark Maule
2005-12-21 18:42 ` [PATCH 3/4] per-platform IA64_{FIRST,LAST}_DEVICE_VECTOR definitions Mark Maule
2005-12-21 19:09   ` Matthew Wilcox
2005-12-21 19:18     ` Mark Maule
2005-12-21 19:32       ` Matthew Wilcox
2005-12-22  6:26   ` Keith Owens
2005-12-22 13:14     ` Matthew Wilcox
2005-12-21 18:42 ` [PATCH 4/4] altix: msi support Mark Maule

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=20051221185637.GA13210@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maule@sgi.com \
    --cc=tony.luck@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox