Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp8210imm; Wed, 5 Sep 2018 19:54:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaZfENTUYBF23GoRJZPZUOThEmrPt8HFrlMBVO0EdyW3FNQ1xBUZ6vTiJxfcddabcI1oU2T X-Received: by 2002:a17:902:8348:: with SMTP id z8-v6mr668893pln.51.1536202467160; Wed, 05 Sep 2018 19:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536202467; cv=none; d=google.com; s=arc-20160816; b=jz8pB9W/AatU8kSJG9mMvucdEBsrJDH+DUSyzQ/Qe8XJhDGy+Rw3OdjPHXvR3cOC9P ThBPzZ7er0xQE+Rm+U0GqYHq/hck4mPE0qfnJiT/3j27uePkzUd4oeYHtTpluSezfcHp vfMBsAN82QylfGS5SOWRs2VSqvJ58zitDd+6tn495lclaIEhN2Zamkf9b5sKUIBEys3h Vh9PuUGFxoRpnpHAEC5g3HqCHnvg/EJlGBrF4MJtvnUXmpHpm9v++szWHqTlYyQwvw4w m+ODB1Fcpof/WAyTF+y1Q3Zy05Vt4p6W+itI9dXhJdW+BqsoXjx6AsPn0NtQBeKDLtWr 7QXg== 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=NthEb/5PEJkAjdqtFv/c7ZrXZE4FgW/TBUuWZzFMPcc=; b=IiiY1XGHIETM5J+EpPKxyeNiLUiZglyNtUp7i2dgIAtyoXxSWn8LBNoTiZ5H6vgV6o XDqB/4dSCKtJRpADgvpjo4cgVpxTPBDxOkv4hUZOtD5W4u82M1Cb/vhUXAScJihET4K9 uK/mtgkqJObof2ZAOwdOVeDTj8gnQGHb58wT1H/JNsxm54hWxZznTYsKcKhzfxLFKxIY 2W8ctxyK9mFcGLTLTKO24QV8PSaTyH3GZIbzOponDZ77DTEQEFuyUxNL8iqAyDsssvja pKzhH3FcSs5ZfI145qaWMF1sqh4axfqxKL+RI9LHoN57Npg+7vxaNPw1CqXtP2YcBbmp cRTg== 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 l5-v6si4201312pls.13.2018.09.05.19.54.11; Wed, 05 Sep 2018 19:54:26 -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 S1726443AbeIFH0N (ORCPT + 99 others); Thu, 6 Sep 2018 03:26:13 -0400 Received: from mga01.intel.com ([192.55.52.88]:4599 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbeIFH0N (ORCPT ); Thu, 6 Sep 2018 03:26:13 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2018 19:53:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,334,1531810800"; d="scan'208";a="68742364" Received: from allen-box.sh.intel.com (HELO [10.239.161.122]) ([10.239.161.122]) by fmsmga008.fm.intel.com with ESMTP; 05 Sep 2018 19:53:04 -0700 Cc: baolu.lu@linux.intel.com, "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 To: "Tian, Kevin" , Joerg Roedel , David Woodhouse References: <20180830013524.28743-1-baolu.lu@linux.intel.com> <20180830013524.28743-4-baolu.lu@linux.intel.com> From: Lu Baolu Message-ID: <08966280-44db-a9a8-bc54-93f698c87823@linux.intel.com> Date: Thu, 6 Sep 2018 10:52:00 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 09/06/2018 10:15 AM, Tian, Kevin wrote: >> 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 Thank you, Kevin. Best regards, Lu Baolu > >> --- >> 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 > >