All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Cc: konrad.wilk@oracle.com, mst@redhat.com, jasowang@redhat.com,
	jan.kiszka@siemens.com, stefano.stabellini@xilinx.com,
	iommu@lists.linux-foundation.org,
	virtualization@lists.linux-foundation.org,
	virtio-dev@lists.oasis-open.org, tsoni@codeaurora.org,
	pratikp@codeaurora.org, christoffer.dall@arm.com,
	alex.bennee@linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC/PATCH 1/1] virtio: Introduce MMIO ops
Date: Thu, 30 Apr 2020 11:14:32 +0100	[thread overview]
Message-ID: <20200430101431.GD19932@willie-the-truck> (raw)
In-Reply-To: <1588240976-10213-2-git-send-email-vatsa@codeaurora.org>

On Thu, Apr 30, 2020 at 03:32:56PM +0530, Srivatsa Vaddagiri wrote:
> Some hypervisors may not support MMIO transport i.e trap config
> space access and have it be handled by backend driver. They may
> allow other ways to interact with backend such as message-queue
> or doorbell API. This patch allows for hypervisor specific
> methods for config space IO.
> 
> Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
> ---
>  drivers/virtio/virtio_mmio.c | 131 ++++++++++++++++++++++++++-----------------
>  include/linux/virtio.h       |  14 +++++
>  2 files changed, 94 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 97d5725..69bfa35 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -100,7 +100,35 @@ struct virtio_mmio_vq_info {
>  	struct list_head node;
>  };
>  
> +#ifdef CONFIG_VIRTIO_MMIO_OPS
>  
> +static struct virtio_mmio_ops *mmio_ops;
> +
> +#define virtio_readb(a)		mmio_ops->mmio_readl((a))
> +#define virtio_readw(a)		mmio_ops->mmio_readl((a))
> +#define virtio_readl(a)		mmio_ops->mmio_readl((a))
> +#define virtio_writeb(val, a)	mmio_ops->mmio_writeb((val), (a))
> +#define virtio_writew(val, a)	mmio_ops->mmio_writew((val), (a))
> +#define virtio_writel(val, a)	mmio_ops->mmio_writel((val), (a))

How exactly are these ops hooked up? I'm envisaging something like:

	ops = spec_compliant_ops;
	[...]
	if (firmware_says_hypervisor_is_buggy())
		ops = magic_qcom_ops;

am I wrong?

> +int register_virtio_mmio_ops(struct virtio_mmio_ops *ops)
> +{
> +	pr_info("Registered %s as mmio ops\n", ops->name);
> +	mmio_ops = ops;

Not looking good, and really defeats the point of standardising this stuff
imo.

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will@kernel.org>
To: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Cc: tsoni@codeaurora.org, virtio-dev@lists.oasis-open.org,
	mst@redhat.com, jan.kiszka@siemens.com, jasowang@redhat.com,
	konrad.wilk@oracle.com, christoffer.dall@arm.com,
	virtualization@lists.linux-foundation.org,
	alex.bennee@linaro.org, iommu@lists.linux-foundation.org,
	stefano.stabellini@xilinx.com, pratikp@codeaurora.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC/PATCH 1/1] virtio: Introduce MMIO ops
Date: Thu, 30 Apr 2020 11:14:32 +0100	[thread overview]
Message-ID: <20200430101431.GD19932@willie-the-truck> (raw)
In-Reply-To: <1588240976-10213-2-git-send-email-vatsa@codeaurora.org>

On Thu, Apr 30, 2020 at 03:32:56PM +0530, Srivatsa Vaddagiri wrote:
> Some hypervisors may not support MMIO transport i.e trap config
> space access and have it be handled by backend driver. They may
> allow other ways to interact with backend such as message-queue
> or doorbell API. This patch allows for hypervisor specific
> methods for config space IO.
> 
> Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
> ---
>  drivers/virtio/virtio_mmio.c | 131 ++++++++++++++++++++++++++-----------------
>  include/linux/virtio.h       |  14 +++++
>  2 files changed, 94 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 97d5725..69bfa35 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -100,7 +100,35 @@ struct virtio_mmio_vq_info {
>  	struct list_head node;
>  };
>  
> +#ifdef CONFIG_VIRTIO_MMIO_OPS
>  
> +static struct virtio_mmio_ops *mmio_ops;
> +
> +#define virtio_readb(a)		mmio_ops->mmio_readl((a))
> +#define virtio_readw(a)		mmio_ops->mmio_readl((a))
> +#define virtio_readl(a)		mmio_ops->mmio_readl((a))
> +#define virtio_writeb(val, a)	mmio_ops->mmio_writeb((val), (a))
> +#define virtio_writew(val, a)	mmio_ops->mmio_writew((val), (a))
> +#define virtio_writel(val, a)	mmio_ops->mmio_writel((val), (a))

