Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1049617iob; Fri, 13 May 2022 21:05:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCWtze1nG4hHyZnK4jdHbsx0PoQQIn/3gonReIEPXK17D/CbbSCDSzeC3Lp4UBAY2ANI3/ X-Received: by 2002:adf:d213:0:b0:20a:d703:154f with SMTP id j19-20020adfd213000000b0020ad703154fmr6532588wrh.604.1652501148830; Fri, 13 May 2022 21:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652501148; cv=none; d=google.com; s=arc-20160816; b=ZCiuggKWpE6PrWPs8qxi42xf/9xLrEzkaVcJyUx9sU8ISZA+Rd5Az++ZtcH+ZQtpqa H95gpaQwHg4iYdcuPN3fpgfan/+MjMchCqbbaZjrF3YtISGN5EBpVXEOeTdbLZfDjjI0 tk2a9nyLJLnnae+JmB9H3AsBPHwuzdMTZwcDUeCvkK5AE0xuNd8+7Gq3jOg+m7q4b5FL EpYMk2mutX8ihKkaAUNH12/f8aD9OSgsyyqlk6O7ScrivWoZKtbEPbNiooo7ZqUeqf9M KZ1ab6pWWFl5SJTqjC7glvfAhG+MNfzGuC9nANYazKIghRH0VK5WX3mO/To8Y5TcT52M IoIg== 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; bh=fS+xyJO7UDDoaVImcgqPf/r6PdUS9KTi4gRtQiCrS8Q=; b=NxVsbjxQZ0SSh+6MvXAJ5ot5fwuFdzJ6sOacHcO36i1lMyxhx7GYuu0nrEjzv5G4Ok eOJEV/TIaEbsYqraJqfnaBa/S6YYSvkmLm8MiPF/WNM3przMVmA1YYCeM5CMc/QDlCM4 HY4Y5TlO2GugWv/l3APiOeeDAWybRBnywYzP5FbP7jkZ+zoWttxUldQSeBJrT7/S7WBL Ej+3DFIalvnWZxkJYMRet7R93z7R79JCJJkATcd9uIiQtqMlkN32+90dmr1S+xtkvp0P 52ES+dE1adHNTjPZ8yuaWZ0nJ0uVMqUY98tvowZpENPzSAkW630RPhrwd40XoxL+u6np SqGg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e1-20020a5d6d01000000b00206cc1a0200si3509393wrq.533.2022.05.13.21.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 21:05:48 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4F5F633EA5C; Fri, 13 May 2022 17:37:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380550AbiEMNHv (ORCPT + 99 others); Fri, 13 May 2022 09:07:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354913AbiEMNHt (ORCPT ); Fri, 13 May 2022 09:07:49 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A621B795 for ; Fri, 13 May 2022 06:07:48 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id E597D4D2; Fri, 13 May 2022 15:07:46 +0200 (CEST) Date: Fri, 13 May 2022 15:07:45 +0200 From: Joerg Roedel To: Suravee Suthikulpanit Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, vasant.hegde@amd.com, jon.grimm@amd.com Subject: Re: [PATCH v2] iommu/amd: Set translation valid bit only when IO page tables are in used Message-ID: References: <20220509074815.11881-1-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220509074815.11881-1-suravee.suthikulpanit@amd.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 09, 2022 at 02:48:15AM -0500, Suravee Suthikulpanit wrote: > On AMD system with SNP enabled, IOMMU hardware checks the host translation > valid (TV) and guest translation valid (GV) bits in the device > table entry (DTE) before accessing the corresponded page tables. > > However, current IOMMU driver sets the TV bit for all devices > regardless of whether the host page table is in used. > This results in ILLEGAL_DEV_TABLE_ENTRY event for devices, which > do not the host page table root pointer set up. Hmm, this sound weird. In the early AMD IOMMUs it was recommended to set TV=1 and V=1 and the rest to 0 to block all DMA from a device. I wonder how this triggers ILLEGAL_DEV_TABLE_ENTRY errors now. It is (was?) legal to set V=1 TV=1, mode=0 and leave the page-table empty. When then IW=0 and IR=0, DMA is blocked. From what I remember this is a valid setting in a DTE. Do you have an example DTE which triggers this error message? Regards, Joerg