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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62C20C433EF for ; Wed, 6 Oct 2021 09:58:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 30D9661152 for ; Wed, 6 Oct 2021 09:58:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 30D9661152 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XLJCPuDwYY8pJzGzD69fpZOVVtWHf+7W8N0EPvRGAyA=; b=AOIfpr5Wi509ak vEchu12GQlcq4QHy+XRma2VTjB8UBZ3X6ojRkSHDuGDJdHMWFyIIhLPfZdATN5oglfnxC6zhOkZ7a 1Ewr9kXFQodO2O72MCP99m+nS0x5cv8uIxJQt2FFDJ72K77JmXZrpl1eBsAdLPTCfV0wPGOND6SFV BaF2IlmVMS4tp00/F/scryi6FwlGNaTMU1bMKYbyy7BOoKYf0Ak4uQDN64nQjyLGL4Ifsc8K/5Cju iSBUaBIDAEzsO/NoLydL5RLoXgaeJfPAoPskd6cyTMv60PTn6aIxHLW2o9QeB9mp0LPLl/LatvreR gAcQZZIX9xTM6Lh3J9+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mY3ei-00Dkvt-PL; Wed, 06 Oct 2021 09:56:09 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mY3eF-00DkbW-RU for linux-arm-kernel@lists.infradead.org; Wed, 06 Oct 2021 09:55:41 +0000 Received: by mail-wr1-x430.google.com with SMTP id s15so7014517wrv.11 for ; Wed, 06 Oct 2021 02:55:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=53P0MWqxHQf69YIQTg7++jhQaclFdr/J2LBfnT7Jxag=; b=SyqmL0KIwaYYoAnvxjN3cUgFEI9q0HKr8Ar/pWsMkn9kMDGzeCkwbxNr5N5Kc/UWS7 qniK5NqdpFiEqx+FSrnniWhRiB36WlBCYKNtzy05dCMjzUyTW9QFNaEZ/f4z9YXH30MO IEn+GlPNPbZiWY/3MJ/uJXvLCXC/DyO5mBNQTIQJy/+FRS6AC8YCO7GzAia1tIaS52In ZmFzmtuOnaCJYRjB58b+zDAHwub8BWctoYeAeSgPq+1yuZ1lQzB34HrNc4dGrF/+kr4F r46OH/pMw/2AQQASBIOLJueH5xJxURZBBbE0SHmAeD1lDV/X9+qdhjVkuRQXODpRNfTK jVWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=53P0MWqxHQf69YIQTg7++jhQaclFdr/J2LBfnT7Jxag=; b=gCuOZIih4JaV17aW8NNTONZWzrqpGG6C/enY9qJtvmYbqaW3N1O7jYk94SRpV1FEds /hvdTblpke9qLPqreo1i7/uKaLysqYr5m73xha5+P9bKXHBikKn+MCzGzLnFHtAN4ZR+ vLo7DN4jyVEMIFbKWNNaKTP97z6g2nKXvb0bYxBU6+zvEQkeD6sjYydSF50InFYIdirX bVcSVbTkrPsRG4z8yJdYSP66otP0+x0uqSiYa8shHbWRFBvZLme3tAk+LqpGaPKIDW6P /+EUAJ24adrv5Up2Gn9QlBEsm4IMMnKOvj2EKaPpHnXvfghJZzbC52n3kin1zubSzUCj 0kOA== X-Gm-Message-State: AOAM532jlOT9y05CxzKwLfHwXDNXjb+y+zVv50HwAhJiKLznBFkV891f JhGpVp2Iu7FIzQRU3HqmSPoxVQ== X-Google-Smtp-Source: ABdhPJzxdeXU89q22gyHmthoWcnGdg9zFvCS0EtqufEuzVaX6IYosj6/AmW+M3t0tXGZdbu/vTLWjg== X-Received: by 2002:a1c:f402:: with SMTP id z2mr8775367wma.53.1633514137346; Wed, 06 Oct 2021 02:55:37 -0700 (PDT) Received: from myrica (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id o6sm378418wri.49.2021.10.06.02.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 02:55:36 -0700 (PDT) Date: Wed, 6 Oct 2021 10:55:14 +0100 From: Jean-Philippe Brucker To: Vivek Kumar Gautam Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, virtualization@lists.linux-foundation.org, joro@8bytes.org, will.deacon@arm.com, mst@redhat.com, robin.murphy@arm.com, eric.auger@redhat.com, kevin.tian@intel.com, jacob.jun.pan@linux.intel.com, yi.l.liu@intel.com, Lorenzo.Pieralisi@arm.com, shameerali.kolothum.thodi@huawei.com Subject: Re: [PATCH RFC v1 10/11] uapi/virtio-iommu: Add a new request type to send page response Message-ID: References: <20210423095147.27922-1-vivek.gautam@arm.com> <20210423095147.27922-11-vivek.gautam@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211006_025539_953989_D1A6CF5E X-CRM114-Status: GOOD ( 18.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 30, 2021 at 02:54:05PM +0530, Vivek Kumar Gautam wrote: > > > +struct virtio_iommu_req_page_resp { > > > + struct virtio_iommu_req_head head; > > > + __le32 domain; > > > > I don't think we need this field, since the fault report doesn't come with > > a domain. > > But here we are sending the response which would be consumed by the vfio > ultimately. In kvmtool, I am consuming this "virtio_iommu_req_page_resp" > request in the virtio/iommu driver, extracting the domain from it, and using > that to call the respective "page_response" ops from "vfio_iommu_ops" in the > vfio/core driver. > > Is this incorrect way of passing on the page-response back to the host > kernel? That works for the host userspace-kernel interface because the device is always attached to a VFIO container. For virtio-iommu the domain info is redundant. The endpoint information needs to be kept through the whole response path in order to target the right endpoint in the end. In addition the guest could enable PRI without attaching the endpoint to a domain, or fail to disable PRI before detaching the endpoint. Sure it's weird, but the host can still inject the recoverable page fault in this case, and the guest answers with "invalid" status but no domain. We could mandate domains for recoverable faults but that forces a synchronization against attach/detach and I think it needlessly deviates from other IOMMUs. Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel