Received: by 10.213.65.68 with SMTP id h4csp1447815imn; Mon, 19 Mar 2018 04:34:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELs0HlPUZccZ2dkhFDbTkzXn8zNKArc6fGwv8HfrWN05tl1vFjaBWD2yMbJGzA578n3OL0sr X-Received: by 10.98.92.194 with SMTP id q185mr9827138pfb.63.1521459295764; Mon, 19 Mar 2018 04:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521459295; cv=none; d=google.com; s=arc-20160816; b=o4hwsS+TwjketLxZgJfJC1lqqsJsOR4cVQx7cB4R4OdqjGiNgXcnhYlRxcmJombmIf BbhMf27fmx4ErQL6qJQbvIpKaV5qgh9sw2G34T8NQwpLYajbVeZZrxVXltyEXfNDJJcQ w3UowtVxfxTpTGL85pnky+vnurqKnJ38gMHk1l9uL5h+hE0LkxJTD9lbzX1K1iTZ08cn dWVkdeMbDflzg1fDI1DIuaGARhRDjLwJFincxh3rDR80xOmCuxqBaYjOLTGNHLs4Shdx EFW/e9I6+j65BpmmEvXXZcC2yiKZ4/KY12jjTVKLY37Hlq7SppGEatZhCFsnyO17X7Qy 1Ydg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=su8nbOidKgA2uPnePtgzK9Jai7P6qr6bbO2zcFN7EKs=; b=M4VWuHSqSe94Jv4Eqqe9xsnszDte9xiCxeQhLCzcJutiXRhGB3dTxXQ+mG7w/AM2sR MSmxVLnLJnbrDPrFtPDOgjHdUS2DLAlQQt4B8lT8mSIQ/Q1e1eAXvC95/+FaNqnWuDix V5cmZeyLeet+83jeI4w1gOSf/bNvbHlFGFX/ujgrZVh9p6C9LjGMF1C9t35M+a74jj/Q 1ZvZzFOVWQdTTR8/Z6HHqTgA2rkFw9kt86ZeYrT/3Dtzm/bDAeJGkUTTH5D9+V7c5JFD 4zIxXZGj7l5cmVbCxtj061Gv04TP0Y4hg7afzSceYVBTcpBU7/4tXgbaSaRaCvfyNS79 TLnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=r/Iv8qaA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si9430743pgd.778.2018.03.19.04.34.41; Mon, 19 Mar 2018 04:34:55 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=r/Iv8qaA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933090AbeCSKkl (ORCPT + 99 others); Mon, 19 Mar 2018 06:40:41 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55214 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932950AbeCSKjT (ORCPT ); Mon, 19 Mar 2018 06:39:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=su8nbOidKgA2uPnePtgzK9Jai7P6qr6bbO2zcFN7EKs=; b=r/Iv8qaAmEUVJ34o7c19R1s7F ZT9gDCScrsDAUxNYFdqTF6qta/TlE6jQ0z5lTcP6eCGOzGjaB7QD4RI5kaNDlWTmPiCZHmLVLFHxU WSySEXFq3TvNtMraNN70uVczBNnj3gfbsOsY6ixflIX3WXm/FF86NQutsTxa8VxW0eQ11gpoejHQY tvXjlhGGspH6/x1vMGCAtX4hJ1QGs6Pqt7ttg9ep8PMtq9WvHhFHaRKlT53c0x84zntEIpHEq2bPQ hu024agtcygk06Pbt7p6pJ6gL3fuVgofc26WyvqikiqWjhbhD4JzRY/4xI5sWjJymP1czS5BN9oEE JMzFQjHbg==; Received: from 178.114.187.156.wireless.dyn.drei.com ([178.114.187.156] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1exsC7-00062i-Ap; Mon, 19 Mar 2018 10:39:11 +0000 From: Christoph Hellwig To: x86@kernel.org Cc: Konrad Rzeszutek Wilk , Tom Lendacky , David Woodhouse , Muli Ben-Yehuda , Jon Mason , Joerg Roedel , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/14] swiotlb: remove swiotlb_set_mem_attributes Date: Mon, 19 Mar 2018 11:38:23 +0100 Message-Id: <20180319103826.12853-12-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180319103826.12853-1-hch@lst.de> References: <20180319103826.12853-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that set_memory_decrypted is always available we can just call it directly. Signed-off-by: Christoph Hellwig Reviewed-by: Konrad Rzeszutek Wilk --- arch/x86/include/asm/mem_encrypt.h | 2 -- arch/x86/mm/mem_encrypt.c | 9 --------- lib/swiotlb.c | 12 ++++++------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h index 22c5f3e6f820..9da0b63c8fc7 100644 --- a/arch/x86/include/asm/mem_encrypt.h +++ b/arch/x86/include/asm/mem_encrypt.h @@ -48,8 +48,6 @@ int __init early_set_memory_encrypted(unsigned long vaddr, unsigned long size); /* Architecture __weak replacement functions */ void __init mem_encrypt_init(void); -void swiotlb_set_mem_attributes(void *vaddr, unsigned long size); - bool sme_active(void); bool sev_active(void); diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index 66beedc8fe3d..d3b80d5f9828 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -446,15 +446,6 @@ void __init mem_encrypt_init(void) : "Secure Memory Encryption (SME)"); } -void swiotlb_set_mem_attributes(void *vaddr, unsigned long size) -{ - WARN(PAGE_ALIGN(size) != size, - "size is not page-aligned (%#lx)\n", size); - - /* Make the SWIOTLB buffer area decrypted */ - set_memory_decrypted((unsigned long)vaddr, size >> PAGE_SHIFT); -} - struct sme_populate_pgd_data { void *pgtable_area; pgd_t *pgd; diff --git a/lib/swiotlb.c b/lib/swiotlb.c index c43ec2271469..005d1d87bb2e 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -156,8 +157,6 @@ unsigned long swiotlb_size_or_default(void) return size ? size : (IO_TLB_DEFAULT_SIZE); } -void __weak swiotlb_set_mem_attributes(void *vaddr, unsigned long size) { } - /* For swiotlb, clear memory encryption mask from dma addresses */ static dma_addr_t swiotlb_phys_to_dma(struct device *hwdev, phys_addr_t address) @@ -209,12 +208,12 @@ void __init swiotlb_update_mem_attributes(void) vaddr = phys_to_virt(io_tlb_start); bytes = PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT); - swiotlb_set_mem_attributes(vaddr, bytes); + set_memory_decrypted((unsigned long)vaddr, bytes >> PAGE_SHIFT); memset(vaddr, 0, bytes); vaddr = phys_to_virt(io_tlb_overflow_buffer); bytes = PAGE_ALIGN(io_tlb_overflow); - swiotlb_set_mem_attributes(vaddr, bytes); + set_memory_decrypted((unsigned long)vaddr, bytes >> PAGE_SHIFT); memset(vaddr, 0, bytes); } @@ -355,7 +354,7 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) io_tlb_start = virt_to_phys(tlb); io_tlb_end = io_tlb_start + bytes; - swiotlb_set_mem_attributes(tlb, bytes); + set_memory_decrypted((unsigned long)tlb, bytes >> PAGE_SHIFT); memset(tlb, 0, bytes); /* @@ -366,7 +365,8 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) if (!v_overflow_buffer) goto cleanup2; - swiotlb_set_mem_attributes(v_overflow_buffer, io_tlb_overflow); + set_memory_decrypted((unsigned long)v_overflow_buffer, + io_tlb_overflow >> PAGE_SHIFT); memset(v_overflow_buffer, 0, io_tlb_overflow); io_tlb_overflow_buffer = virt_to_phys(v_overflow_buffer); -- 2.14.2