All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: vdasa@vmware.com
Cc: pv-drivers@vmware.com, linux-kernel-review@vmware.com,
	Cyprien Laplace <claplace@vmware.com>,
	Vishnu Dasa <vdasa@vmware.com>, Bryan Tan <bryantan@vmware.com>,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] VMCI: Add support for ARM64
Date: Fri, 06 May 2022 16:13:57 +0200	[thread overview]
Message-ID: <87levezr2y.fsf@redhat.com> (raw)
In-Reply-To: <20220414193316.14356-1-vdasa@vmware.com>

vdasa@vmware.com writes:

> From: Vishnu Dasa <vdasa@vmware.com>
>
> Add support for ARM64 architecture so that the driver can now be built
> and VMCI device can be used.
>
> Update Kconfig file to allow the driver to be built on ARM64 as well.
> Fail vmci_guest_probe_device() on ARM64 if the device does not support
> MMIO register access.  Lastly, add virtualization specific barriers
> which map to actual memory barrier instructions on ARM64, because it
> is required in case of ARM64 for queuepair (de)queuing.
>

FWIW, it seems you're doing three things at once, better split this into
a 3-patch series.

> Reviewed-by: Bryan Tan <bryantan@vmware.com>
> Reviewed-by: Cyprien Laplace <claplace@vmware.com>
> Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
> ---
>  drivers/misc/vmw_vmci/Kconfig           |  2 +-
>  drivers/misc/vmw_vmci/vmci_guest.c      |  4 ++++
>  drivers/misc/vmw_vmci/vmci_queue_pair.c | 12 ++++++++++++
>  3 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/vmw_vmci/Kconfig b/drivers/misc/vmw_vmci/Kconfig
> index 605794aadf11..b6d4d7fd686a 100644
> --- a/drivers/misc/vmw_vmci/Kconfig
> +++ b/drivers/misc/vmw_vmci/Kconfig
> @@ -5,7 +5,7 @@
>  
>  config VMWARE_VMCI
>  	tristate "VMware VMCI Driver"
> -	depends on X86 && PCI
> +	depends on (X86 || ARM64) && !CPU_BIG_ENDIAN && PCI
>  	help
>  	  This is VMware's Virtual Machine Communication Interface.  It enables
>  	  high-speed communication between host and guest in a virtual
> diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
> index 57a6157209a1..aa7b05de97dd 100644
> --- a/drivers/misc/vmw_vmci/vmci_guest.c
> +++ b/drivers/misc/vmw_vmci/vmci_guest.c
> @@ -614,6 +614,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
>  	}
>  
>  	if (!mmio_base) {
> +		if (IS_ENABLED(CONFIG_ARM64)) {
> +			dev_err(&pdev->dev, "MMIO base is invalid\n");
> +			return -ENXIO;
> +		}
>  		error = pcim_iomap_regions(pdev, BIT(0), KBUILD_MODNAME);
>  		if (error) {
>  			dev_err(&pdev->dev, "Failed to reserve/map IO regions\n");
> diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
> index 94ebf7f3fd58..8f2de1893245 100644
> --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
> +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
> @@ -2577,6 +2577,12 @@ static ssize_t qp_enqueue_locked(struct vmci_queue *produce_q,
>  	if (result < VMCI_SUCCESS)
>  		return result;
>  
> +	/*
> +	 * This virt_wmb() ensures that data written to the queue
> +	 * is observable before the new producer_tail is.
> +	 */
> +	virt_wmb();
> +
>  	vmci_q_header_add_producer_tail(produce_q->q_header, written,
>  					produce_q_size);
>  	return written;
> @@ -2620,6 +2626,12 @@ static ssize_t qp_dequeue_locked(struct vmci_queue *produce_q,
>  	if (buf_ready < VMCI_SUCCESS)
>  		return (ssize_t) buf_ready;
>  
> +	/*
> +	 * This virt_rmb() ensures that data from the queue will be read
> +	 * after we have determined how much is ready to be consumed.
> +	 */
> +	virt_rmb();
> +
>  	read = (size_t) (buf_ready > buf_size ? buf_size : buf_ready);
>  	head = vmci_q_header_consumer_head(produce_q->q_header);
>  	if (likely(head + read < consume_q_size)) {

-- 
Vitaly


WARNING: multiple messages have this Message-ID (diff)
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: vdasa@vmware.com
Cc: Vishnu Dasa <vdasa@vmware.com>,
	pv-drivers@vmware.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-kernel-review@vmware.com, Bryan Tan <bryantan@vmware.com>,
	Cyprien Laplace <claplace@vmware.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] VMCI: Add support for ARM64
Date: Fri, 06 May 2022 16:13:57 +0200	[thread overview]
Message-ID: <87levezr2y.fsf@redhat.com> (raw)
In-Reply-To: <20220414193316.14356-1-vdasa@vmware.com>

vdasa@vmware.com writes:

> From: Vishnu Dasa <vdasa@vmware.com>
>
> Add support for ARM64 architecture so that the driver can now be built
> and VMCI device can be used.
>
> Update Kconfig file to allow the driver to be built on ARM64 as well.
> Fail vmci_guest_probe_device() on ARM64 if the device does not support
> MMIO register access.  Lastly, add virtualization specific barriers
> which map to actual memory barrier instructions on ARM64, because it
> is required in case of ARM64 for queuepair (de)queuing.
>

FWIW, it seems you're doing three things at once, better split this into
a 3-patch series.

> Reviewed-by: Bryan Tan <bryantan@vmware.com>
> Reviewed-by: Cyprien Laplace <claplace@vmware.com>
> Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
> ---
>  drivers/misc/vmw_vmci/Kconfig           |  2 +-
>  drivers/misc/vmw_vmci/vmci_guest.c      |  4 ++++
>  drivers/misc/vmw_vmci/vmci_queue_pair.c | 12 ++++++++++++
>  3 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/vmw_vmci/Kconfig b/drivers/misc/vmw_vmci/Kconfig
> index 605794aadf11..b6d4d7fd686a 100644
> --- a/drivers/misc/vmw_vmci/Kconfig
> +++ b/drivers/misc/vmw_vmci/Kconfig
> @@ -5,7 +5,7 @@
>  
>  config VMWARE_VMCI
>  	tristate "VMware VMCI Driver"
> -	depends on X86 && PCI
> +	depends on (X86 || ARM64) && !CPU_BIG_ENDIAN && PCI
>  	help
>  	  This is VMware's Virtual Machine Communication Interface.  It enables
>  	  high-speed communication between host and guest in a virtual
> diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
> index 57a6157209a1..aa7b05de97dd 100644
> --- a/drivers/misc/vmw_vmci/vmci_guest.c
> +++ b/drivers/misc/vmw_vmci/vmci_guest.c
> @@ -614,6 +614,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
>  	}
>  
>  	if (!mmio_base) {
> +		if (IS_ENABLED(CONFIG_ARM64)) {
> +			dev_err(&pdev->dev, "MMIO base is invalid\n");
> +			return -ENXIO;
> +		}
>  		error = pcim_iomap_regions(pdev, BIT(0), KBUILD_MODNAME);
>  		if (error) {
>  			dev_err(&pdev->dev, "Failed to reserve/map IO regions\n");
> diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
> index 94ebf7f3fd58..8f2de1893245 100644
> --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
> +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
> @@ -2577,6 +2577,12 @@ static ssize_t qp_enqueue_locked(struct vmci_queue *produce_q,
>  	if (result < VMCI_SUCCESS)
>  		return result;
>  
> +	/*
> +	 * This virt_wmb() ensures that data written to the queue
> +	 * is observable before the new producer_tail is.
> +	 */
> +	virt_wmb();
> +
>  	vmci_q_header_add_producer_tail(produce_q->q_header, written,
>  					produce_q_size);
>  	return written;
> @@ -2620,6 +2626,12 @@ static ssize_t qp_dequeue_locked(struct vmci_queue *produce_q,
>  	if (buf_ready < VMCI_SUCCESS)
>  		return (ssize_t) buf_ready;
>  
> +	/*
> +	 * This virt_rmb() ensures that data from the queue will be read
> +	 * after we have determined how much is ready to be consumed.
> +	 */
> +	virt_rmb();
> +
>  	read = (size_t) (buf_ready > buf_size ? buf_size : buf_ready);
>  	head = vmci_q_header_consumer_head(produce_q->q_header);
>  	if (likely(head + read < consume_q_size)) {

-- 
Vitaly

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

WARNING: multiple messages have this Message-ID (diff)
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: vdasa@vmware.com
Cc: pv-drivers@vmware.com, linux-kernel-review@vmware.com,
	Cyprien Laplace <claplace@vmware.com>,
	Vishnu Dasa <vdasa@vmware.com>, Bryan Tan <bryantan@vmware.com>,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] VMCI: Add support for ARM64
Date: Fri, 06 May 2022 16:13:57 +0200	[thread overview]
Message-ID: <87levezr2y.fsf@redhat.com> (raw)
In-Reply-To: <20220414193316.14356-1-vdasa@vmware.com>

vdasa@vmware.com writes:

> From: Vishnu Dasa <vdasa@vmware.com>
>
> Add support for ARM64 architecture so that the driver can now be built
> and VMCI device can be used.
>
> Update Kconfig file to allow the driver to be built on ARM64 as well.
> Fail vmci_guest_probe_device() on ARM64 if the device does not support
> MMIO register access.  Lastly, add virtualization specific barriers
> which map to actual memory barrier instructions on ARM64, because it
> is required in case of ARM64 for queuepair (de)queuing.
>

FWIW, it seems you're doing three things at once, better split this into
a 3-patch series.

> Reviewed-by: Bryan Tan <bryantan@vmware.com>
> Reviewed-by: Cyprien Laplace <claplace@vmware.com>
> Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
> ---
>  drivers/misc/vmw_vmci/Kconfig           |  2 +-
>  drivers/misc/vmw_vmci/vmci_guest.c      |  4 ++++
>  drivers/misc/vmw_vmci/vmci_queue_pair.c | 12 ++++++++++++
>  3 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/vmw_vmci/Kconfig b/drivers/misc/vmw_vmci/Kconfig
> index 605794aadf11..b6d4d7fd686a 100644
> --- a/drivers/misc/vmw_vmci/Kconfig
> +++ b/drivers/misc/vmw_vmci/Kconfig
> @@ -5,7 +5,7 @@
>  
>  config VMWARE_VMCI
>  	tristate "VMware VMCI Driver"
> -	depends on X86 && PCI
> +	depends on (X86 || ARM64) && !CPU_BIG_ENDIAN && PCI
>  	help
>  	  This is VMware's Virtual Machine Communication Interface.  It enables
>  	  high-speed communication between host and guest in a virtual
> diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
> index 57a6157209a1..aa7b05de97dd 100644
> --- a/drivers/misc/vmw_vmci/vmci_guest.c
> +++ b/drivers/misc/vmw_vmci/vmci_guest.c
> @@ -614,6 +614,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
>  	}
>  
>  	if (!mmio_base) {
> +		if (IS_ENABLED(CONFIG_ARM64)) {
> +			dev_err(&pdev->dev, "MMIO base is invalid\n");
> +			return -ENXIO;
> +		}
>  		error = pcim_iomap_regions(pdev, BIT(0), KBUILD_MODNAME);
>  		if (error) {
>  			dev_err(&pdev->dev, "Failed to reserve/map IO regions\n");
> diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
> index 94ebf7f3fd58..8f2de1893245 100644
> --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
> +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
> @@ -2577,6 +2577,12 @@ static ssize_t qp_enqueue_locked(struct vmci_queue *produce_q,
>  	if (result < VMCI_SUCCESS)
>  		return result;
>  
> +	/*
> +	 * This virt_wmb() ensures that data written to the queue
> +	 * is observable before the new producer_tail is.
> +	 */
> +	virt_wmb();
> +
>  	vmci_q_header_add_producer_tail(produce_q->q_header, written,
>  					produce_q_size);
>  	return written;
> @@ -2620,6 +2626,12 @@ static ssize_t qp_dequeue_locked(struct vmci_queue *produce_q,
>  	if (buf_ready < VMCI_SUCCESS)
>  		return (ssize_t) buf_ready;
>  
> +	/*
> +	 * This virt_rmb() ensures that data from the queue will be read
> +	 * after we have determined how much is ready to be consumed.
> +	 */
> +	virt_rmb();
> +
>  	read = (size_t) (buf_ready > buf_size ? buf_size : buf_ready);
>  	head = vmci_q_header_consumer_head(produce_q->q_header);
>  	if (likely(head + read < consume_q_size)) {

-- 
Vitaly


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

  reply	other threads:[~2022-05-06 14:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14 19:33 [PATCH] VMCI: Add support for ARM64 vdasa
2022-04-14 19:33 ` vdasa
2022-04-14 19:33 ` vdasa
2022-05-06 14:13 ` Vitaly Kuznetsov [this message]
2022-05-06 14:13   ` Vitaly Kuznetsov
2022-05-06 14:13   ` Vitaly Kuznetsov
2022-05-11 19:54   ` Vishnu Dasa
2022-05-11 19:54     ` Vishnu Dasa
2022-05-11 19:54     ` Vishnu Dasa
2022-05-11 20:02     ` Arnd Bergmann
2022-05-11 20:02       ` Arnd Bergmann
2022-05-11 20:02       ` Arnd Bergmann

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=87levezr2y.fsf@redhat.com \
    --to=vkuznets@redhat.com \
    --cc=bryantan@vmware.com \
    --cc=claplace@vmware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel-review@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pv-drivers@vmware.com \
    --cc=vdasa@vmware.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 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.