From nobody Sat Nov 30 04:26:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1616062464; cv=none; d=zohomail.com; s=zohoarc; b=DZe7oLR4WWsyZBLHzWR5WumC0N63BCCAhWFGMcxQ4wx0D4jmfDrAAMmIPNoTXZbgur4mFU4RR19dp7t9dYg2U7uWv1AniPxMXNW+W5wQTTca4eOzWGLKSZo/H3Oomuvrj4cueV/NVaqcYUzbYONkYIGiE7XDQ1Cdk8j8VPL22uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616062464; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jqnxm854ZkzHnoc/cGVME3wbWF5nHrJSeLOnsd7AR3U=; b=TZBtCx+6voCspQXzq1jr6J754wB6KWnEk8pVg651y6OPq87UHoGnr7vT7Jd+DHRlXHwrfFsTYxcuwtqbMmJLhQ8IfcrTc3mbmhLeykow4+/z3k4JZ+vKgtTHzki1jZDEnVHluJWFdzk6AV8/waKLsggxOV8CFjxRJM+fjAvuSLo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1616062464681964.226881660985; Thu, 18 Mar 2021 03:14:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.98874.187832 (Exim 4.92) (envelope-from ) id 1lMpfE-0007Sw-KT; Thu, 18 Mar 2021 10:14:00 +0000 Received: by outflank-mailman (output) from mailman id 98874.187832; Thu, 18 Mar 2021 10:14:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lMpfE-0007Sp-HA; Thu, 18 Mar 2021 10:14:00 +0000 Received: by outflank-mailman (input) for mailman id 98874; Thu, 18 Mar 2021 10:13:59 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lMpfD-0007Sh-BF for xen-devel@lists.xenproject.org; Thu, 18 Mar 2021 10:13:59 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id eff9bc1d-c2c1-4203-9268-4c90312ff026; Thu, 18 Mar 2021 10:13:58 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B9C21AC1E; Thu, 18 Mar 2021 10:13:57 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: eff9bc1d-c2c1-4203-9268-4c90312ff026 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1616062437; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jqnxm854ZkzHnoc/cGVME3wbWF5nHrJSeLOnsd7AR3U=; b=Hmwoh+M3z8oP9tjzgCwN6Ee6cUFd/1Hxa1TOQ2G5QPHB7x0Zk9NhupoD9q2ORtUjr4WgsS Q5BuVPoi6bdoOY/Wt2Nk5E5YBXZOPKwlzjKpNupRaCcVAh7c01gLTyEJqxOrWo1bU6WjZZ cRsEfLoel7NpPiL+bstBi/6LipUFxoI= Subject: [PATCH 2/4][4.15?] VT-d: leave FECTL write to vtd_resume() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Kevin Tian , Ian Jackson References: Message-ID: <57976bd9-6c50-26c3-1f06-62f1a5546e06@suse.com> Date: Thu, 18 Mar 2021 11:13:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" We shouldn't blindly unmask the interrupt when resuming. vtd_resume() will restore the intended state. Signed-off-by: Jan Beulich --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -2092,7 +2092,7 @@ static int adjust_vtd_irq_affinities(voi } __initcall(adjust_vtd_irq_affinities); =20 -static int __must_check init_vtd_hw(void) +static int __must_check init_vtd_hw(bool resume) { struct acpi_drhd_unit *drhd; struct vtd_iommu *iommu; @@ -2121,6 +2121,10 @@ static int __must_check init_vtd_hw(void disable_qinval(iommu); } =20 + if ( resume ) + /* FECTL write done by vtd_resume(). */ + continue; + spin_lock_irqsave(&iommu->register_lock, flags); sts =3D dmar_readl(iommu->reg, DMAR_FECTL_REG); sts &=3D ~DMA_FECTL_IM; @@ -2320,7 +2324,7 @@ static int __init vtd_setup(void) P(iommu_hap_pt_share, "Shared EPT tables"); #undef P =20 - ret =3D init_vtd_hw(); + ret =3D init_vtd_hw(false); if ( ret ) goto error; =20 @@ -2590,7 +2594,7 @@ static void vtd_resume(void) if ( !iommu_enabled ) return; =20 - if ( init_vtd_hw() !=3D 0 && force_iommu ) + if ( init_vtd_hw(true) !=3D 0 && force_iommu ) panic("IOMMU setup failed, crash Xen for security purpose\n"); =20 for_each_drhd_unit ( drhd )