Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp88102imm; Wed, 5 Sep 2018 19:18:56 -0700 (PDT) X-Google-Smtp-Source: ANB0VdanhcGyA1zmO+j9WoObr45WR5OT7g7yB/rZQiUD7JOgq+De/Ii2rYxjmBNvGO0lGst6ZtgE X-Received: by 2002:a62:6a01:: with SMTP id f1-v6mr620634pfc.156.1536200336060; Wed, 05 Sep 2018 19:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536200336; cv=none; d=google.com; s=arc-20160816; b=Z1GRFA2ejtjLkDIo3r+WQp5Rq25VAlBPgXOaf7C6/5vR7jn/UvCp6geRfPsLled97V FAVrr1AT8plsc5DscV9uRiyawtxBcn8yq0W8JdN76vEyIVfGz/jRIkzSBNPg7aEP/Jla MZKR/oU2JHabqx7Jp06kAujsTEiLTRN69Kj3upV61l4h6+WLL3vYjvzeyeNuAXnSZMdm DSJVPocOhm+h1msSARoX30ppv3spD5GoDRP7sNc1uDMXZLlFBImmBeBNauEu2SESiNpa bgM5+G7rBtrey3H6jmKN7EuVaKklw3i7eiMktAW+WHyRQvpz5ZyqbewOf9CWp317f59s 2E0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=htuy0kM4qX8UaSkr8nPekOLUvY9R+WkavKnsNoJTeMw=; b=CedPLD9yq5KtM5txYKjW82H8a6XEaLWy/bKEfmFvgOqKbvxZBDnFQCfYLSmENsCVJG W/bZewnBhyABbqCb278pswXHAoxmr5+AplA2/MKucvAZfcuQh78Yud4Ob9zK026Kxkv0 hWFiwfQyvRF+Qmo/72+f/o/3sPVQlFrxNBtJxVkOZSemSpT3HV9w4ZtwUROnZOVPk3no k106HkbFnueG76ZouohUP5t5EReyTZ7xbZN5SheHipnB2E46ng0jUkQG0FQ6PIi5A5xO PtBA/+rwzl3CGcsnIKD89UXRfP8EuSg5wVkfYE9ezYsWqMVha8cINzgSbDYH5jszWrMd M4EQ== 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 y1-v6si4070863pfc.132.2018.09.05.19.18.40; Wed, 05 Sep 2018 19:18:56 -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 S1726248AbeIFGuW convert rfc822-to-8bit (ORCPT + 99 others); Thu, 6 Sep 2018 02:50:22 -0400 Received: from mga07.intel.com ([134.134.136.100]:8615 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbeIFGuW (ORCPT ); Thu, 6 Sep 2018 02:50:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2018 19:17:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,334,1531810800"; d="scan'208";a="87583677" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga001.fm.intel.com with ESMTP; 05 Sep 2018 19:15:31 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 5 Sep 2018 19:15:31 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 5 Sep 2018 19:15:30 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.205]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.150]) with mapi id 14.03.0319.002; Thu, 6 Sep 2018 10:15:28 +0800 From: "Tian, Kevin" To: Lu Baolu , Joerg Roedel , "David Woodhouse" CC: "Raj, Ashok" , "Kumar, Sanjay K" , "Pan, Jacob jun" , "Liu, Yi L" , "Sun, Yi Y" , "peterx@redhat.com" , Jean-Philippe Brucker , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , Jacob Pan Subject: RE: [PATCH v2 03/12] iommu/vt-d: Move page table helpers into header Thread-Topic: [PATCH v2 03/12] iommu/vt-d: Move page table helpers into header Thread-Index: AQHUQAHvQ6+D9j7BN0OKWrCwSnidcqTijsnA Date: Thu, 6 Sep 2018 02:15:27 +0000 Message-ID: References: <20180830013524.28743-1-baolu.lu@linux.intel.com> <20180830013524.28743-4-baolu.lu@linux.intel.com> In-Reply-To: <20180830013524.28743-4-baolu.lu@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzViYWViNWMtMGVhOS00ZWM1LTkyOGItMjQ1MTVjNWNiM2UyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTFRuV1wvb3BMV05jUnJET0l5dFwvZjd6NjNqNXYzQVUwSlF1U0Y0eHpNK3lmKzFVXC9uWkRxUWJqMzF1bklEREdUWiJ9 dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Lu Baolu [mailto:baolu.lu@linux.intel.com] > Sent: Thursday, August 30, 2018 9:35 AM > > So that they could also be used in other source files. > > Cc: Ashok Raj > Cc: Jacob Pan > Cc: Kevin Tian > Cc: Liu Yi L > Signed-off-by: Lu Baolu > Reviewed-by: Ashok Raj Reviewed-by: Kevin Tian > --- > drivers/iommu/intel-iommu.c | 43 ------------------------------------- > include/linux/intel-iommu.h | 43 > +++++++++++++++++++++++++++++++++++++ > 2 files changed, 43 insertions(+), 43 deletions(-) > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index b0da4f765274..93cde957adc7 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -315,49 +315,6 @@ static inline void context_clear_entry(struct > context_entry *context) > context->hi = 0; > } > > -/* > - * 0: readable > - * 1: writable > - * 2-6: reserved > - * 7: super page > - * 8-10: available > - * 11: snoop behavior > - * 12-63: Host physcial address > - */ > -struct dma_pte { > - u64 val; > -}; > - > -static inline void dma_clear_pte(struct dma_pte *pte) > -{ > - pte->val = 0; > -} > - > -static inline u64 dma_pte_addr(struct dma_pte *pte) > -{ > -#ifdef CONFIG_64BIT > - return pte->val & VTD_PAGE_MASK; > -#else > - /* Must have a full atomic 64-bit read */ > - return __cmpxchg64(&pte->val, 0ULL, 0ULL) & VTD_PAGE_MASK; > -#endif > -} > - > -static inline bool dma_pte_present(struct dma_pte *pte) > -{ > - return (pte->val & 3) != 0; > -} > - > -static inline bool dma_pte_superpage(struct dma_pte *pte) > -{ > - return (pte->val & DMA_PTE_LARGE_PAGE); > -} > - > -static inline int first_pte_in_page(struct dma_pte *pte) > -{ > - return !((unsigned long)pte & ~VTD_PAGE_MASK); > -} > - > /* > * This domain is a statically identity mapping domain. > * 1. This domain creats a static 1:1 mapping to all usable memory. > diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h > index 2173ae35f1dc..41791903a5e3 100644 > --- a/include/linux/intel-iommu.h > +++ b/include/linux/intel-iommu.h > @@ -501,6 +501,49 @@ static inline void __iommu_flush_cache( > clflush_cache_range(addr, size); > } > > +/* > + * 0: readable > + * 1: writable > + * 2-6: reserved > + * 7: super page > + * 8-10: available > + * 11: snoop behavior > + * 12-63: Host physcial address > + */ > +struct dma_pte { > + u64 val; > +}; > + > +static inline void dma_clear_pte(struct dma_pte *pte) > +{ > + pte->val = 0; > +} > + > +static inline u64 dma_pte_addr(struct dma_pte *pte) > +{ > +#ifdef CONFIG_64BIT > + return pte->val & VTD_PAGE_MASK; > +#else > + /* Must have a full atomic 64-bit read */ > + return __cmpxchg64(&pte->val, 0ULL, 0ULL) & VTD_PAGE_MASK; > +#endif > +} > + > +static inline bool dma_pte_present(struct dma_pte *pte) > +{ > + return (pte->val & 3) != 0; > +} > + > +static inline bool dma_pte_superpage(struct dma_pte *pte) > +{ > + return (pte->val & DMA_PTE_LARGE_PAGE); > +} > + > +static inline int first_pte_in_page(struct dma_pte *pte) > +{ > + return !((unsigned long)pte & ~VTD_PAGE_MASK); > +} > + > extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct > pci_dev *dev); > extern int dmar_find_matched_atsr_unit(struct pci_dev *dev); > > -- > 2.17.1