On 04/09/2024 1:43 pm, Michal Orzel wrote:
> diff --git a/xen/drivers/passthrough/arm/smmu.c
> b/xen/drivers/passthrough/arm/smmu.c
> index f2cee82f553a..4c8a446754cc 100644
> --- a/xen/drivers/passthrough/arm/smmu.c
> +++ b/xen/drivers/passthrough/arm/smmu.c
> @@ -1619,19 +1619,21 @@ static int arm_smmu_master_alloc_smes(struct device
> *dev)
> spin_lock(&smmu->stream_map_lock);
> /* Figure out a viable stream map entry allocation */
> for_each_cfg_sme(cfg, i, idx, fwspec->num_ids) {
> + uint16_t mask = (fwspec->ids[i] >> SMR_MASK_SHIFT) &
> SMR_MASK_MASK;
Not related to the change itself, but consider using MASK_EXTR() ?
It reduces code volume for the reader, and removes a class of errors by
accidentally mismatching the mask/shift constants.
In x86 in particular, we're trying to remove the SHIFT constants and
only have the MASKs.
Although it looks like this is an abnormal pair to begin with, being
shift then mask, rather than the more usual mask then shift.
~Andrew