Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14470262pxu; Tue, 5 Jan 2021 02:23:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAKzIxSqBcnEyZ9ram/a1oNUBTSrxgVXaQf3P7qomvGg9lrC8rP8jwMTY/qCIL+Jn4P0A5 X-Received: by 2002:a50:fb85:: with SMTP id e5mr74353809edq.153.1609842224228; Tue, 05 Jan 2021 02:23:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609842224; cv=none; d=google.com; s=arc-20160816; b=Jz2dodEt3ePHpwecNyQozilJzXmniGAp6I6P/HfSNLGu9ocDmTL2Nxr1Mt1ryEtm+y HN1GNMKxNY34hXk7ZltzQ6c3TBLZxViBbOxZeY3NA24b47a3LfdTavwxfxkyzb0GOuoW Rq0TL06wc+ea09pxpuWuyYliZwagxLBqeuNJmYuNDATK+hkzt07Uxi7nlJ385tyOBzwL RakDxi5t7SG2cO70AixjKA13NbNxuuMa/oOV79xS8AfdmYiP8N3svVFGvQZlr3g9DDmF 4kZy6WtnJY3k5ecgndkb4Y8OFwULkD8wWss4N7w+XqPs0IRJ5cNqkav5aA+P0pH2BvnI 5RgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EVz+m6gjXCXiRGpAA6hb4FVi0ebUcWmcTwsx9IcT4xo=; b=jS15MMlsuqAmp3D3XwW7swOlZKf2IGXcBUGIeExQeAzcpdlFuLNRbFVdVzhhfRwTJA b5GYv1eGD/Z7eTlDGksHNoLR08HWwj98xBLT7LmpshY4j9MRcYFRF2aPYCU9ViImKkPN LF///EVFs0BC8sVwQy4Dy6J4gJhQ3Qgb5m22tg0/kpMwX1IUi3IO4pQGITW+YseRanYK gmArU3n8KbdfcSC7dAl4Bd2BreF1wMy5FjNjbJInsFrCYJXtQIZmH7uPsAOw0VUSDa54 2mSPNIsi3LoC7uLwicZwN8vNmsfrFd6ru6ck7k+PNSTlLhm0EAFmMJc9HGQ029XT9rsy iA4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=JnGPYAnl; 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=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g25si32720539edr.220.2021.01.05.02.23.21; Tue, 05 Jan 2021 02:23:44 -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=@alien8.de header.s=dkim header.b=JnGPYAnl; 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=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728883AbhAEKVm (ORCPT + 99 others); Tue, 5 Jan 2021 05:21:42 -0500 Received: from mail.skyhub.de ([5.9.137.197]:45106 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728373AbhAEKVm (ORCPT ); Tue, 5 Jan 2021 05:21:42 -0500 Received: from zn.tnic (p200300ec2f103700ba0c0ccd6fae6c32.dip0.t-ipconnect.de [IPv6:2003:ec:2f10:3700:ba0c:ccd:6fae:6c32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 31C911EC0324; Tue, 5 Jan 2021 11:21:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1609842060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=EVz+m6gjXCXiRGpAA6hb4FVi0ebUcWmcTwsx9IcT4xo=; b=JnGPYAnlDzMEVLWBbPU/lENeQXdyjPwSRwR7qYaKT5NT7lGBIhzD+Bi3NqtG1hbfAnLi40 cDXVyyU9CJzFP8acQfjIWZmwEsIy3R6NhThLIg4H3556Vqimi+caLoF2c+WoEhdqth6vYg UtT01IKy62Nj3CCrnB65BhL6xV4yls0= Date: Tue, 5 Jan 2021 11:20:56 +0100 From: Borislav Petkov To: David Woodhouse Cc: iommu@lists.linux-foundation.org, Joerg Roedel , Will Deacon , Greg Kroah-Hartman , "Rafael J. Wysocki" , lkml , Thomas Gleixner , Suravee Suthikulpanit Subject: Re: [PATCH] iommu/amd: Set iommu->int_enabled consistently when interrupts are set up Message-ID: <20210105102056.GA28649@zn.tnic> References: <20210104132250.GE32151@zn.tnic> <20210104232353.GJ32151@zn.tnic> <50cd5f55be8ead0937ac315cd2f5b89364f6a9a5.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <50cd5f55be8ead0937ac315cd2f5b89364f6a9a5.camel@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 05, 2021 at 01:32:51AM +0000, David Woodhouse wrote: > From: David Woodhouse > > When I made the INTCAPXT support stop gratuitously pretending to be MSI, > I missed the fact that iommu_setup_msi() also sets the ->int_enabled > flag. I missed this in the iommu_setup_intcapxt() code path, which means > that a resume from suspend will try to allocate the IRQ domains again, > accidentally re-enabling interrupts as it does, resulting in much sadness. > > Lift out the bit which sets iommu->int_enabled into the iommu_init_irq() > function which is also where it gets checked. > > Link: https://lore.kernel.org/r/20210104132250.GE32151@zn.tnic/ > Fixes: d1adcfbb520c ("iommu/amd: Fix IOMMU interrupt generation in X2APIC mode") > Reported-by: Borislav Petkov > Signed-off-by: David Woodhouse > --- > There's a possibility we also need to ensure that the actual > MMIO_INTCAPXT_xxx_OFFSET registers are restored too. Unless you > actually trigger something to generate faults, you'll never know. > I don't see offhand how that was working in the pretend-to-be-MSI case > either. > > drivers/iommu/amd/init.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c > index f54cd79b43e4..6a1f7048dacc 100644 > --- a/drivers/iommu/amd/init.c > +++ b/drivers/iommu/amd/init.c > @@ -1973,8 +1973,6 @@ static int iommu_setup_msi(struct amd_iommu *iommu) > return r; > } > > - iommu->int_enabled = true; > - > return 0; > } > > @@ -2169,6 +2167,7 @@ static int iommu_init_irq(struct amd_iommu *iommu) > if (ret) > return ret; > > + iommu->int_enabled = true; > enable_faults: > iommu_feature_enable(iommu, CONTROL_EVT_INT_EN); > > -- Tested-by: Borislav Petkov Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette