From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75471C433EF for ; Thu, 17 Mar 2022 13:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234458AbiCQNWa (ORCPT ); Thu, 17 Mar 2022 09:22:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbiCQNW1 (ORCPT ); Thu, 17 Mar 2022 09:22:27 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2DD41760E9; Thu, 17 Mar 2022 06:21:10 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AAFF421108; Thu, 17 Mar 2022 13:21:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1647523269; h=from:from:reply-to: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=OQSNVY5ry6JPZidVzTQekm/g7RGFWM3qtv5Uggb/ziA=; b=bwSOJ2vnD+dtYYUcUSM425vvrfLnK63Y6Of6LE2Lch+TeaVLiBQWfEJnxVMEPuWzAPJWS2 T1RC/nJ8Pgk+wvrv6HRfB0RFeTlwJbK6J+KgmhX197lzYM6jcfCu55rvQgNDKDgBJUgKbJ KzHZzk+1K3EzFF4fdxr2Ki9XMyX/CVE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1647523269; h=from:from:reply-to: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=OQSNVY5ry6JPZidVzTQekm/g7RGFWM3qtv5Uggb/ziA=; b=iL4+jc8bcuBD9X4xuAYrd/i6+tbXXhs3vl91B0j4W5tP/aHmqf5q/VCABCDNEkFooR2qdp 5vDIeftzHCzeTEDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 631EB13BA9; Thu, 17 Mar 2022 13:21:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EpZKFsU1M2L4DQAAMHmgww (envelope-from ); Thu, 17 Mar 2022 13:21:09 +0000 Date: Thu, 17 Mar 2022 14:21:08 +0100 From: Joerg Roedel To: Vasant Karasulli Cc: linux-kernel@vger.kernel.org, bp@alien8.de, kvm@vger.kernel.org, x86@kernel.org, thomas.lendacky@amd.com, Varad Gautam Subject: Re: [PATCH v5 1/1] x86/test: Add a test for AMD SEV-ES #VC handling Message-ID: References: <20220208162623.18368-1-vkarasulli@suse.de> <20220208162623.18368-2-vkarasulli@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220208162623.18368-2-vkarasulli@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vasant, thanks for submitting this. On Tue, Feb 08, 2022 at 05:26:23PM +0100, Vasant Karasulli wrote: > From: Varad Gautam > > Add a KUnit based test to validate Linux's VC handling, and introduce > a new CONFIG_X86_TESTS to cover such tests. The test: > 1. installs a kretprobe on the #VC handler (sev_es_ghcb_hv_call, to > access GHCB before/after the resulting VMGEXIT). > 2. triggers an NAE. > 3. checks that the kretprobe was hit with the right exit_code available > in GHCB. > > Since relying on kprobes, the test does not cover NMI contexts. > > Signed-off-by: Varad Gautam > Signed-off-by: Vasant Karasulli > --- > arch/x86/Kbuild | 2 + > arch/x86/Kconfig.debug | 16 ++++ > arch/x86/kernel/Makefile | 7 ++ > arch/x86/tests/Makefile | 3 + > arch/x86/tests/sev-test-vc.c | 154 +++++++++++++++++++++++++++++++++++ > 5 files changed, 182 insertions(+) > create mode 100644 arch/x86/tests/Makefile > create mode 100644 arch/x86/tests/sev-test-vc.c Can we split this up a bit? Say into an initial patch which adds arch/x86/tests/ and the Kconfig option and then three patches adding the tests: 1. Infrastructure and instruction-based tests (cpuid, wbinvd) 2. Register access tests (MSR, DR7) 3. IO tests (mmio, ioio) > +static void sev_es_nae_mmio(struct kunit *test) > +{ > + unsigned long lapic_ver_pa = 0xfee00030; /* APIC_DEFAULT_PHYS_BASE + APIC_LVR */ Instead of the comment, please use the values directly to assign the variable. Regards, -- Jörg Rödel jroedel@suse.de SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 Nürnberg Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev