Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp106183rwd; Wed, 7 Jun 2023 20:24:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4eiTZ5pFoBK4J+N0PpP4oAEIey+dpkqLuvakzl6YQ3DNkSiv5PwRp4coeiSmte0//fzJgD X-Received: by 2002:a05:6870:31d0:b0:187:e563:77b9 with SMTP id x16-20020a05687031d000b00187e56377b9mr6338546oac.45.1686194693284; Wed, 07 Jun 2023 20:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686194693; cv=none; d=google.com; s=arc-20160816; b=m3y933C8lKw7TdFlsP1WcPsRnYQs0/T7i3otQP+HDotvf+F3WCeKfEJ7NfClIOeetB CwD8vYpZLOUYJeFRpflvC1Ro/oxn1frM6FnQ/Z+1I737IellH64uRKGAccqALyyh8oPm xx6VuhEDE+IMGYaeiydpX7IFSR8J0pmIdwk3FxpfCewSVzz5kuHeg7/yzN/6Z59o3Rsl 7xgq3Cc2AeHb50WJCGE8EUwZQWPDBRyRCljJKx4VAeOQfX3hGNpyg+eow1TL20uFB0+h vSRxY2j76VOVE+xXkXhsDFfI98pEhta15rah2Na23ODqsRoYfY2j15p1+JsNel6qZPPg Dxpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=PgkpwUSNlIJk+LkvnHYPFinYIhbzgGjdaUbM4bkLZSk=; b=UZ5LzCKIuug79S3DU3q5j88yTzy2NViPkSkt4jyHnGTNEpDhCWLXVppDgQX4frBbuj QNxxTeCTGvRAGWfM1Y4QScyP+GArJ0inRbsSjbpsD9QlTnHFfxZdAilhSL8Ontc8LIbu C7AhnIF5w4uJ4OnR1ErZz1gGMN7yWQD80coYPhDgJN9ha+67bz9o2abjMBK6kJgs4kKL qhKq2Xog0Kpo/zCrHVC4UBABRTWVfiwbDw+/xa/7lkdtqQZB4cat7BYoibU8JxFQNws4 yQcS6080koJNV46QCZoLUxpUTs0j6UtWl5yqVNEr3RyTVAEtDhsLVaXJUzDQQepMSXZ2 77+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=N+O0Sdhv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e128-20020a636986000000b00543d2b889e0si286303pgc.469.2023.06.07.20.24.39; Wed, 07 Jun 2023 20:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=N+O0Sdhv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233942AbjFHDFP (ORCPT + 99 others); Wed, 7 Jun 2023 23:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233248AbjFHDFJ (ORCPT ); Wed, 7 Jun 2023 23:05:09 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C74B2115; Wed, 7 Jun 2023 20:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686193508; x=1717729508; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=qbYHxqwb+lRQXv1Qno1Zzxd311Ixqqs8VMrd2MxUXcY=; b=N+O0SdhvQawpz3gDU2kR/zIMIxc/kwnsJLKqhXuAbIDKiGJW5OQl/8Cs /hzh1OA7HU3uxrmsC2c8XeiyRQ/pyBHYikPlb3w3G1qhCu9a9KYn9lhg0 ajeo+DTOnxy8ZSgCpzWA89e/5KpTlqYTCaLh0RsjtGdtiOtENFNm7OzCO 8uK+0X2IPX651zdfi5KKgbtt9a1pOqX/MYzyTjPCwB5tjmtNgQWaCDMxM YG+WFFJ23CSlVMo61YamXVqcS/m95H1iVVQynxu0ADgMMoZqscbW3kHac vJwzsI4mwXseEHz1FVnAkR24+2sKkIWC697jgduUEtsol3YMPKhIrYu9i g==; X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="341840949" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="341840949" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 20:05:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="703909451" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="703909451" Received: from allen-box.sh.intel.com (HELO [10.239.159.127]) ([10.239.159.127]) by orsmga007.jf.intel.com with ESMTP; 07 Jun 2023 20:05:06 -0700 Message-ID: Date: Thu, 8 Jun 2023 11:03:59 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cc: baolu.lu@linux.intel.com Subject: Re: Question about reserved_regions w/ Intel IOMMU Content-Language: en-US To: Alexander Duyck , LKML , linux-pci , iommu@lists.linux.dev References: From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 6/8/23 7:03 AM, Alexander Duyck wrote: > On Wed, Jun 7, 2023 at 3:40 PM Alexander Duyck > wrote: >> >> I am running into a DMA issue that appears to be a conflict between >> ACS and IOMMU. As per the documentation I can find, the IOMMU is >> supposed to create reserved regions for MSI and the memory window >> behind the root port. However looking at reserved_regions I am not >> seeing that. I only see the reservation for the MSI. >> >> So for example with an enabled NIC and iommu enabled w/o passthru I am seeing: >> # cat /sys/bus/pci/devices/0000\:83\:00.0/iommu_group/reserved_regions >> 0x00000000fee00000 0x00000000feefffff msi >> >> Shouldn't there also be a memory window for the region behind the root >> port to prevent any possible peer-to-peer access? > > Since the iommu portion of the email bounced I figured I would fix > that and provide some additional info. > > I added some instrumentation to the kernel to dump the resources found > in iova_reserve_pci_windows. From what I can tell it is finding the > correct resources for the Memory and Prefetchable regions behind the > root port. It seems to be calling reserve_iova which is successfully > allocating an iova to reserve the region. > > However still no luck on why it isn't showing up in reserved_regions. Perhaps I can ask the opposite question, why it should show up in reserve_regions? Why does the iommu subsystem block any possible peer- to-peer DMA access? Isn't that a decision of the device driver. The iova_reserve_pci_windows() you've seen is for kernel DMA interfaces which is not related to peer-to-peer accesses. Best regards, baolu