Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp116293ybt; Mon, 6 Jul 2020 05:29:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPrh7wg0gYJAJA4mwNU6288Hx7b7/O59aBazyriXoroNjbT3y6ZhhYggJT/UPNcPhFDjhQ X-Received: by 2002:aa7:d848:: with SMTP id f8mr46500641eds.329.1594038585085; Mon, 06 Jul 2020 05:29:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1594038585; cv=pass; d=google.com; s=arc-20160816; b=EJO7ejyhWe79jt2JQL7AJnK6/7L3A0Vzoj/tkCd1fB1XeFVxIPx/3HOJFfkRY4Wyuh XEG1eLu1MDq+TH+C1ZKOLowQV6N/IDO1Gj2i+8FgmEKtzEbvsYGQMjr8KTwVmpuJYlMn V8+FSCuSsm6eIFcQJl2f+FVgqXFVxuEO2llqSuFAAdmbYPTjBButexpMzEht+wsIpGJc yMtkKiEkNVMhl9uY7epq+BT/d5qqsVo5TSgmQd1oyCjFr9+FdYEemxMBRtZkxY7Jx9AX Ja3+LxG7jjDcq0fnkKJ8HsIgaoGciGSlSPahBaxrjo1/DPiW+eSMsNwX7senk+AfRdYS 8YBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-product:dlp-version:dlp-reaction:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature:ironport-sdr :ironport-sdr; bh=YnbMOFLfoEFebGPc748yAr2swf4UYhNAW53P5XzqKcg=; b=bR4xxA1opbJEQdK43+tU5dz5kdW+EwtwWJvI7k58SmHy4knSRTAaGhWQWVs+KHyr3b 7OkHPxAoceWeeLJao4RfnKNnpYf/i0qnVvPh2sVOs3WcKIk0wLLXnsO0SmbnfsyGvUtD Vm6iz0jCwCa1Ioi5kaCoedoyg6zHUQHFSR+q94syH0kLx23Q02akFm0t5iIdIKQn0XXD GLwb++lUz+hz7EDk7VTxU6gSEGwd7KzTXi9uIl0kwSR2LnTBk3Z/hjXSlPZnJ9zrXRXZ VB4G9Ywt5FLXn7dv+eCpGKdfBbgdyI1hKNkTIj3YnKuyS3GYnjaM4xM7F5jHleNOO6cR 05vQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=WXJLh3YI; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id yd21si13145938ejb.727.2020.07.06.05.29.22; Mon, 06 Jul 2020 05:29:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=WXJLh3YI; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729121AbgGFM2e (ORCPT + 99 others); Mon, 6 Jul 2020 08:28:34 -0400 Received: from mga06.intel.com ([134.134.136.31]:9814 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728885AbgGFM2d (ORCPT ); Mon, 6 Jul 2020 08:28:33 -0400 IronPort-SDR: xe+UbvA7GO377IAVB16mK0g72ZNzoODjCVVdc4CLwA3n1A/THHYuJv4JBMmjMYwKi/FuM49/yz x++G/rIA4wug== X-IronPort-AV: E=McAfee;i="6000,8403,9673"; a="208913535" X-IronPort-AV: E=Sophos;i="5.75,318,1589266800"; d="scan'208";a="208913535" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2020 05:28:30 -0700 IronPort-SDR: vXwojdEXOpj+Qevv2B+CudT13PNp6Bl4l359VdAl8rKopFCsKlFlzoNWqpH21bUfgPId+mdmpv ZcuogUMbODWw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,318,1589266800"; d="scan'208";a="322367707" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 06 Jul 2020 05:28:30 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 6 Jul 2020 05:28:30 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 6 Jul 2020 05:28:29 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.176) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 6 Jul 2020 05:28:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YRBnoJZV7LIeXIxRaXyfs1/abKIUPfryFh8+cuaAxBY0bfOAvdZaMNPc1hn1r5kPJJVsLVuWS42AIRHKy1UuiPKm/sfuPB2WgtbHW1OO0QB3zuGIlgyUkuEBEmnhNFHs3T9EQ5QOLtf2+CJgn/1rNupIiwzRuFBDkzOwtJeLBQZszLZ8vwyYGkXntzxxgE2CgGs+IMEpZclXbMTjww8zC0ea6QSeojT2sVPbVMhSvqfgUezrM8YiSAJGlMF7N/164wVr5pTayI+fowVF+Rd+NV/H18p+pgzBXt2ZlujhrB38XFP30ZAjVPAV2G4PRfiG014xQ5B7w9zL+nVEzwgRaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YnbMOFLfoEFebGPc748yAr2swf4UYhNAW53P5XzqKcg=; b=KEDuhz86sGfuWy0h4uwYvrrcLvnKSsaX5O1tR1KHTb4LWYeK7fQeR6ICdD97PfTU+UrSEkGU7Q8Uts/dxllEH+VyxAEnWsB9HiP6e7RgNuCbq1wNy8hAt/X7ogO+0TJHxPr+H2Vw8eM3vYqB8Mk0lmsdxNr9/ksnaXY0EGVq/aCqyfv3LD79lE4Ilk/iP/YBGp8ZDoFFepkkkplhJq8fU0SLYcRcQjEv+e4us8DY7dxmrr4fKkTg7Vc/8vPmrrNup5hARjS77UkIffUcmE7pnC+Jf8iQ+i3mwG/wMOVsi5iD7C/dzx4yV6f1XQfMaLHyPu/6qzEo76eUtIiOJDIzUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YnbMOFLfoEFebGPc748yAr2swf4UYhNAW53P5XzqKcg=; b=WXJLh3YIOyOklGQISOxbIZWpq/Tz45dCGIAxNcrCJcb1jwqzaYhUWOXKlPzudMHE2+atbGV9hf2hZavplnC1PQU7iXV6UEuweh5x69VxhOcrnUEKa4p73y/X5V6FfS6l+a6rcOUJkOGDoxlxHt4MLNjiPF6DsTD8fL/LllEg6WA= Received: from DM5PR11MB1435.namprd11.prod.outlook.com (2603:10b6:4:7::18) by DM6PR11MB3420.namprd11.prod.outlook.com (2603:10b6:5:69::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.23; Mon, 6 Jul 2020 12:27:41 +0000 Received: from DM5PR11MB1435.namprd11.prod.outlook.com ([fe80::9002:97a2:d8c0:8364]) by DM5PR11MB1435.namprd11.prod.outlook.com ([fe80::9002:97a2:d8c0:8364%10]) with mapi id 15.20.3153.029; Mon, 6 Jul 2020 12:27:41 +0000 From: "Liu, Yi L" To: Auger Eric , "alex.williamson@redhat.com" , "baolu.lu@linux.intel.com" , "joro@8bytes.org" CC: "Tian, Kevin" , "jacob.jun.pan@linux.intel.com" , "Raj, Ashok" , "Tian, Jun J" , "Sun, Yi Y" , "jean-philippe@linaro.org" , "peterx@redhat.com" , "Wu, Hao" , "stefanha@gmail.com" , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v4 01/15] vfio/type1: Refactor vfio_iommu_type1_ioctl() Thread-Topic: [PATCH v4 01/15] vfio/type1: Refactor vfio_iommu_type1_ioctl() Thread-Index: AQHWUfUZTaGhOIgs0kmjsvrJtAKWW6j6TVoAgAAuaYA= Date: Mon, 6 Jul 2020 12:27:41 +0000 Message-ID: References: <1593861989-35920-1-git-send-email-yi.l.liu@intel.com> <1593861989-35920-2-git-send-email-yi.l.liu@intel.com> <0622db04-8254-8068-e00a-4681ec8686a8@redhat.com> In-Reply-To: <0622db04-8254-8068-e00a-4681ec8686a8@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.207] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5e8666eb-c0c0-49f9-2def-08d821a7fa51 x-ms-traffictypediagnostic: DM6PR11MB3420: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:849; x-forefront-prvs: 04569283F9 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: k44kEKp/3yooPpidPQneAVLG3oP0rghJbc7oOaiczxuzshkHfymY/ChYEj8fD2Agi6RDoEUL0afaau6tkZehoHMEdJW4nAi8dYKrMtW9I7MLazpbat0l1uWRtm4JgCPB63D+zSjNTxJ8REi1cIMUBJrLwSqcwZGKTACieY0wFnQhQDdzKMKlBZFtkywv1D2W0Z3s6Atm2TpI0sjZ12pETqFcn3q44XgT6gUE1Vr2qcQOIzqJuzvvfphAMLuE+AVy80krAR/+yQILw6ia6o/6vsnYbuOu1rMI53XpmExvRRTNIYRGENs4JTSNLExyD3ELPKZJceY/Q/IMMctY9FnGBA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR11MB1435.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(366004)(39860400002)(136003)(346002)(396003)(376002)(71200400001)(83380400001)(186003)(4326008)(52536014)(66946007)(8936002)(6506007)(66446008)(64756008)(66556008)(66476007)(76116006)(2906002)(53546011)(55016002)(9686003)(26005)(5660300002)(86362001)(316002)(110136005)(54906003)(7416002)(478600001)(30864003)(7696005)(33656002)(8676002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: IZuH9XZOA8C014Qmv+WbpkbGPoHXlrywZhQ7JsuHNtyCRzqZaExRikG1YlVqOjxYIw2hLHr6HsEpKpCMF1geeQVoOnIFGUUBULrHUPVqFGa+mhvpNkgrb9nEzzN2EXLLP8aIxJkjprotnGylgO70O3DFOyFkyQvAq8fQvu0XMasDz2zneX8o9vm2kpdJ6HoqLeFNmpiPpybzF5MxJQbhYo9DnXXIsUDjNHkfRanlgxoEDad49+CipCjduScxzWT6UTa6aKk9cmOlvnAc1MflCDdDFeWZDRmGfAQnk0wSHtCorJTGxjJMARZjNb40+qfU0Bh+FvItk13lmPs/bb5qvwp1fewmRbTVMpc93GIf2CjbZHaWQAIo8r+ae6pw9w3vAK95rOxvMcaC8SKJGl4CHEbo7PAnRaPRDniCUu53ZUSoQWjL9A0BfIhNEv3c1O47YFBojiT6W8n+mrGt56IyR25akgYLCFmHJRCgXpUlSZDdMc0c8+r/AZqwlVRnpDIt Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR11MB1435.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e8666eb-c0c0-49f9-2def-08d821a7fa51 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jul 2020 12:27:41.4285 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HX+Hr2jSRDwMoal0uMY7c8dNOXZ9+DkDLk4Lo8J7N34njvw/Ovw8P2Cw+7YoUoTdGonxQ9tubPMabRTkFMJy8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3420 X-OriginatorOrg: intel.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SGkgRXJpYywNCg0KPiBGcm9tOiBBdWdlciBFcmljIDxlcmljLmF1Z2VyQHJlZGhhdC5jb20+DQo+ IFNlb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