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=-15.7 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 3945BC47080 for ; Tue, 1 Jun 2021 14:31:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 BBB4A61209 for ; Tue, 1 Jun 2021 14:31:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBB4A61209 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lo5Q4-0000i8-IU for qemu-devel@archiver.kernel.org; Tue, 01 Jun 2021 10:31:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lo5MQ-0006ks-5N for qemu-devel@nongnu.org; Tue, 01 Jun 2021 10:27:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55106) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lo5MM-0005NU-Sd for qemu-devel@nongnu.org; Tue, 01 Jun 2021 10:27:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622557629; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZaAALR0wjWVsqeBS1ax65feR/aplvchtE8t/zU+Jb7Y=; b=MHQ3yDKArRBczdpzkjAtV9HM0qiT2myuknx0khD+opaFPOAEG67M4J2OpQqQOLAlfBIS7v vH9qeEGlVUlpY6z/d7gDEYtyUcEUD58Sb/SS9IRJQ5r3v2FimF0FhRWqJkA5syR3oMSP9q 3/yax1C+E2NL7cxe8aElvsJGexVon7M= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-E9KxqRvjPHebARAo7y9ffw-1; Tue, 01 Jun 2021 10:27:05 -0400 X-MC-Unique: E9KxqRvjPHebARAo7y9ffw-1 Received: by mail-ej1-f70.google.com with SMTP id z6-20020a17090665c6b02903700252d1ccso3393298ejn.10 for ; Tue, 01 Jun 2021 07:27:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZaAALR0wjWVsqeBS1ax65feR/aplvchtE8t/zU+Jb7Y=; b=M459KV5Nx/DdDkKjgGtUK/22CMiWO8kF3cpbcM+MtQ2DERRSipEX24A9LMxf1OCNgo BGHjexx+cqBfXmGZccbxpDX5w/VZqkhrCgJYrGbGoMD68VnZaW+lkTU9rvlGdIq9AFy2 nZFzXBS1wfXw6pYE2y9Azy2yU4R2rIMWbxfzzz7KMWXbWEVmlOSCwnOddpnec+D5Z91U hQJP3dTgwczekdRSIVK/rfgisJtrBu9WlBBKS3Yzvio0Io5IG9+oCAQQ1KrSAC5sFtOa PEPhNhjI5J1Ep/LWkdRjDSyJJCe8zMUfj4lOJbyT8tBtGkrsYiqczMUi6p1VKnujJPY/ dSew== X-Gm-Message-State: AOAM531DB7MhFWqBMVwHB658NrKC2oAVFbjwA+IMl6zNF2Pj0Nuv7ASf 779+S4qgxfkTpgZltUNz1Qh4Z5Sr6jrIux+oVm37O/hvtHBlVZW0WkG8uir/7Q5rN7wP6ysxU6I 47FXmNMww4crf3aw= X-Received: by 2002:a17:906:2d51:: with SMTP id e17mr7458011eji.500.1622557624575; Tue, 01 Jun 2021 07:27:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR4IvHyKtBiTNxHaBw1zGiDGi49GbfNfOvQaUrcZTwzcOssQfScOegVhcOTCmHwq5PBg4RDA== X-Received: by 2002:a17:906:2d51:: with SMTP id e17mr7457985eji.500.1622557624379; Tue, 01 Jun 2021 07:27:04 -0700 (PDT) Received: from [192.168.1.36] (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id h23sm3340841eds.73.2021.06.01.07.27.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Jun 2021 07:27:04 -0700 (PDT) Subject: Re: [PATCH 1/1] amd_iommu: fix device entry invalidation To: Roman Kapl References: <20210601141039.16104-1-rka@sysgo.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: Date: Tue, 1 Jun 2021 16:27:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210601141039.16104-1-rka@sysgo.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.613, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 6/1/21 4:10 PM, Roman Kapl wrote: > Since QEMU maintains TLB entries keyed by the device ID, there is no separate > device entry cache. This means we need to invalidate all translations keyed by > the device ID. > Fixes: d29a09ca684 ("hw/i386: Introduce AMD IOMMU") ? > Signed-off-by: Roman Kapl > --- > hw/i386/amd_iommu.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c > index 2801dff97c..62d22b220b 100644 > --- a/hw/i386/amd_iommu.c > +++ b/hw/i386/amd_iommu.c > @@ -356,6 +356,7 @@ static void amdvi_update_iotlb(AMDVIState *s, uint16_t devid, > } > > entry->domid = domid; > + entry->devid = devid; > entry->perms = to_cache.perm; > entry->translated_addr = to_cache.translated_addr; > entry->page_mask = to_cache.addr_mask; > @@ -399,6 +400,8 @@ static void amdvi_inval_devtab_entry(AMDVIState *s, uint64_t *cmd) > amdvi_log_illegalcom_error(s, extract64(cmd[0], 60, 4), > s->cmdbuf + s->cmdbuf_head); > } > + g_hash_table_foreach_remove(s->iotlb, amdvi_iotlb_remove_by_devid, > + &devid); > trace_amdvi_devtab_inval(PCI_BUS_NUM(devid), PCI_SLOT(devid), > PCI_FUNC(devid)); > } >