On 15.03.2024 12:16, Nicola Vetrini wrote:
> Delete unused functions from 'iommu_guest.c'.
> 
> The 'cmd' parameter of amd_iommu_send_guest_cmd is passed
> to a function that expects arrays of size 4, therefore
> specifying explicitly the size also in amd_iommu_send_guest_cmd
> allows not to accidentally pass a bigger array.
> 
> No functional change.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetr...@bugseng.com>
> ---
> All current users of amd_iommu_send_guest pass an array of size 4,
> hence this is fixing a potential issue noticed by the analyzer for MISRA C
> Rule 17.5, not an actual bug.
> 
> guest_iommu_add_ptr_log has still one caller, but even that seems
> suspicious. I left it in and uniformed its parameter type at the
> moment, so that whether it should be kept can be sorted out later.
> If that caller indeed should be removed as well, then
> no function in the file is actually reachable as far as I can tell.

Afaict this wants removing too.

But what I'm more puzzled by: You remove all callers of
amd_iommu_send_guest_cmd(), yet still ...

> --- a/xen/drivers/passthrough/amd/iommu.h
> +++ b/xen/drivers/passthrough/amd/iommu.h
> @@ -346,12 +346,8 @@ void cf_check amd_iommu_crash_shutdown(void);
>  
>  /* guest iommu support */
>  #ifdef CONFIG_HVM
> -void amd_iommu_send_guest_cmd(struct amd_iommu *iommu, u32 cmd[]);
> -void guest_iommu_add_ppr_log(struct domain *d, u32 entry[]);
> -void guest_iommu_add_event_log(struct domain *d, u32 entry[]);
> -int guest_iommu_init(struct domain* d);
> -void guest_iommu_destroy(struct domain *d);
> -int guest_iommu_set_base(struct domain *d, uint64_t base);
> +void amd_iommu_send_guest_cmd(struct amd_iommu *iommu, uint32_t cmd[4]);

... retain the function.

Jan

Reply via email to