Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7693504imu; Tue, 22 Jan 2019 10:00:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Jp/EHkq1wtJlDoNwB/bMcuy5yqISWxSPSQMI6J5UD2nUgIqLZQWljALgLNy5QjL4EVplz X-Received: by 2002:a17:902:1122:: with SMTP id d31mr35091548pla.246.1548180008695; Tue, 22 Jan 2019 10:00:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548180008; cv=none; d=google.com; s=arc-20160816; b=hmkIIAydzprtnex1jbCjCZ0T9e5gejYpKsgIlWkpPmDXFPPFiwSR8fCxrUWOZSJpVG ovAPQcsN2DcFA7rSg7mflDYdCLJgoABzX62wAKZDtAPE6Z9JE6LtprKISc4ZtjSWj6QE aL9OkzL7ZNgoOdyCl8SE+p1P2B9L2SEwitT7CBiYnlVpQduwJ1SbGlETM1QaGccVOmMN fRTCA19+mbJLio4LTDcpqpmPHTKDfkP3F5T6Hpne60ewh14+0sR+3ENRnx9BnnIcEpYJ APzWLl4UsWAGe8d89+EFZOlFWFKLSVICY4tWGF/DcSUq09fWsA2W8i9pNlnpmBn7q+8I YxZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=2sdqZJYOD88IXsTaCGIFSjwzq8+QjVudsK2vz601fFM=; b=UReVhcP+ED4ksoLhW511UJ1VI99tjDhYKBe1koYk9BaPpoeQH/hQkjpXtfc9PCfiTO s4di2C9pNN2tq8Z9dDE31YBqsGIWS+iq8VPj8AW+ZzfnRQR2OoS8AYN59Aw/7d1lM8Ve 088kkaOprUGmRkPQ/NriDrlJVbNGnmC9SkeHpvEpcGc5xXCBiR7DcNUigqujkZwbA2Kk xYmTklLAkw51xpc+Y74BoleInM7F0DfpUiT38q6PK1f4499UtePbGFx74m0kHrB0JxHg 2OxGHaCZm74RkqnetbCTZyoPU49yXU5ZC0gzJMy0ahXOTzg91Te7+IE2ZrekoqF7tenC ACAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u11si17386236plm.8.2019.01.22.09.59.52; Tue, 22 Jan 2019 10:00:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726814AbfAVR6R (ORCPT + 99 others); Tue, 22 Jan 2019 12:58:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38722 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725862AbfAVR6R (ORCPT ); Tue, 22 Jan 2019 12:58:17 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F47488E53; Tue, 22 Jan 2019 17:58:16 +0000 (UTC) Received: from w520.home (ovpn-116-182.phx2.redhat.com [10.3.116.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7F365D737; Tue, 22 Jan 2019 17:58:15 +0000 (UTC) Date: Tue, 22 Jan 2019 10:58:15 -0700 From: Alex Williamson To: Pierre Morel Cc: Jean-Philippe Brucker , Robin Murphy , gerald.schaefer@de.ibm.com, linux-s390@vger.kernel.org, walling@linux.ibm.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] iommu/s390: Declare s390 iommu reserved regions Message-ID: <20190122105815.4796a2f9@w520.home> In-Reply-To: References: <1547573850-9459-1-git-send-email-pmorel@linux.ibm.com> <3cd790d6-aa6f-e817-27ce-56d7a9b6b6e5@linux.ibm.com> <668fe734-e4bf-0342-ab8c-df54d9022db4@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 22 Jan 2019 17:58:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 21 Jan 2019 12:51:14 +0100 Pierre Morel wrote: > On 18/01/2019 14:51, Jean-Philippe Brucker wrote: > > Hi Pierre, > > > > On 18/01/2019 13:29, Pierre Morel wrote: > >> On 17/01/2019 14:02, Robin Murphy wrote: > >>> On 15/01/2019 17:37, Pierre Morel wrote: > >>>> The s390 iommu can only allow DMA transactions between the zPCI device > >>>> entries start_dma and end_dma. > >>>> > > ... > > >> > >> I already posted a patch retrieving the geometry through > >> VFIO_IOMMU_GET_INFO using a specific capability for the geometry [1], > >> and AFAIU, Alex did not agree with this. > > > > On arm we also need to report the IOMMU geometry to userspace (max IOVA > > size in particular). Shameer has been working on a solution [2] that > > presents a unified view of both geometry and reserved regions into the > > VFIO_IOMMU_GET_INFO call, and I think we should go with that. If I > > understand correctly it's currently blocked on the RMRR problem and > > we're waiting for Jacob or Ashok to take a look at it, as Kevin pinged > > them on thread [1]? > > > > [2] https://lkml.org/lkml/2018/4/18/293 > > > > Thanks, > > Jean > > > > Hi Jean, > > I hopped that this proposition went in the same direction based on the > following assumptions: > > > - The goal of the get_resv_region is defined in iommu.h as: > ----- > * @get_resv_regions: Request list of reserved regions for a device > ----- > > - A iommu reserve region is a region which should not be mapped. > Isn't it exactly what happens outside the aperture? > Shouldn't it be reported by the iommu reserved region? > > - If we use VFIO and want to get all reserved region we will have the > VFIO_IOMMU_GET_INFO call provided by Shameer and it can get all reserved > regions depending from the iommu driver itself at once by calling the > get_reserved_region callback instead of having to merge them with the > aperture. > > - If there are other reserved region, depending on the system > configuration and not on the IOMMU itself, the VFIO_IOMMU_GET_INFO call > will have to merge them with the region gotten from the iommu driver. > > - If we do not use QEMU nor VFIO at all, AFAIU, the standard way to > retrieve the reserved regions associated with a device is to call the > get_reserved_region callback from the associated iommu. > > Please tell me were I am wrong. The existing proposal by Shameer exposes an IOVA list, which includes ranges that the user _can_ map through the IOMMU, therefore this original patch is unnecessary, the IOMMU geometry is already the starting point of the IOVA list, creating the original node, which is split as necessary to account for the reserved regions. To me, presenting a user interface that exposes ranges that _cannot_ be mapped is a strange interface. If we started from a position of what information do we want to provide to the user and how will they consume it, would we present a list of reserved ranges? I think the only argument for the negative ranges is that we already have them in the kernel, but I don't see that it necessarily makes them the right solution for userspace. > >> What is different in what you propose? > >> > >> @Alex: I was hoping that this patch goes in your direction. What do you > >> think? I think it's unnecessary given that in Shameer's proposal: - We start from the IOMMU exposed geometry - We present a list of usable IOVA ranges, not a list of reserved ranges Thanks, Alex