From: Zhenyu Wang Subject: Re: [PATCH v3 1/2] drm/i915: remove confusing GPIO vs PCH_GPIO Date: Mon, 23 Jul 2018 10:58:05 +0800 Message-ID: <20180723025805.GC1267@zhen-hp.sh.intel.com> References: <20180713154212.17036-1-lucas.demarchi@intel.com> <20180713160719.GM5565@intel.com> <20180718100118.GR5565@intel.com> <0b144e086cbce731f99b0b286e018cd898eff44b.camel@intel.com> Reply-To: Zhenyu Wang Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0321336675==" Return-path: In-Reply-To: <0b144e086cbce731f99b0b286e018cd898eff44b.camel@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: "De Marchi, Lucas" Cc: "daniel.vetter@ffwll.ch" , "intel-gfx@lists.freedesktop.org" , "Vivi, Rodrigo" , "intel-gvt-dev@lists.freedesktop.org" List-Id: intel-gfx@lists.freedesktop.org --===============0321336675== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IcjzwMCQyeqbz4V/" Content-Disposition: inline --IcjzwMCQyeqbz4V/ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018.07.19 17:20:15 +0000, De Marchi, Lucas wrote: > CC'ing gvt maintainers (and fixing Jani's address in CC). >=20 > See below >=20 > On Wed, 2018-07-18 at 13:01 +0300, Ville Syrj=E4l=E4 wrote: > > On Tue, Jul 17, 2018 at 03:16:53PM -0700, Lucas De Marchi wrote: > > > On Fri, Jul 13, 2018 at 9:10 AM Ville Syrj=E4l=E4 > > > wrote: > > > >=20 > > > > On Fri, Jul 13, 2018 at 08:42:11AM -0700, Lucas De Marchi wrote: > > > > > Instead of defining all registers twice, define just a PCH_GPIO_B= ASE > > > > > that has the same address as PCH_GPIO_A and use that to calculate= all > > > > > the others. This also brings VLV and !HAS_GMCH_DISPLAY in line, d= oing > > > > > the same thing. > > > > >=20 > > > > > v2: Fix GMBUS registers to be relative to gpio base; create GPIO() > > > > > macro to return a particular gpio address and move the enum o= ut of > > > > > i915_reg.h (suggested by Jani) > > > > >=20 > > > > > v3: Move base offset inside the GPIO() macro so the GMBUS defines > > > > > don't > > > > > actually need to be changed (suggested by Daniel/Ville) > > > > >=20 > > > > > Signed-off-by: Lucas De Marchi > > > > > --- > > > > > drivers/gpu/drm/i915/gvt/handlers.c | 2 +- > > > > > drivers/gpu/drm/i915/i915_drv.h | 3 ++- > > > > > drivers/gpu/drm/i915/i915_reg.h | 24 +++++------------------- > > > > > drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++++++++++ > > > > > drivers/gpu/drm/i915/intel_i2c.c | 12 ++++-------- > > > > > 5 files changed, 28 insertions(+), 29 deletions(-) > > > > >=20 > > > > > diff --git a/drivers/gpu/drm/i915/gvt/handlers.c > > > > > b/drivers/gpu/drm/i915/gvt/handlers.c > > > > > index 7a58ca555197..ecff866bbbf1 100644 > > > > > --- a/drivers/gpu/drm/i915/gvt/handlers.c > > > > > +++ b/drivers/gpu/drm/i915/gvt/handlers.c > > > > > @@ -2118,7 +2118,7 @@ static int init_generic_mmio_info(struct > > > > > intel_gvt *gvt) > > > > >=20 > > > > > MMIO_F(PCH_GMBUS0, 4 * 4, 0, 0, 0, D_ALL, gmbus_mmio_read, > > > > > gmbus_mmio_write); > > > > > - MMIO_F(PCH_GPIOA, 6 * 4, F_UNALIGN, 0, 0, D_ALL, NULL, NULL= ); > > > > > + MMIO_F(GPIO(GPIOA), 6 * 4, F_UNALIGN, 0, 0, D_ALL, NULL, NU= LL); > > > >=20 > > > > I have no idea of gpio_mmio_base is populated correctly at this poi= nt > > > > for gvt, and I'm too lazy to find out. > > >=20 > > > humn, unfortunately it is not > > >=20 > > > i915_driver_load() -> i915_load_modeset_init() -> intel_setup_gmbus() > > > -> dev_priv->gpio_mmio_base =3D ... > > > i915_driver_load() -> i915_driver_init_hw() -> intel_gvt_init() -> > > > intel_gvt_init_device() -> intel_gvt_setup_mmio_info() -> > > > init_generic_mmio_info() > > >=20 > > > Is adding a single PCH_GPIO_BASE that doesn't depend on dev_priv being > > > populated for use on gvt an option? > >=20 > > IIRC gvt already has some local register defines (possibly due to this > > same reason?). Could add a few more I suppose. +cc the gvt folks to get > > their input. >=20 > Summary to gvt maintainers: I want to get rid of the multiple GPIO vs PCH= _GPIO > defines we have today. For that I created the GPIO() macro, but it depend= s on > dev_priv being populated with the gpio's block offset already which is not > true while initializing gvt. > This also applys to GMBUS change, right? > I can define a PCH_GPIO_BASE as above in i915_reg.h that is the same as > PCH_GPIOA today. Or define it in a private gvt header. Do you have another > option/suggestion? > yeah, adding a base define for gvt private seems good to me, as gvt handles MMIO trap so may need to use them in different way. thanks --=20 Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827 --IcjzwMCQyeqbz4V/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQTXuabgHDW6LPt9CICxBBozTXgYJwUCW1VEPQAKCRCxBBozTXgY J16GAJ4v4a2AaTxZs47h0N7JziQiesIf6gCdGldz2vf0ANbve8qwtMYwreqd/+4= =VqXY -----END PGP SIGNATURE----- --IcjzwMCQyeqbz4V/-- --===============0321336675== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============0321336675==--