From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84305C00140 for ; Thu, 18 Aug 2022 10:49:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DCFE6CD38F; Thu, 18 Aug 2022 10:49:06 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 37BFFCD32F for ; Thu, 18 Aug 2022 10:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660819728; x=1692355728; h=from:to:subject:in-reply-to:references:date:message-id: mime-version; bh=rYsSXFd1w8iLxiYaLGy22Y2SCqGYk/YYsW1/aMDlZbc=; b=ZE0MF7vPGlehfHMJ3pSq19JaA1tWBBMUKOH+8gXiFzibXX3E15KTLJAf JTZNo0SoIhUumMGuZfx6D911WMyR/CCljNORp9ZgfZyw71N2F9nLpnqZL fzJI+vLAZfH/Qgf3FHC0dId3zR+YXlEU/vLngyNXkTm1B3r8qP0tHH9yK Ppp7l9KA/lwwA4OhuohJQ6w6qSeFrPA1nBvdnM0FqkCviddLet2Zr+NUx v1X38iT1gX3SWUGjx8MV1v70RcIXzSQty7QgbRJxGnQfpYRzGZVTIBAso arWJdiJKJJL64mEnyxx24oOIDNvWqeP0Pht4xIxiznjanX5AiJ2r65M0d A==; X-IronPort-AV: E=McAfee;i="6500,9779,10442"; a="279693399" X-IronPort-AV: E=Sophos;i="5.93,246,1654585200"; d="scan'208";a="279693399" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2022 03:48:47 -0700 X-IronPort-AV: E=Sophos;i="5.93,246,1654585200"; d="scan'208";a="636775782" Received: from mwiniars-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.40.166]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2022 03:48:45 -0700 From: Jani Nikula To: Maarten Lankhorst , intel-gfx@lists.freedesktop.org In-Reply-To: <914a1ac6-202f-eca4-46dc-ac1899321182@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <914a1ac6-202f-eca4-46dc-ac1899321182@linux.intel.com> Date: Thu, 18 Aug 2022 13:48:43 +0300 Message-ID: <87zgg1omic.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Intel-gfx] [PATCH 16/16] drm/i915: make device info a pointer to static const data X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, 18 Aug 2022, Maarten Lankhorst wrote: > Op 20-06-2022 om 10:49 schreef Jani Nikula: >> Now that the device info is no longer modified runtime, we don't need to >> make a copy of it, and we can convert i915->__info into a pointer to >> static const data. Also remove mkwrite_device_info(). >> >> This does increase the text size slightly. >> >> Signed-off-by: Jani Nikula >> >> --- >> >> An alternative is to keep copying device info, but casting away the >> const only once at the copy time, removing mkwrite_device_info(). >> --- >> drivers/gpu/drm/i915/i915_driver.c | 8 ++------ >> drivers/gpu/drm/i915/i915_drv.h | 11 ++--------- >> 2 files changed, 4 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c >> index 5969cc7805d3..9c9c492e97a8 100644 >> --- a/drivers/gpu/drm/i915/i915_driver.c >> +++ b/drivers/gpu/drm/i915/i915_driver.c >> @@ -793,9 +793,6 @@ static void i915_welcome_messages(struct drm_i915_private *dev_priv) >> static struct drm_i915_private * >> i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent) >> { >> - const struct intel_device_info *match_info = >> - (struct intel_device_info *)ent->driver_data; >> - struct intel_device_info *device_info; >> struct intel_runtime_info *runtime; >> struct drm_i915_private *i915; >> >> @@ -809,9 +806,8 @@ i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent) >> /* Device parameters start as a copy of module parameters. */ >> i915_params_copy(&i915->params, &i915_modparams); >> >> - /* Setup the write-once "constant" device info */ >> - device_info = mkwrite_device_info(i915); >> - memcpy(device_info, match_info, sizeof(*device_info)); >> + /* Static const device info. */ >> + i915->__info = (const struct intel_device_info *)ent->driver_data; >> >> /* Initialize initial runtime info from static const data and pdev. */ >> runtime = RUNTIME_INFO(i915); >> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h >> index 89472440947c..a2a57f07c5be 100644 >> --- a/drivers/gpu/drm/i915/i915_drv.h >> +++ b/drivers/gpu/drm/i915/i915_drv.h >> @@ -380,7 +380,7 @@ struct drm_i915_private { >> /* i915 device parameters */ >> struct i915_params params; >> >> - const struct intel_device_info __info; /* Use INTEL_INFO() to access. */ >> + const struct intel_device_info *__info; /* Use INTEL_INFO() to access. */ >> struct intel_runtime_info __runtime; /* Use RUNTIME_INFO() to access. */ >> struct intel_driver_caps caps; >> >> @@ -848,7 +848,7 @@ static inline struct intel_gt *to_gt(struct drm_i915_private *i915) >> GENMASK(INTEL_FRONTBUFFER_BITS_PER_PIPE * ((pipe) + 1) - 1, \ >> INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)) >> >> -#define INTEL_INFO(dev_priv) (&(dev_priv)->__info) >> +#define INTEL_INFO(__i915) (__i915->__info) >> #define RUNTIME_INFO(dev_priv) (&(dev_priv)->__runtime) >> #define DRIVER_CAPS(dev_priv) (&(dev_priv)->caps) >> >> @@ -1432,13 +1432,6 @@ void i915_gem_driver_release(struct drm_i915_private *dev_priv); >> >> int i915_gem_open(struct drm_i915_private *i915, struct drm_file *file); >> >> -/* intel_device_info.c */ >> -static inline struct intel_device_info * >> -mkwrite_device_info(struct drm_i915_private *dev_priv) >> -{ >> - return (struct intel_device_info *)INTEL_INFO(dev_priv); >> -} >> - >> static inline enum i915_map_type >> i915_coherent_map_type(struct drm_i915_private *i915, >> struct drm_i915_gem_object *obj, bool always_coherent) > > I think just moving around things is safest in this case. I believe > all should be moved to the new display sub-struct, but this is a start > of making that easier. > > For the series, except patch 5: > > Reviewed-by: Maarten Lankhort Thanks... but there's v2 starting at [1]. I don't recall any changes other than rebase and slight reordering of patches. What's wrong with patch 5? I mean it does get modified runtime. BR, Jani. [1] https://lore.kernel.org/r/cover.1660137416.git.jani.nikula@intel.com -- Jani Nikula, Intel Open Source Graphics Center