Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp714518ybg; Tue, 9 Jun 2020 10:57:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyg7qSl7m3GBTLyfnzuLicjYdvW/fWWkjp78oU/RDj/tHK6xL/lNjQHqhALGqcpk8nz0y6 X-Received: by 2002:a05:6402:17ce:: with SMTP id s14mr27549138edy.53.1591725465712; Tue, 09 Jun 2020 10:57:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591725465; cv=none; d=google.com; s=arc-20160816; b=QVhcUtmaguzi5muPLUNJ4YuID8Dtoe8tCByYchejW64MZsAy/cCzg29mBH3Hath6KM creJZzrX/xH0lYTXcEG9eiPmS6OynXkTCcfwk7DndYxjCf3HPPWrAQA5QzdMze3B6zCn YY+6qd+7I2CXlNNoMggsIyVbFDU1WGa5JjWA5Pu0xqScMSQQ+vF1gKHIdZCoyqtu+OE7 IvL9yc0Pj5cxRGKHu6jiT6o/KvuIyYhEvMBwDeQW8VgLkNcJS/Nkc+LA4kMf0pnXcuWQ 0AYsuaruI8CzdA8WldD57ivpU/LCRXKm9ACJQSjDXgUqx34NbrPMjP8zaNLzRZ3yZAS1 em1A== 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:mime-version :message-id:date:subject:cc:to:from; bh=CslfUrX3QxIvql/h9G1m5CmJLbBVry7uvRpZwBLTJ+c=; b=AntWw2e7D3yZql/59pu2zr/y904puTjWpDmfoPl2vf2Fk2N2pHjBRUjh5AVP/S5ICr jzgpuUIeHXTmpBag3LfytN0uYT+/gTwwvGBcQBdhn42Qa0wqiZhbADDGi/m1Geni4fKa VwqQv/D9yDFJ9CuYR0DNwkIKdjAXPo+eQqk42lY0lXA14mBkC6Uve6vjvwx8JM489mUY ie5yvzELfaSGKwFfeUzeZ5hRd5oYW5Dj9niboFEHiNT2WMkyB+7mHcS0NOTk2YulfcR7 C41fNy/HAhq9MZ9FlY6PGskv51iPzeXbLC4GTvi7j+6rJpmHuxlo+7b1KxOlIqUj0MoX Ucxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si11251007edi.116.2020.06.09.10.57.22; Tue, 09 Jun 2020 10:57:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731897AbgFIRng (ORCPT + 99 others); Tue, 9 Jun 2020 13:43:36 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:56073 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728472AbgFIRng (ORCPT ); Tue, 9 Jun 2020 13:43:36 -0400 Received: from 1.general.cascardo.us.vpn ([10.172.70.58] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jiiHe-0004lb-1P; Tue, 09 Jun 2020 17:43:34 +0000 From: Thadeu Lima de Souza Cascardo To: linux-kernel@vger.kernel.org Cc: Mark Gross , x86@kernel.org, "H. Peter Anvin" , Borislav Petkov , Ingo Molnar , Thomas Gleixner , Thadeu Lima de Souza Cascardo , John Johansen , Steve Beattie Subject: [PATCH] x86/speculation/srbds: do not try to turn mitigation off when not supported Date: Tue, 9 Jun 2020 14:43:13 -0300 Message-Id: <20200609174313.2600320-1-cascardo@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When SRBDS is mitigated by TSX OFF, update_srbds_msr will still read and write to MSR_IA32_MCU_OPT_CTRL even when that is not supported by the microcode. Checking for X86_FEATURE_SRBDS_CTRL as a CPU feature available makes more sense than checking for SRBDS_MITIGATION_UCODE_NEEDED as the found "mitigation". Signed-off-by: Thadeu Lima de Souza Cascardo Acked-by: John Johansen Acked-by: Steve Beattie Cc: stable@vger.kernel.org --- arch/x86/kernel/cpu/bugs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index b6f887be440c..ee5bdca7fd30 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -432,7 +432,7 @@ void update_srbds_msr(void) if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) return; - if (srbds_mitigation == SRBDS_MITIGATION_UCODE_NEEDED) + if (!boot_cpu_has(X86_FEATURE_SRBDS_CTRL)) return; rdmsrl(MSR_IA32_MCU_OPT_CTRL, mcu_ctrl); -- 2.25.1