From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58EEAC432C1 for ; Wed, 25 Sep 2019 06:50:29 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27832217F4 for ; Wed, 25 Sep 2019 06:50:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27832217F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D09FAB6C; Wed, 25 Sep 2019 06:50:28 +0000 (UTC) Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 21296B3E for ; Wed, 25 Sep 2019 06:50:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9E0038A for ; Wed, 25 Sep 2019 06:50:19 +0000 (UTC) Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F24F4C058CA4 for ; Wed, 25 Sep 2019 06:50:18 +0000 (UTC) Received: by mail-pg1-f199.google.com with SMTP id h36so2991883pgb.3 for ; Tue, 24 Sep 2019 23:50:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qR/cKb1LH4Ut6XBt6GUfg+wU8+q9TeAgUhlA6c+rO4c=; b=ksPAll9tXi+v7iUMSM6dzb3zR/3f0f5zjeeimhgPAog2I2fjDZX9983IRDjaQFDcAp G9LovxSwqom9KUbsXa6K+AhfU0yBsqiWyOQ+CJ/rst7mfvmoWo+xuDt9mMHUsYgoen+k cM4lakTFF/9o/09vEsy17uOriAwePoRsTS+lwN7YRFJh0ypYuOMnSxgkQRom8S580YsC j0B75LSz9A4AAaxPlylJwf6daKq3Yra3bvvXZ0z2qcmBuknWrNrY6ZFsmSiXQ5/WLeND NEdYnw/8uvM3joV0FpZNM7WMxOxEfaRFOudkSq82u1Y6LGbeWuyCoxfIWgnKJstFFAf9 E7bg== X-Gm-Message-State: APjAAAXe9C+w+hZ4fIi7jrGVBHeikzoe10YuWsrihWakvylz22mgZjKz KZGNXpg/xE/i9TJnCOom73kUVnnGj13shN7lrKwJptkRn8sqHBqgYJjZxkaj1D7aPweq+mxbkvO bUhwsVEzrlaXKr1s8/6+vTWEDrbKcFw== X-Received: by 2002:a17:90a:32c8:: with SMTP id l66mr4786659pjb.44.1569394218437; Tue, 24 Sep 2019 23:50:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqypWllblpMbhsSgwCAwLu+m/4ke343KRyPgiqd/aaN/IjsSQuc6mo4RWHK4cbHfclvFvQlQKQ== X-Received: by 2002:a17:90a:32c8:: with SMTP id l66mr4786640pjb.44.1569394218177; Tue, 24 Sep 2019 23:50:18 -0700 (PDT) Received: from xz-x1 ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id u1sm3296193pgi.28.2019.09.24.23.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2019 23:50:17 -0700 (PDT) Date: Wed, 25 Sep 2019 14:50:06 +0800 From: Peter Xu To: Lu Baolu Subject: Re: [RFC PATCH 4/4] iommu/vt-d: Identify domains using first level page table Message-ID: <20190925065006.GN28074@xz-x1> References: <20190923122454.9888-1-baolu.lu@linux.intel.com> <20190923122454.9888-5-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190923122454.9888-5-baolu.lu@linux.intel.com> User-Agent: Mutt/1.11.4 (2019-03-13) Cc: kevin.tian@intel.com, Yi Sun , ashok.raj@intel.com, kvm@vger.kernel.org, sanjay.k.kumar@intel.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Alex Williamson , David Woodhouse , yi.y.sun@intel.com X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: iommu-bounces@lists.linux-foundation.org Errors-To: iommu-bounces@lists.linux-foundation.org On Mon, Sep 23, 2019 at 08:24:54PM +0800, Lu Baolu wrote: > +/* > + * Check and return whether first level is used by default for > + * DMA translation. > + */ > +static bool first_level_by_default(void) > +{ > + struct dmar_drhd_unit *drhd; > + struct intel_iommu *iommu; > + > + rcu_read_lock(); > + for_each_active_iommu(iommu, drhd) > + if (!sm_supported(iommu) || > + !ecap_flts(iommu->ecap) || > + !cap_caching_mode(iommu->cap)) > + return false; > + rcu_read_unlock(); > + > + return true; > +} "If no caching mode, then we will not use 1st level." Hmm, does the vIOMMU needs to support caching-mode if with the solution you proposed here? Caching mode is only necessary for shadowing AFAICT, and after all you're going to use full-nested, then... then I would think it's not needed. And if so, with this patch 1st level will be disabled. Sounds like a paradox... I'm thinking what would be the big picture for this to work now: For the vIOMMU, instead of exposing the caching-mode, I'm thinking maybe we should expose it with ecap.FLTS=1 while we can keep ecap.SLTS=0 then it's natural that we can only use 1st level translation in the guest for all the domains (and I assume such an ecap value should never happen on real hardware, am I right?). Regards, -- Peter Xu _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu