Received: by 10.192.165.156 with SMTP id m28csp763834imm; Tue, 17 Apr 2018 20:18:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49K13M5hF4z/7SsYGwv4tS6xDYoJFckGQvGtxfewwcc2J+NzRO0nUobQMDZcNPUkjnIN6Em X-Received: by 2002:a17:902:9a8c:: with SMTP id w12-v6mr384967plp.333.1524021522351; Tue, 17 Apr 2018 20:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524021522; cv=none; d=google.com; s=arc-20160816; b=OMMU6tOBnWJ9ymfcqAYXwww3q1xNJ4FLfMmZz90AwP9W+CQ5PKluYQSBwt92vQlXHe /v5iFF0BGrTMjtShjbSw7ghEzH+nmhMVIj3d/Q749IbBjoVnEjSMAEt8ew47SFFXNtPm gxO8KjFg30MLrt+TyI4YukfxyM16xyCSGTg9dv0SKB38EeT6/OrPvwboIId89T1FzM8S iHZYNKnKt7Ib+p+YGd6AWvfZ2FeDkkL5VejZ3EWXQdHXJhqpfzNz8qRmgLTotaXAkxkU BTWd6cFSHZkqIFqbUwwThwHBgcXH0ka2a+LHGvzb6M7uZzvJheRRSYfQ2VjSbhF1sWId 4GYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:from:cc:references:to :subject:arc-authentication-results; bh=8Q1MVdyfBfOpK4m3g5YO064DimtRz9nQKy0JCK8BO+M=; b=E3mAiW2nUZJ5OrJ9VS0lK1CrNXXihUOGWo24svUrl6jIqHjhky4LzAsJj5kG4vIek+ m9/bE1JTLsXNSJGBZRpfncpUHDWygcg1Ao3Di/5NrV5SGjMXEreRwdW7jSwIVuXyR3E4 Ek1un7dXAiYHeE4ARs/4quQobjhxGCm7l/A1jpTzcqzIg5d6tooEn+rTVxZfvF57bSva DFBAAriTady5rZla4nWv8XJNmK8cowueWt1aBdIK1e2ETLn0RfjZ81yPZrGoG2UkEm3y b8+qLAsVJ2Ng4W637c4ekBI2882o7pGEYiC550fm1YwN3CjINXkuaMvdCv2JCZoSqYHr hxag== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bd9-v6si286350plb.461.2018.04.17.20.18.28; Tue, 17 Apr 2018 20:18:42 -0700 (PDT) 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753436AbeDRDRZ (ORCPT + 99 others); Tue, 17 Apr 2018 23:17:25 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58562 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753252AbeDRDRV (ORCPT ); Tue, 17 Apr 2018 23:17:21 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3I3FBUb019246 for ; Tue, 17 Apr 2018 23:17:21 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hds1rtf35-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 17 Apr 2018 23:17:20 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Apr 2018 04:17:18 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 18 Apr 2018 04:17:15 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3I3HEIV56885308; Wed, 18 Apr 2018 03:17:14 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 308F6AE055; Wed, 18 Apr 2018 04:07:04 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74CEBAE051; Wed, 18 Apr 2018 04:07:01 +0100 (BST) Received: from [9.202.15.240] (unknown [9.202.15.240]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 18 Apr 2018 04:07:01 +0100 (BST) Subject: Re: [RFC] virtio: Use DMA MAP API for devices without an IOMMU To: Christoph Hellwig , Benjamin Herrenschmidt References: <20180405105631.9514-1-khandual@linux.vnet.ibm.com> <3e1b113b-79ca-b700-5be9-10c66d74aabe@linux.vnet.ibm.com> <20180405175326-mutt-send-email-mst@kernel.org> <1522940983.21446.205.camel@kernel.crashing.org> <20180405213042-mutt-send-email-mst@kernel.org> <1522963113.21446.211.camel@kernel.crashing.org> <70cb433f-a8f7-5199-3c96-a760c7624804@linux.vnet.ibm.com> <20180406071634.GA31108@infradead.org> <1523003838.21446.238.camel@kernel.crashing.org> <20180415121157.GA17726@infradead.org> Cc: robh@kernel.org, "Michael S. Tsirkin" , aik@ozlabs.ru, jasowang@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, joe@perches.com, david@gibson.dropbear.id.au, linuxppc-dev@lists.ozlabs.org, elfring@users.sourceforge.net From: Anshuman Khandual Date: Wed, 18 Apr 2018 08:47:10 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20180415121157.GA17726@infradead.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18041803-0040-0000-0000-000004302BCC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041803-0041-0000-0000-00002634397F Message-Id: <002f153f-452d-f64b-4fc7-7f3383b39162@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-18_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804180029 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/15/2018 05:41 PM, Christoph Hellwig wrote: > On Fri, Apr 06, 2018 at 06:37:18PM +1000, Benjamin Herrenschmidt wrote: >>>> implemented as DMA API which the virtio core understands. There is no >>>> need for an IOMMU to be involved for the device representation in this >>>> case IMHO. >>> >>> This whole virtio translation issue is a mess. I think we need to >>> switch it to the dma API, and then quirk the legacy case to always >>> use the direct mapping inside the dma API. >> >> Fine with using a dma API always on the Linux side, but we do want to >> special case virtio still at the arch and qemu side to have a "direct >> mapping" mode. Not sure how (special flags on PCI devices) to avoid >> actually going through an emulated IOMMU on the qemu side, because that >> slows things down, esp. with vhost. >> >> IE, we can't I think just treat it the same as a physical device. > > We should have treated it like a physical device from the start, but > that device has unfortunately sailed. > > But yes, we'll need a per-device quirk that says 'don't attach an > iommu'. How about doing it per platform basis as suggested in this RFC through an arch specific callback. Because all the virtio devices in the given platform would require and exercise this option (to avail bounce buffer mechanism for secure guests as an example). So the flag basically is a platform specific one not a device specific one.