From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81A50C433E0 for ; Tue, 2 Feb 2021 12:08:56 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 8006D64F65 for ; Tue, 2 Feb 2021 12:08:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8006D64F65 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B64614B14A; Tue, 2 Feb 2021 07:08:54 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NWCG53DNcINH; Tue, 2 Feb 2021 07:08:53 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A6CEF4B194; Tue, 2 Feb 2021 07:08:53 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4DF374B14A for ; Tue, 2 Feb 2021 07:08:52 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TDSq95IIzZ9F for ; Tue, 2 Feb 2021 07:08:50 -0500 (EST) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 6CA914B13C for ; Tue, 2 Feb 2021 07:08:50 -0500 (EST) Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4DVNq54Kjjz7YvC; Tue, 2 Feb 2021 20:07:29 +0800 (CST) Received: from [10.174.184.42] (10.174.184.42) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.498.0; Tue, 2 Feb 2021 20:08:46 +0800 Subject: Re: [PATCH v11 03/13] vfio: VFIO_IOMMU_SET_MSI_BINDING To: Eric Auger , , , , , , , , , , References: <20201116110030.32335-1-eric.auger@redhat.com> <20201116110030.32335-4-eric.auger@redhat.com> From: Keqian Zhu Message-ID: <635db234-33ff-c079-40cb-2de00c089e7c@huawei.com> Date: Tue, 2 Feb 2021 20:08:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20201116110030.32335-4-eric.auger@redhat.com> X-Originating-IP: [10.174.184.42] X-CFilter-Loop: Reflected Cc: jean-philippe@linaro.org, jacob.jun.pan@linux.intel.com, nicoleotsuka@gmail.com, vivek.gautam@arm.com, yi.l.liu@intel.com, zhangfei.gao@linaro.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Eric, On 2020/11/16 19:00, Eric Auger wrote: > This patch adds the VFIO_IOMMU_SET_MSI_BINDING ioctl which aim > to (un)register the guest MSI binding to the host. This latter > then can use those stage 1 bindings to build a nested stage > binding targeting the physical MSIs. [...] > +static int vfio_iommu_type1_set_msi_binding(struct vfio_iommu *iommu, > + unsigned long arg) > +{ > + struct vfio_iommu_type1_set_msi_binding msi_binding; > + unsigned long minsz; > + int ret = -EINVAL; > + > + minsz = offsetofend(struct vfio_iommu_type1_set_msi_binding, > + size); > + > + if (copy_from_user(&msi_binding, (void __user *)arg, minsz)) > + return -EFAULT; > + > + if (msi_binding.argsz < minsz) > + return -EINVAL; We can check BIND and UNBIND are not set simultaneously, just like VFIO_IOMMU_SET_PASID_TABLE. > + > + if (msi_binding.flags == VFIO_IOMMU_UNBIND_MSI) { > + vfio_unbind_msi(iommu, msi_binding.iova); > + ret = 0; > + } else if (msi_binding.flags == VFIO_IOMMU_BIND_MSI) { > + ret = vfio_bind_msi(iommu, msi_binding.iova, > + msi_binding.gpa, msi_binding.size); > + } > + return ret; > +} > + Thanks, Keqian _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm