Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp966904rwi; Wed, 19 Oct 2022 05:17:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Fy8G0KwoTC8mDCk3kQSVxO//NiVZHmgIrOdEbxu1OUR/0CSVqCN23af8tbu/Kpb5DWc19 X-Received: by 2002:a17:906:99c5:b0:73d:70c5:1a4f with SMTP id s5-20020a17090699c500b0073d70c51a4fmr6187586ejn.302.1666181828144; Wed, 19 Oct 2022 05:17:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666181828; cv=pass; d=google.com; s=arc-20160816; b=jK/Am7w+TpCbwBizzoLnGxLhWywoPj4ZCC3uXg16i+qTERlWBuCMuSQiQ38r1+MIat FPbepo3DhaotNnYMJfPmlCaTdVNkmNOPEv+79iOyWkeLVUvXmr9B90fP8ihNkNU02PR4 GCmpwGa4kZ2YDFoxSoDs+G4TaYpGDisDYdPjO1rLShCtwh/gD0n17cHvkfB7HIUf6NMB DZ5taEaOgX3MFeFMDn39fuju93JrkcdX+IqQDrXQQHdLzmiI9bGwk6R55sruqd0MgGxm 0d/uNQVb+/5/I2ZbA4wrL/Za7MfarwSFQwosoq4Yg3T2q17bde9D0vzjvDd0pB8bvqOd jtqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=kCgyBKJ9d6lt4VQeRpDfp9Rsmn8Tl4jkhernxtel23E=; b=NSoOQCVl855jEYF2y9/kySgRUoHcfkWbAbQJgGpscTQFFooRPVao+VFuc4NR6yk3uC griI9NEo9lIGJX4OsmvPy5ITko/2erNM+k996lAiYndor1KhkInBy+G7lUDIvhz9guGB LDtiuvQuRZLtXd7PGT23CApupJCLOD1YpnDJPLCf8fh5ryPslGckh+cZLoClyV7j376p ClezECTtkiZWa6psE9SO58QMqYyItzo2rEhy6BOVmk8D5P5fmoJOb35vkYW5O0yOiHqi d9V0fiUrI6KR3/4bdqPonl2jo1y20oQ1PqyQ9MBEiZZGt+Ys5wUQLge8ndQzqwGsydMA sH7Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=V2o8VKRK; 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 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ce6-20020a170906b24600b0078de51ec509si12045641ejb.686.2022.10.19.05.16.25; Wed, 19 Oct 2022 05:17:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=V2o8VKRK; 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 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231824AbiJSLsP (ORCPT + 99 others); Wed, 19 Oct 2022 07:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231785AbiJSLrn (ORCPT ); Wed, 19 Oct 2022 07:47:43 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C3E916724C; Wed, 19 Oct 2022 04:26:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666178819; x=1697714819; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=aYvcYv4qIetfbf0GKCF3640hE1V+39glJh8F2SiEYGc=; b=V2o8VKRKTDBX7VRZJImJuBowaGeZeYcq/1QMIXj2lgwacFx4T0veBxAk GG7rs7/Vq6OSNScRd75qRPESqWFywKfoVM+wY0Uzg6+qzEDIPTKuBdPK5 AQmXrH48ZDqGg/lTtTpWCR2ybVKi3hsGVTMFxj+tYYVVA9hnRHWvas3T+ Q+vIP50sjIHlSfWhPbgEQWV4iqTLAZ2DkrBfJMM+tcI3aznnjs7bCwx24 irnarMIeGNCJ0rpDHFAw36I49C6gYc6DuaQBEuUfa2YMJZqmnRmK6DGOD nHL+5htU1NxcVO8xcyavMHYNbFrABOlJtHYSjMbG0+LTMZcQUhghZtF29 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="392664166" X-IronPort-AV: E=Sophos;i="5.95,195,1661842800"; d="scan'208";a="392664166" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 02:46:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="607011300" X-IronPort-AV: E=Sophos;i="5.95,195,1661842800"; d="scan'208";a="607011300" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga006.jf.intel.com with ESMTP; 19 Oct 2022 02:46:22 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 19 Oct 2022 02:46:22 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 19 Oct 2022 02:46:19 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Wed, 19 Oct 2022 02:46:19 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.107) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Wed, 19 Oct 2022 02:46:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hesTFV5MRLkqKrEz9MCHcw1IVmR14qndOm9CqLq2S+QC7bsvHhjlbH/k9dCzbUiX909UfbsSJxhtNR46a1k6eW1m8yazJunKuXOIxgDWOUzadDc7dKt7bqOrUMFXBlIelbt3V/VkKyQVxIfcw6l3tJ1qYhn3G/i9Yo0pkEWX49CPC/2NulUXxmn8qNFcu0SvWLhN19+MklfO4RKBa23fCeViR+kWZ63sTvFe7OdZCGmYarab5Y549X/YZ3WKNX11bte/7MAd4NpDtsbJoq150L8G9QPp9T7b1d1xTD19UHB4P/lLJ/bDygELvfwiZjKfwilb3686U2H/oHG6NiFpZQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kCgyBKJ9d6lt4VQeRpDfp9Rsmn8Tl4jkhernxtel23E=; b=kxeZ9azrodkbFHYM+kq0eWPe0R/XLR0wFhSBWxTCiTmU4XqOAnYMfDs0d51OaSyLn5H+UBC0HyU7XGjuSryvsxfZL0kFTPjJHJxzWLKDN0ltY+z2+fgtPWjuTA5thBBmi7BxJzGeQYMPNqL+G3rk0fUnFmepn2MLRGacJr/70T2HnfjzlGVV15aQ+1LpT0Y5ypaB+WNnbkDzspK+ZqYDnlIwUboH8d/aV0Rf2ST9gis8KcLOAAHw42+dafvsoEtzZJNr5nLwor5IUA9v4ln7+E3hLOCFCCfNnSOJV+TCT/SaNI1piYqyxW0Zx+miFqzbQA/aN8S4/V3VpdzcKjS1qg== 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 Received: from BN9PR11MB5276.namprd11.prod.outlook.com (2603:10b6:408:135::18) by SN7PR11MB6828.namprd11.prod.outlook.com (2603:10b6:806:2a3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Wed, 19 Oct 2022 09:46:15 +0000 Received: from BN9PR11MB5276.namprd11.prod.outlook.com ([fe80::737e:211a:bb53:4cd7]) by BN9PR11MB5276.namprd11.prod.outlook.com ([fe80::737e:211a:bb53:4cd7%4]) with mapi id 15.20.5723.033; Wed, 19 Oct 2022 09:46:15 +0000 From: "Tian, Kevin" To: "Yu, Fenghua" , Vinod Koul , "Van De Ven, Arjan" , Dave Hansen , "Jiang, Dave" , Lu Baolu , Jacob Pan CC: "dmaengine@vger.kernel.org" , linux-kernel , "Yu, Fenghua" , "stable@vger.kernel.org" Subject: RE: [PATCH v2] dmaengine: idxd: Do not enable user type Work Queue without Shared Virtual Addressing Thread-Topic: [PATCH v2] dmaengine: idxd: Do not enable user type Work Queue without Shared Virtual Addressing Thread-Index: AQHY4Bvoj4lQIaJXwEmOKYS/HRkVUq4VeWOQ Date: Wed, 19 Oct 2022 09:46:15 +0000 Message-ID: References: <20221014222541.3912195-1-fenghua.yu@intel.com> In-Reply-To: <20221014222541.3912195-1-fenghua.yu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR11MB5276:EE_|SN7PR11MB6828:EE_ x-ms-office365-filtering-correlation-id: 7c66e5ef-bf8e-45a4-7b70-08dab1b6c3fd x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yAJ8T3Pb2z7n3UqLtMnnb2vwgnPtQlA2VBzNANIw4V7JjJK/3NkU4Tzr+7MoofXDxDhHjiR6cl79MQzrXRQb7PxqROP9CtHalXthVcEZRlCDjQ1rZ6VlInNjzCug9qMBtE/WbIGJe6FcTBGefvRPUOtwKEYvgejdhPl23NnnV81IqTJy125kw6LP5XvcaUDI5/wtuKWdvxKqZ9eWwX5LBFA8mNwOuXn1pQ74ZVHLNA63VIgPIv1HIgBr8EXUiyszTOAUFGqImyPYQdHVrkFGUkm+CV6gyiT5uUy9c5sBay+J8f0aJKg1HT3chYQy23mnWx4/5xdgaNu38r0ST7t+9/5HJU5rTmxk9KbQh7tboMNPKs9P+cvQB1AW4CCivZpWa1MP3WrSbI26vNWf0Yj+9eF4wYwtFXYk/7oADYYbWI7h7aujlQCsnHqSOi+S3Xzb4Qme8o/f7XvXpE621jwrEbUtZtVu5yVgGaBNaLhj+0GfR30oGbQUuJSn6gWA7eCRKKoQdBC1vujTLr9HPE12GlfWGlqgL5J9Bx4N+y/PWmFiHh/zaT/b9bdJe51wlAQMjDqbppME3iqOQMUT3kF3Mex6EEelrD5cSPPAEsY21ThKf+n7X88ToQzLAgyekC8dIIaXIUe/C+vVRwEJ4IiBkLZeM2LuRWVfN3KUti329GzRedrJyBeQEORT7hs8OgjXhTPwq4UjU0CbEkaJbbvEVzaUA7j1gfShzdcUQkqC5vyS9cqBGKlxvJ0ydoL42aDY6eXlOsGH+WZbI/AagUFoQTKzZQms6cYFqJeNjgEAopM= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5276.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(136003)(376002)(346002)(39860400002)(396003)(366004)(451199015)(54906003)(86362001)(41300700001)(110136005)(8676002)(76116006)(66476007)(66446008)(7696005)(6506007)(316002)(5660300002)(4326008)(64756008)(55016003)(26005)(66556008)(9686003)(52536014)(83380400001)(8936002)(2906002)(82960400001)(186003)(33656002)(71200400001)(66946007)(38100700002)(478600001)(38070700005)(921005)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ZvJuKIAmfAw9lfBiriRkQbgUKyLO38UMwpgPFhIg0hfSX1+U6sqLpQcBd4e0?= =?us-ascii?Q?eWg7APJXX7uVj7YKPQISIKtiF1ibees6+DDJpDNB+K+oIc02SSTufF4O5b8r?= =?us-ascii?Q?DdGNNy2F7SicKOOQK2gmyX8OnROkxyN0wMEr/3N6w2bsLD0drhHTPVfZzvEy?= =?us-ascii?Q?QKRh9R9Fqi9/+BWx7f/2rs409f8812GA2/GxAAIZ/k+nN94gPT+Opyvr8+hf?= =?us-ascii?Q?Ul0kJD+cwy/gF6YnCW90YICojxRN3aIMIo7GIDSOJwYX3o0KnNee4YRtN5bJ?= =?us-ascii?Q?Qa8pc99pDvZY34fSnjqlNpvkcYaCo1mXLKl3x1qzVsQ2zXt1lsUX2f58R0/A?= =?us-ascii?Q?CXoxi5WRwz9grrJ+uY/puGM5HxRaBoHBFGaYwbJbvd/FLtyxMqBeqIQhZV27?= =?us-ascii?Q?apDXX6xphbqIO0hQn50vm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DmmSlRSk02OmNVXfx3?= =?us-ascii?Q?Ce/CL5f3tpYkO9a7SVFxI+ybq032N7XD/3aNmL3Z1feSdz212RVYkhiQYgAl?= =?us-ascii?Q?3V40E72Sg3EzC8edDxWDbzZo13FGsiaE9duFMfNRgyEZT40ymqNGYkT4zqe5?= =?us-ascii?Q?4FBFKjLkGRc5Rh/ExoUjS6Jm7EZtXv/UWCX7WQhqREyT0+4rqqFB/AuEb3fv?= =?us-ascii?Q?CCkOzx9khhOw606kf1AkJlguvztrzyhrKgzB12xQHaGRlolmwlG6eXqlyelS?= =?us-ascii?Q?dCjNcY+VdYEX/6Z7FrFsTkvAeLO7OFygql/XMy0f?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5276.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c66e5ef-bf8e-45a4-7b70-08dab1b6c3fd X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Oct 2022 09:46:15.6367 (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: mG4xO17YW73FCpTIVSlHeUogwYz5cCrNTFUlDMnU33U/Maihwro/MyvaEX0lODjBtO3KIndBo/WXKiwJQ2sIng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB6828 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 > From: Fenghua Yu > Sent: Saturday, October 15, 2022 6:26 AM >=20 > + /* > + * User type WQ is enabled only when SVA is enabled for two > reasons: > + * - If no IOMMU or IOMMU Passthrough without SVA, userspace This statement is kind of misleading. Even if IOMMU is in DMA mode user type WQ still doesn't work w/o SVA.=20 > + * can directly access physical address through the WQ. > + * - The IDXD cdev driver does not provide any ways to pin > + * user pages and translate the address from user VA to IOVA or > + * PA without IOMMU SVA. Therefore the application has no way > + * to instruct the device to perform DMA function. This makes > + * the cdev not usable for normal application usage. > + */ It could be simply stated as "SVA is the only secure/reliable way for the device to access user space memory" > + if (!device_user_pasid_enabled(idxd)) { > + idxd->cmd_status =3D IDXD_SCMD_WQ_USER_NO_IOMMU; be specific i.e. IDXD_SCMD_WQ_USER_NO_SVA > + dev_dbg(&idxd->pdev->dev, > + "User type WQ cannot be enabled without SVA.\n"); > + > + return -EOPNOTSUPP; > + } > + > =20 with above change the check on pasid_enabled should be removed from idxd_cdev_open() and idxd_cdev_release(). They should always work with SVA enabled.