From patchwork Mon Jun 5 14:08:16 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: 103283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2717173vqr; Mon, 5 Jun 2023 07:16:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Xj/dcztFUNjahb0AmPRfIHAsfaZY3GuvzNrpQGedQ9tmEF0e2zxcd1yzu5DLG0eoA4xTo X-Received: by 2002:a17:903:1ce:b0:1b0:3742:e725 with SMTP id e14-20020a17090301ce00b001b03742e725mr6937265plh.56.1685974565861; Mon, 05 Jun 2023 07:16:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685974565; cv=none; d=google.com; s=arc-20160816; b=kNlF6OI5btVeV4OrQJ7HB09kapF9e5TE4J37xMoSNyevRrXCbfrk3axEp8A9+1mchT Q4lbKIwZJz8sGPiMWlIQv3rvB3wQXUv4TPl9ft/Ecy3io5DNzZkhsV+DZQcS2bfeEGZs m4qKFwSvzzPFHA0zT6wYGFaTHipEFFHTczpXz1m7dlVudQaK9YfYwVUEV/xvKS5bl36s AEMW3mxlPjV7MFgwqRsZdOENUVuqn0q80/gHvvfu5lMljzM+j6gjYA4e57rnQ63yL3iD GHt542YUOzbp1MiP/bpfjtieVA3GUIWycrSMd1vKBzC49h4drKnDJgXPEYxQ5nyHi6Xt qRIw== 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=QbncYe5bJfQl9Kaut5W1J4D/EgNC3+gf86CUeN1lbFA=; b=0zvZKh1jeFsBchSUZxhCP0oIDiKiG3ohMD1wKifaYUTtffpGTgTDo3XxtYGt+DIJXU k1Mxq0ZnB3gfH2jt5Ch0xuHiLiANRrGKfIaQuEr4jkm3/nqVKJy50dfRMa+2qgqOk5sH WSuuwuQLEYHXKN4ydSsu6iYaMKQ2f4FhKUlvOtFZKmvUxodtrJjRTm1jjDTgthJ8xP/X rny3uGPn1kBNg1f4XAzyTJuitOLfCUHYxwkGn5+BkOCjhKKPL9X+g6LGSBFLorHLKnbN iPxN8XqhdmroPDUjVKfXugweB+MhdD6IAeHDWsVJ5h+uCdki1rLZUZ4SLckIdpiIUMpV lv+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=sEX9Ronh; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 c11-20020a170902d48b00b001afd1a40242si5494503plg.637.2023.06.05.07.15.53; Mon, 05 Jun 2023 07:16:05 -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=sEX9Ronh; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S234517AbjFEOJm (ORCPT + 99 others); Mon, 5 Jun 2023 10:09:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233125AbjFEOIf (ORCPT ); Mon, 5 Jun 2023 10:08:35 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACBC2118; Mon, 5 Jun 2023 07:08:19 -0700 (PDT) Date: Mon, 05 Jun 2023 14:08:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1685974097; 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=QbncYe5bJfQl9Kaut5W1J4D/EgNC3+gf86CUeN1lbFA=; b=sEX9RonhP2krlur3O4PmtZYJ/+fUbttNmpgkAGBNEUF3tjEM3NkSZ0Sz5pNAc7ObcmtHZh FL4cHIKufDMYyJHiLuu3Ttav9t7lSr2Z1ehuCM0PvglphTo4ZiJB4Vs4GWY3ctFhITviu8 h2c/sWO/ckuxwPBky/DJTJ8VkFhxItLNQ8dZM6GjYKmopBZ/yoo1UjrE0kI6bdi0Wy9E2z BpW+SIZzUmEWqves6CsalzYMGzRg7/8+D6w9+tgD8K2lvmhMNAjWV7r+pkBpns6IDrQZbm qLeVKyXq3/eVFMAem845I/Xpfb2uJPmsMQcqqSbuWqzlAqdRAgJlXLb/R2C7mw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1685974097; 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=QbncYe5bJfQl9Kaut5W1J4D/EgNC3+gf86CUeN1lbFA=; b=mpa0RJe/5uUr/7CyxetWM6fdtv1GWZ4AWcwC7d/ZX2fQsGPfAv+BhsJJU7hwvD2CHbT8gJ VglakVU19Opqy2Cw== From: "tip-bot2 for Juergen Gross" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mtrr] x86/hyperv: Set MTRR state when running as SEV-SNP Hyper-V guest Cc: Juergen Gross , "Borislav Petkov (AMD)" , Michael Kelley , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230502120931.20719-5-jgross@suse.com> References: <20230502120931.20719-5-jgross@suse.com> MIME-Version: 1.0 Message-ID: <168597409682.404.2522096676257055244.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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?1767872466146193843?= X-GMAIL-MSGID: =?utf-8?q?1767872466146193843?= The following commit has been merged into the x86/mtrr branch of tip: Commit-ID: c957f1f3c498bcce85c04e92e60afbae1fd10cde Gitweb: https://git.kernel.org/tip/c957f1f3c498bcce85c04e92e60afbae1fd10cde Author: Juergen Gross AuthorDate: Tue, 02 May 2023 14:09:19 +02:00 Committer: Borislav Petkov (AMD) CommitterDate: Thu, 01 Jun 2023 15:04:32 +02:00 x86/hyperv: Set MTRR state when running as SEV-SNP Hyper-V guest In order to avoid mappings using the UC- cache attribute, set the MTRR state to use WB caching as the default. This is needed in order to cope with the fact that PAT is enabled, while MTRRs are not supported by the hypervisor. Fixes: 90b926e68f50 ("x86/pat: Fix pat_x_mtrr_type() for MTRR disabled case") Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov (AMD) Tested-by: Michael Kelley Link: https://lore.kernel.org/r/20230502120931.20719-5-jgross@suse.com Signed-off-by: Borislav Petkov (AMD) --- arch/x86/hyperv/ivm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c index cc92388..6f7c1b5 100644 --- a/arch/x86/hyperv/ivm.c +++ b/arch/x86/hyperv/ivm.c @@ -17,6 +17,7 @@ #include #include #include +#include #ifdef CONFIG_AMD_MEM_ENCRYPT @@ -372,6 +373,9 @@ void __init hv_vtom_init(void) x86_platform.guest.enc_cache_flush_required = hv_vtom_cache_flush_required; x86_platform.guest.enc_tlb_flush_required = hv_vtom_tlb_flush_required; x86_platform.guest.enc_status_change_finish = hv_vtom_set_host_visibility; + + /* Set WB as the default cache mode. */ + mtrr_overwrite_state(NULL, 0, MTRR_TYPE_WRBACK); } #endif /* CONFIG_AMD_MEM_ENCRYPT */