Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4039123ybl; Tue, 20 Aug 2019 06:11:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvI2hRg1ANwCjN2CrEEIBZXMToBo8qk7nsyDdbWIuqtN1Z3HjgshV7/TaiL3ldmhDkYuay X-Received: by 2002:a17:902:be03:: with SMTP id r3mr28654554pls.156.1566306705606; Tue, 20 Aug 2019 06:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566306705; cv=none; d=google.com; s=arc-20160816; b=NcXSlZ3ZxjHjbK5Gy1s6npqkL9KOmSInKsv8J5EqJ+TezzXPiNi/zEKuPe4DNqK+SJ P1mR2SMyKgAvtXKQgpIqXEj1bKfAn8A0e5AFAWZBQY5q5llSCAJlJLztHXpOph9E2/Eu 23YVGInEUpMkEg30nQ8iXjCuGAo4EHjDwYUWMDIDW0019GewQDSi6ckC4WfsK5UKs9d7 p9p/FCMLxmynOZrh/3cHSFFOcqR5qd82mR6BnfO+Qh8/ZeRIR8N+9/qWwTUGmNONHYUg msT6LEptefCoL28j1RmTe8nGiiujIsYHEKtA/XfHaeyUmvB908W1nUgO6EBfF5jpHoJu A8zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=R/XEZX18qkyJvhxRVDCiF+uMNuLw57f1ZojJ1bFz9f8=; b=RFZ5kjbQo5YXJd8BWpAdQJC8xXvG4tvpYxtKlox9GJehxInlJUakAMIaGw+BWUij/F XTb5Aodr8nNNleQ1CZIIrqBRtsVvcNCYNDD96BmK+CqDCzJUfPzu9MgrVmZIKAiIfbSv zA2EKXC6ZGncvVhr0mqSxhSvxIndR9FzxL8XanzYQ2vwqCHBAxUbjavmrvPzl0b0lUgI 32MMLtIrFdxPS3xovfWYPRhmlbDoq1VTKvzLv9oyocV65fvBuP/2MepynZIgxjHBHyQz CKOdlx2RVp6YsSKg1h7VgkmUgX5gCJh1THu+6QotRcrZs/fZtSToih64bD6i0LMe+RVp Xlqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H50PQ5XZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15si12100853ply.127.2019.08.20.06.11.30; Tue, 20 Aug 2019 06:11:45 -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; dkim=pass header.i=@linaro.org header.s=google header.b=H50PQ5XZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729948AbfHTNJJ (ORCPT + 99 others); Tue, 20 Aug 2019 09:09:09 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44572 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728595AbfHTNJJ (ORCPT ); Tue, 20 Aug 2019 09:09:09 -0400 Received: by mail-pl1-f196.google.com with SMTP id t14so2729805plr.11 for ; Tue, 20 Aug 2019 06:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=R/XEZX18qkyJvhxRVDCiF+uMNuLw57f1ZojJ1bFz9f8=; b=H50PQ5XZm7e7HPZqtsiAV1BlECpRkPYzUHgvQIOmbQXYrwcj9vPVBlNXpCsWZnYzIP HffL4/rfz53HSSwmFbD5hVG/omf43KELdSunZ5IkCLusywD2fKAXXYxVRpObFQ/FDpUx QqTF9jnjVmvQPw/IKpos0CsWqjBQHqEj9V9zitsMwThRWj/JMOmHpXKiy61E4dTsB9Wn gR8bO1eBdTdGPNFVWNt4CyK1FtLcXOEry8JD3Tqd+nGs+1LotJd3EtkTPOTTxqylLRmo YDw809dLvzu1PWhbeFTVdYPnBJrK0e7kVozVelfoZESQBgAFaEi6uDQaDm6AchCU7qKd bmYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=R/XEZX18qkyJvhxRVDCiF+uMNuLw57f1ZojJ1bFz9f8=; b=QVxu740pDx9CAaUP8sKLRit+9iG3fzBSvOKvLnCftsgcthjSkAKC75s+vdI5dfk7qR cicmA4C9kX0i74mV43daeuwb6zwLMBcqY1X6KWrLlluY1CjzjnqSb7D6rb8QizHuO4lN XDZKgC+dtvVGmMpvv7KiTcIEI4V+pAuDBgq8hpK5t07tGbJIBQOSmaSWmHGuQSMtrDNm pDk9xxnIrCIndkuSfHemQ8VhRzNYXetkYA/YliYkDpRsZw0lQxpnZO0ipO3e8SkZDwcc KjJ/MC5BdRqXAR5iR+dUhbspuAG5M6GhEcvmCIri0jHUMrUSiMGhgS61JnxFo0/wM3x+ c/lg== X-Gm-Message-State: APjAAAUA8s5t+7//mCOZbGgZfHcP9tGIWvvGl2Hv7LRKjKcGQH1hb1QF Nav3S7IqvgGKoPfUQpKaf36pbw== X-Received: by 2002:a17:902:4283:: with SMTP id h3mr17410026pld.56.1566306548634; Tue, 20 Aug 2019 06:09:08 -0700 (PDT) Received: from ?IPv6:240e:362:43e:2200:6d55:ae74:3a5b:9669? ([240e:362:43e:2200:6d55:ae74:3a5b:9669]) by smtp.gmail.com with ESMTPSA id t4sm24029670pfd.109.2019.08.20.06.09.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Aug 2019 06:09:07 -0700 (PDT) Subject: Re: [PATCH 2/2] uacce: add uacce module To: Greg Kroah-Hartman Cc: Arnd Bergmann , linux-accelerators@lists.ozlabs.org, linux-kernel@vger.kernel.org, Kenneth Lee , Zaibo Xu , Zhou Wang References: <1565775265-21212-1-git-send-email-zhangfei.gao@linaro.org> <1565775265-21212-3-git-send-email-zhangfei.gao@linaro.org> <20190815141351.GD23267@kroah.com> From: zhangfei Message-ID: <6daab785-a8f9-684e-eb71-7a81604d3bb0@linaro.org> Date: Tue, 20 Aug 2019 21:08:55 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190815141351.GD23267@kroah.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/8/15 下午10:13, Greg Kroah-Hartman wrote: > On Wed, Aug 14, 2019 at 05:34:25PM +0800, Zhangfei Gao wrote: >> +int uacce_register(struct uacce *uacce) >> +{ >> + int ret; >> + >> + if (!uacce->pdev) { >> + pr_debug("uacce parent device not set\n"); >> + return -ENODEV; >> + } >> + >> + if (uacce->flags & UACCE_DEV_NOIOMMU) { >> + add_taint(TAINT_CRAP, LOCKDEP_STILL_OK); >> + dev_warn(uacce->pdev, >> + "Register to noiommu mode, which export kernel data to user space and may vulnerable to attack"); >> + } > THat is odd, why even offer this feature then if it is a major issue? UACCE_DEV_NOIOMMU maybe confusing here. In this mode, app use ioctl to get dma_handle from dma_alloc_coherent. It does not matter iommu is enabled or not. In case iommu is disabled, it maybe dangerous to kernel, so we added warning here, is it required? We support two modes. 1. support sva, (va = iova) a. If pasid is supported, multi-process can be supported. b. If pasid is not supported, multi-process can NOT be supported. We borrowed va from user space to achieve a single virtual address system. 2. Can not support sva, iova != va, Here user app get dma_handle from dma_alloc_coherent via ioctl. We need this mode for two reasons: 1. This mode can support multi-process, to support openssl etc. 2. Some accelerators (crypto like zip, etc) can work without sva, just prepare data and kick start. Thanks