From owner-svn-src-head@freebsd.org Thu May 4 14:58:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 664E0D5E08A; Thu, 4 May 2017 14:58:39 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 068E618E4; Thu, 4 May 2017 14:58:38 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-wm0-f52.google.com with SMTP id w64so21435483wma.0; Thu, 04 May 2017 07:58:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=gM/6gG+3/KVpa173penmy0fd6VGlSAqhufHqexCcLZs=; b=BoDHMw1sLKIdJeX+TOrZ7gogrnJpa10bUqxvKkaLCDJwnyEAGY+DQbhX7ujUAyf2Z0 dNoZ3AChcu09IAL58pIyPR49ODY04nErV56NbPBwkSFpCin5mH2uhUo3ZRV0+P/pQYZt RDkc/FH96VNNBc9s/DmbnSAYm17ICjwqaqbPmLVwyatcsHGYGDR31b0MDjOn4S5cTgO5 Lb+Yyhm4IwDq3zexhcmZdoR+BrNkTSn27z1oBfPxOH74tNP7Nm0Gf/2DfwEUyakLOfvL VImNyZAwm86QLL+Yg4ZyVo4MYVQ2tkyK21tbmZ2d8PDXdRws5pwc9KkP8H7MPgjwTC6C PCxg== X-Gm-Message-State: AN3rC/5EVYH85eX3Qc92mDH+3HLyHVwB5RWWZPdwHPr4RhMLUYDwyLq5 mVYAu+raMevWcqUBqbk= X-Received: by 10.28.15.75 with SMTP id 72mr2239533wmp.48.1493909910347; Thu, 04 May 2017 07:58:30 -0700 (PDT) Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com. [74.125.82.44]) by smtp.gmail.com with ESMTPSA id r29sm1543565wra.18.2017.05.04.07.58.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 May 2017 07:58:30 -0700 (PDT) Received: by mail-wm0-f44.google.com with SMTP id u65so3045757wmu.1; Thu, 04 May 2017 07:58:30 -0700 (PDT) X-Received: by 10.80.186.199 with SMTP id x65mr30743297ede.46.1493909910029; Thu, 04 May 2017 07:58:30 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.80.169.4 with HTTP; Thu, 4 May 2017 07:58:29 -0700 (PDT) In-Reply-To: <201704300208.v3U28lZo093446@repo.freebsd.org> References: <201704300208.v3U28lZo093446@repo.freebsd.org> From: Conrad Meyer Date: Thu, 4 May 2017 07:58:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r317600 - in head/sys: amd64/vmm/amd modules/vmm To: Anish Gupta Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 14:58:39 -0000 Hi Anish, On Sat, Apr 29, 2017 at 7:08 PM, Anish Gupta 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