Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4051592imm; Tue, 29 May 2018 20:47:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIyjfMVUiTqXmmyHL3bTXtSHELpvj564oTKwXZpJr9nqvJevG4+8ynKypkQ+I99kWDUup50 X-Received: by 2002:a62:249b:: with SMTP id k27-v6mr1108150pfk.143.1527652056351; Tue, 29 May 2018 20:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527652056; cv=none; d=google.com; s=arc-20160816; b=P4owjVcJdQhZfXERH+N8eyHFsSxHvpeUhlJivSodshdbwXEhJvoSdySjhVTqWtZ96g dhyB169erRw2aVB8Hr60iTwvG2tm8tD8ms5kkQnwQHfvXGedZNsZ44ZA/tuniH9FQQXU jQ+jI6PctAN2wcelkBU4GkI0NB4tx1BaZUsaaaSaFOz0y9w4VKwz22TJZ0hclCblAZMc h8PxMaflEs9+57NlCp7h8niXf7409eXW+hWYDLGEVYrogHo21rJzv1X9XFykHooMyiWO tGvLfRUrYK0em2gLg0oFsSDi7uk37Uzwuk1JbVYqDHUBmFO/2QGfyM9415ZW+PFWE3km BsGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:arc-authentication-results; bh=+8+G3oSO2VhoXwpV7WKq8uN43H+IatnrKPu0QZ+1OhA=; b=tQS5TRO9wAT/q3Ionl0oUf/PZR064zFjghvX3mdCiH2Fqj7r5m5VwSU24QKOb0TjG8 O3xRRYEzFNSLDeZrtd9NQthFOtZ35TPisrLqtWVq30WXH+kOlljPd4y+DvyAmSpNRoI7 7clW1PMVrz1poZDt7ivXLj/UBFAVJ3RTWth/ddZYz+mzniZpyuAz9ZhDH5k7XssAGn+E ly4t49j4bDmwFmc/sjCWEpYflJhQKKgqncqpooQFq3sFXJyWEi9Gtd/yumRKptY3GxC5 ZhifIU0e/g88n99TgtonSkKP6GR08zqqthT0A4zVF173LbFJaB8nZhc05YRDDgR3L3KO 5vvg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 38-v6si34493644plc.446.2018.05.29.20.47.21; Tue, 29 May 2018 20:47:36 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755241AbeE3Dph convert rfc822-to-8bit (ORCPT + 99 others); Tue, 29 May 2018 23:45:37 -0400 Received: from mga01.intel.com ([192.55.52.88]:7413 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754935AbeE3Dpf (ORCPT ); Tue, 29 May 2018 23:45:35 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2018 20:45:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,458,1520924400"; d="scan'208";a="55016107" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 29 May 2018 20:45:34 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 29 May 2018 20:45:34 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 29 May 2018 20:45:34 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.82]) by shsmsx102.ccr.corp.intel.com ([169.254.2.223]) with mapi id 14.03.0319.002; Wed, 30 May 2018 11:45:32 +0800 From: "Tian, Kevin" To: Alex Williamson CC: Jacob Pan , Jean-Philippe Brucker , "iommu@lists.linux-foundation.org" , LKML , Joerg Roedel , David Woodhouse , "Greg Kroah-Hartman" , "Wysocki, Rafael J" , "Liu, Yi L" , "Raj, Ashok" , Jean Delvare , Christoph Hellwig , Lu Baolu , Yi L Subject: RE: [PATCH v4 04/22] iommu/vt-d: add bind_pasid_table function Thread-Topic: [PATCH v4 04/22] iommu/vt-d: add bind_pasid_table function Thread-Index: AQHT1cxrC6UgpKcW20OywYDXDmuYDKQEzd+AgASqXQCAAFimgIA9Dz6AgADhuaD//5YBAIAAizqw Date: Wed, 30 May 2018 03:45:30 +0000 Message-ID: References: <1523915351-54415-1-git-send-email-jacob.jun.pan@linux.intel.com> <1523915351-54415-5-git-send-email-jacob.jun.pan@linux.intel.com> <20180417131047.0a9c310f@w520.home> <20180420164251.5245f822@jacob-builder> <20180529140915.1f174689@w520.home> <20180529211746.74f1dd23@w520.home> In-Reply-To: <20180529211746.74f1dd23@w520.home> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmU1ZTI5YTktMzUwOS00NzMwLWI3NTUtYWFjNjIzNTAzNjAwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjN0dVwvd1pzTkZQTnZTZmZodHppa0x0WEhKanZ5VU5GY203dUJsY3hpbGNzPSJ9 dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Alex Williamson [mailto:alex.williamson@redhat.com] > Sent: Wednesday, May 30, 2018 11:18 AM > > On Wed, 30 May 2018 01:41:43 +0000 > "Tian, Kevin" wrote: > > > > From: Alex Williamson [mailto:alex.williamson@redhat.com] > > > Sent: Wednesday, May 30, 2018 4:09 AM > > > > > > On Fri, 20 Apr 2018 16:42:51 -0700 > > > Jacob Pan wrote: > > > > > > > On Fri, 20 Apr 2018 19:25:34 +0100 > > > > Jean-Philippe Brucker wrote: > > > > > > > > > On Tue, Apr 17, 2018 at 08:10:47PM +0100, Alex Williamson wrote: > > > > > [...] > > > > > > > + /* Assign guest PASID table pointer and size order */ > > > > > > > + ctx_lo = (pasidt_binfo->base_ptr & VTD_PAGE_MASK) | > > > > > > > + (pasidt_binfo->pasid_bits - MIN_NR_PASID_BITS); > > > > > > > > > > > > Where does this IOMMU API interface define that base_ptr is 4K > > > > > > aligned or the format of the PASID table? Are these all > > > > > > standardized or do they vary by host IOMMU? If they're standards, > > > > > > maybe we could note that and the spec which defines them when > we > > > > > > declare base_ptr. If they're IOMMU specific then I don't > > > > > > understand how we'll match a user provided PASID table to the > > > > > > requirements and format of the host IOMMU. Thanks, > > > > > > > > > > On SMMUv3 the minimum alignment for base_ptr is 64 bytes, so a > > > guest > > > > > under a vSMMU might pass a pointer that's not aligned on 4k. > > > > > > > > > PASID table pointer for VT-d is 4K aligned. > > > > > Maybe this information could be part of the data passed to > userspace > > > > > about IOMMU table formats and features? They're not part of this > > > > > series, but I think we wanted to communicate IOMMU-specific > features > > > > > via sysfs. > > > > > > > > > Agreed, I believe Yi Liu is working on a sysfs interface such that QEMU > > > > can match IOMMU model and features. > > > > > > Digging this up again since v5 still has this issue. The IOMMU API is > > > a kernel internal abstraction of the IOMMU. sysfs is a userspace > > > interface. Are we suggesting that the /only/ way to make use of the > > > internal IOMMU API here is to have a user provided opaque pasid table > > > that we can't even do minimal compatibility sanity testing on and we > > > simply hope that hardware covers all the fault conditions without > > > taking the host down with it? I guess we have to assume the latter > > > since the user has full control of the table, but I have a hard time > > > getting past lack of internal ability to use the interface and no > > > ability to provide even the slimmest sanity testing. Thanks, > > > > > > > checking size, alignment, ... is OK, which I think is already considered > > by vendor IOMMU driver. However sanity testing table format might > > be difficult. The initial table provided by guest is likely just all ZEROs. > > whatever format violation may be caught only when a PASID entry > > is updated... > > There's sanity testing the actual contents of the table, which I agree > would be difficult and would likely require some sort of shadowing at > additional overhead, but what about even basic consistency checking? > For example, is it possible that due to hardware variations a user > might generate a table which works on some systems but not others? > What > if two table formats are sufficiently similar that the IOMMU driver > puts an incompatible table in place but it continuously generates > faults, how do we debug that? As an intermediary in this whole process > I'd really rather be able to identify that the user claims to be > providing a TypeA table but the IOMMU only supports TypeB, so clearly > this won't work. I don't see that we have that capability. Thanks, > I remember we ever discussed to define some vendor/model ID, which can be retrieved by user space and then passed back when doing table binding. Then above simple model matching check can be done accordingly. It is actually a basic requirement when using virtio-iommu, same driver expecting to work on all vendor IOMMUs. However I don't remember whether/where that logic is implemented in this series (especially when there are two tracks moving in parallel). I'll leave to Jacob/Jean to further comment. Thanks Kevin