Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2395486rdb; Thu, 21 Sep 2023 18:31:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEoV925ZZiDTdqvV4F8JGQ2H6fqFUHFor4nZpONRMDG9CsL2sIBUbb5t2yqr2IBgvkmCNvG X-Received: by 2002:a05:6358:728e:b0:143:6977:22c5 with SMTP id w14-20020a056358728e00b00143697722c5mr6154305rwf.1.1695346296654; Thu, 21 Sep 2023 18:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695346296; cv=none; d=google.com; s=arc-20160816; b=jd3uBiDu4kcMkgyalLyD5T6F5TeU9dlpDSREhQaCZAB7lEp7r+Gy3vPt6pTntPmE18 /cAbt+Z8KLVFACa5JBknV4AayWvIpPgcYu13TVG+bHxX/GZJkLfZt08VkfEIHdWnz2JQ FOib7e4MlI+v17WoJzrew5dg2tI3A8D0w79tCSiHs50838+vPXmdngCz6MQTu4IeDm0P CYeFfuJJAatZipbgIJjy/rUgB9l0zk5B7x7NzVTXdcctxS10aogKTVwyyph44bmIRFKf HqUi86Be+3xA69vMHuLBJnnH3bRS3EZy7rI2a4v1HAtMXL8fwEGckr35gVoLdAzYufDv 6tCQ== 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=T6eXOYU3AG+rzCi81yzfSwl4eylb6quscLRsdbDixUY=; fh=ncJBVmsnOSqrX1O37yfYEzicwaA2e7ARxnsU7aiysyE=; b=e0geqX+L4O89GVvbtfda1CqkrWwQ+ZBKycXWL860gfBeak5htUk6bt9PCJZRmcsy9q sWCotFQmC3SeUT7f7ryqR9N6Tq2pG2K/vX8K0cvGom0jqs/pqo3I6OEN1lCxTDXc3Kvb 5ZnecwO+a6av0fEkQ+6c5LpwcsZdGN3bjmPmuT6y0/MWSq+6OP6Lpb5kbTAQPCBMPc64 PTwkJcpzfzyVAqQdfzmHx0ldCivcnuFeOj0W7UnyXhlANjjnYxB8VD+kZc8ORAZGsSVj 5Wrjr4c2YisJ+yit1dGwmwJbz+iU5lcfbKAlfVeuDf3dToRFNcG9mQ7SAHkGbqWQfho9 rfLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mYLObWUc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n20-20020a637214000000b0056fa98a8542si2600137pgc.227.2023.09.21.18.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:31:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mYLObWUc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id B59F58311BD9; Thu, 21 Sep 2023 13:56:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229909AbjIUU4p (ORCPT + 99 others); Thu, 21 Sep 2023 16:56:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229670AbjIUUtM (ORCPT ); Thu, 21 Sep 2023 16:49:12 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAA2D4CB00; Thu, 21 Sep 2023 10:49:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695318588; x=1726854588; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fZEXWeTeOBrejODuS6erDuW9xhi+ilN63E3t7GSB+Dc=; b=mYLObWUcd9WTK/8as8BLRXq34hkELQ+jqRWpxcYabdwgQj1hmo3YyPjU K6XUxEbrRgGBFkE1odl1b4Yk0/Wdyd1QWoT0Qop9VQQ/qHEQAJXaL5mph E2xcdYJi5zLclO7jDAskar481WVdWzYHT2AuoI3OhwCRdL2DLNaR9fq6K pG0rjNNOfMGhA0yAthttcVSto8Fc3oKCRajdWVOnDmIEHv9klpnTW+PSr LdxGsuuJnxrKP1AL9XlL4hDVseR70QrauEMQyAa7R0Rp+B5/BTsENVMME kRqUjQ/ESVtEeDzghup16Tvvx2LufPHsE+dd1A4aIJ0tba/KcqBIhcTY3 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="359832824" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="359832824" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2023 00:52:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="723649502" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="723649502" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by orsmga006.jf.intel.com with ESMTP; 21 Sep 2023 00:52:09 -0700 From: Yi Liu To: joro@8bytes.org, alex.williamson@redhat.com, jgg@nvidia.com, kevin.tian@intel.com, robin.murphy@arm.com, baolu.lu@linux.intel.com Cc: cohuck@redhat.com, eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org, mjrosato@linux.ibm.com, chao.p.peng@linux.intel.com, yi.l.liu@intel.com, yi.y.sun@linux.intel.com, peterx@redhat.com, jasowang@redhat.com, shameerali.kolothum.thodi@huawei.com, lulu@redhat.com, suravee.suthikulpanit@amd.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, zhenzhong.duan@intel.com, joao.m.martins@oracle.com Subject: [PATCH v4 03/17] iommufd: Unite all kernel-managed members into a struct Date: Thu, 21 Sep 2023 00:51:24 -0700 Message-Id: <20230921075138.124099-4-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230921075138.124099-1-yi.l.liu@intel.com> References: <20230921075138.124099-1-yi.l.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 13:56:43 -0700 (PDT) From: Nicolin Chen The struct iommufd_hw_pagetable has been representing a kernel-managed HWPT, yet soon will be reused to represent a user-managed HWPT. These two types of HWPTs has the same IOMMUFD object type and an iommu_domain object, but have quite different attributes/members. Add a union in struct iommufd_hw_pagetable and group all the existing kernel-managed members. One of the following patches will add another struct for user-managed members. Signed-off-by: Nicolin Chen Signed-off-by: Yi Liu --- drivers/iommu/iommufd/iommufd_private.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/iommufd/iommufd_private.h b/drivers/iommu/iommufd/iommufd_private.h index 3064997a0181..947a797536e3 100644 --- a/drivers/iommu/iommufd/iommufd_private.h +++ b/drivers/iommu/iommufd/iommufd_private.h @@ -231,13 +231,18 @@ int iommufd_vfio_ioas(struct iommufd_ucmd *ucmd); */ struct iommufd_hw_pagetable { struct iommufd_object obj; - struct iommufd_ioas *ioas; struct iommu_domain *domain; - bool auto_domain : 1; - bool enforce_cache_coherency : 1; - bool msi_cookie : 1; - /* Head at iommufd_ioas::hwpt_list */ - struct list_head hwpt_item; + + union { + struct { /* kernel-managed */ + struct iommufd_ioas *ioas; + bool auto_domain : 1; + bool enforce_cache_coherency : 1; + bool msi_cookie : 1; + /* Head at iommufd_ioas::hwpt_list */ + struct list_head hwpt_item; + }; + }; }; struct iommufd_hw_pagetable * -- 2.34.1