All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey.Brodkin@synopsys.com (Alexey Brodkin)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH] ARCv2: intc: untangle SMP, MCIP and IDU
Date: Fri, 7 Oct 2016 17:31:46 +0000	[thread overview]
Message-ID: <1475861484.2874.44.camel@synopsys.com> (raw)
In-Reply-To: <62f431fd-8c66-143b-2129-a1b996a0a98c@synopsys.com>

Hi Vineet,

On Thu, 2016-10-06@10:10 -0700, Vineet Gupta wrote:
> On 10/06/2016 02:10 AM, Alexey Brodkin wrote:
> > 
> > > 
> > > +struct mcip_bcr {
> > > +#ifdef CONFIG_CPU_BIG_ENDIAN
> > > +		unsigned int pad3:8,
> > > +			?????idu:1, llm:1, num_cores:6,
> > > +			?????iocoh:1,??gfrc:1, dbg:1, pad2:1,
> > > +			?????msg:1, sem:1, ipi:1, pad:1,
> > > +			?????ver:8;
> > > +#else
> > > +		unsigned int ver:8,
> > > +			?????pad:1, ipi:1, sem:1, msg:1,
> > > +			?????pad2:1, dbg:1, gfrc:1, iocoh:1,
> > > +			?????num_cores:6, llm:1, idu:1,
> > > +			?????pad3:8;
> > > +#endif
> > > +};
> > 
> > IMHO we should stop using this kind of constructions because they
> > are ugly and what's more important not portable.
> 
> They are ugly I agree - but not portable - really ? The whole point is to make
> this work on BE w/o changing the src code - this details remains hidden in an
> obscure header.

That's what I learned the hard way.
At least I was beaten a couple of times yet in both Linux kernel community and
U-Boot
one.

> > Even though we have it now working for both LE and BE configurations
> > it won't work for 64-bit cores. We'll need to add ifdeffed 32-bit paddings
> > then which will make that construction even more ugly.
> 
> When we get to 64-bit a lot things would have to change - and possibly the aux reg
> layout. There is no way to make this exact code 64-bit ready !

Probably but as of now I believe use of offsets for bit-fields is the safest
approach which makes code ugly as well but at least that way we reduce risk
of erroneous copy-paste in "mirrored" part.

-Alexey

WARNING: multiple messages have this Message-ID (diff)
From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
To: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Yuriy.Kolerov@synopsys.com" <Yuriy.Kolerov@synopsys.com>,
	"Vladislav.Zakharov@synopsys.com"
	<Vladislav.Zakharov@synopsys.com>,
	"linux-snps-arc@lists.infradead.org" 
	<linux-snps-arc@lists.infradead.org>
Subject: Re: [PATCH] ARCv2: intc: untangle SMP, MCIP and IDU
Date: Fri, 7 Oct 2016 17:31:46 +0000	[thread overview]
Message-ID: <1475861484.2874.44.camel@synopsys.com> (raw)
In-Reply-To: <62f431fd-8c66-143b-2129-a1b996a0a98c@synopsys.com>

Hi Vineet,

On Thu, 2016-10-06 at 10:10 -0700, Vineet Gupta wrote:
> On 10/06/2016 02:10 AM, Alexey Brodkin wrote:
> > 
> > > 
> > > +struct mcip_bcr {
> > > +#ifdef CONFIG_CPU_BIG_ENDIAN
> > > +		unsigned int pad3:8,
> > > +			     idu:1, llm:1, num_cores:6,
> > > +			     iocoh:1,  gfrc:1, dbg:1, pad2:1,
> > > +			     msg:1, sem:1, ipi:1, pad:1,
> > > +			     ver:8;
> > > +#else
> > > +		unsigned int ver:8,
> > > +			     pad:1, ipi:1, sem:1, msg:1,
> > > +			     pad2:1, dbg:1, gfrc:1, iocoh:1,
> > > +			     num_cores:6, llm:1, idu:1,
> > > +			     pad3:8;
> > > +#endif
> > > +};
> > 
> > IMHO we should stop using this kind of constructions because they
> > are ugly and what's more important not portable.
> 
> They are ugly I agree - but not portable - really ? The whole point is to make
> this work on BE w/o changing the src code - this details remains hidden in an
> obscure header.

That's what I learned the hard way.
At least I was beaten a couple of times yet in both Linux kernel community and
U-Boot
one.

> > Even though we have it now working for both LE and BE configurations
> > it won't work for 64-bit cores. We'll need to add ifdeffed 32-bit paddings
> > then which will make that construction even more ugly.
> 
> When we get to 64-bit a lot things would have to change - and possibly the aux reg
> layout. There is no way to make this exact code 64-bit ready !

Probably but as of now I believe use of offsets for bit-fields is the safest
approach which makes code ugly as well but at least that way we reduce risk
of erroneous copy-paste in "mirrored" part.

-Alexey

  reply	other threads:[~2016-10-07 17:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-05 20:39 [PATCH] ARCv2: intc: untangle SMP, MCIP and IDU Vineet Gupta
2016-10-05 20:39 ` Vineet Gupta
2016-10-06  9:10 ` Alexey Brodkin
2016-10-06  9:10   ` Alexey Brodkin
2016-10-06 17:10   ` Vineet Gupta
2016-10-06 17:10     ` Vineet Gupta
2016-10-07 17:31     ` Alexey Brodkin [this message]
2016-10-07 17:31       ` Alexey Brodkin
2016-10-07 21:39       ` Vineet Gupta
2016-10-07 21:39         ` Vineet Gupta

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=1475861484.2874.44.camel@synopsys.com \
    --to=alexey.brodkin@synopsys.com \
    --cc=linux-snps-arc@lists.infradead.org \
    /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.