public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Mrzyglod, Daniel T" <daniel.t.mrzyglod@intel.com>
To: "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 v7 2/3] lib/intel_mmio: add funtions for read/write register funtions
Date: Mon, 19 Aug 2019 13:19:14 +0000	[thread overview]
Message-ID: <063c9a8f74964ac1a4c4fa94dad951327b8e7bd6.camel@intel.com> (raw)
In-Reply-To: <156598459984.11610.11086078307790618830@skylake-alporthouse-com>

On Fri, 2019-08-16 at 20:43 +0100, Chris Wilson wrote:
> Quoting Daniel Mrzyglod (2019-08-16 15:53:16)
> >     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.
> > 
> >     v4: reword commitmsg, spelling errors
> > 
> >     Cc: Antonio Argenziano <antonio.argenziano@intel.com>
> >     Cc: Daniele Spurio Ceraolo <daniele.ceraolospurio@intel.com>
> >     Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> >     Cc: Chris Wilson <chris@chris-wilson.co.uk>
> >     Cc: Petri Latvala <petri.latvala@intel.com>
> >     Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> > 
> >     Reviewed-by: Zbigniew Kempczyński <
> > zbigniew.kempczynski@intel.com>
> >     Signed-off-by: Daniel Mrzyglod <daniel.t.mrzyglod@intel.com>
> > ---
> >  lib/intel_io.h   |   7 ++++
> >  lib/intel_mmio.c | 107
> > +++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 114 insertions(+)
> > 
> > diff --git a/lib/intel_io.h b/lib/intel_io.h
> > index 6014c485..99cb1829 100644
> > --- a/lib/intel_io.h
> > +++ b/lib/intel_io.h
> > @@ -49,6 +49,13 @@ 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 *igt_mmio, uint32_t reg);
> > +uint16_t INREG16_DEV(void *igt_mmio, uint32_t reg);
> > +uint8_t INREG8_DEV(void *igt_mmio, uint32_t reg);
> > +void OUTREG_DEV(void *igt_mmio, uint32_t reg, uint32_t val);
> > +void OUTREG16_DEV(void *igt_mmio, uint32_t reg, uint16_t val);
> > +void OUTREG8_DEV(void *igt_mmio, uint32_t reg, uint8_t val);
> > +
> >  /* sideband access functions from intel_iosf.c */
> >  uint32_t intel_dpio_reg_read(uint32_t reg, int phy);
> >  void intel_dpio_reg_write(uint32_t reg, uint32_t val, int phy);
> > diff --git a/lib/intel_mmio.c b/lib/intel_mmio.c
> > index a5458aeb..01411c37 100644
> > --- a/lib/intel_mmio.c
> > +++ b/lib/intel_mmio.c
> > @@ -405,3 +405,110 @@ void OUTREG8(uint32_t reg, uint8_t val)
> >  {
> >         *((volatile uint8_t *)igt_global_mmio + reg) = val;
> >  }
> > +
> > +
> > +/**
> > + * INREG_DEV:
> > + * @igt_mmio maped memory pointer
> > + * @reg: register offset
> > + *
> > + * 32-bit read of the register at offset @reg. This function only
> > works when the
> > + * new register access helper is initialized with
> > intel_register_access_init().
> > + *
> > + * This function directly accesses the igt_mmio without safety
> > checks.
> > + *
> > + * Returns:
> > + * The value read from the register.
> > + */
> > +uint32_t INREG_DEV(void *igt_mmio, uint32_t reg)
> > +{
> > +       return *(volatile uint32_t *)((volatile char *)igt_mmio +
> > reg);
> 
> We allow arithmetic on void*, the first cast is unnecessary.
> 
> Is there a good reason why these are not inlines? The cost of
> function
> call looks to be greater than the body?
> -Chris

So you suggest to move all those functions to intel_io.h/or other
header/ as static inlines? 

I expanded those functions like it was for previous register read write
functions - so maybe this behaviour was for debugging pupose?

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

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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16 14:53 [igt-dev] [PATCH i-g-t v7 0/3] Remove global igt_global_mmio Daniel Mrzyglod
2019-08-16 14:53 ` [igt-dev] [PATCH i-g-t v7 1/3] lib/igt_device: add igt_device_get_pci_addr by fd Daniel Mrzyglod
2019-08-16 14:53 ` [igt-dev] [PATCH i-g-t v7 2/3] lib/intel_mmio: add funtions for read/write register funtions Daniel Mrzyglod
2019-08-16 19:43   ` Chris Wilson
2019-08-19 13:19     ` Mrzyglod, Daniel T [this message]
2019-08-16 14:53 ` [igt-dev] [PATCH i-g-t v7 3/3] lib/intel_mmio: add additional api for multiple devices Daniel Mrzyglod
2019-08-16 19:50   ` Chris Wilson
2019-08-16 15:43 ` [igt-dev] ✓ Fi.CI.BAT: success for Remove global igt_global_mmio (rev7) Patchwork
2019-08-17  7:43 ` [igt-dev] ✓ Fi.CI.IGT: " 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=063c9a8f74964ac1a4c4fa94dad951327b8e7bd6.camel@intel.com \
    --to=daniel.t.mrzyglod@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox