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=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED autolearn=unavailable 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 2978FC004C9 for ; Mon, 6 May 2019 01:41:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 EF63120675 for ; Mon, 6 May 2019 01:41:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="agtsKTTc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF63120675 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=su1d0hHf70yDuVyxYfxcW9u9h+EZTmJiL82bYYPP7pI=; b=agtsKTTczkdvxLA1kub6xZy/1 KnVb7UUJdrrWGGRzsS5F9waFpAz2kqY/gQWzO09rKs4VE7Vqcl1J7diLc8ErKoOOSeBiua8PjlJmU HCzUSrWVo9AJ2PTtUaQDqXT6TTXSyMDRxFKTnBesMTXvialpXOMgFDzdWzIM+E9v/XzjXq5Rsvf4v 5XUx51CnzNrMkxO8n50+e0bCmglTgPBN0KBjuegaZa9E3yLzmlMWR9SUAse4subPCh4oJiGqz1VEL 8mZ1U574wb0N8DB9tjBtHKCwfOvgNNQhLZ3TDdYF2jDHjX8tQvzGvEXaC0AaV+zINmyPDejvmps82 LbbN+FJKw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hNSdS-0005yR-5a; Mon, 06 May 2019 01:41:42 +0000 Received: from mga14.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hNSdN-0005wS-1W; Mon, 06 May 2019 01:41:38 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 May 2019 18:41:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,435,1549958400"; d="scan'208";a="146639249" Received: from allen-box.sh.intel.com (HELO [10.239.159.136]) ([10.239.159.136]) by fmsmga008.fm.intel.com with ESMTP; 05 May 2019 18:41:24 -0700 Subject: Re: [RFC 6/7] iommu/vt-d: convert the intel iommu driver to the dma-iommu ops api To: Tom Murphy References: <20190504132327.27041-1-tmurphy@arista.com> <20190504132327.27041-7-tmurphy@arista.com> <602b77a2-9c68-ad14-b64f-904a7ff27a15@linux.intel.com> From: Lu Baolu Message-ID: <2419e94d-bfdb-e70d-bbfd-425671886e99@linux.intel.com> Date: Mon, 6 May 2019 09:34:59 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190505_184137_103811_C62A7CCB X-CRM114-Status: GOOD ( 21.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , kvm@vger.kernel.org, Will Deacon , David Brown , Thierry Reding , Marek Szyprowski , linux-s390@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Joerg Roedel , iommu@lists.linux-foundation.org, Krzysztof Kozlowski , Jonathan Hunter , linux-rockchip@lists.infradead.org, Kukjin Kim , linux-arm-kernel@lists.infradead.org, Andy Gross , linux-tegra@vger.kernel.org, Marc Zyngier , linux-arm-msm@vger.kernel.org, Alex Williamson , linux-mediatek@lists.infradead.org, Matthias Brugger , Thomas Gleixner , Gerald Schaefer , Robin Murphy , linux-kernel@vger.kernel.org, Tom Murphy , Rob Clark , David Woodhouse , baolu.lu@linux.intel.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On 5/6/19 1:03 AM, Tom Murphy wrote: > On Sun, May 5, 2019 at 3:44 AM Lu Baolu wrote: >> Hi, >> >> On 5/4/19 9:23 PM, Tom Murphy wrote: >>> static int intel_iommu_add_device(struct device *dev) >>> { >>> + struct dmar_domain *dmar_domain; >>> + struct iommu_domain *domain; >>> struct intel_iommu *iommu; >>> struct iommu_group *group; >>> - struct iommu_domain *domain; >>> + dma_addr_t base; >>> u8 bus, devfn; >>> >>> iommu = device_to_iommu(dev, &bus, &devfn); >>> @@ -4871,9 +4514,12 @@ static int intel_iommu_add_device(struct device *dev) >>> if (IS_ERR(group)) >>> return PTR_ERR(group); >>> >>> + base = IOVA_START_PFN << VTD_PAGE_SHIFT; >>> domain = iommu_get_domain_for_dev(dev); >>> + dmar_domain = to_dmar_domain(domain); >>> if (domain->type == IOMMU_DOMAIN_DMA) >>> - dev->dma_ops = &intel_dma_ops; >>> + iommu_setup_dma_ops(dev, base, >>> + __DOMAIN_MAX_ADDR(dmar_domain->gaw) - base); >> I didn't find the implementation of iommu_setup_dma_ops() in this >> series. Will the iova resource be initialized in this function? > Ah sorry, I should've mentioned this is based on the > http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-iommu-ops.3 > branch with the "iommu/vt-d: Delegate DMA domain to generic iommu" and > "iommu/amd: Convert the AMD iommu driver to the dma-iommu api" patch > sets applied. > >> If so, will this block iommu_group_create_direct_mappings() which >> reserves and maps the reserved iova ranges. > The reserved regions will be reserved by the > iova_reserve_iommu_regions function instead: > (https://github.com/torvalds/linux/blob/6203838dec05352bc357625b1e9ba0a10d3bca35/drivers/iommu/dma-iommu.c#L238 > ) > iommu_setup_dma_ops calls iommu_dma_init_domain which calls > iova_reserve_iommu_regions. > iommu_group_create_direct_mappings will still execute normally but it > won't be able to call the intel_iommu_apply_resv_region function > because it's been removed in this patchset. > This shouldn't change any behavior and the same regions should be reserved. > Okay, I understand it now. Thanks for the explanation. Best regards, Lu Baolu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel