Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4766319ybl; Tue, 4 Feb 2020 01:26:57 -0800 (PST) X-Google-Smtp-Source: APXvYqzN6bK5ymzgnjYUX9GtXi+Rg+r2bdqjB5kQUZ0CBVSnKcY4R6JQRCypUvryDyMCVwEyuFVS X-Received: by 2002:aca:1913:: with SMTP id l19mr2664592oii.47.1580808417107; Tue, 04 Feb 2020 01:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580808417; cv=none; d=google.com; s=arc-20160816; b=M9Y+CXK3b8L2O3T0Bn6y5lD81yA7EKolKw9wLYltSX+IGMxDvF47byRnElYMdO01iY qzffJTq+MYN4Aeg7jVrwL8Sdv9KbVQ1En5CUkrIAHq2F2oNUqTSTwyfHf61D95qGrziU 5r7mQ7Ng1ErZEFu57JIM1H4ShLjCVf5kTr+lZhU6SJeZ5ENIxfXZLGcKfmoILQx0C3BP Cy/HwDJLAY/eDsWhaQJq/hAEihNOJ3HrivjKwMgJEAzbTjcwopSpD4KMxsT/xTJ8R1PU 3P+sh0d3KVXj/iX/Xx7Ci8f1dNSB/E9DkXb3ggrdd81W8d5E0QXMHCpR0l4DPKqt1AJb v6aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=/LrB1QQcfXPxi0BB+lcewM64zrtrSOEYAcITFbKQ4wI=; b=Uj0gBwbHfSjV7TuGUyiGbFq7UEgGqLiVJJgDr0p8o1fGfBEsYbaR3UVqpo7kdXnAf+ /BepzSrYM50CnGAkc91BT1On26t9lRqACKXUawr07Ct5daEFCOH9S/A8/mbRuqzvvLxG 2DtcZTktpMg3CsF4aDSExCtyxrKH30hpIHD8oYMAkYCg/AWUilwWtPoHAgt7DHewtovx SYfqhIajfpsrBiROal/n7R2M9HkSDviB/SaDVG3yu6VEycONEiSLnBTvGtKAjg16sG+P DgwxX0q8wO7s+1SeMmXc8TPQgy3vhnQMBbahUr4EKGXmUj+iXQiPeC2KewkB/LbXRW2E lwqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=P60K4t5g; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k205si6966488oib.64.2020.02.04.01.26.45; Tue, 04 Feb 2020 01:26:57 -0800 (PST) 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=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=P60K4t5g; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726684AbgBDJZs (ORCPT + 99 others); Tue, 4 Feb 2020 04:25:48 -0500 Received: from mail-ua1-f68.google.com ([209.85.222.68]:35855 "EHLO mail-ua1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726196AbgBDJZs (ORCPT ); Tue, 4 Feb 2020 04:25:48 -0500 Received: by mail-ua1-f68.google.com with SMTP id y3so6471909uae.3 for ; Tue, 04 Feb 2020 01:25:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=/LrB1QQcfXPxi0BB+lcewM64zrtrSOEYAcITFbKQ4wI=; b=P60K4t5ggLQr/vhZHiXRlNywK69iPHwx590eFL3PWBdM4grhTUdcJtIzcoDprLCWT5 7m0n41QNkC8//4JfksLTz3YdQUVxEAGSDuZ9j+W1a0nr+VT86k3WY6fHx1FvGidLTTLy +w3Et4GwWqW1Y/UOb4tyjt07vAISYdOcsP/ZwOg1V/KnnyOAF5auYXjo5JGMn7+72ZuG KOS57j5QABVOvSR/VaJ+0zijMitZCtAji/0qGDGkhMome9LKH3rlcKGXQN1d+0fDdjdr 11d7hpEYBvM/Pc5HMA4mbzRQuC7Z5V/iFUQep1upy5JLQZhZKX4GTwvjnL9DG9LiIf3K gI/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=/LrB1QQcfXPxi0BB+lcewM64zrtrSOEYAcITFbKQ4wI=; b=DpAsAsj60zTQc4xDE/dMkAAUcmvQOMaLESZpOhURD7m4kJNqZQIrL7DbP7jGHx0alG Shn7ECm6YF2nkR/72De6K+ArhqWXXgn7BWYvi+F5JirBU8CNn6XVOvOoIJnZxAV23H4S ibO1Q4GRsD2QplAgnQPODS1bEPJeHZyz0ILLYFTGyrkj1rS8trmugOUq66FjVBtaf/CZ kLZd88Oc5PIspr+rkINQnqzRDaP/YH30mqRT2c+8CJ1icbCIsNp/wpp8m+WGr+DGRG7E 0LT2paalE3QexKZRjlqkccVQ984O5aofl0O/Zvfjxbwkt+lj7SIJkd3ulM2Kjg801hNa RIEA== X-Gm-Message-State: APjAAAVCUiABCM5BdhlzRNZlmMebasQja+YuB0KTana+qKnHyTby4U7t E22jd10CYUUB+tt0OU+oEwdl0jfY2C2DtAPZQkYONQ== X-Received: by 2002:ab0:2a0c:: with SMTP id o12mr16324286uar.72.1580808347038; Tue, 04 Feb 2020 01:25:47 -0800 (PST) MIME-Version: 1.0 References: <20200203091009.196658-1-jian-hong@endlessm.com> In-Reply-To: From: Jian-Hong Pan Date: Tue, 4 Feb 2020 17:25:04 +0800 Message-ID: Subject: Re: [PATCH] iommu/intel-iommu: set as DUMMY_DEVICE_DOMAIN_INFO if no IOMMU To: Lu Baolu Cc: David Woodhouse , Joerg Roedel , iommu@lists.linux-foundation.org, Linux Kernel , Linux Upstreaming Team Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lu Baolu =E6=96=BC 2020=E5=B9=B42=E6=9C=884=E6= =97=A5 =E9=80=B1=E4=BA=8C =E4=B8=8B=E5=8D=882:11=E5=AF=AB=E9=81=93=EF=BC=9A > > Hi, > > On 2020/2/3 17:10, Jian-Hong Pan wrote: > > If the device has no IOMMU, it still invokes iommu_need_mapping during > > intel_alloc_coherent. However, iommu_need_mapping can only check the > > device is DUMMY_DEVICE_DOMAIN_INFO or not. This patch marks the device > > is a DUMMY_DEVICE_DOMAIN_INFO if the device has no IOMMU. > > > > Signed-off-by: Jian-Hong Pan > > --- > > drivers/iommu/intel-iommu.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > > index 35a4a3abedc6..878bc986a015 100644 > > --- a/drivers/iommu/intel-iommu.c > > +++ b/drivers/iommu/intel-iommu.c > > @@ -5612,8 +5612,10 @@ static int intel_iommu_add_device(struct device = *dev) > > int ret; > > > > iommu =3D device_to_iommu(dev, &bus, &devfn); > > - if (!iommu) > > + if (!iommu) { > > + dev->archdata.iommu =3D DUMMY_DEVICE_DOMAIN_INFO; > > Is this a DMA capable device? Do you mean is the device in DMA Remapping table? Dump DMAR from ACPI table. The device is not in the table. So, it does not support DMAR, Intel IOMMU. Or, should device_to_iommu be invoked in iommu_need_mapping to check IOMMU feature again? Best regards, Jian-Hong Pan > I am afraid some real bugs might be > covered up if we marking the device as IOMMU dummy here. > > Best regards, > baolu > > > return -ENODEV; > > + } > > > > iommu_device_link(&iommu->iommu, dev); > > > >