All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Zhi Wang <zhi.wang.linux@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, jgg@nvidia.com,
	intel-gvt-dev@lists.freedesktop.org, hch@lst.de
Subject: Re: [Intel-gfx] [PATCH v6 2/3] i915/gvt: Save the initial HW state snapshot in i915
Date: Wed, 9 Feb 2022 08:32:01 +0100	[thread overview]
Message-ID: <20220209073201.GB9050@lst.de> (raw)
In-Reply-To: <20220208111151.13115-2-zhi.a.wang@intel.com>

On Tue, Feb 08, 2022 at 06:11:50AM -0500, Zhi Wang wrote:
> +	struct drm_i915_private *dev_priv = iter->i915;
> +	u32 *mmio, i;
> +
> +	for (i = offset; i < offset + size; i += 4) {
> +		mmio = iter->data + i;
> +		*mmio = intel_uncore_read_notrace(to_gt(dev_priv)->uncore,
> +						  _MMIO(i));

This reads much stranger than:

	u32 *mmio = iter->data;

	for (i = offset; i < offset + size; i += 4) {
		mmio[i] = intel_uncore_read_notrace(to_gt(dev_priv)->uncore,
						    _MMIO(i));
	}

> +static int handle_mmio(struct intel_gvt_mmio_table_iter *iter,
> +		       u32 offset, u32 device, u32 size)
> +{
> +	if (WARN_ON(!IS_ALIGNED(offset, 4)))
> +		return -EINVAL;

Shouldn't this be in the caller of the method?

> +	save_mmio(iter, offset, size);
> +	return 0;

Now that the block callback is gone save_mmio and handle_mmio
can be merged.

> +	mem = vzalloc(2 * SZ_1M);

Don't we want a driver-wide constant for this instead of a magic number?

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Zhi Wang <zhi.wang.linux@gmail.com>
Cc: hch@lst.de, jgg@nvidia.com, jani.nikula@linux.intel.com,
	intel-gfx@lists.freedesktop.org,
	intel-gvt-dev@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Zhi Wang <zhi.a.wang@intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Vivi Rodrigo <rodrigo.vivi@intel.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>
Subject: Re: [PATCH v6 2/3] i915/gvt: Save the initial HW state snapshot in i915
Date: Wed, 9 Feb 2022 08:32:01 +0100	[thread overview]
Message-ID: <20220209073201.GB9050@lst.de> (raw)
In-Reply-To: <20220208111151.13115-2-zhi.a.wang@intel.com>

On Tue, Feb 08, 2022 at 06:11:50AM -0500, Zhi Wang wrote:
> +	struct drm_i915_private *dev_priv = iter->i915;
> +	u32 *mmio, i;
> +
> +	for (i = offset; i < offset + size; i += 4) {
> +		mmio = iter->data + i;
> +		*mmio = intel_uncore_read_notrace(to_gt(dev_priv)->uncore,
> +						  _MMIO(i));

This reads much stranger than:

	u32 *mmio = iter->data;

	for (i = offset; i < offset + size; i += 4) {
		mmio[i] = intel_uncore_read_notrace(to_gt(dev_priv)->uncore,
						    _MMIO(i));
	}

> +static int handle_mmio(struct intel_gvt_mmio_table_iter *iter,
> +		       u32 offset, u32 device, u32 size)
> +{
> +	if (WARN_ON(!IS_ALIGNED(offset, 4)))
> +		return -EINVAL;

Shouldn't this be in the caller of the method?

> +	save_mmio(iter, offset, size);
> +	return 0;

Now that the block callback is gone save_mmio and handle_mmio
can be merged.

> +	mem = vzalloc(2 * SZ_1M);

Don't we want a driver-wide constant for this instead of a magic number?

  reply	other threads:[~2022-02-09  7:32 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 11:11 [Intel-gfx] [PATCH v6 1/3] i915/gvt: Introduce the mmio table to support VFIO new mdev API Zhi Wang
2022-02-08 11:11 ` Zhi Wang
2022-02-08 11:11 ` Zhi Wang
2022-02-08 11:11 ` [Intel-gfx] [PATCH v6 2/3] i915/gvt: Save the initial HW state snapshot in i915 Zhi Wang
2022-02-08 11:11   ` Zhi Wang
2022-02-08 11:11   ` Zhi Wang
2022-02-09  7:32   ` Christoph Hellwig [this message]
2022-02-09  7:32     ` Christoph Hellwig
2022-02-09 19:50     ` [Intel-gfx] " Wang, Zhi A
2022-02-09 19:50       ` Wang, Zhi A
2022-02-09 19:50       ` Wang, Zhi A
2022-02-08 11:11 ` [Intel-gfx] [PATCH v6 3/3] i915/gvt: Use the initial HW state snapshot saved " Zhi Wang
2022-02-08 11:11   ` Zhi Wang
2022-02-08 11:11   ` Zhi Wang
2022-02-09  7:32   ` [Intel-gfx] " Christoph Hellwig
2022-02-09  7:32     ` Christoph Hellwig
2022-02-08 12:24 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [v6,1/3] i915/gvt: Introduce the mmio table to support VFIO new mdev API Patchwork
2022-02-08 15:15 ` [Intel-gfx] [PATCH v6 1/3] " Jani Nikula
2022-02-08 15:15   ` Jani Nikula
2022-02-08 15:15   ` Jani Nikula
2022-02-09  7:28   ` [Intel-gfx] " Christoph Hellwig
2022-02-09  7:28     ` Christoph Hellwig
2022-02-09  9:04     ` [Intel-gfx] " Jani Nikula
2022-02-09  9:04       ` Jani Nikula
2022-02-09  9:04       ` Jani Nikula
2022-02-09 19:57       ` [Intel-gfx] " Wang, Zhi A
2022-02-09 19:57         ` Wang, Zhi A
2022-02-09 19:57         ` Wang, Zhi A
2022-02-09 19:57     ` [Intel-gfx] " Wang, Zhi A
2022-02-09 19:57       ` Wang, Zhi A
2022-02-09 19:57       ` Wang, Zhi A
2022-03-15  7:52       ` [Intel-gfx] " Christoph Hellwig
2022-03-15  7:52         ` Christoph Hellwig
2022-03-15  8:46         ` [Intel-gfx] " Jani Nikula
2022-03-15  8:46           ` Jani Nikula
2022-03-15  8:46           ` Jani Nikula
2022-03-15  8:48           ` [Intel-gfx] " Christoph Hellwig
2022-03-15  8:48             ` Christoph Hellwig
2022-03-15  8:59             ` [Intel-gfx] " Wang, Zhi A
2022-03-15  8:59               ` Wang, Zhi A
2022-03-15  8:59               ` Wang, Zhi A
2022-03-15  9:16             ` [Intel-gfx] " Jani Nikula
2022-03-15  9:16               ` Jani Nikula
2022-03-15  9:16               ` Jani Nikula
2022-02-09  7:36 ` [Intel-gfx] " Christoph Hellwig
2022-02-09  7:36   ` Christoph Hellwig

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=20220209073201.GB9050@lst.de \
    --to=hch@lst.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jgg@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhi.wang.linux@gmail.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 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.