Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1547452rdh; Mon, 25 Sep 2023 16:57:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXSRHpXOuAOtMAVbE4t1jtCC8A6rC2DWSsAjIyDpuQL0eBVqdo6oGwhxgcwmPage9mWIa9 X-Received: by 2002:a05:6a21:3297:b0:15e:986:d92b with SMTP id yt23-20020a056a21329700b0015e0986d92bmr7134862pzb.16.1695686232940; Mon, 25 Sep 2023 16:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695686232; cv=none; d=google.com; s=arc-20160816; b=h7ZuYUpOadaQ0zw32c2wYM9FXIF2aj4M7ireJuwZQYsByn48UAEtDntD4QJ+FOwAEK Y95OrbjYKfYzlcasNoBRLGUX8GoybkOsYniIRW29EXHBN1uHkvXxDBQwFIk69EZZP1JS yAj8jwBMh7AiEbIVr/FAsoKyCxHLNYB9c7DA8uB6ITZIxrQcygkjtQMInYYTfw6YFf2h 3dcafVQ+k3BZgp0+GHttWIO8+A+V1voKA7LnTxa3s0sDyElLbjfQOT8XyHawbiZbUG62 a4uimvEqSMA1PCyqzc0KDVO17Wz0tRx236A9zKPvtQHphEFblAhuEewAaACcbkNxNcPA o7SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=MBb7/o1IRk0JElBFa4klbTWLM6mKvJph/LCCzFiKFTQ=; fh=AfsjATVnzZRJaUrZvZrNsvo4nEvCYzJfa655Qzt9sTo=; b=dz5FltOaMysTeRVsr3A+jzXoIlMtQY8vRut+jk2k/Zr70I11xOnvU2UVVu7xiQ4W1b /JgbCMBhJmQULzUIz4rQ9Q6/5yox4E5XokYh4jZ0qSALh8QhOLrIft/6KHCcPIHSrRHK MQyhMpOqhbIUFjesEKOsllEZmarfYj8OiCVieoVNo4tco7bcAB1ItGMBSLB0mt+zQ1XX dVkW6oB4DwcTAZ0F+/i/8gloq/KPWrUEuwb+i/0DfYMKkI0sZjCKrGTvNOZaP2vs6wah OJaeJn3XpznCcXmiTY1MXOeXKUQZwRKACbP6SpqyRUen175m9Ldb239eFv5c0F3i2g16 wM6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bdCxsRsu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id o15-20020a17090a4e8f00b002774aec6805si4440772pjh.68.2023.09.25.16.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 16:57:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bdCxsRsu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 516888047D75; Mon, 25 Sep 2023 12:16:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233075AbjIYTQm (ORCPT + 99 others); Mon, 25 Sep 2023 15:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjIYTQl (ORCPT ); Mon, 25 Sep 2023 15:16:41 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D69DDB8 for ; Mon, 25 Sep 2023 12:16:34 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-59c2ca3bcf9so133147297b3.3 for ; Mon, 25 Sep 2023 12:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695669394; x=1696274194; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=MBb7/o1IRk0JElBFa4klbTWLM6mKvJph/LCCzFiKFTQ=; b=bdCxsRsuc6E/4uG33ZbF7h9ni1HZOQM67sMu51HAfAAS4zlgo0HSPBU3eLq6NvdHpf yjN0QQGHskEmGy+HP27CJ/F/tGOWGfsy9UMQIoIZXmzw/ERJC46aAxPQgQLo9QtAdu8I uH36WitWtQ56nNGynkpDOORRFY0pJ/jd/80aCC2oStQUk7tSKM3pIdGZmrj17B7t+g0U d3Xt9YTEPFoH9cjWZ7uw9WCS5CJJmfeNad75bUq5PCntCq2auPuftVKV0ocyTzrwNFeH P6whpXQkW7rOz5QRmyXtO65yxc3GxX9M6ctx+OJ1RgVDIikob2tve+p9hBGwtMdzDleJ gKsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695669394; x=1696274194; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MBb7/o1IRk0JElBFa4klbTWLM6mKvJph/LCCzFiKFTQ=; b=XxXRXUoYCqnVUu0ceH/TUSmsEPdgoVxQbinxsPdeuZdlqkcFoXiqCxsc168/cqq1X0 2bh7jcNkisCWGzuXNvbRXvMFOFSjE0l76lMvJJkJKyZXYpCt4oROYUnINvtAFJkSHV+G fhQLnTh5qsc0jvkD1W2NOmZOkpNPdlbd6DmJ7FHIYbpMMr5Fy4eGvKv32CrWaWl30GcE ZnAyGSREmnMLvRCJjZAhlpe5C6qdCyEIOKMX5ot8mQ7DJ3KUYtESDLfxzxrN+YZCq6IM BJzUYHpllrkQQXMQmaxS5lplo2+NZRu0zBS7dXVUPxQsCu6hhmvGxS4/0IepXXg/F3iu XOhQ== X-Gm-Message-State: AOJu0YwMTyaN5IPLw8MmUga47V+XUnzy68pbYQOSwuJsHg4YlsBm9dLp fiz9zzFxBGNm+r12ypHtJAiBQ1CW8Us= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:ec12:0:b0:589:a5c6:4a8e with SMTP id j18-20020a81ec12000000b00589a5c64a8emr88716ywm.1.1695669394067; Mon, 25 Sep 2023 12:16:34 -0700 (PDT) Date: Mon, 25 Sep 2023 12:16:32 -0700 In-Reply-To: <8c6a1fc8-2ac5-4767-8b02-9ef56434724e@maciej.szmigiero.name> Mime-Version: 1.0 References: <0ffde769702c6cdf6b6c18e1dcb28b25309af7f7.1695659717.git.maciej.szmigiero@oracle.com> <8c6a1fc8-2ac5-4767-8b02-9ef56434724e@maciej.szmigiero.name> Message-ID: Subject: Re: [PATCH] KVM: x86: Ignore MSR_AMD64_BU_CFG access From: Sean Christopherson To: "Maciej S. Szmigiero" Cc: Paolo Bonzini , Borislav Petkov , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Tom Lendacky Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 12:16:41 -0700 (PDT) +Tom On Mon, Sep 25, 2023, Maciej S. Szmigiero wrote: > On 25.09.2023 20:30, Sean Christopherson wrote: > >> > >> Hyper-V enabled Windows Server 2022 KVM VM cannot be started on Zen1 Ryzen > >> since it crashes at boot with SYSTEM_THREAD_EXCEPTION_NOT_HANDLED + > >> STATUS_PRIVILEGED_INSTRUCTION (in other words, because of an unexpected #GP > >> in the guest kernel). > >> > >> This is because Windows tries to set bit 8 in MSR_AMD64_BU_CFG and can't > >> handle receiving a #GP when doing so. > > > > Any idea why? > > I guess it is trying to set some chicken bit? > > By the way, I tested Windows Server 2019 now - it has the same problem. > > So likely Windows 11 and newer version of Windows 10 have it, too. ... > > > diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h > > > index 1d111350197f..c80a5cea80c4 100644 > > > --- a/arch/x86/include/asm/msr-index.h > > > +++ b/arch/x86/include/asm/msr-index.h > > > @@ -553,6 +553,7 @@ > > > #define MSR_AMD64_CPUID_FN_1 0xc0011004 > > > #define MSR_AMD64_LS_CFG 0xc0011020 > > > #define MSR_AMD64_DC_CFG 0xc0011022 > > > +#define MSR_AMD64_BU_CFG 0xc0011023 > > > > What document actually defines this MSR? All of the PPRs I can find for Family 17h > > list it as: > > > > MSRC001_1023 [Table Walker Configuration] (Core::X86::Msr::TW_CFG) > > It's partially documented in various AMD BKDGs, however I couldn't find > any definition for this particular bit (8) - other than that it is reserved. I found it as MSR_AMD64_BU_CFG for Model 16h, but that's Jaguar/Puma, not Zen1. My guess is that Windows is trying to write this thing: MSRC001_1023 [Table Walker Configuration] (Core::X86::Msr::TW_CFG) Read-write. Reset: 0000_0000_0000_0000h. _lthree0_core[3,1]; MSRC001_1023 Bits Description 63:50 Reserved. 49 TwCfgCombineCr0Cd: combine CR0_CD for both threads of a core. Read-write. Reset: 0. Init: BIOS,1. 1=The host Cr0_Cd values from the two threads are OR'd together and used by both threads. 48:0 Reserved. Though that still doesn't explain bit 8... Perhaps a chicken-bit related to yet another speculation bug? Boris or Tom, any idea what Windows is doing? I doubt it changes our options in terms of "fixing" this in KVM, but having a somewhat accurate/helpful changelog would be nice.