All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Michael Kelley <mikelley@microsoft.com>
Cc: kys@microsoft.com, haiyangz@microsoft.com,
	sthemmin@microsoft.com, wei.liu@kernel.org,
	tianyu.lan@microsoft.com, longli@microsoft.com,
	ndesaulniers@google.com, vt@altlinux.org, kuba@kernel.org,
	linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH 1/1] Drivers: hv: vmbus: Rework use of DMA_BIT_MASK(64)
Date: Sun, 6 Feb 2022 18:37:44 -0700	[thread overview]
Message-ID: <YgB36FwuRaF85WQq@dev-arch.archlinux-ax161> (raw)
In-Reply-To: <1644176216-12531-1-git-send-email-mikelley@microsoft.com>

Hi Michael,

On Sun, Feb 06, 2022 at 11:36:56AM -0800, Michael Kelley wrote:
> Using DMA_BIT_MASK(64) as an initializer for a global variable
> causes problems with Clang 12.0.1. The compiler doesn't understand
> that value 64 is excluded from the shift at compile time, resulting
> in a build error.
> 
> While this is a compiler problem, avoid the issue by setting up
> the dma_mask memory as part of struct hv_device, and initialize
> it using dma_set_mask().
> 
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Reported-by: Vitaly Chikunov <vt@altlinux.org>
> Reported-by: Jakub Kicinski <kuba@kernel.org>
> Fixes: 743b237c3a7b ("scsi: storvsc: Add Isolation VM support for storvsc driver")
> Signed-off-by: Michael Kelley <mikelley@microsoft.com>

Thanks a lot for working around this. I am hoping that this will be
fixed in clang soon, as it is high priority on our list of issues to
fix. Once it has been fixed, we should be able to undo this workaround
in one way or another.

I can confirm the warning is resolved, which will allow us to build
ARCH=arm64 and ARCH=x86_64 allmodconfig with -Werror on mainline with
clang once another fix [1] is merged.

Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>

[1]: https://git.kernel.org/gregkh/usb/c/b470947c3672f7eb7c4c271d510383d896831cc2

> ---
>  drivers/hv/vmbus_drv.c | 4 ++--
>  include/linux/hyperv.h | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 17bf55f..0d96634 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -2079,7 +2079,6 @@ struct hv_device *vmbus_device_create(const guid_t *type,
>  	return child_device_obj;
>  }
>  
> -static u64 vmbus_dma_mask = DMA_BIT_MASK(64);
>  /*
>   * vmbus_device_register - Register the child device
>   */
> @@ -2120,8 +2119,9 @@ int vmbus_device_register(struct hv_device *child_device_obj)
>  	}
>  	hv_debug_add_dev_dir(child_device_obj);
>  
> -	child_device_obj->device.dma_mask = &vmbus_dma_mask;
>  	child_device_obj->device.dma_parms = &child_device_obj->dma_parms;
> +	child_device_obj->device.dma_mask = &child_device_obj->dma_mask;
> +	dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64));
>  	return 0;
>  
>  err_kset_unregister:
> diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
> index f565a89..fe2e017 100644
> --- a/include/linux/hyperv.h
> +++ b/include/linux/hyperv.h
> @@ -1262,6 +1262,7 @@ struct hv_device {
>  	struct vmbus_channel *channel;
>  	struct kset	     *channels_kset;
>  	struct device_dma_parameters dma_parms;
> +	u64 dma_mask;
>  
>  	/* place holder to keep track of the dir for hv device in debugfs */
>  	struct dentry *debug_dir;
> -- 
> 1.8.3.1
> 

  reply	other threads:[~2022-02-07  1:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-06 19:36 [PATCH 1/1] Drivers: hv: vmbus: Rework use of DMA_BIT_MASK(64) Michael Kelley
2022-02-07  1:37 ` Nathan Chancellor [this message]
2022-02-07  2:42   ` Michael Kelley (LINUX)
2022-02-07 17:56     ` Wei Liu

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=YgB36FwuRaF85WQq@dev-arch.archlinux-ax161 \
    --to=nathan@kernel.org \
    --cc=haiyangz@microsoft.com \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=longli@microsoft.com \
    --cc=mikelley@microsoft.com \
    --cc=ndesaulniers@google.com \
    --cc=sthemmin@microsoft.com \
    --cc=tianyu.lan@microsoft.com \
    --cc=vt@altlinux.org \
    --cc=wei.liu@kernel.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.