From patchwork Tue Oct 18 21:46:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 13011084 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 1CF6BC41535 for ; Tue, 18 Oct 2022 21:46:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbiJRVqu (ORCPT ); Tue, 18 Oct 2022 17:46:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229983AbiJRVqR (ORCPT ); Tue, 18 Oct 2022 17:46:17 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB180BBE2A for ; Tue, 18 Oct 2022 14:46:15 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-356a9048111so150618827b3.6 for ; Tue, 18 Oct 2022 14:46:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=bnjKRO1Jjs2jHP6DoGJsiluSLKIdkDLSSjeGZPUpjjA=; b=Da0pPy4X3ZVFaEuMNV6dm/Y5modIMGa/eD2ANcXTlnok0eWAqQ+Filcde9fkXKVmwA GZ9R5Jbb4zjPyBNOpwGcbLikhUl2skOWZKneCjSV/vNx3xO7b4HDrA7TwxaDqczsbtSI DPS3JSXISkeMQ24TvcMCFOrvEPAJKHNLV+xw7mL3qFJ296Qmiz0gYrCc7ZJlE33ZkXyq jid8saX0B6iJpstshD5u5B4SAW5P+nZfDxCB/epWdOlydkP+LwR7ORr+lKhrrlY3Xm3j 6uYyrygfwhIJyVfW2SLTRSl2/x3IU3HOm8wyb3kEEQwD3ZvKAmc6TFXrQIMOdTP5X+pm FugA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=bnjKRO1Jjs2jHP6DoGJsiluSLKIdkDLSSjeGZPUpjjA=; b=DoG3sBvfiT7hwtMqjtqCrJSsx42IxGGtZMMFwheJJa8A3reJ5Vi5wlLLNZgqToKCEH rQGtEp9L8dMmCVEEfu+bxgD6IoIcg0O3aP5sWLra64g44UPbvrFMAqFEXDKPGhClHEr7 22M4sScV3UFUXgzchyxYsyOs0NnEb+0AJYB5gVsGE2NKsSYlRlwV3KbsQWlSrXkeCcgy iWr6replzoXzHSR89Zq0tyzzV5l9VKiHMp9KSuWuyosoYpjT52665WY2yXae5zyDz3oR P0mfO5VKotsM5pOZKR4LienaM7UMcnrvzDAbIsVCtoOprh+dN22RNZrWw9NbCdf7PNGZ yzvg== X-Gm-Message-State: ACrzQf3t91G/oUZwF83lAgKnmnlQiNj/gu2QbReOgz/FwPii2tpsl3q0 zp4lHR3OMbAchLG7K4diNgk9Kspn/npZ6A== X-Google-Smtp-Source: AMsMyM6kOM1/KDXTnhAIrM+3akQ/2wmWhzbI2obNuuVIFXvEOJJ4px9Rer6g5gqO5ruTGcJQZ28bXOusRpPFQw== X-Received: from dmatlack-n2d-128.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:1309]) (user=dmatlack job=sendgmr) by 2002:a81:6304:0:b0:358:7d68:b6d with SMTP id x4-20020a816304000000b003587d680b6dmr4182378ywb.268.1666129575264; Tue, 18 Oct 2022 14:46:15 -0700 (PDT) Date: Tue, 18 Oct 2022 14:46:04 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog Message-ID: <20221018214612.3445074-1-dmatlack@google.com> Subject: [PATCH v2 0/8] KVM: selftests: Fix and clean up emulator_error_test From: David Matlack To: Paolo Bonzini Cc: Sean Christopherson , Jim Mattson , Peter Xu , Colton Lewis , Aaron Lewis , kvm@vger.kernel.org, David Matlack Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Miscellaneous fixes and cleanups to emulator_error_test. The reason I started looking at this test is because it fails when TDP is disabled, which pollutes my test results wheneveer I am testing a new series for upstream. v2: - Split emulator_error_test into 2 separate tests to ensure continued test coverage of KVM emulation in response to EPT violations when "allow_smaller_maxphyaddr && guest.MAXPHYADDR < host.MAXPHADDR". [Sean] - Test that flds generates #PF(RSVD) when TDP is disabled [Sean] v1: https://lore.kernel.org/kvm/20220929204708.2548375-1-dmatlack@google.com/ David Matlack (8): KVM: selftests: Rename emulator_error_test to smaller_maxphyaddr_emulation_test KVM: selftests: Explicitly require instructions bytes KVM: selftests: Delete dead ucall code KVM: selftests: Move flds instruction emulation failure handling to header KVM: x86/mmu: Use BIT{,_ULL}() for PFERR masks KVM: selftests: Copy KVM PFERR masks into selftests KVM: selftests: Expect #PF(RSVD) when TDP is disabled KVM: selftest: Add a test for KVM_CAP_EXIT_ON_EMULATION_FAILURE arch/x86/include/asm/kvm_host.h | 20 +- tools/testing/selftests/kvm/.gitignore | 3 +- tools/testing/selftests/kvm/Makefile | 3 +- .../selftests/kvm/include/x86_64/processor.h | 31 +++ .../kvm/x86_64/emulator_error_test.c | 193 ------------------ .../x86_64/exit_on_emulation_failure_test.c | 42 ++++ .../selftests/kvm/x86_64/flds_emulation.h | 67 ++++++ .../smaller_maxphyaddr_emulation_test.c | 118 +++++++++++ 8 files changed, 272 insertions(+), 205 deletions(-) delete mode 100644 tools/testing/selftests/kvm/x86_64/emulator_error_test.c create mode 100644 tools/testing/selftests/kvm/x86_64/exit_on_emulation_failure_test.c create mode 100644 tools/testing/selftests/kvm/x86_64/flds_emulation.h create mode 100644 tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c base-commit: 458e98746fa852d744d34b5a8d0b1673959efc2f