Re: [PATCH v1 13/16] ufs: mcq: Add completion support of a cqe

Bart Van Assche
2022-09-30T20:41:40Z

On 9/22/22 18:05, Asutosh Das wrote:
> +static int ufshcd_mcq_get_tag(struct ufs_hba *hba,
> + struct ufs_hw_queue *hwq,
> + struct cq_entry *cqe)
> +{
> + dma_addr_t dma_addr;
> +
> + /* Bits 63:7 UCD base address, 6:5 are reserved, 4:0 is SQ ID */
> + dma_addr = le64_to_cpu(cqe->command_desc_base_addr) & CQE_UCD_BA;
> +
> + return (dma_addr - hba->ucdl_dma_addr) /
> + sizeof(struct utp_transfer_cmd_desc);
> +}

Since the above code only works correctly if the size of struct
utp_transfer_cmd_desc is a multiple of 1 << 7, please add a
BUILD_BUG_ON() statement that verifies that the size of
utp_transfer_cmd_desc is a multiple of 128.

Thanks,

Bart.