Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3065045pxb; Mon, 9 Nov 2020 01:16:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8xSA1FAihUIIZM5rPKKX1WSpGUwfJfTaTPW9PSohAaTOiK6I3Zcbfhvw7TAgCG2a6Oc2V X-Received: by 2002:aa7:c90a:: with SMTP id b10mr13999797edt.266.1604913370059; Mon, 09 Nov 2020 01:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604913370; cv=none; d=google.com; s=arc-20160816; b=X0yCewDBDE64llEPRXHPkqToetVXP2FCxabx5tnKNwTZYz6uxENUPHd94pStqb17Py TcufyEmAfoovcuMfGJwU1t7Bem1kAwYd5qTbdb1DN6wOQG5JPu8TcGMgbdF/Jya5P3FK fIz+sPCGGhxWCHufO8IsnSFtU8HcT9eH+VIKVut2/91cwn0j/PLa1bTn6+bcjYgrwCm9 lbB0pYPUFRwn+FHa0RfRLbz4efA5EKMG8G/lt3Zf7yxg+ePMPAmD1Q3WDx1paM0ZdpCd L40jvsRVNFjWmU+27a9XgGR/qdB3Qnv1hxAOcqCeqVrkwWm76YUC/odgEPVklx6DpGfm ebNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ipacAfJrcUtFbk4kHEgOAkZMChrOufJTZqnjVylo3V4=; b=zrkH/Ln/mj7YhIcmoV0FafMlXsL+jhEC60sM4jEeo8sLWdHB2+Ec9Jxr1n0Eyeeqmr oFLhLUNG900cnx+xw9oGiwx4wI7PYnttgmIMfJk3yA4e+zde8B76kkhJmtcS6VIkbcpv EkSinYPK+JW4+GIflayMvqbsiiNQPYf5NHo8y5QDFsut4IkbSF4F7+G3ZAWLCteJF094 v+y12lY9n42G7awWLI55+ovnv0tGN9EGsh9A90nX3woBUB9bljrw/lorOrJhUoTvO3N5 hmO1fXCYMzblfBnRaCRjjFZLv8HlBthNenkGZ6R544990L5vKtYCOWJkQb3qqqs6I/eS 3exw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cfs1nbvS; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a42si9374634edf.535.2020.11.09.01.15.47; Mon, 09 Nov 2020 01:16:10 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=cfs1nbvS; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729857AbgKIJMW (ORCPT + 99 others); Mon, 9 Nov 2020 04:12:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726482AbgKIJMV (ORCPT ); Mon, 9 Nov 2020 04:12:21 -0500 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D545C0613CF for ; Mon, 9 Nov 2020 01:12:21 -0800 (PST) Received: by mail-lj1-x244.google.com with SMTP id l10so9370233lji.4 for ; Mon, 09 Nov 2020 01:12:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ipacAfJrcUtFbk4kHEgOAkZMChrOufJTZqnjVylo3V4=; b=cfs1nbvSNaF0RgE6Xx5r9EKZ2Lpfy3eyp9kFQWTdkWi1XH1N5o0cjNLHHnXeF1HNL6 B8CYQoZMucWCx5Rn7WQs8tcIecSHKUjRK+ZtqaCZHmpOnpCrr92wFIMAQdf4w+ovB3px dS0edwMrhuxRTG9uTnthhmr/AUdE5xMF4uk5uve0JxaBt7QpQvQ2TZEcVXa7wr5et9Pv uLIq0+6sNwp/qjE1TskxJLuOHtuGmrlftKifZi3wU0X3CjKrHRXOSlo017jQZe179qJ7 6TQO/23kXEorFpfzmpr0PLNiJWfaaapQbDer0kvmsCsrUm+b4ik89oAGwEB3pr632R7C zZtQ== 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; bh=ipacAfJrcUtFbk4kHEgOAkZMChrOufJTZqnjVylo3V4=; b=DedTK6VaSjbSDJR2mphXZB9pbRY+Z7PDP5oF1eBPcsr/xvwgeq4uXpVs6jn6x7/9H3 g92eocrno/G3X3qEMoHmIPYYzvwh+vgpyl5RZoMB7RYeYsC3PCX+pL/G90Qvu7mm2iiD j8CJFtkvUWqWhwVZaWZ7y+fet7mQrQIq0w5k/vzEzcd+oOcarGg6FMBgecFrn6L6te0I +A3K1yrpOw9F+0FzW+cGe60Jrg8fdLeT+VjvZsVoPZ0JhSM6H6aqnXW3wUJidgMsQpeD FFugrj2QpLydpY2GUszy12yk9nRI8q2WL2AVC04NrHa6O+rWijFUOiaSGjaV4TVmreqn ECUQ== X-Gm-Message-State: AOAM533GOcToU3HZKc0doyKVJTIhi6ho97I6NDM/U0yzXCn7N16PoSA6 SkSbdw17zvjAs//UlEXDgbet1mO+8WEx06yzx04= X-Received: by 2002:a2e:95cf:: with SMTP id y15mr5247385ljh.209.1604913139942; Mon, 09 Nov 2020 01:12:19 -0800 (PST) MIME-Version: 1.0 References: <20201104081438.2075-1-zhenzhong.duan@gmail.com> <9e5e5f48-e91d-adce-cbf5-b98fee3b56a6@linux.intel.com> In-Reply-To: <9e5e5f48-e91d-adce-cbf5-b98fee3b56a6@linux.intel.com> From: Zhenzhong Duan Date: Mon, 9 Nov 2020 17:12:00 +0800 Message-ID: Subject: Re: [PATCH] iommu/vt-d: avoid unnecessory panic if iommu init fail in tboot To: Lu Baolu Cc: linux-kernel , ning.sun@intel.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, jroedel@suse.de, tboot-devel@lists.sourceforge.net, David Woodhouse , iommu@lists.linux-foundation.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Baolu, On Mon, Nov 9, 2020 at 11:15 AM Lu Baolu wrote: > > Hi Zhenzhong, > > On 11/9/20 10:27 AM, Zhenzhong Duan wrote: > > +intel iommu maintainers, > > > > Can anyone help review this patch? Thanks > > > > Zhenzhong > > > > On Wed, Nov 4, 2020 at 4:15 PM Zhenzhong Duan wrote: > >> > >> "intel_iommu=off" command line is used to disable iommu and iommu is force > >> enabled in a tboot system. Meanwhile "intel_iommu=tboot_noforce,off" > >> could be used to force disable iommu in tboot for better performance. > >> > >> By default kernel should panic if iommu init fail in tboot for security > >> reason, but it's unnecessory if we use "intel_iommu=tboot_noforce,off". > >> > >> Fix it by return 0 in tboot_force_iommu() so that force_on is not set. > >> > >> Fixes: 7304e8f28bb2 ("iommu/vt-d: Correctly disable Intel IOMMU force on") > >> Signed-off-by: Zhenzhong Duan > >> --- > >> arch/x86/kernel/tboot.c | 5 +---- > >> 1 file changed, 1 insertion(+), 4 deletions(-) > >> > >> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c > >> index 992fb1415c0f..9fd4d162b331 100644 > >> --- a/arch/x86/kernel/tboot.c > >> +++ b/arch/x86/kernel/tboot.c > >> @@ -511,12 +511,9 @@ struct acpi_table_header *tboot_get_dmar_table(struct acpi_table_header *dmar_tb > >> > >> int tboot_force_iommu(void) > >> { > >> - if (!tboot_enabled()) > >> + if (!tboot_enabled() || intel_iommu_tboot_noforce) > >> return 0; > >> > >> - if (intel_iommu_tboot_noforce) > >> - return 1; > > This was obviously wrong. It should return false, right? I guess you missed above change: "if (!tboot_enabled() || intel_iommu_tboot_noforce)". It does return false. > > It looks odd that intel_iommu_tboot_noforce is defined in Intel iommu > implementation, but is used here. How about moving it back to the iommu > driver? That's better, will do. Thanks for your suggestion. Zhenzhong