Commit 6bf625a4 authored by Michael Kelley's avatar Michael Kelley Committed by Wei Liu
Browse files

Drivers: hv: vmbus: Rework use of DMA_BIT_MASK(64)



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: default avatarNathan Chancellor <nathan@kernel.org>
Reported-by: default avatarVitaly Chikunov <vt@altlinux.org>
Reported-by: default avatarJakub Kicinski <kuba@kernel.org>
Fixes: 743b237c ("scsi: storvsc: Add Isolation VM support for storvsc driver")
Signed-off-by: default avatarMichael Kelley <mikelley@microsoft.com>
Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/1644176216-12531-1-git-send-email-mikelley@microsoft.com


Signed-off-by: default avatarWei Liu <wei.liu@kernel.org>
parent 8bc69f86
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2082,7 +2082,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
 */
@@ -2123,8 +2122,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:
+1 −0
Original line number Diff line number Diff line
@@ -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;