Message ID | 20240910152207.38974-5-nikwip@amazon.de |
---|---|
State | New |
Headers | show
Return-Path: <kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=cIp6G5oM; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amazon.de header.i=@amazon.de header.a=rsa-sha256 header.s=amazon201209 header.b=onwNz2cR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X37Hb1l3nz1y1x for <incoming@patchwork.ozlabs.org>; Wed, 11 Sep 2024 01:42:19 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6bWrk9yhBvezDmyk75jHK+jSHtzgk6sd4tVCrwdz5RI=; b=cIp6G5oMjzNuAR 4A5zCYX/dTXnFurRTZYopwf2JgjeQHT9+jU2732MBGhz/zR+HoyLQh8DWePKJ2qWP0JQKGksmx9jd ww+Qu844tm44WJa+qfWK/pnKr4tzYcfMjZ222P69+Pd2PgnVKiqM34g4Q0ecvOpZeXWHhwkHF7eaj +eNN92zWZp4OK0EbpGvAYDDlyKmW/ujqXH+tv+5nMNmWbSiFKMQtnGDjsnmhnkqfyErTnbgxIrk9S gfe2OzjVLWSDRvSkTyBep7u6Lum4fGtEDZ4Jea37BO/xqchGUrYjxPqC25cQE3Pqx4JbK0vJma+Ob 8VrZWNQhjFCiHnbBHkfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so30T-00000006BET-3MWZ; Tue, 10 Sep 2024 15:42:17 +0000 Received: from smtp-fw-9106.amazon.com ([207.171.188.206]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so2iD-000000065Dg-0GAQ for kvm-riscv@lists.infradead.org; Tue, 10 Sep 2024 15:23:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1725981805; x=1757517805; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lz3T3yEcwSJRvadrpSBViYV6gSG8fKxfLSa5nbTuxyw=; b=onwNz2cRBMgtvZJoje0nbsyFiSjF8l2Wmr1GnLA2+WmEQGkUb0+311SF gaJ4K1gXw5pwCKBrEEGJGZbQJFHNd4ePtGf4Q45msPOaTJyudtVqLJ+ZV 3nVkbKaFdX4q6ffNuzRwtRAO56CVtfXoqo2CNrH8lTuXNZa7pWcar6ow4 s=; X-IronPort-AV: E=Sophos;i="6.10,217,1719878400"; d="scan'208";a="758470419" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.25.36.210]) by smtp-border-fw-9106.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2024 15:23:25 +0000 Received: from EX19MTAEUA001.ant.amazon.com [10.0.43.254:25293] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.16.205:2525] with esmtp (Farcaster) id 36754a66-9e06-49ef-ae03-a1478e3cf7ea; Tue, 10 Sep 2024 15:23:23 +0000 (UTC) X-Farcaster-Flow-ID: 36754a66-9e06-49ef-ae03-a1478e3cf7ea Received: from EX19D004EUA001.ant.amazon.com (10.252.50.27) by EX19MTAEUA001.ant.amazon.com (10.252.50.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Tue, 10 Sep 2024 15:23:23 +0000 Received: from EX19MTAUEA001.ant.amazon.com (10.252.134.203) by EX19D004EUA001.ant.amazon.com (10.252.50.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Tue, 10 Sep 2024 15:23:22 +0000 Received: from dev-dsk-nikwip-1b-bc9ec026.eu-west-1.amazon.com (10.253.74.52) by mail-relay.amazon.com (10.252.134.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34 via Frontend Transport; Tue, 10 Sep 2024 15:23:21 +0000 From: Nikolas Wipper <nikwip@amazon.de> To: Paolo Bonzini <pbonzini@redhat.com>, Sean Christopherson <seanjc@google.com>, Vitaly Kuznetsov <vkuznets@redhat.com> CC: Nicolas Saenz Julienne <nsaenz@amazon.com>, Alexander Graf <graf@amazon.de>, James Gowans <jgowans@amazon.com>, <nh-open-source@amazon.com>, Thomas Gleixner <tglx@linutronix.de>, "Ingo Molnar" <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, <linux-kernel@vger.kernel.org>, <kvm@vger.kernel.org>, <x86@kernel.org>, <linux-doc@vger.kernel.org>, <linux-kselftest@vger.kernel.org>, <kvmarm@lists.linux.dev>, <kvm-riscv@lists.infradead.org>, Nikolas Wipper <nikwip@amazon.de> Subject: [PATCH 04/15] KVM: x86/mmu: Store GPA in exception if applicable Date: Tue, 10 Sep 2024 15:21:56 +0000 Message-ID: <20240910152207.38974-5-nikwip@amazon.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240910152207.38974-1-nikwip@amazon.de> References: <20240910152207.38974-1-nikwip@amazon.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_082325_176800_1067057B X-CRM114-Status: GOOD ( 12.50 ) X-Spam-Score: -2.9 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Store the GPA where the page walk failed within the walker's exception. Precisely this means, the PTE's GPA, if it couldn't be resolved or it caused an access violation, or the fully translated GPA in [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [207.171.188.206 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [207.171.188.206 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [207.171.188.206 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [207.171.188.206 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [207.171.188.206 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines -0.1 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <kvm-riscv.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/kvm-riscv>, <mailto:kvm-riscv-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/kvm-riscv/> List-Post: <mailto:kvm-riscv@lists.infradead.org> List-Help: <mailto:kvm-riscv-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/kvm-riscv>, <mailto:kvm-riscv-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kvm-riscv" <kvm-riscv-bounces@lists.infradead.org> Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
KVM: x86: Introduce new ioctl KVM_TRANSLATE2
|
expand
|
diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h index afd8e86bc6af..6501ce1c76fd 100644 --- a/arch/x86/kvm/kvm_emulate.h +++ b/arch/x86/kvm/kvm_emulate.h @@ -25,6 +25,12 @@ struct x86_exception { u16 error_code; bool nested_page_fault; u64 address; /* cr2 or nested page fault gpa */ + /* + * If error_code is a page fault, this will be the address of the last + * visited page table, or the fully translated address if it caused the + * failure. Otherwise, it will not hold a meaningful value. + */ + u64 gpa_page_fault; u8 async_page_fault; unsigned long exit_qualification; #define KVM_X86_UNMAPPED_PTE_GPA BIT(0) diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h index f6a78b7cfca1..74651b097fa0 100644 --- a/arch/x86/kvm/mmu/paging_tmpl.h +++ b/arch/x86/kvm/mmu/paging_tmpl.h @@ -485,6 +485,7 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, walker->fault.vector = PF_VECTOR; walker->fault.error_code_valid = true; walker->fault.error_code = errcode; + walker->fault.gpa_page_fault = real_gpa; #if PTTYPE == PTTYPE_EPT /*
Store the GPA where the page walk failed within the walker's exception. Precisely this means, the PTE's GPA, if it couldn't be resolved or it caused an access violation, or the fully translated GPA in case the final page caused an access violation. Returning the GPA from the page walker directly is not possible, because other code within KVM relies on INVALID_GPA being returned on failure. Signed-off-by: Nikolas Wipper <nikwip@amazon.de> --- arch/x86/kvm/kvm_emulate.h | 6 ++++++ arch/x86/kvm/mmu/paging_tmpl.h | 1 + 2 files changed, 7 insertions(+)