Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1153806rwo; Wed, 2 Aug 2023 09:26:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlFw1BlQH/R1d32fgQH7PUrpull3Ky5BQniq1eMv3SXi+wVfWFt9yKkB6kWu9Pm2F+2IZ7Vy X-Received: by 2002:a17:902:e746:b0:1ab:11c8:777a with SMTP id p6-20020a170902e74600b001ab11c8777amr19734671plf.13.1690993602075; Wed, 02 Aug 2023 09:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690993602; cv=none; d=google.com; s=arc-20160816; b=ai9dXuJN4SzFxOng5NmP7n3uBzWWre7yw+58hlKuzTFcF0EFKq0gprrzk5VOqBKO+1 qC8pOnTrESufmeaJ3Ka8QkXOTjr0OwCqtPI38oT/9PMrNjhjtwoV6ofS/N+8FaSHSIRd wgF9JOWyBXfcMb9JZ7Wkmi059oc7ZmIs/2X8UjpWpHNLNDrmmbK/sGAIHQd9gZgIwyc/ qOzTwaoQxtnh0hUpdLeI7rVOEq1YNtHTzWJeot1zf+j5l8OHwRL1Oj2s/kJ38WPa9dpb d9QxXPY0x8b9OGNdInshXz3Ld3DWccMe/l0UgwVGbTizFq+jQ4zKA6DGqbln94lJjQ5Y sVgQ== 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=eXA1T7JmGWAKlz5WKva9qUA0PJ5k+FcRMYlr91yxr48=; fh=/OeRilf9OQVhmfIPbwulsKpPHdUUb+i4ioYcpliqSBM=; b=JNGTtvUicpmAWKyJQtthoR/tmTeHJ6Ws68tDjc/6Th6+f/BCn4gYAF67x4AFQ9/9Ax MmcmbK0qkQJ4eXXfUct8bAyDPKrC3zS+FAUxn6k4nay5ys4z+GIUyJkTL9CFNZA6i9RY /JYoXZnCaksMm1iZDf1Z3cA0/cAjwT52rlluQeQ0p8loeHHNDUGeILaJzk54EvsWuCyU XNDMkMD28UT7/YdPuvnPNZaHC1/630FgCUe3gdv6ihMTusvi43hzqy5T2OVa1Mk7Fw38 hNsHaE/PBcOON+ZYrh3OBIA79fi5Lwg0qtXCavRhtwlB80VqazIVyc1NnvpcsAbdzOX0 lX7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="ol/qMSiv"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j17-20020a170902da9100b001bc24370e5bsi3671093plx.356.2023.08.02.09.26.29; Wed, 02 Aug 2023 09:26:42 -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=@google.com header.s=20221208 header.b="ol/qMSiv"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234991AbjHBPgC (ORCPT + 99 others); Wed, 2 Aug 2023 11:36:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234931AbjHBPfr (ORCPT ); Wed, 2 Aug 2023 11:35:47 -0400 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B3023AB7 for ; Wed, 2 Aug 2023 08:35:14 -0700 (PDT) Received: by mail-pl1-x64a.google.com with SMTP id d9443c01a7336-1bbbc4ae328so53566645ad.1 for ; Wed, 02 Aug 2023 08:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690990513; x=1691595313; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=eXA1T7JmGWAKlz5WKva9qUA0PJ5k+FcRMYlr91yxr48=; b=ol/qMSivwT1iENMFxDjh2B4/2i95/AvHO1rUnkjEW/0fGNMo/re/cW2NcTSCSErt5W hwZfNL0ZL9FIqji9/cSg0jWD4ON9pJrh+xFXl2E6C+so9LaU9gIpAb9eJGWg07Djw4oe sG8+BfwtbI2QsZeVLieqrkGRxHSISsrqgpVAwbLbU35r6H5Vc+pdAfKL1KCO59mRIW/s IU7B3oZxnCbiZV0GbNjnjMktXCQLMdKTrG5cydYCsttNocDlbqxSAinPbehQ+qHSEJSf 3KFUxTMN2eV/a1nzwqlOx4XdLhwPVWUL22lAYKh0j9pavCY+hC+HvAaz48CbRxx1PaJw rIyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690990513; x=1691595313; 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=eXA1T7JmGWAKlz5WKva9qUA0PJ5k+FcRMYlr91yxr48=; b=UT4KQ3OsdzqkkuUa+6BjEQDtYsry8TJzrsz3D7DsV6m2UDJAx30Dfwr1nQGUcl2fq7 sLBtRFKSdpw9UMgsIXtIrnZBkrl18UuXsDKLAtSBRRjdyYkqQFezTbumVKL/qFZ0kbWb NyimYMFiCk061YKhDj+XStIXjDmmD3JSr7pU4fiRwQ7//CjGu4XtlyvfB3B4naPTFHSl MT0NXa0EFewRmKi5o08bwBoC5CxWg9yakrkrkKWgUTO3MLhK0qErMb0+vOMAzG6r4tDi a2D5pNPi8EvQQbEK8IlkBXNF9J5iutRV0SxPSxHllisuFs/voMKrmg8amfh4qcedX8fK YUFw== X-Gm-Message-State: ABy/qLZOEFJP9odY040SA/3gydBHAcSvf4XVn8izfVs+qLc7KMM60Vef O0doXQz8Dp/kRq5LpsYMH6kwwWYhCa0= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:ea08:b0:1bb:c7c5:3eb6 with SMTP id s8-20020a170902ea0800b001bbc7c53eb6mr90737plg.7.1690990513727; Wed, 02 Aug 2023 08:35:13 -0700 (PDT) Date: Wed, 2 Aug 2023 08:35:12 -0700 In-Reply-To: <7b4d5df0-f554-2fc0-5c19-021f8eb3f6aa@amd.com> Mime-Version: 1.0 References: <8eb933fd-2cf3-d7a9-32fe-2a1d82eac42a@mail.ustc.edu.cn> <4ebb3e20-a043-8ad3-ef6c-f64c2443412c@amd.com> <544b7f95-4b34-654d-a57b-3791a6f4fd5f@mail.ustc.edu.cn> <7a4f3f59-1482-49c4-92b2-aa621e9b06b3@amd.com> <7b4d5df0-f554-2fc0-5c19-021f8eb3f6aa@amd.com> Message-ID: Subject: Re: [Question] int3 instruction generates a #UD in SEV VM From: Sean Christopherson To: Tom Lendacky Cc: Wu Zongyo , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL 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 On Wed, Aug 02, 2023, Tom Lendacky wrote: > On 8/2/23 10:04, Sean Christopherson wrote: > > Side topic, KVM should require nrips for SEV and beyond, I don't see how SEV can > > possibly work if KVM doesn't utilize nrips. E.g. this > > > > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c > > index 2eace114a934..43e500503d48 100644 > > --- a/arch/x86/kvm/svm/svm.c > > +++ b/arch/x86/kvm/svm/svm.c > > @@ -5111,9 +5111,11 @@ static __init int svm_hardware_setup(void) > > svm_adjust_mmio_mask(); > > + nrips = nrips && boot_cpu_has(X86_FEATURE_NRIPS); > > + > > /* > > * Note, SEV setup consumes npt_enabled and enable_mmio_caching (which > > - * may be modified by svm_adjust_mmio_mask()). > > + * may be modified by svm_adjust_mmio_mask()), as well as nrips. > > */ > > sev_hardware_setup(); > > You moved the setting of nrips up, I'm assuming you then want to add a check > in sev_hardware_setup() for nrips? Doh. I like to think I would have noticed that I forgot to add that check before postinga patch, but I give myself 50/50 odds at best.