From patchwork Wed Feb 10 18:26:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12081587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 596C7C433E6 for ; Wed, 10 Feb 2021 18:29:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2895664DD4 for ; Wed, 10 Feb 2021 18:29:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234094AbhBJS3S (ORCPT ); Wed, 10 Feb 2021 13:29:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234149AbhBJS06 (ORCPT ); Wed, 10 Feb 2021 13:26:58 -0500 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86304C061793 for ; Wed, 10 Feb 2021 10:26:17 -0800 (PST) Received: by mail-qv1-xf49.google.com with SMTP id a12so2096062qvo.3 for ; Wed, 10 Feb 2021 10:26:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=JZ1+OeX1TQvRpSX6JVWSAIUPwsDYxG2Z3TWK9Qe0O5U=; b=NfFuUEeo+s9u+tT8+c/ZsIpa4exSCJzAS5ypgoPfEefptNAPa7vv7w9wZsJhwDRjhl IHTvI2lAI2kDu5osP8WWLS6XaoWEKHwTo1wFmdudx2DDti0whx0MZ9ecqlRTcoQvwSHP UwBEe27vkJVFDsCrgO1lzIwnsZ46cBT2QqM8CXi0qiZe7dtnBf6gChHUWtI/MW8llzRj 0727GsQbZwC62YlQdfL1A0va57Ey5Kb+wDjRh7Encx9ta5jnZMJ18/P+4X1T/J4qZD/3 f+eglDIXE4QnxMrE3Bd4tROFQc5FtWEjKwsR48xU4EITj504ULALGIQE5EJC9y1eIVE9 pk5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=JZ1+OeX1TQvRpSX6JVWSAIUPwsDYxG2Z3TWK9Qe0O5U=; b=npEOcS2D9rHRk6rmSCC9z7QPndRs21yAnfWuImQjVRtBbbVj7kmplAdOZyqufZmRH9 Btpa+DdJJRZV3gnrqDQLFH2NdtG5Kh8OFaE7DRa11+TXdL3l46R9V9j3DhMS/+i5RLdK d0yEHEGmSKE6kxDdDndPQrP35ETQUjgvDUysbiW8saf0pqXaMs5UClSWGWeYbCW1hToy FjBlDIacdkfZI8nuQOkYu/drSx985eTWT9NuliYfJX6AU7I/jFGUhIy/41+fF6YB0sUx 5Cvg5TdxzDnMSohpYKOJrg3rX9CrgQT0DtlSV4Qtrp7VR3kwX8mtZqHqCedj0TfA9ZPn VrKw== X-Gm-Message-State: AOAM533Ba1eUrVD8WKTXPbg06au9IW/QvvUAA/+DP4LCixo/obT1zZLl g9uRxC41lJoxF3ST75NAWnRsA3Kmh1M= X-Google-Smtp-Source: ABdhPJzxWDnH96alg+/xCqZ29NSwweiSbYq+2GZDKyN3IOAUJdc5jlmCZGKSGBCfA+Ulq5gRHfJa+xRx7AU= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:11fc:33d:bf1:4cb8]) (user=seanjc job=sendgmr) by 2002:a0c:fa51:: with SMTP id k17mr425208qvo.29.1612981576645; Wed, 10 Feb 2021 10:26:16 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 10 Feb 2021 10:26:05 -0800 In-Reply-To: <20210210182609.435200-1-seanjc@google.com> Message-Id: <20210210182609.435200-2-seanjc@google.com> Mime-Version: 1.0 References: <20210210182609.435200-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH 1/5] KVM: selftests: Ignore recently added Xen tests' build output From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, David Woodhouse Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add the new Xen test binaries to KVM selftest's .gitnore. Signed-off-by: Sean Christopherson Reviewed-by: David Woodhouse --- tools/testing/selftests/kvm/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftests/kvm/.gitignore index 1b32c97f8c82..3a84394829ea 100644 --- a/tools/testing/selftests/kvm/.gitignore +++ b/tools/testing/selftests/kvm/.gitignore @@ -26,6 +26,8 @@ /x86_64/vmx_set_nested_state_test /x86_64/vmx_tsc_adjust_test /x86_64/xapic_ipi_test +/x86_64/xen_shinfo_test +/x86_64/xen_vmcall_test /x86_64/xss_msr_test /x86_64/vmx_pmu_msrs_test /demand_paging_test From patchwork Wed Feb 10 18:26:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12081589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A26CC433E0 for ; Wed, 10 Feb 2021 18:30:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08E2364E57 for ; Wed, 10 Feb 2021 18:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234167AbhBJS3p (ORCPT ); Wed, 10 Feb 2021 13:29:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234152AbhBJS1A (ORCPT ); Wed, 10 Feb 2021 13:27:00 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2A54C061797 for ; Wed, 10 Feb 2021 10:26:19 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id g17so754355ybh.4 for ; Wed, 10 Feb 2021 10:26:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=qP8W8fesy6rJnl8LFgqcqjLlutMaErDAaGGZqrc5ReM=; b=IDp6SH8FucguzZwM8vydazWPuRkkyBURwiL/ZFhG83f5Q5Y+skiev5m88thBUBeLYl Iay7T5UchXCsRJGKwHSl4hVNHJ/uBXakaJW5DzO7yZx/DyNf4TA8C9JFEoBsct6RZp0/ sKNwBbf3IFpvZbbYrwy15yEgKWeCtsA29trFbXPLw0+5eCelppO7mtBn+X/1IpXEQr70 iUilso7ROd+pLw5F43ylf16NL7Pyr8kl11UulCYa4UYzdZHZKsnhGvHosy94UoAabhaz X1pvWU5032pfh2HnarV4zCvh06PlflO5u6EgP2Te3X8H5jJPaYw7yy+BC6lRWTPPQSOF 148g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=qP8W8fesy6rJnl8LFgqcqjLlutMaErDAaGGZqrc5ReM=; b=DE7N/JaLq/fDkhoOaQkTVkVWfrrps2mZkuytu6sW8OGi8ocbRQsrV9h/YgAuFJ9mn6 BCVdPh5zVGz9WJ476eIEP/pG1FQ1IWGxT1EZzZQA6rQXW1GN3v61411cbtsLLmF6vjQ+ ZZ+wdJwXI/uHeR4tYaRmBaNyTJkJu4xZSyzuXU9HyfRUJ4iLNCYjNQ0pxob5+SwGnHi2 AVHT6UA8xBuCh5qv5KmrC74gLxFZQgr1Ebrkb08nsbJYyJ8kpANumiqnRYiyA0ssRVE1 8NVCRoJIBdc0yTHcbccLFXtO2RXGYPskdmxf6+PFyGRvmXB/di17NMtSt9MEGq6w9lZi aEOA== X-Gm-Message-State: AOAM532m9eI0LENAYXZz5cQ1MxixVx+p3bcZ5zXlhTiFprjSFWiQbGaz HN90vXWyMfsy8cno7J3eljI5QkBRP+Y= X-Google-Smtp-Source: ABdhPJyTPd8l9+mGvnSeTAJBG98ENRZMMYVImrNTwMJ6HjhsDvl2vtCgsZfrvQuK99U9B1lHIpDbTDAOWVM= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:11fc:33d:bf1:4cb8]) (user=seanjc job=sendgmr) by 2002:a25:ad26:: with SMTP id y38mr6225800ybi.391.1612981579216; Wed, 10 Feb 2021 10:26:19 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 10 Feb 2021 10:26:06 -0800 In-Reply-To: <20210210182609.435200-1-seanjc@google.com> Message-Id: <20210210182609.435200-3-seanjc@google.com> Mime-Version: 1.0 References: <20210210182609.435200-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH 2/5] KVM: selftests: Fix size of memslots created by Xen tests From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, David Woodhouse Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org For better or worse, the memslot APIs take the number of pages, not the size in bytes. The Xen tests need 2 pages, not 8192 pages. Fixes: 8d4e7e80838f ("KVM: x86: declare Xen HVM shared info capability and add test case") Cc: David Woodhouse Signed-off-by: Sean Christopherson Reviewed-by: David Woodhouse --- tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c | 3 +-- tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c index bdb3feb86b5b..cb3963957b3b 100644 --- a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c +++ b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c @@ -79,8 +79,7 @@ int main(int argc, char *argv[]) /* Map a region for the shared_info page */ vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, - SHINFO_REGION_GPA, SHINFO_REGION_SLOT, - 2 * getpagesize(), 0); + SHINFO_REGION_GPA, SHINFO_REGION_SLOT, 2, 0); virt_map(vm, SHINFO_REGION_GPA, SHINFO_REGION_GPA, 2, 0); struct kvm_xen_hvm_config hvmc = { diff --git a/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c b/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c index 86653361c695..8389e0bfd711 100644 --- a/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c +++ b/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c @@ -102,8 +102,7 @@ int main(int argc, char *argv[]) /* Map a region for the hypercall pages */ vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, - HCALL_REGION_GPA, HCALL_REGION_SLOT, - 2 * getpagesize(), 0); + HCALL_REGION_GPA, HCALL_REGION_SLOT, 2, 0); virt_map(vm, HCALL_REGION_GPA, HCALL_REGION_GPA, 2, 0); for (;;) { From patchwork Wed Feb 10 18:26:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12081591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B156C4332D for ; Wed, 10 Feb 2021 18:30:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D4CA64E7D for ; Wed, 10 Feb 2021 18:30:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232996AbhBJS34 (ORCPT ); Wed, 10 Feb 2021 13:29:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233947AbhBJS1E (ORCPT ); Wed, 10 Feb 2021 13:27:04 -0500 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA60FC061788 for ; Wed, 10 Feb 2021 10:26:23 -0800 (PST) Received: by mail-qk1-x74a.google.com with SMTP id f16so2284732qkk.20 for ; Wed, 10 Feb 2021 10:26:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=e/+smwaphYxpb2OBykRaiI2qxi+r1iC3TI9cKW9LQAY=; b=SBHmhZobtoi3KqCYzyV03uf8QCxFqDBqLqXozwb3/jdSQmszqqm9TiOh6dwoO0jqtf bBelHwWVkPhnpTt81RR2KVeERjmmK52LgFlViDjTmb0pUWAFWJySNdxqbEzuZZLsoxca Ryl1zbekb/Ayi6V0ZGa+KgMlWLPAujl4ETHZWu7nOsk24fRLu6mG3qzyt0hSTxG5imY1 5S6nHum5lYGtJ9k/6X1+bAftzRodlEzz88hzLKcJFOusrfbud/b5iOKkHIQdCAp5+QbN nnkHBRkaORYgphz/FK/Q4E6DyxlN8s1SU6aYwwF/AHZDNh5pxMUK9H8IPO2/cOEr8mpf Q6oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=e/+smwaphYxpb2OBykRaiI2qxi+r1iC3TI9cKW9LQAY=; b=UDLl9HJkYXNlgR21ZgRMs5/2Ts6Ve6wSGc2yxO6wtSEY2ZdHIz+ox+/pIsOdjMdMYZ cmksVQsI/jSaYzYK/r1tgWmVpLZ2PF5pqrjRtog2XiOQAypIS8vrbmNJM5IERLgY5qbN D1Wa2+85fgMUVfhYMhOgK9ESi0Bx53fAGoMu/N5AO/B8HIMurHG9Yms3iTKL5/+B5jHI sWGYreqPM2bAZc73Bqdul4XxSEGLjDh5eyP6sNY0A7KdlBLMIVb18g7pq9/Rhx0beoeK 3fS5cGY0nJ4LZMGHt+FUMhZ27Cf2ewMwgvT8KQZxHEfrjk9QZca3UuMSbu3YMBQTVEhv mk9A== X-Gm-Message-State: AOAM531ms1PANLXje1K1pfMMxX/g4lUtFEIHYjNbFX+re+EQ+8fZuq/e 55ZGZ3ZOlrmsGryvh0XiXKABFS/PsQ8= X-Google-Smtp-Source: ABdhPJxIbp6/W2XHdD5AboBQyWQNYv/qugOTUPti7CdCCnJohaae/ys6EzLmx61wIk3rmhTJbVA8Jd5jWKY= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:11fc:33d:bf1:4cb8]) (user=seanjc job=sendgmr) by 2002:ad4:54ad:: with SMTP id r13mr4104809qvy.48.1612981581338; Wed, 10 Feb 2021 10:26:21 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 10 Feb 2021 10:26:07 -0800 In-Reply-To: <20210210182609.435200-1-seanjc@google.com> Message-Id: <20210210182609.435200-4-seanjc@google.com> Mime-Version: 1.0 References: <20210210182609.435200-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH 3/5] KVM: selftests: Fix hex vs. decimal snafu in Xen test From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, David Woodhouse Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The Xen shinfo selftest uses '40' when setting the GPA of the vCPU info struct, but checks for the result at '0x40'. Arbitrarily use the hex version to resolve the bug. Fixes: 8d4e7e80838f ("KVM: x86: declare Xen HVM shared info capability and add test case") Cc: David Woodhouse Signed-off-by: Sean Christopherson Reviewed-by: David Woodhouse --- tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c index cb3963957b3b..b2a3be9eba8e 100644 --- a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c +++ b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) struct kvm_xen_vcpu_attr vi = { .type = KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO, - .u.gpa = SHINFO_REGION_GPA + 40, + .u.gpa = SHINFO_REGION_GPA + 0x40, }; vcpu_ioctl(vm, VCPU_ID, KVM_XEN_VCPU_SET_ATTR, &vi); From patchwork Wed Feb 10 18:26:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12081593 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61AFDC433E0 for ; Wed, 10 Feb 2021 18:30:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2991D64E57 for ; Wed, 10 Feb 2021 18:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233326AbhBJSaM (ORCPT ); Wed, 10 Feb 2021 13:30:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234195AbhBJS1w (ORCPT ); Wed, 10 Feb 2021 13:27:52 -0500 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 624DBC0617AB for ; Wed, 10 Feb 2021 10:26:24 -0800 (PST) Received: by mail-qv1-xf4a.google.com with SMTP id h13so2069056qvo.18 for ; Wed, 10 Feb 2021 10:26:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=QyQE3EdrqBvyx/EpOPhJj5SBwQHKK6yPydf0zBuWnjI=; b=IZQDi86ZCM/UWeCQWeODOWfhtsGqzS5/TOXfadVuSw6WuPvR8j13JDMi2i0sh6vESF IqAhmzewaORsdMThrJ9fVlCP/yep47VjEFXUTMJkhK3r5Zhwv9A+tQqr8bRCa6hFjoZM G6SefOgNDG7bNlOY/Ue9Xivk/y6AZ7JJaBjyb9xm4HX+7ZRA5hWsHdjBaSM0URW9ku1e RWbeGJiqdnlT/vqcmw92OFOT8xxDu3+SSOlnov4hDv0Ty3iqzSpRTVFcgHDlKhmjmtce k1t/pP2AKolsdY9WIZZeEPTVi9Pb8oAnwhUhWG21frgllQ/vS9giudZ10Ft7+UaJbgf0 cheQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=QyQE3EdrqBvyx/EpOPhJj5SBwQHKK6yPydf0zBuWnjI=; b=qgj4KpIscJaqt0LnOPKPc3BjPk+Z+EHHjY/dEKXkexJMVQMSRVab6n3IMqaMWBEEli T77bo3/JIwKQRAqSsX8H6nY9KY0DHvuABv7EPByXOySG93RYqsWlLJiTBhKYnuYAS2Yr Kj2nnb0sb9ryATwzRuClw8xc2R5rLPo7MLPoQMHAF1OJZUtmAJFbqndiRcYviwyEpida crWkTPIVU1Ej1ToRyDMOr3spD9nEGpYpoIBznd7EtWjxX6B+qxBGh4vMd5WRuyz6dhcK dukSZ/R04V4Wu+pE/6wPOwGrIhx5TJ8izajDPlr6tjEXPZTGZLjlWjrZslsjhuuStxAV jmrA== X-Gm-Message-State: AOAM530lkRps37TS/bbNSPb37+NT8AirwXwZz/Po+pKCVihuUGpF+o6Z PNEM0MkctpxPJ5rM7JLxw8RrEjER49s= X-Google-Smtp-Source: ABdhPJz4sOmQy0NThSlPmmMSaR5smiCWwLuIHxk9+mbZKXuUI0AT3Lq++1jU3lJsPrUA7M5PBCzKczekcuE= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:11fc:33d:bf1:4cb8]) (user=seanjc job=sendgmr) by 2002:a0c:bd93:: with SMTP id n19mr4048142qvg.5.1612981583481; Wed, 10 Feb 2021 10:26:23 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 10 Feb 2021 10:26:08 -0800 In-Reply-To: <20210210182609.435200-1-seanjc@google.com> Message-Id: <20210210182609.435200-5-seanjc@google.com> Mime-Version: 1.0 References: <20210210182609.435200-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH 4/5] KVM: sefltests: Don't bother mapping GVA for Xen shinfo test From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, David Woodhouse Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Don't bother mapping the Xen shinfo pages into the guest, they don't need to be accessed using the GVAs and passing a define with "GPA" in the name to addr_gva2hpa() is confusing. Cc: David Woodhouse Signed-off-by: Sean Christopherson Reviewed-by: David Woodhouse --- tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c index b2a3be9eba8e..9246ea310587 100644 --- a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c +++ b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c @@ -80,7 +80,6 @@ int main(int argc, char *argv[]) /* Map a region for the shared_info page */ vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, SHINFO_REGION_GPA, SHINFO_REGION_SLOT, 2, 0); - virt_map(vm, SHINFO_REGION_GPA, SHINFO_REGION_GPA, 2, 0); struct kvm_xen_hvm_config hvmc = { .flags = KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL, @@ -147,9 +146,9 @@ int main(int argc, char *argv[]) struct pvclock_wall_clock *wc; struct pvclock_vcpu_time_info *ti, *ti2; - wc = addr_gva2hva(vm, SHINFO_REGION_GPA + 0xc00); - ti = addr_gva2hva(vm, SHINFO_REGION_GPA + 0x40 + 0x20); - ti2 = addr_gva2hva(vm, PVTIME_ADDR); + wc = addr_gpa2hva(vm, SHINFO_REGION_GPA + 0xc00); + ti = addr_gpa2hva(vm, SHINFO_REGION_GPA + 0x40 + 0x20); + ti2 = addr_gpa2hva(vm, PVTIME_ADDR); vm_ts.tv_sec = wc->sec; vm_ts.tv_nsec = wc->nsec; From patchwork Wed Feb 10 18:26:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12081595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2AECC43381 for ; Wed, 10 Feb 2021 18:30:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F0F264E7E for ; Wed, 10 Feb 2021 18:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234163AbhBJSa1 (ORCPT ); Wed, 10 Feb 2021 13:30:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234227AbhBJS2R (ORCPT ); Wed, 10 Feb 2021 13:28:17 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86C99C061356 for ; Wed, 10 Feb 2021 10:26:27 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id d8so3416540ybs.11 for ; Wed, 10 Feb 2021 10:26:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=k5i+QStGtQxdagBNJrvuN+hHOAh+jl0k4jqWkBv5Txo=; b=k+HQLP7ZAGZeXAn/ix0c4UhVWLdldPjZ/ibyMGb3EcJ5r7/SSlasbZ+peiPz4/dfeA uEH5B6bRD+SOmm4eWj6xiJndkk0yc+3PpNeQKqMFVbkxN3167GuPxWYqF4f3xVIx/Oee 8EHYOGRtFSQxw+kOEtOxOGUOeCFlFcNpRE+ntpQoinGKhiX9laJ3bfuEgAacn/YQM+cl vzcse75GvtyndIQxoxO3ATIPRX76hclb2stNW5gWjzQSbBGryw8cQXTlVxRdSyakt/h0 R/oS7dLb4gGHZJcOE86Y68qbBHhKMYJCQM1hvpuCHqh3g45VuoSTYRdnlnOepU+04GUk 9Umw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=k5i+QStGtQxdagBNJrvuN+hHOAh+jl0k4jqWkBv5Txo=; b=sjbMhUcLAB6cLiosDui33/gW97N4JP7qrrLzLXvKhZTLUQXJfjr4iAvRxdKSYYzjIY z8z6MJcZNDvQeIiG6/j3dXR3ZW6aM9gUttrlDwafSmpzqPijEhCE7Ofl2x03sp6kckzi UFZMjfg1sCiCZK+S+zk8vAV1+zFYyyHXmZaj2CATZR+PGtQBIgzPfmMxwZqdUmaffkb4 iNurDiiyD7ndwZ3x+dbkXOXFcaVjdLuDoHLmXJiSC8kpq5m0yacQLgP/qZagVhtYtTkl Pui6FeTNzUBQLhwXNKZfSocPldQ0kCrfNcEKDbLwdWCMm5qRbU3gbP618EKFFZVhuipm 1VZg== X-Gm-Message-State: AOAM532nwyyJp8tp2zVsBboqFRRCDiblz5L6qSsK8P97CjhIBb2pWidy mtxMVEOmBYZmaEBaoslGDOHENgYbTdM= X-Google-Smtp-Source: ABdhPJwsbfpnnRhdi/WJEW0HkFZzjg18vDB3jDEI9My/tl73gxM0LcJP75gzxbp7QADg77Mvqm7ahgtBfPQ= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:11fc:33d:bf1:4cb8]) (user=seanjc job=sendgmr) by 2002:a25:1e42:: with SMTP id e63mr5919281ybe.270.1612981586793; Wed, 10 Feb 2021 10:26:26 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 10 Feb 2021 10:26:09 -0800 In-Reply-To: <20210210182609.435200-1-seanjc@google.com> Message-Id: <20210210182609.435200-6-seanjc@google.com> Mime-Version: 1.0 References: <20210210182609.435200-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH 5/5] KVM: x86/xen: Explicitly pad struct compat_vcpu_info to 64 bytes From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, David Woodhouse Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add a 2 byte pad to struct compat_vcpu_info so that the sum size of its fields is actually 64 bytes. The effective size without the padding is also 64 bytes due to the compiler aligning evtchn_pending_sel to a 4-byte boundary, but depending on compiler alignment is subtle and unnecessary. Opportunistically replace spaces with tables in the other fields. Cc: David Woodhouse Signed-off-by: Sean Christopherson Reviewed-by: David Woodhouse --- arch/x86/kvm/xen.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/xen.h b/arch/x86/kvm/xen.h index 4b32489c0cec..b66a921776f4 100644 --- a/arch/x86/kvm/xen.h +++ b/arch/x86/kvm/xen.h @@ -49,11 +49,12 @@ struct compat_arch_vcpu_info { }; struct compat_vcpu_info { - uint8_t evtchn_upcall_pending; - uint8_t evtchn_upcall_mask; - uint32_t evtchn_pending_sel; - struct compat_arch_vcpu_info arch; - struct pvclock_vcpu_time_info time; + uint8_t evtchn_upcall_pending; + uint8_t evtchn_upcall_mask; + uint16_t pad; + uint32_t evtchn_pending_sel; + struct compat_arch_vcpu_info arch; + struct pvclock_vcpu_time_info time; }; /* 64 bytes (x86) */ struct compat_arch_shared_info {