linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Peter Hilber <peter.hilber@opensynergy.com>
Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>,
	DTML <devicetree@vger.kernel.org>,
	 virtualization@lists.linux-foundation.org,
	virtio-dev@lists.oasis-open.org,
	 Igor Skalkin <igor.skalkin@opensynergy.com>,
	Rob Herring <robh+dt@kernel.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	 souvik.chakravarty@arm.com, alex.bennee@linaro.org,
	jean-philippe@linaro.org,  mikhail.golubev@opensynergy.com,
	anton.yakovlev@opensynergy.com,
	 "Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	 Vincent Guittot <vincent.guittot@linaro.org>
Subject: Re: [RFC PATCH v2 10/10] firmware: arm_scmi: Add virtio transport
Date: Thu, 8 Apr 2021 09:15:28 +0530	[thread overview]
Message-ID: <CAOh2x==6TH-A8076weSLy7kLqrNZgRgp2GFyAEGGPyikw1rgGg@mail.gmail.com> (raw)
In-Reply-To: <20201105212116.411422-11-peter.hilber@opensynergy.com>

On Fri, Nov 6, 2020 at 2:59 AM Peter Hilber
<peter.hilber@opensynergy.com> wrote:

> +static int scmi_vio_probe(struct virtio_device *vdev)
> +{
> +       struct device *dev = &vdev->dev;
> +       struct scmi_vio_channel **vioch;
> +       bool have_vq_rx;
> +       int vq_cnt;
> +       int i;
> +       struct virtqueue *vqs[VIRTIO_SCMI_VQ_MAX_CNT];
> +
> +       vioch = devm_kcalloc(dev, VIRTIO_SCMI_VQ_MAX_CNT, sizeof(*vioch),
> +                            GFP_KERNEL);
> +       if (!vioch)
> +               return -ENOMEM;
> +
> +       have_vq_rx = virtio_has_feature(vdev, VIRTIO_SCMI_F_P2A_CHANNELS);
> +       vq_cnt = have_vq_rx ? VIRTIO_SCMI_VQ_MAX_CNT : 1;
> +
> +       for (i = 0; i < vq_cnt; i++) {
> +               vioch[i] = devm_kzalloc(dev, sizeof(**vioch), GFP_KERNEL);
> +               if (!vioch[i])
> +                       return -ENOMEM;
> +       }
> +
> +       if (have_vq_rx)
> +               vioch[VIRTIO_SCMI_VQ_RX]->is_rx = true;
> +
> +       if (virtio_find_vqs(vdev, vq_cnt, vqs, scmi_vio_complete_callbacks,
> +                           scmi_vio_vqueue_names, NULL)) {
> +               dev_err(dev, "Failed to get %d virtqueue(s)\n", vq_cnt);
> +               return -1;
> +       }
> +       dev_info(dev, "Found %d virtqueue(s)\n", vq_cnt);
> +
> +       for (i = 0; i < vq_cnt; i++) {
> +               spin_lock_init(&vioch[i]->lock);
> +               vioch[i]->vqueue = vqs[i];
> +               vioch[i]->vqueue->priv = vioch[i];

The vqueue->priv field is used by core, you can't update it else
notifications won't work.

> +       }
> +
> +       vdev->priv = vioch;
> +
> +       virtio_device_ready(vdev);
> +
> +       return 0;
> +}

diff --git a/drivers/firmware/arm_scmi/virtio.c
b/drivers/firmware/arm_scmi/virtio.c
index f70aa72f34f1..b1af77341b30 100644
--- a/drivers/firmware/arm_scmi/virtio.c
+++ b/drivers/firmware/arm_scmi/virtio.c
@@ -80,7 +80,8 @@ static int scmi_vio_populate_vq_rx(struct
scmi_vio_channel *vioch,

 static void scmi_vio_complete_cb(struct virtqueue *vqueue)
 {
-       struct scmi_vio_channel *vioch = vqueue->priv;
+       struct scmi_vio_channel **_vioch = vqueue->vdev->priv;
+       struct scmi_vio_channel *vioch = _vioch[vqueue->index];
        unsigned long iflags;
        unsigned int length;

@@ -454,7 +455,6 @@ static int scmi_vio_probe(struct virtio_device *vdev)
        for (i = 0; i < vq_cnt; i++) {
                spin_lock_init(&vioch[i]->lock);
                vioch[i]->vqueue = vqs[i];
-               vioch[i]->vqueue->priv = vioch[i];
        }

        vdev->priv = vioch;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      parent reply	other threads:[~2021-04-08  3:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 21:21 [RFC PATCH v2 00/10] firmware: arm_scmi: Add virtio transport Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 01/10] firmware: arm_scmi, smccc, mailbox: Make shmem based transports optional Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 02/10] firmware: arm_scmi: Document that max_msg is a per channel type limit Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 03/10] firmware: arm_scmi: Add op to override max message # Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 04/10] firmware: arm_scmi: Add per message transport data Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 05/10] firmware: arm_scmi: Add xfer_init_buffers transport op Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 06/10] firmware: arm_scmi: Add optional link_supplier() " Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 07/10] firmware: arm_scmi: Add per-device transport private info Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 08/10] firmware: arm_scmi: Add is_scmi_protocol_device() Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 09/10] dt-bindings: arm: Add virtio transport for SCMI Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 10/10] firmware: arm_scmi: Add virtio transport Peter Hilber
2020-11-10 21:32   ` Cristian Marussi
2020-11-12 10:57     ` Peter Hilber
2020-11-17 21:20       ` Cristian Marussi
2021-04-08  3:45   ` Viresh Kumar [this message]

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='CAOh2x==6TH-A8076weSLy7kLqrNZgRgp2GFyAEGGPyikw1rgGg@mail.gmail.com' \
    --to=viresh.kumar@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=anton.yakovlev@opensynergy.com \
    --cc=devicetree@vger.kernel.org \
    --cc=igor.skalkin@opensynergy.com \
    --cc=jasowang@redhat.com \
    --cc=jean-philippe@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikhail.golubev@opensynergy.com \
    --cc=mst@redhat.com \
    --cc=peter.hilber@opensynergy.com \
    --cc=robh+dt@kernel.org \
    --cc=souvik.chakravarty@arm.com \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=virtio-dev@lists.oasis-open.org \
    --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;
as well as URLs for NNTP newsgroup(s).