From patchwork Thu Sep 14 08:56:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 139683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp466692vqi; Thu, 14 Sep 2023 09:21:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbyEjbCfYVSX5/laBqviZNVspiSjaSADWuBHpsY+dsi/bZ6WjsiZDUyAQKTkxm6EJT8uSv X-Received: by 2002:a05:6a20:565b:b0:14d:6309:fc94 with SMTP id is27-20020a056a20565b00b0014d6309fc94mr5142097pzc.36.1694708516537; Thu, 14 Sep 2023 09:21:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694708516; cv=none; d=google.com; s=arc-20160816; b=yrfGq8gQ6SF7qRadE/x2vTDgPFX6Cbz1Lfj0l0gyn1DsO2V04gJl9qYJJf215XCQjL ANeLLyLfIFrSmTyNHrhQ27QMF7FAYdtieP/d72TDUb0JCkcjCN+REV1mZ6QOGwfp9kOS MZTqPA6l58bQ8JBa3jO737EMjXqXD9EE/S0hMMYve/tVe87+UIhawiY+h6Vc9c/kezSJ a1roVGYz+cgBr3e1bt4RFzZ1QHqhC8ULCuWEj6AlzEk16rMCPwRJmY95DmFPq3uwdihG pLa2TfcYYanl7Ts7+HztLcSCnHeBCC4HidK+9ZDi7Q3DZggI5Ha8p9g1O0ZzYTuNVcRU dcWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=L6865mmVqSir+H6clZp2jETsNNBrfbzdjIULYDbDDL0=; fh=JFvRLtRIMZvCnJUsxV0gv79r+wO9Mnl08XOA+KkZDv4=; b=Tp7ZObxa87othBjMrgTRc4o3mO8+JNhCYKrYXkVr3x0ZogBroXjEvYyz+XSlsRS255 2q5Bv8Mk9YqA/SysXfl/Mc/eaimHzJ+v/SLSLPEOUdcfHfZ8OpZw/7kS5SXeJcWSXAdS L0Ja3Vg4uEYBeg1GOEa+DnsAgJJJCbYBR9LSYQWWhcnneJs0d6xoyI5O4gTV3dpS/DJb TlfHhqZb7/7kuZRgoilAsgcll3kPzv2YWGMIhfe6uz36dWt3b8hlD5dV3QeUxpcNVU2W SjrbyQTv2O25PC4htlMSaLlsqtLFSMYI/001sN+99EFm99iiZhH2PeP4/UjXRSRM818m X70A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bYoHD3kz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id br15-20020a056a00440f00b0068fca4405aasi1864514pfb.338.2023.09.14.09.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 09:21:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bYoHD3kz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 9100581143EC; Thu, 14 Sep 2023 02:00:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236753AbjINJAW (ORCPT + 35 others); Thu, 14 Sep 2023 05:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236624AbjINJAJ (ORCPT ); Thu, 14 Sep 2023 05:00:09 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D824CC7; Thu, 14 Sep 2023 02:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694682005; x=1726218005; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3swk2kXJoM2a1PqfcTU8QJMMZhHalASP/3K35w+Kct8=; b=bYoHD3kzqqo4+DtwQS2eDhQnQ4RKjH+iCnOe0fB71q73fpcYbJcnHLr5 55cMM2eyy7qlLFFfA2g0j6toC9FBEHqDh78eIUoEA3lKdvKpPgsZODuRy ZTULNko7p+iyEtsgHICJb2FLNUUdCWuZHnLglRm01U4b4EgAOEkmnmJGE j/4zF1Mndg6V2/hSXcnSwOgkT5+T/D4RNmrIB64WV34YIqdw3OhMAOBwv wOoVHCOHbasKD7dCaQ0RGSQUgfBIkRX9/KsRAfFOmOAhoEZY7/5qVV3ij udcz+2+VhiFIqwMcJGHmLW/5nk1Z09HYGP7kyc5VmRI798GfHULU48xwr Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="465266334" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="465266334" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2023 01:59:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="859612834" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="859612834" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga002.fm.intel.com with ESMTP; 14 Sep 2023 01:59:55 -0700 From: Lu Baolu To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen Cc: Yi Liu , Jacob Pan , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu , Jason Gunthorpe Subject: [PATCH v5 04/12] iommu: Cleanup iopf data structure definitions Date: Thu, 14 Sep 2023 16:56:30 +0800 Message-Id: <20230914085638.17307-5-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230914085638.17307-1-baolu.lu@linux.intel.com> References: <20230914085638.17307-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 02:00:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777030677729879682 X-GMAIL-MSGID: 1777030677729879682 struct iommu_fault_page_request and struct iommu_page_response are not part of uAPI anymore. Convert them to data structures for kAPI. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian --- include/linux/iommu.h | 27 +++++++++++---------------- drivers/iommu/io-pgfault.c | 1 - drivers/iommu/iommu.c | 4 ---- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 1040047982aa..db13ebaabcf7 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -69,12 +69,12 @@ struct iommu_fault_page_request { #define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1) #define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2) #define IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID (1 << 3) - __u32 flags; - __u32 pasid; - __u32 grpid; - __u32 perm; - __u64 addr; - __u64 private_data[2]; + u32 flags; + u32 pasid; + u32 grpid; + u32 perm; + u64 addr; + u64 private_data[2]; }; /** @@ -83,7 +83,7 @@ struct iommu_fault_page_request { * @prm: Page Request message, when @type is %IOMMU_FAULT_PAGE_REQ */ struct iommu_fault { - __u32 type; + u32 type; struct iommu_fault_page_request prm; }; @@ -104,8 +104,6 @@ enum iommu_page_response_code { /** * struct iommu_page_response - Generic page response information - * @argsz: User filled size of this data - * @version: API version of this structure * @flags: encodes whether the corresponding fields are valid * (IOMMU_FAULT_PAGE_RESPONSE_* values) * @pasid: Process Address Space ID @@ -113,14 +111,11 @@ enum iommu_page_response_code { * @code: response code from &enum iommu_page_response_code */ struct iommu_page_response { - __u32 argsz; -#define IOMMU_PAGE_RESP_VERSION_1 1 - __u32 version; #define IOMMU_PAGE_RESP_PASID_VALID (1 << 0) - __u32 flags; - __u32 pasid; - __u32 grpid; - __u32 code; + u32 flags; + u32 pasid; + u32 grpid; + u32 code; }; diff --git a/drivers/iommu/io-pgfault.c b/drivers/iommu/io-pgfault.c index e5b8b9110c13..24b5545352ae 100644 --- a/drivers/iommu/io-pgfault.c +++ b/drivers/iommu/io-pgfault.c @@ -56,7 +56,6 @@ static int iopf_complete_group(struct device *dev, struct iopf_fault *iopf, enum iommu_page_response_code status) { struct iommu_page_response resp = { - .version = IOMMU_PAGE_RESP_VERSION_1, .pasid = iopf->fault.prm.pasid, .grpid = iopf->fault.prm.grpid, .code = status, diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 3bfc56df4f78..ccad2131f49d 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1458,10 +1458,6 @@ int iommu_page_response(struct device *dev, if (!param || !param->fault_param) return -EINVAL; - if (msg->version != IOMMU_PAGE_RESP_VERSION_1 || - msg->flags & ~IOMMU_PAGE_RESP_PASID_VALID) - return -EINVAL; - /* Only send response if there is a fault report pending */ mutex_lock(¶m->fault_param->lock); if (list_empty(¶m->fault_param->faults)) {