From: Mark D Rustad <mrustad@gmail.com>
To: Zhu Lingshan <lingshan.zhu@intel.com>
Cc: jasowang@redhat.com, alex.williamson@redhat.com,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
netdev@vger.kernel.org, Dan Daly <dan.daly@intel.com>,
Cunming Liang <cunming.liang@intel.com>,
tiwei.bie@intel.com, jason.zeng@intel.com,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 1/2] IFC hardware operation layer
Date: Sat, 9 Nov 2019 12:07:08 -0800 [thread overview]
Message-ID: <D62E513D-61C9-424E-93B8-42129CEE5385@gmail.com> (raw)
In-Reply-To: <20191108075143-mutt-send-email-mst@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 3806 bytes --]
On Tue, Nov 05, 2019 at 05:37:39PM +0800, Zhu Lingshan wrote:
> This commit introduced ifcvf_base layer, which handles hardware
> operations and configurations.
>
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> ---
> drivers/vhost/ifcvf/ifcvf_base.c | 344 +++++++++++++++++++++++++++++++++++++++
> drivers/vhost/ifcvf/ifcvf_base.h | 132 +++++++++++++++
> 2 files changed, 476 insertions(+)
> create mode 100644 drivers/vhost/ifcvf/ifcvf_base.c
> create mode 100644 drivers/vhost/ifcvf/ifcvf_base.h
>
> diff --git a/drivers/vhost/ifcvf/ifcvf_base.c
> b/drivers/vhost/ifcvf/ifcvf_base.c
> new file mode 100644
> index 0000000..0659f41
> --- /dev/null
> +++ b/drivers/vhost/ifcvf/ifcvf_base.c
> @@ -0,0 +1,344 @@
<snip>
> + while (pos) {
> + ret = ifcvf_read_config_range(dev, (u32 *)&cap,
> + sizeof(cap), pos);
> +
> + if (ret < 0) {
> + IFC_ERR(&dev->dev, "Failed to get PCI capability at %x",
Missing a \n on the message.
> + pos);
> + break;
> + }
> +
> + if (cap.cap_vndr != PCI_CAP_ID_VNDR)
> + goto next;
> +
> + IFC_DBG(&dev->dev, "read PCI config: config type: %u, PCI bar: %u,\
> + PCI bar offset: %u, PCI config len: %u.\n",
Really do not continue strings in this way. Again, just start the format on
the second line and let it be as long as it needs to be. Also drop the . on
the end of the log messages (there are many in this patch).
> + cap.cfg_type, cap.bar, cap.offset, cap.length);
>
<snip>
> + hw->lm_cfg = hw->mem_resource[IFCVF_LM_BAR].addr;
> +
> + IFC_DBG(&dev->dev, "PCI capability mapping: common cfg: %p,\
> + notify base: %p\n, isr cfg: %p, device cfg: %p,\
> + multiplier: %u\n",
Another continued long format string to go onto one line.
> + hw->common_cfg, hw->notify_base, hw->isr,
> + hw->net_cfg, hw->notify_off_multiplier);
> +
> + return 0;
> +}
> +
> +u8 ifcvf_get_status(struct ifcvf_hw *hw)
> +{
> + u8 old_gen, new_gen, status;
> +
> + do {
> + old_gen = ioread8(&hw->common_cfg->config_generation);
> + status = ioread8(&hw->common_cfg->device_status);
> + new_gen = ioread8(&hw->common_cfg->config_generation);
> + } while (old_gen != new_gen);
> +
> + return status;
> +}
> +
> +void ifcvf_set_status(struct ifcvf_hw *hw, u8 status)
> +{
> + iowrite8(status, &hw->common_cfg->device_status);
> +}
> +
> +void ifcvf_reset(struct ifcvf_hw *hw)
> +{
> + ifcvf_set_status(hw, 0);
> + ifcvf_get_status(hw);
> +}
> +
> +static void ifcvf_add_status(struct ifcvf_hw *hw, u8 status)
> +{
> + if (status != 0)
> + status |= ifcvf_get_status(hw);
> +
> + ifcvf_set_status(hw, status);
> + ifcvf_get_status(hw);
> +}
> +
> +u64 ifcvf_get_features(struct ifcvf_hw *hw)
> +{
> + struct virtio_pci_common_cfg *cfg = hw->common_cfg;
> + u32 features_lo, features_hi;
> +
> + iowrite32(0, &cfg->device_feature_select);
> + features_lo = ioread32(&cfg->device_feature);
> +
> + iowrite32(1, &cfg->device_feature_select);
> + features_hi = ioread32(&cfg->device_feature);
> +
> + return ((u64)features_hi << 32) | features_lo;
> +}
> +
> +void ifcvf_read_net_config(struct ifcvf_hw *hw, u64 offset,
> + void *dst, int length)
> +{
> + u8 old_gen, new_gen, *p;
> + int i;
> +
> + WARN_ON(offset + length > sizeof (struct ifcvf_net_config));
> +
> + do {
> + old_gen = ioread8(&hw->common_cfg->config_generation);
> + p = dst;
> +
> + for (i = 0; i < length; i++)
> + *p++ = ioread8((u8 *)hw->net_cfg + offset + i);
> +
> + new_gen = ioread8(&hw->common_cfg->config_generation);
> + } while (old_gen != new_gen);
> +}
> +
> +void ifcvf_write_net_config(struct ifcvf_hw *hw, u64 offset,
> + const void *src, int length)
> +{
> + const u8 *p;
> + int i;
> +
> + p = src;
> + WARN_ON(offset + length > sizeof (struct ifcvf_net_config));
No space after sizeof.
<snip>
--
Mark Rustad, MRustad@gmail.com
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
next prev parent reply other threads:[~2019-11-09 20:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 9:37 [PATCH 0/2] Intel IFC VF driver for VDPA Zhu Lingshan
2019-11-05 9:37 ` [PATCH 1/2] IFC hardware operation layer Zhu Lingshan
2019-11-05 11:29 ` Michael S. Tsirkin
2019-11-08 11:55 ` Zhu Lingshan
2019-11-05 12:45 ` Michael S. Tsirkin
2019-11-05 12:47 ` Jason Wang
2019-11-08 8:04 ` Zhu Lingshan
2019-11-06 10:09 ` Jason Wang
2019-11-08 12:24 ` Zhu Lingshan
2019-11-08 12:57 ` Michael S. Tsirkin
2019-11-08 13:07 ` Zhu Lingshan
2019-11-09 20:07 ` Mark D Rustad [this message]
2019-11-05 9:37 ` [PATCH 2/2] IFC VDPA layer Zhu Lingshan
2019-11-06 10:39 ` Jason Wang
2019-11-08 12:46 ` Zhu Lingshan
2019-11-12 8:54 ` Zhu Lingshan
2019-11-09 19:56 ` Mark D Rustad
2019-11-12 8:40 ` Zhu Lingshan
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=D62E513D-61C9-424E-93B8-42129CEE5385@gmail.com \
--to=mrustad@gmail.com \
--cc=alex.williamson@redhat.com \
--cc=cunming.liang@intel.com \
--cc=dan.daly@intel.com \
--cc=jason.zeng@intel.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lingshan.zhu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=tiwei.bie@intel.com \
--cc=virtualization@lists.linux-foundation.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
all inboxes | Powered by JetHome®