public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Mrzyglod, Daniel T" <daniel.t.mrzyglod@intel.com>
To: "Kempczynski, Zbigniew" <zbigniew.kempczynski@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"chris@chris-wilson.co.uk" <chris@chris-wilson.co.uk>
Subject: Re: [igt-dev] [PATCH i-g-t v11 2/3] lib/intel_mmio: add funtions for read/write register funtions
Date: Thu, 29 Aug 2019 13:10:00 +0000	[thread overview]
Message-ID: <9eac445456d8f24eb8f0ffca351697c0cce9bdf5.camel@intel.com> (raw)
In-Reply-To: <156706599615.15406.46785752496187553@skylake-alporthouse-com>

On Thu, 2019-08-29 at 09:06 +0100, Chris Wilson wrote:
> Quoting Kempczynski, Zbigniew (2019-08-29 06:03:37)
> > On Wed, 2019-08-28 at 20:12 +0200, Daniel Mrzyglod wrote:
> > >     This patch is first move to extend functionality of
> > > intel_mmio library.
> > >     There was limitation for 1 device, adding pointer for IO
> > > functions to
> > >     mmaped area gives us possibility to use those IO functions
> > > for other
> > > mmaped
> > >     devices.
> > > 
> > <cut>
> > > -uint16_t INREG16(uint32_t reg);
> > > -uint8_t INREG8(uint32_t reg);
> > > -void OUTREG(uint32_t reg, uint32_t val);
> > > -void OUTREG16(uint32_t reg, uint16_t val);
> > > -void OUTREG8(uint32_t reg, uint8_t val);
> > > +
> > > +uint32_t INREG_DEV(void *mmio, uint32_t reg);
> > > +uint16_t INREG16_DEV(void *mmio, uint32_t reg);
> > > +uint8_t INREG8_DEV(void *mmio, uint32_t reg);
> > > +void OUTREG_DEV(void *mmio, uint32_t reg, uint32_t val);
> > > +void OUTREG16_DEV(void *mmio, uint32_t reg, uint16_t val);
> > > +void OUTREG8_DEV(void *mmio, uint32_t reg, uint8_t val);
> > > +
> > > +#define INREG_PTR(n,...) INREG##n##_DEV(__VA_ARGS__)
> > > +#define INREG_NOPTR(n,...) INREG##n##_DEV(igt_global_mmio,
> > > __VA_ARGS__)
> > > +#define INREG_GET_MACRO(_1,_2,NAME,...) NAME
> > > +#define INREGX(n,...) INREG_GET_MACRO(__VA_ARGS__, INREG_PTR,
> > > INREG_NOPTR)(n, __VA_ARGS__)
> > > +#define INREG16(...) INREGX(16, __VA_ARGS__)
> > > +#define INREG8(...) INREGX(8, __VA_ARGS__)
> > > +#define INREG(...) INREGX(,__VA_ARGS__)
> > > +
> > > +#define OUTREG_PTR(n,...) OUTREG##n##_DEV(__VA_ARGS__)
> > > +#define OUTREG_NOPTR(n,...) OUTREG##n##_DEV(igt_global_mmio,
> > > __VA_ARGS__)
> > > +#define OUTREG_GET_MACRO(_1,_2,_3,NAME,...) NAME
> > > +#define OUTREGX(n, ...) OUTREG_GET_MACRO(__VA_ARGS__,
> > > OUTREG_PTR,
> > > OUTREG_NOPTR)(n, __VA_ARGS__)
> > > +#define OUTREG16(...) OUTREGX(16, __VA_ARGS__)
> > > +#define OUTREG8(...) OUTREGX(8, __VA_ARGS__)
> > > +#define OUTREG(...) OUTREGX(,__VA_ARGS__)
> > 
> > You'll likely became my local macro God, but this is overkill IMO.
> > 
> > For sake of readability I would: 
> > 1. make OUTREGX_DEV, INREGX_DEV (X = {,8,16}) inline functions
> > 2. make OUTREGX, INREG (X = {,8,16}) macros with predefined
> > igt_global_mmio
> >    as first argument to *_DEV() function.
> > 
> > If someone needs to use different mmio than igt_global_mmio he 
> > should use *_DEV(). 
> > 
> > Chris, could you speak up about above?
> 
> I would have finished the job by building the inlines with the
> macros...
> -Chris

THX for comments!
I spend some time with my old macros but inlines generated by macros
are probably cleaner and tidier solution!

Daniel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-08-29 13:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28 18:12 [igt-dev] [PATCH i-g-t v11 0/3] Remove global igt_global_mmio Daniel Mrzyglod
2019-08-28 18:12 ` [igt-dev] [PATCH i-g-t v11 1/3] lib/igt_device: add igt_device_get_pci_addr by fd Daniel Mrzyglod
2019-08-28 18:12 ` [igt-dev] [PATCH i-g-t v11 2/3] lib/intel_mmio: add funtions for read/write register funtions Daniel Mrzyglod
2019-08-29  5:03   ` Kempczynski, Zbigniew
2019-08-29  8:06     ` Chris Wilson
2019-08-29 13:10       ` Mrzyglod, Daniel T [this message]
2019-08-28 18:12 ` [igt-dev] [PATCH i-g-t v11 3/3] lib/intel_mmio: add additional api for multiple devices Daniel Mrzyglod
2019-08-29 10:20 ` [igt-dev] ✓ Fi.CI.BAT: success for Remove global igt_global_mmio (rev11) Patchwork
2019-08-29 18:34 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

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=9eac445456d8f24eb8f0ffca351697c0cce9bdf5.camel@intel.com \
    --to=daniel.t.mrzyglod@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=zbigniew.kempczynski@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