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=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 BB908C43461 for ; Sun, 13 Sep 2020 12:42:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77C8D2158C for ; Sun, 13 Sep 2020 12:42:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="huPHGHga" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725945AbgIMMmX (ORCPT ); Sun, 13 Sep 2020 08:42:23 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:43073 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725919AbgIMMmV (ORCPT ); Sun, 13 Sep 2020 08:42:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600000939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=A6XG2fJLHeDjdaV/7MOzK55rA0FpDa4k55hAmmbHojo=; b=huPHGHgaX6Jc4pr5RQ2kvepPjTecZpoauD14blPF49+bAjEJqZ9ro+uKeKIf2SAdZqjWop k0K/NRBymUf01+ZLAHCiPks9H3nfQQlMnUdg6uRB9MW2cqwBydwBOO5ns8qU5sUAamKdMF wl8XhgAoKqabx9K/7L1jRwo+LpwjVxs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-dsjiyH1PPLOpul9vJsB81w-1; Sun, 13 Sep 2020 08:42:15 -0400 X-MC-Unique: dsjiyH1PPLOpul9vJsB81w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87C59185A0FC; Sun, 13 Sep 2020 12:42:14 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90DF827BC0; Sun, 13 Sep 2020 12:42:12 +0000 (UTC) From: Maxim Levitsky To: linux-kernel@vger.kernel.org Cc: Suravee Suthikulpanit , iommu@lists.linux-foundation.org (open list:AMD IOMMU (AMD-VI)), Joao Martins , Joerg Roedel , Maxim Levitsky Subject: [PATCH] iommu/amd: fix interrupt remapping for avic Date: Sun, 13 Sep 2020 15:42:11 +0300 Message-Id: <20200913124211.6419-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit e52d58d54a32 ("iommu/amd: Use cmpxchg_double() when updating 128-bit IRTE") accidentally removed an assumption that modify_irte_ga always set the valid bit and amd_iommu_activate_guest_mode relied on that. Side effect of this is that on my machine, VFIO based VMs with AVIC enabled would eventually crash and show IOMMU errors like that: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0055 address=0xfffffffdf8000000 flags=0x0008] Fixes: e52d58d54a321 ("iommu/amd: Use cmpxchg_double() when updating 128-bit IRTE") Signed-off-by: Maxim Levitsky --- drivers/iommu/amd/iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 07ae8b93887e5..aff4cc1869356 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -3853,6 +3853,7 @@ int amd_iommu_activate_guest_mode(void *data) entry->hi.fields.ga_root_ptr = ir_data->ga_root_ptr; entry->hi.fields.vector = ir_data->ga_vector; entry->lo.fields_vapic.ga_tag = ir_data->ga_tag; + entry->lo.fields_remap.valid = 1; return modify_irte_ga(ir_data->irq_2_irte.devid, ir_data->irq_2_irte.index, entry, ir_data); -- 2.26.2