Received: by 2002:ac0:950e:0:0:0:0:0 with SMTP id f14csp1320135imc; Sun, 17 Mar 2019 10:23:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvjgPIw3GcIrPi5YNYA4BIAKeq7QykrKJVCGcw9/NS1OC6WW44SI6i0wD6MN4s3MdrxgYX X-Received: by 2002:aa7:8019:: with SMTP id j25mr14962998pfi.82.1552843422324; Sun, 17 Mar 2019 10:23:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552843422; cv=none; d=google.com; s=arc-20160816; b=MJ9QGmVpsmNjpV/ZyWuJcdKUirgUyjTpBoA24w2xUzbzMJIr72L+7QeD3BnTkJFFfY lYS8wLQprWZDC1lkYmqwiNzI7vxjfMF+ssCmHH5isYrP8NDiH928wTnlcQKkL5o0/Zr4 ptBWGbMwQ+S5enyINPYEkiaYs6b2pI8XuiawEKv+XmC7OOv4jyNpayyAecZ2Bq2Gceg3 YAf6EVorVOPJv+Wxb33FK7sALCoNzoZ6VtDQosdvKdoTwcTYJ0vHpR5/O2penrG/T3F6 c77BshPNIrHPgS6W+m1zkKtGt8ejcUshDOqn3FxoUjlIT/I+KszWJcRjPp251F/XmH+h OHGQ== 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:date:subject:cc:to:from; bh=i9T2/4m8+lEW5H9o7WD+4B9DXFvXGR2zP1u8WtdRBlU=; b=E5XAufFOgptR9bHxsVi14ycqQDwc8TazeHK5xDvYLC31BwkK01/5MM5eRiusFty4Mv gb3sTFw8qCwcXQT1ct+4Rxxrh0rZyA8dM/rsWkJ63sgObQqOhKC1u8xGP44Qd9nFpyXg ISQMQeKDIsQejLtBzuiTl5qFbparg3CMEMy0Rox8vYRjEDr0gexG/PwToLmhR0Yu/pnR ugVyt/2LpLQN68lT/UmCm7fM/H0H78SjL64m0Zz6zIV9W5csBmFIH6P5hP3yROsIk76/ 6KOFNxgIKxZdhdAcABcJQfi7mEwS6f1qMol0+ZdbS5WdY1KiQz2GfOcreAfBllUZGZHX kJiA== 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 b13si7419193plz.22.2019.03.17.10.23.27; Sun, 17 Mar 2019 10:23: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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727183AbfCQRWu (ORCPT + 99 others); Sun, 17 Mar 2019 13:22:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38472 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbfCQRWs (ORCPT ); Sun, 17 Mar 2019 13:22:48 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F1CC38535D; Sun, 17 Mar 2019 17:22:47 +0000 (UTC) Received: from laptop.redhat.com (ovpn-116-102.ams2.redhat.com [10.36.116.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0EE819C71; Sun, 17 Mar 2019 17:22:43 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, joro@8bytes.org, alex.williamson@redhat.com, jacob.jun.pan@linux.intel.com, yi.l.liu@linux.intel.com, jean-philippe.brucker@arm.com, will.deacon@arm.com, robin.murphy@arm.com Cc: kevin.tian@intel.com, ashok.raj@intel.com, marc.zyngier@arm.com, christoffer.dall@arm.com, peter.maydell@linaro.org, vincent.stehle@arm.com Subject: [PATCH v6 01/22] driver core: add per device iommu param Date: Sun, 17 Mar 2019 18:22:11 +0100 Message-Id: <20190317172232.1068-2-eric.auger@redhat.com> In-Reply-To: <20190317172232.1068-1-eric.auger@redhat.com> References: <20190317172232.1068-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sun, 17 Mar 2019 17:22:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jacob Pan DMA faults can be detected by IOMMU at device level. Adding a pointer to struct device allows IOMMU subsystem to report relevant faults back to the device driver for further handling. For direct assigned device (or user space drivers), guest OS holds responsibility to handle and respond per device IOMMU fault. Therefore we need fault reporting mechanism to propagate faults beyond IOMMU subsystem. There are two other IOMMU data pointers under struct device today, here we introduce iommu_param as a parent pointer such that all device IOMMU data can be consolidated here. The idea was suggested here by Greg KH and Joerg. The name iommu_param is chosen here since iommu_data has been used. Suggested-by: Greg Kroah-Hartman Reviewed-by: Greg Kroah-Hartman Signed-off-by: Jacob Pan Link: https://lkml.org/lkml/2017/10/6/81 --- include/linux/device.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index b425a7ee04ce..39b4dd1b01f5 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -42,6 +42,7 @@ struct iommu_ops; struct iommu_group; struct iommu_fwspec; struct dev_pin_info; +struct iommu_param; struct bus_attribute { struct attribute attr; @@ -961,6 +962,7 @@ struct dev_links_info { * device (i.e. the bus driver that discovered the device). * @iommu_group: IOMMU group the device belongs to. * @iommu_fwspec: IOMMU-specific properties supplied by firmware. + * @iommu_param: Per device generic IOMMU runtime data * * @offline_disabled: If set, the device is permanently online. * @offline: Set after successful invocation of bus type's .offline(). @@ -1054,6 +1056,7 @@ struct device { void (*release)(struct device *dev); struct iommu_group *iommu_group; struct iommu_fwspec *iommu_fwspec; + struct iommu_param *iommu_param; bool offline_disabled:1; bool offline:1; -- 2.20.1