From: Simon Horman <horms@kernel.org>
To: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, jgg@nvidia.com,
leon@kernel.org, linux-rdma@vger.kernel.org,
netdev@vger.kernel.org, kuba@kernel.org,
anthony.l.nguyen@intel.com, Joshua Hay <joshua.a.hay@intel.com>
Subject: Re: [Intel-wired-lan] [iwl-next 6/6] idpf: implement get LAN MMIO memory regions
Date: Wed, 28 May 2025 11:44:07 +0100 [thread overview]
Message-ID: <20250528104407.GB365796@horms.kernel.org> (raw)
In-Reply-To: <20250523170435.668-7-tatyana.e.nikolova@intel.com>
On Fri, May 23, 2025 at 12:04:35PM -0500, Tatyana Nikolova wrote:
> From: Joshua Hay <joshua.a.hay@intel.com>
>
> The RDMA driver needs to map its own MMIO regions for the sake of
> performance, meaning the IDPF needs to avoid mapping portions of the BAR
> space. However, the IDPF cannot assume where these are and must avoid
> mapping hard coded regions as much as possible.
>
> The IDPF maps the bare minimum to load and communicate with the
> control plane, i.e., the mailbox registers and the reset state
> registers. Because of how and when mailbox reigster offsets are
> initialized, it is easier to adjust the existing defines to be relative
> to the mailbox region starting address. Use a specific mailbox register
> write function that uses these relative offsets. The reset state
> register addresses are calculated the same way as for other registers,
> described below.
>
> The IDPF then calls a new virtchnl op to fetch a list of MMIO regions
> that it should map. The addresses for the registers in these regions are
> calculated by determining what region the register resides in, adjusting
> the offset to be relative to that region, and then adding the
> register's offset to that region's mapped address.
>
> If the new virtchnl op is not supported, the IDPF will fallback to
> mapping the whole bar. However, it will still map them as separate
> regions outside the mailbox and reset state registers. This way we can
> use the same logic in both cases to access the MMIO space.
>
> Reviewed-by: Madhu Chittim <madhu.chittim@intel.com>
> Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
> Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
...
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_idc.c b/drivers/net/ethernet/intel/idpf/idpf_idc.c
...
> @@ -447,12 +469,15 @@ int idpf_idc_init_aux_core_dev(struct idpf_adapter *adapter,
> */
> void idpf_idc_deinit_core_aux_device(struct iidc_rdma_core_dev_info *cdev_info)
> {
> + struct iidc_rdma_priv_dev_info *privd = cdev_info->iidc_priv;
> +
Hi Joshua, Tatyana, all,
On the line below it is assumed that cdev_info may be NULL.
But on the line above cdev_info is unconditionally dereferenced.
This doesn't seem consistent.
Flagged by Smatch.
> if (!cdev_info)
> return;
>
> idpf_unplug_aux_dev(cdev_info->adev);
>
> - kfree(cdev_info->iidc_priv);
> + kfree(privd->mapped_mem_regions);
> + kfree(privd);
> kfree(cdev_info);
> }
>
...
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, jgg@nvidia.com,
leon@kernel.org, linux-rdma@vger.kernel.org,
netdev@vger.kernel.org, kuba@kernel.org,
anthony.l.nguyen@intel.com, Joshua Hay <joshua.a.hay@intel.com>
Subject: Re: [iwl-next 6/6] idpf: implement get LAN MMIO memory regions
Date: Wed, 28 May 2025 11:44:07 +0100 [thread overview]
Message-ID: <20250528104407.GB365796@horms.kernel.org> (raw)
In-Reply-To: <20250523170435.668-7-tatyana.e.nikolova@intel.com>
On Fri, May 23, 2025 at 12:04:35PM -0500, Tatyana Nikolova wrote:
> From: Joshua Hay <joshua.a.hay@intel.com>
>
> The RDMA driver needs to map its own MMIO regions for the sake of
> performance, meaning the IDPF needs to avoid mapping portions of the BAR
> space. However, the IDPF cannot assume where these are and must avoid
> mapping hard coded regions as much as possible.
>
> The IDPF maps the bare minimum to load and communicate with the
> control plane, i.e., the mailbox registers and the reset state
> registers. Because of how and when mailbox reigster offsets are
> initialized, it is easier to adjust the existing defines to be relative
> to the mailbox region starting address. Use a specific mailbox register
> write function that uses these relative offsets. The reset state
> register addresses are calculated the same way as for other registers,
> described below.
>
> The IDPF then calls a new virtchnl op to fetch a list of MMIO regions
> that it should map. The addresses for the registers in these regions are
> calculated by determining what region the register resides in, adjusting
> the offset to be relative to that region, and then adding the
> register's offset to that region's mapped address.
>
> If the new virtchnl op is not supported, the IDPF will fallback to
> mapping the whole bar. However, it will still map them as separate
> regions outside the mailbox and reset state registers. This way we can
> use the same logic in both cases to access the MMIO space.
>
> Reviewed-by: Madhu Chittim <madhu.chittim@intel.com>
> Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
> Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
...
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_idc.c b/drivers/net/ethernet/intel/idpf/idpf_idc.c
...
> @@ -447,12 +469,15 @@ int idpf_idc_init_aux_core_dev(struct idpf_adapter *adapter,
> */
> void idpf_idc_deinit_core_aux_device(struct iidc_rdma_core_dev_info *cdev_info)
> {
> + struct iidc_rdma_priv_dev_info *privd = cdev_info->iidc_priv;
> +
Hi Joshua, Tatyana, all,
On the line below it is assumed that cdev_info may be NULL.
But on the line above cdev_info is unconditionally dereferenced.
This doesn't seem consistent.
Flagged by Smatch.
> if (!cdev_info)
> return;
>
> idpf_unplug_aux_dev(cdev_info->adev);
>
> - kfree(cdev_info->iidc_priv);
> + kfree(privd->mapped_mem_regions);
> + kfree(privd);
> kfree(cdev_info);
> }
>
...
next prev parent reply other threads:[~2025-05-28 10:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-23 17:04 [Intel-wired-lan] [iwl-next 0/6] Add RDMA support for Intel IPU E2000 in idpf Tatyana Nikolova
2025-05-23 17:04 ` Tatyana Nikolova
2025-05-23 17:04 ` [Intel-wired-lan] [iwl-next 1/6] idpf: use reserved RDMA vectors from control plane Tatyana Nikolova
2025-05-23 17:04 ` Tatyana Nikolova
2025-05-25 5:23 ` [Intel-wired-lan] " Paul Menzel
2025-05-28 21:35 ` Hay, Joshua A
2025-05-28 21:35 ` Hay, Joshua A
2025-05-23 17:04 ` [Intel-wired-lan] [iwl-next 2/6] idpf: implement core RDMA auxiliary dev create, init, and destroy Tatyana Nikolova
2025-05-23 17:04 ` Tatyana Nikolova
2025-05-28 10:40 ` [Intel-wired-lan] " Simon Horman
2025-05-28 10:40 ` Simon Horman
2025-05-28 21:35 ` [Intel-wired-lan] " Hay, Joshua A
2025-05-28 21:35 ` Hay, Joshua A
2025-05-23 17:04 ` [Intel-wired-lan] [iwl-next 3/6] idpf: implement RDMA vport " Tatyana Nikolova
2025-05-23 17:04 ` Tatyana Nikolova
2025-05-23 17:04 ` [Intel-wired-lan] [iwl-next 4/6] idpf: implement remaining IDC RDMA core callbacks and handlers Tatyana Nikolova
2025-05-23 17:04 ` Tatyana Nikolova
2025-05-23 17:04 ` [Intel-wired-lan] [iwl-next 5/6] idpf: implement IDC vport aux driver MTU change handler Tatyana Nikolova
2025-05-23 17:04 ` Tatyana Nikolova
2025-05-23 17:04 ` [Intel-wired-lan] [iwl-next 6/6] idpf: implement get LAN MMIO memory regions Tatyana Nikolova
2025-05-23 17:04 ` Tatyana Nikolova
2025-05-28 10:44 ` Simon Horman [this message]
2025-05-28 10:44 ` Simon Horman
2025-05-28 21:35 ` [Intel-wired-lan] " Hay, Joshua A
2025-05-28 21:35 ` Hay, Joshua A
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=20250528104407.GB365796@horms.kernel.org \
--to=horms@kernel.org \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jgg@nvidia.com \
--cc=joshua.a.hay@intel.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tatyana.e.nikolova@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 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.