Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3788287img; Mon, 25 Mar 2019 18:31:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqycWZbhKVnpCOvxOdY3M1/yiO3MFqPvBbMuOEP3mJu+ljRGOPHP5bpAdst5GI7zSIN+oE+H X-Received: by 2002:aa7:83cb:: with SMTP id j11mr26973987pfn.117.1553563870400; Mon, 25 Mar 2019 18:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553563870; cv=none; d=google.com; s=arc-20160816; b=FZQkdt+IQlRGh3aONZaNG28DDOZO8WdRs3KXQTI8yl/U3HYKDu2yepDkhT/VlE4U72 4ARm+3YeLb3UKm6GYxluXUUxHTulB13kDUn14eVVhbGTvOOSda531LowCxyXSD7OxTk+ zHyNKyrEY/n+Vm9YkDnhKvlBk49kbL6kedcaXe71fP76z1BZZHoKMbii57sAbUrol6Dc kh0LMYL8BVFmdejgpMa8A0GEC/PrWva2/V/bID5O0PMBtejrJSG2gPMe1kJUfg0f4HEn 1UADHl4vf+6hqhOO8eoax4wMXC/8ibJtvrZd4yH4U4T2i9pdOV0uJ4Rns3b9Itti7vm8 3Twg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc; bh=HQ2JXL2+XIfeWQS3JXdAVOJVP5bo4gHu3cRzDwWe3KQ=; b=mAUMH31fivRFgjzettyWCbxeZJqADcgg04gG1ZXufO5kH8WRrCxjQobw+8Vf0MhA7P AtvuyB5C7V995MGR0ASJyNav+vPO43TLrWgXVuq2CAEyfgi7QxcZ0IE9STctXctU2LyJ LU8u2w2okEG97F0DpIZaVmV53xjGqVBn5NJmTcGhhDu8APSVUAu2cqNQlEmGleXzcfbO kKkndmUzQprz/dZnuwaAfIlDidh2BuciIU/B/ZFA0FRxjDDtBX+1eL5DQHeqmP+hFH6u JzpECrjBYczCMZEP4WnDKc3Q6kPMU4hn1cFmwxQRx1ATW8EiKjzYH6qPPZnIJslbAsT+ eZHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d195si15346784pga.309.2019.03.25.18.30.55; Mon, 25 Mar 2019 18:31:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730745AbfCZBaA (ORCPT + 99 others); Mon, 25 Mar 2019 21:30:00 -0400 Received: from mga01.intel.com ([192.55.52.88]:47516 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727506AbfCZBaA (ORCPT ); Mon, 25 Mar 2019 21:30:00 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2019 18:29:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,270,1549958400"; d="scan'208";a="130144816" Received: from allen-box.sh.intel.com (HELO [10.239.159.136]) ([10.239.159.136]) by orsmga006.jf.intel.com with ESMTP; 25 Mar 2019 18:29:58 -0700 Cc: baolu.lu@linux.intel.com, iommu@lists.linux-foundation.org, Tom Murphy , Dmitry Safonov , Jacob Pan , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/7] iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions To: James Sewart References: <0F0C82BE-86E5-4BAC-938C-6F7629E18D27@arista.com> <83B82113-8AE5-4B0C-A079-F389520525BD@arista.com> <445F31EA-20F3-481C-B1DF-8B163791FF8C@arista.com> From: Lu Baolu Message-ID: Date: Tue, 26 Mar 2019 09:24:20 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <445F31EA-20F3-481C-B1DF-8B163791FF8C@arista.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi James, On 3/25/19 8:57 PM, James Sewart wrote: >>> Theres an issue that if we choose to alloc a new resv_region with type >>> IOMMU_RESV_DIRECT, we will need to refactor intel_iommu_put_resv_regions >>> to free this entry type which means refactoring the rmrr regions in >>> get_resv_regions. Should this work be in this patchset? >> Do you mean the rmrr regions are not allocated in get_resv_regions, but >> are freed in put_resv_regions? I think we should fix this in this patch >> set since this might impact the device passthrough if we don't do it. > They’re not allocated and not freed currently, only type IOMMU_RESV_MSI is > freed in put_resv_regions. If we allocate a new resv_region with type > IOMMU_RESV_DIRECT for the isa region, then it won’t be freed. If we modify > put_resv_regions to free type IOMMU_RESV_DIRECT, then we will try to free > the static RMRR regions. > > Either the ISA region is static and not freed as with my implementation, > or the RMRR regions are converted to be allocated on each call to > get_resv_regions and freed in put_resv_regions. > By the way, there's another way in my mind. Let's add a new region type for LPC devices, e.x. IOMMU_RESV_LPC, and then handle it in the same way as those MSI regions. Just FYI. Best regards, Lu Baolu