Received: by 10.223.185.116 with SMTP id b49csp2860367wrg; Mon, 5 Mar 2018 09:49:49 -0800 (PST) X-Google-Smtp-Source: AG47ELuhYEMBBgSI5WrH428HBMfz7HZAmt4CeuW40PSiN/Ort/1rGfA5/OfJ061f/VFMCNJm2U5S X-Received: by 2002:a17:902:a713:: with SMTP id w19-v6mr2084002plq.246.1520272189188; Mon, 05 Mar 2018 09:49:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520272189; cv=none; d=google.com; s=arc-20160816; b=xqgGFSr8CoqqU0V7sKZl/+qCYfzAxuDYtrGAviuw3S8O2B+qcLLuarWorHupYUmmqL sjldPSf+MA+hHW0pEHEJ/wzp8k5x/GiunVp6FCJ3IPbx2jpGEFAb7jwveZph1RsB5JSb x8rC8s6G2wJBDXUpIq3CcG8ZsawLflGcbOkpddk/uFFg6bV+vMs7gM4NCex8VLHXZnzh zz8idpn+itkhNv/XmHV3OxqIUrVOBqowZNHYtXEfJWuR1az3IUsbN3txQHcPxku37PX7 R1S+z6RN6iZsY614gPapu0QCGQ+TrZ6WMYdEZ92sycczjPwT/ukTy31PTsY/EpmDNqev vslg== 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=m8riGatcL0sN578NoDGE2AuwWQaduhGk4Q8gIxVJb8g=; b=qoGMmjJEeasSXE8GYN/2u8jKsTYXsD6VteooqRfoSURdFij3IDSuDT8yDISQ6q2xIR Q9WxTH5ISCiMJKm71Yk97Enyfo0/xtEMHMpVV8UIIZmD2bglKt4yVMaoSQtGR6OZK0R+ FciGfr1/vMc/cirL9BcOZTlUZ1FDxN/r1/tzfyQsNLb2tsSnwoPP5Y7QEZDNLMagrG0v 05Eld8Wb/u/12+21/exazhDzxNq6yL2Jl3wDYrErj0fBAHUjg7d+3CW0fLKtgrUqgmnr GqG189HA/FNAL6gJ/hRupdcG8obeqGYI6K58W1DOjO1zvuKTtkzrf4SpdQC9brHlcZBG +5jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=pNGnZh7b; 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 j8si10419297pfn.234.2018.03.05.09.49.35; Mon, 05 Mar 2018 09:49:49 -0800 (PST) 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=pNGnZh7b; 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 S1752856AbeCERsO (ORCPT + 99 others); Mon, 5 Mar 2018 12:48:14 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:60676 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752715AbeCERrU (ORCPT ); Mon, 5 Mar 2018 12:47:20 -0500 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=m8riGatcL0sN578NoDGE2AuwWQaduhGk4Q8gIxVJb8g=; b=pNGnZh7bKjRHAg75KSs2F7zun ssDwuqenhcUyEbZKDnfKBle/CiDSXkbKBYTUDmqQ47jBsA/ipolDgdi5YvtuNCEUxvqCAmS63Zk1I 80PiSnAcuoi2tj00kwGkuplpoiMFPeX7IVBrX9yPdh+wSvORG0sxCoy5KrwinL/gwZ0tYSGGSc1dL FouLfJgCtDo170Gvh2JYmZdHhuviDccHkTz0H0qfUyHhBYAUlv+xgxIRcVbJ8zzt5eCC0JmfCFvTG Q5c5qV8BfU/0hO1VXGvk5UGfbYNG448MgpwYcncuF+CkkDOjB+aJe6Of4XD89hPKhxocN1+lvTDAk S0hWthbfA==; Received: from [209.116.154.70] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1esuCZ-0002xe-0c; Mon, 05 Mar 2018 17:47:07 +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 12/13] swiotlb: remove swiotlb_set_mem_attributes Date: Mon, 5 Mar 2018 09:46:54 -0800 Message-Id: <20180305174655.9878-13-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180305174655.9878-1-hch@lst.de> References: <20180305174655.9878-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 --- 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 8bfc735bbdd7..65f45e0ef496 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -379,15 +379,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 ca8eeaead925..8b06b4485e65 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) { } - /* Note that this doesn't work with highmem page */ static dma_addr_t swiotlb_virt_to_bus(struct device *hwdev, volatile void *address) @@ -202,12 +201,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); } @@ -348,7 +347,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); /* @@ -359,7 +358,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