Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp316977ybg; Mon, 1 Jun 2020 02:04:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCuk9uMOEA+a4dH9YjRVxO/heh5D9BiR4BSy5DJ6G05HJh5CjF7F24O2CUdDSTsCAU/jGW X-Received: by 2002:a17:907:4096:: with SMTP id nm6mr4595812ejb.4.1591002276554; Mon, 01 Jun 2020 02:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591002276; cv=none; d=google.com; s=arc-20160816; b=ZHKW5u5WAorfIbGB4NQ6v6kLJ/GVTAl2JUFUIAhUVW+IOzgFvliflyB5Doiy4coDUp wMnuume3tn7f+yopM26daDNZM3WoeMOqlauWO8OWwsCjFTc1UzV3uUoxNlPJCuIwWVqy qh5HhtPMwGIKQxggBCKdlKsNZbFVVUzk2b7+hU0ABRQsSWaJ7kxWS8cZeDrTsFjoE49E bN3fvJuuDJGqB3lfE4gQsKvIraKgS+qR2MIrhKRDmDGHERSTG1EykOm1EeR9HxH6OJhw IMbql8gf31VK2DM6MU9f7jUTAaiYWXgmewJUX0xLeGZl4vcAY1jF1pdGWHjOZTI3fFhf +HBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=7AHyHy71PRCPWnWWZDlygaNumW5TiHukNpBzFPglV6c=; b=qkuQWSB2/tiGCR+KTYv+KPIiCf4Nc/nalDxCJPdglPeHPEaIgL+UGzi8vPdHXg9l28 Z/UArakCn+EXloVZALnM/cSRli5tM3yo+mjg/9XN+Ikl5UuDBaY6WnK3yv9NgCBUczUz YIGP/onXkS+EGgrL5YNyLmHVIpAOt1o74UbroGlm1WRANoynIc7amG91HimLr+Ekg91f WS4IcznQWrSymy4vpnMS7o34wHfB1aRu+vD0neXi2RZC7jKxYt2Prcl9LGjUfvbulIBh oSriInAIZlKwa08CFHXQFvyAsqgsnXrT98ASll7Kjm8bD/YwCuiY2A2t0JizLgWFkMqI JEPA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t4si8752204eds.217.2020.06.01.02.04.13; Mon, 01 Jun 2020 02:04:36 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725886AbgFAJBy (ORCPT + 99 others); Mon, 1 Jun 2020 05:01:54 -0400 Received: from winnie.ispras.ru ([83.149.199.91]:32370 "EHLO smtp.ispras.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725290AbgFAJBy (ORCPT ); Mon, 1 Jun 2020 05:01:54 -0400 Received: from monopod.intra.ispras.ru (monopod.intra.ispras.ru [10.10.3.121]) by smtp.ispras.ru (Postfix) with ESMTP id D9D7C203BF; Mon, 1 Jun 2020 12:01:48 +0300 (MSK) Date: Mon, 1 Jun 2020 12:01:48 +0300 (MSK) From: Alexander Monakov To: Suravee Suthikulpanit cc: linux-kernel@vger.kernel.org, Joerg Roedel , iommu@lists.linux-foundation.org Subject: Re: [PATCH] iommu/amd: Fix event counter availability check In-Reply-To: <56761139-f794-39b1-4dfa-dfc05fbe5f60@amd.com> Message-ID: References: <20200529200738.1923-1-amonakov@ispras.ru> <56761139-f794-39b1-4dfa-dfc05fbe5f60@amd.com> User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Jun 2020, Suravee Suthikulpanit wrote: > > Moving init_iommu_perf_ctr just after iommu_flush_all_caches resolves > > the issue. This is the earliest point in amd_iommu_init_pci where the > > call succeeds on my laptop. > > According to your description, it should just need to be anywhere after the > pci_enable_device() is called for the IOMMU device, isn't it? So, on your > system, what if we just move the init_iommu_perf_ctr() here: No, this doesn't work, as I already said in the paragraph you are responding to. See my last sentence in the quoted part. So the implication is init_device_table_dma together with subsequent cache flush is also setting up something that is necessary for counters to be writable. Alexander