svn commit: r317600 - in head/sys: amd64/vmm/amd modules/vmm
Conrad Meyer
cem at freebsd.org
Thu May 4 14:58:39 UTC 2017
Hi Anish,
On Sat, Apr 29, 2017 at 7:08 PM, Anish Gupta <anish at freebsd.org> wrote:
> Author: anish
> Date: Sun Apr 30 02:08:46 2017
> New Revision: 317600
> URL: https://svnweb.freebsd.org/changeset/base/317600
>
> Log:
> Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct assignment to VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=1.
>
> Reviewed by:bcr
> Approved by:grehan
> Tested by:rgrimes
> Differential Revision:https://reviews.freebsd.org/D10049
> ...
>
> Added: head/sys/amd64/vmm/amd/amdvi_hw.c
> ...
> +/* See section 2.5.4 of AMD IOMMU spec ver 2.62.*/
> +static inline void
> +amdvi_decode_evt_flag_type(uint8_t type)
> +{
> +
> + switch (AMDVI_EVENT_FLAG_TYPE(type)) {
> + case 0:
> + printf("RSVD\n");
> + break;
> + case 1:
> + printf("Master Abort\n");
> + break;
> + case 2:
> + printf("Target Abort\n");
> + break;
> + case 3:
> + printf("Data Err\n");
> + break;
> + default:
> + break;
> + }
> +}
Coverity warns that the result of AMDVI_EVENT_FLAG_TYPE() in this
function will always be zero. This makes sense, as the macro is
defined as:
#define AMDVI_EVENT_FLAG_TYPE(x) (((x) >> 9) & 0x3)
And "type" is a uint8_t. Right-shifting it by 9 will always zero it.
Perhaps the function's parameter should be a wider type?
FYI, this is Coverity CID 1374742.
Best,
Conrad
More information about the svn-src-head
mailing list