From patchwork Mon Mar 27 20:09:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 75668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1768472vqo; Mon, 27 Mar 2023 13:22:39 -0700 (PDT) X-Google-Smtp-Source: AKy350aJ3pIX5lkiMm0eTaf8YFsE8mgmxgGloF935Q27Glx/47V/5Fpi4KfFxGGvNF2t7zScSJTQ X-Received: by 2002:a17:906:4b51:b0:92f:3e2b:fbb7 with SMTP id j17-20020a1709064b5100b0092f3e2bfbb7mr12979426ejv.14.1679948559487; Mon, 27 Mar 2023 13:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679948559; cv=none; d=google.com; s=arc-20160816; b=G11q7t4PXRawKSlUH3A5naykyPeAyUQ7HoAXzsEszOGJWFeLnRPkyazNXjUPB9AgoG VyctCweG7OXeY3mUWUKgr8UWuczS9clqmGK5yOnhr9VoVZSxylAfOh8Q2HGLdymNKR+E cpVKGzsk/JWt2MMYmelCdwNNCRILOIo4cKAqVwP4dBuV+OyNqziERJmyzev9JDARIEGo V3hU0TllY8NO46er/KGdIDjg4nICIpm/cUw18uA9+lxZDhtlkp6q0HfGWGkjc31TYQZc Yom5qQo+BYD3cTR/mFuQvuT1pQq8WbOq2vd+6u9yUAtiZ8brFaA9rf1PntX98sT1fm2L Zwwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=k2jw5BA/HVG6MhvyqeHZziDkRNXCWdjJkAUwLh/XHD4=; b=KNcjQ1hSvYRpl5wurhVqV+JsUHhtw35VCe/ARMWXvSW+Oci3Yj1FIP4RLEim6dt8YE lbZg/euFtT4/HTCi7jZfs/Pb8xRVh71uZDR8Fxc5nrwhei95FgkXZ8KE/qAILc6YaAp5 /IRSRGZXHZj7hkTHemO/7c633hqUnY1BipPyR2Qcadn1I1U6GtRsenwyckw49IwK5Sz5 HSMWZcM5+BBFeNsXE/HhNTsfClYO8b63+4pv6EiwgjcYRErUw6VRFDe5cjRBm21FbALn mbcZJc21UvxErCHb/APnK9qpjJD49l3IZ4p++WUz8o3WQLIXCBi0FOadqR62/+VdHJye 1Z6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AfmK3AFw; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb26-20020a1709077e9a00b0093dc70f1709si12874315ejc.779.2023.03.27.13.22.15; Mon, 27 Mar 2023 13:22:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AfmK3AFw; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232307AbjC0UKA (ORCPT + 99 others); Mon, 27 Mar 2023 16:10:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232156AbjC0UJ6 (ORCPT ); Mon, 27 Mar 2023 16:09:58 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB48172A; Mon, 27 Mar 2023 13:09:55 -0700 (PDT) Date: Mon, 27 Mar 2023 20:09:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1679947793; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k2jw5BA/HVG6MhvyqeHZziDkRNXCWdjJkAUwLh/XHD4=; b=AfmK3AFwqSDfAWXTZsqDUaA8wViuBTcFQdRS239HONCZ+XschQxwpAr22pbiJdJsT+pGlk ymMPK6GGB4ZLWHJQMNtBYqKSn283+ZNWSnzW83zPMboJhD9ZJOr9rnEV7mc8/VK0v39QSW yZKa44cTTbtabthiiqTFkuf4pY8lfqBeZI8p6zre6K8TcNC5JnhhTf4Ak5ncUjug6eDEMt +Jn4GewSwdrznTUHk1a2lxvK6W4LvmebP/vRBwlEw2MvdbRPZ9R9IeuP3a7ttfVQIrhnxo dFrgWiG5L8wY3v++W7hVdi002nWqcQhkEt2MN2N0BIfWGG3yFNGxbUpgaIAenQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1679947793; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k2jw5BA/HVG6MhvyqeHZziDkRNXCWdjJkAUwLh/XHD4=; b=SwEaRKjwxeI8erabPwBfIIIwQ2Ap9ho6p0ulqSJzMpUqcOp7Dq4gmq8z46WHgB04iX29s3 r37U5S1f4iDBieBg== From: "tip-bot2 for Michael Kelley" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/sev] Drivers: hv: Explicitly request decrypted in vmap_pfn() calls Cc: Michael Kelley , "Borislav Petkov (AMD)" , Tianyu Lan , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <1679838727-87310-4-git-send-email-mikelley@microsoft.com> References: <1679838727-87310-4-git-send-email-mikelley@microsoft.com> MIME-Version: 1.0 Message-ID: <167994779321.5837.13303658601319169134.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761439018243944769?= X-GMAIL-MSGID: =?utf-8?q?1761553740987086182?= The following commit has been merged into the x86/sev branch of tip: Commit-ID: d33ddc92db8a61416473ff3d7f1c621c50733dc0 Gitweb: https://git.kernel.org/tip/d33ddc92db8a61416473ff3d7f1c621c50733dc0 Author: Michael Kelley AuthorDate: Sun, 26 Mar 2023 06:51:58 -07:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 27 Mar 2023 08:46:43 +02:00 Drivers: hv: Explicitly request decrypted in vmap_pfn() calls Update vmap_pfn() calls to explicitly request that the mapping be for decrypted access to the memory. There's no change in functionality since the PFNs passed to vmap_pfn() are above the shared_gpa_boundary, implicitly producing a decrypted mapping. But explicitly requesting "decrypted" allows the code to work before and after changes that cause vmap_pfn() to mask the PFNs to being below the shared_gpa_boundary. Signed-off-by: Michael Kelley Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Tianyu Lan Link: https://lore.kernel.org/r/1679838727-87310-4-git-send-email-mikelley@microsoft.com --- arch/x86/hyperv/ivm.c | 2 +- drivers/hv/ring_buffer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c index f33c67e..5648efb 100644 --- a/arch/x86/hyperv/ivm.c +++ b/arch/x86/hyperv/ivm.c @@ -343,7 +343,7 @@ void *hv_map_memory(void *addr, unsigned long size) pfns[i] = vmalloc_to_pfn(addr + i * PAGE_SIZE) + (ms_hyperv.shared_gpa_boundary >> PAGE_SHIFT); - vaddr = vmap_pfn(pfns, size / PAGE_SIZE, PAGE_KERNEL_IO); + vaddr = vmap_pfn(pfns, size / PAGE_SIZE, pgprot_decrypted(PAGE_KERNEL)); kfree(pfns); return vaddr; diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index c6692fd..2111e97 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -211,7 +211,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, ring_info->ring_buffer = (struct hv_ring_buffer *) vmap_pfn(pfns_wraparound, page_cnt * 2 - 1, - PAGE_KERNEL); + pgprot_decrypted(PAGE_KERNEL)); kfree(pfns_wraparound); if (!ring_info->ring_buffer)