Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1538102pxb; Tue, 8 Feb 2022 21:32:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzv329MRRbRDBmsiuDon5r0B4Uo5nGErfLUyosghLMskx+JIQ9QSMZ/z0TMt6DiRpyVQ9ZE X-Received: by 2002:a17:902:d3c6:: with SMTP id w6mr592753plb.4.1644384773650; Tue, 08 Feb 2022 21:32:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644384773; cv=none; d=google.com; s=arc-20160816; b=YXFefAmTDD5H/BxLHb2EvshvMsUbB3/6r87gyt+zCSB7fiY60wg6PbpB5jrWX1m7ci Epr4qEtMFthVOskTpYdUTYQWZdHMAkFxUxnA+TPjFP1ij/NEZwsKp6SX4X2qvk89Xaji ZzD1xccg/h7FNaKbCKD/Ah8NJJKTYxzlgFIUUGERMXra1VtBMLFqJyR4Sh0sj+8SivAf sOhXDkQqDQfOGHGjWKrs9LonKrF0LRC0P13bFlvqNgIoRthjeeuKfV8vXngRgwK1ql1v Ff8ZW8vskktAP43RLP/riG72xJWIMTr1xmyJgGxhHBAjoO0MzgmBn0PaaMuDCx5f/vb5 P9zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ampLmTQuSiMPJBNwDeELf8QuOf2JYLIW0f+HbrkDM60=; b=RkYb/drJQwbMu0EQI0tAzzGnm70Z1YNHtlt9oxkK3miRy1DgexHtXPw4BLKbn1Cx0t w1l23jYkPmpUKr4MqcfCenEdeRsIvGvHaZdaQ8RG4p8FeaLqjr9pxXcJPsFq1bstOESz h8ZjZaOFqrF8xxtRBVe79JglwNE8Wd1r42Bo2NlURC9Zy+Ty88m81pFBrRr0YQbA4sum YhwZ342QoTUmzIuCt6AiSn+RORJRGQt2fcydZcbeMgnAKu90kzR/8XF4rxgSahqFp2kk QUd834+gTFbM2tkxiXyzx9VZ6V0f1h+OjrzxR81ERE/0VbdMBJZTbIVQqv8FPRHBimyk Cybw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IEKb+F95; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e21si14947358pgj.698.2022.02.08.21.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 21:32:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IEKb+F95; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F408BC029809; Tue, 8 Feb 2022 21:31:52 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347751AbiBGBhz (ORCPT + 99 others); Sun, 6 Feb 2022 20:37:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347658AbiBGBhw (ORCPT ); Sun, 6 Feb 2022 20:37:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC44C061348; Sun, 6 Feb 2022 17:37:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E5CA6134B; Mon, 7 Feb 2022 01:37:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58E41C340E9; Mon, 7 Feb 2022 01:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644197869; bh=9I+whS5koYY+pxEubsRWG77KrwVlDeIlbrZ3BX5fbVg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IEKb+F95sAcz7UK/L0CLOnWToa1t+elpe2x58gm1Qgq8wV0/6oDKJlljse99ougw7 m7YqacuOHmcXis0iAwnfpT5yTiQiNlQ9W/Qf7oBTM9hCvs57b1kTSZhOujOBmkNzYI M6YiKxvzCEf3Brs32KHrSrI8FofoUlYAbwyRBVc61QMX2dba0xzNfBT7eOisCMFGLG BMFBM+lXAbehOHojCm/Y3syut7N+6QDA+83U/RsvAddZlRrAl+swQ7SK+rG9OhE8Qj BZYpudGF+JCJgUV1r97xvUvBPuUqkpqTRTTkoREeIPtfUVZhOhw9RX93MnTslwGJnc r7OwpGfa/3KGg== Date: Sun, 6 Feb 2022 18:37:44 -0700 From: Nathan Chancellor To: Michael Kelley 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) Message-ID: References: <1644176216-12531-1-git-send-email-mikelley@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1644176216-12531-1-git-send-email-mikelley@microsoft.com> X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Reported-by: Vitaly Chikunov > Reported-by: Jakub Kicinski > Fixes: 743b237c3a7b ("scsi: storvsc: Add Isolation VM support for storvsc driver") > Signed-off-by: Michael Kelley 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 Tested-by: Nathan Chancellor [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 >