How exactly are these ops hooked up? I'm envisaging something like:

	ops = spec_compliant_ops;
	[...]
	if (firmware_says_hypervisor_is_buggy())
		ops = magic_qcom_ops;

am I wrong?

> +int register_virtio_mmio_ops(struct virtio_mmio_ops *ops)
> +{
> +	pr_info("Registered %s as mmio ops\n", ops->name);
> +	mmio_ops = ops;

Not looking good, and really defeats the point of standardising this stuff
imo.

Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-04-30 10:14 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 10:02 [RFC/PATCH 0/1] virtio_mmio: hypervisor specific interfaces for MMIO Srivatsa Vaddagiri
2020-04-30 10:02 ` Srivatsa Vaddagiri
2020-04-30 10:02 ` [RFC/PATCH 1/1] virtio: Introduce MMIO ops Srivatsa Vaddagiri
2020-04-30 10:02   ` Srivatsa Vaddagiri
2020-04-30 10:14   ` Will Deacon [this message]
2020-04-30 10:14     ` Will Deacon
2020-04-30 10:34     ` Srivatsa Vaddagiri
2020-04-30 10:34       ` Srivatsa Vaddagiri
2020-04-30 10:41       ` Will Deacon
2020-04-30 10:41         ` Will Deacon
2020-04-30 11:11         ` Srivatsa Vaddagiri
2020-04-30 11:11           ` Srivatsa Vaddagiri
2020-04-30 12:59           ` Jan Kiszka
2020-04-30 12:59             ` [virtio-dev] " Jan Kiszka
2020-04-30 12:59             ` Jan Kiszka
2020-04-30 13:33             ` Srivatsa Vaddagiri
2020-04-30 13:33               ` Srivatsa Vaddagiri
2020-04-30 13:33               ` Srivatsa Vaddagiri
2020-04-30 19:34               ` Michael S. Tsirkin
2020-04-30 19:34                 ` [virtio-dev] " Michael S. Tsirkin
2020-04-30 19:34                 ` Michael S. Tsirkin
2020-04-30 10:07 ` [RFC/PATCH 0/1] virtio_mmio: hypervisor specific interfaces for MMIO Michael S. Tsirkin
2020-04-30 10:07   ` [virtio-dev] " Michael S. Tsirkin
2020-04-30 10:07   ` Michael S. Tsirkin
2020-04-30 10:40   ` Srivatsa Vaddagiri
2020-04-30 10:40     ` Srivatsa Vaddagiri
2020-04-30 10:56   ` Jason Wang
2020-04-30 10:56     ` [virtio-dev] " Jason Wang
2020-04-30 10:56     ` Jason Wang
2020-04-30 10:08 ` Will Deacon
2020-04-30 10:08   ` Will Deacon
2020-04-30 10:29   ` Srivatsa Vaddagiri
2020-04-30 10:29     ` Srivatsa Vaddagiri
2020-04-30 10:39     ` Will Deacon
2020-04-30 10:39       ` Will Deacon
2020-04-30 11:02       ` Srivatsa Vaddagiri
2020-04-30 11:02         ` Srivatsa Vaddagiri
2020-04-30 11:02         ` Srivatsa Vaddagiri

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=20200430101431.GD19932@willie-the-truck \
    --to=will@kernel.org \
    --cc=alex.bennee@linaro.org \
    --cc=christoffer.dall@arm.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jan.kiszka@siemens.com \
    --cc=jasowang@redhat.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pratikp@codeaurora.org \
    --cc=stefano.stabellini@xilinx.com \
    --cc=tsoni@codeaurora.org \
    --cc=vatsa@codeaurora.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 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.