[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/iommu: smmu: Rework how the SMMU version is detected





On 24/12/2020 17:00, Andrew Cooper wrote:
On 24/12/2020 16:49, Julien Grall wrote:
From: Julien Grall <jgrall@xxxxxxxxxx>

Clang 11 will throw the following error:

smmu.c:2284:18: error: cast to smaller integer type 'enum 
arm_smmu_arch_version' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
         smmu->version = (enum arm_smmu_arch_version)of_id->data;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The error can be prevented by introduce static variable for each SMMU
version and store a pointer for each of them.

Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>

You can also fix this by casting through (uintptr_t) instead of (enum
arm_smmu_arch_version), which wouldn't involve an extra indirection.

I thought about using a different cast, but it feels just papering over the issue.

But I don't see what's the problem with the extra indirection... It is self-contained and only used during the IOMMU initialization.


Alternatively, you could modify dt_device_match to union void *data with
uintptr_t val for when you want to actually pass non-pointer data.

~Andrew


--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.