From patchwork Mon Aug 9 09:34:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Like Xu X-Patchwork-Id: 12426035 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 156F3C432BE for ; Mon, 9 Aug 2021 09:34:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFEFD6108D for ; Mon, 9 Aug 2021 09:34:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234545AbhHIJen (ORCPT ); Mon, 9 Aug 2021 05:34:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234521AbhHIJem (ORCPT ); Mon, 9 Aug 2021 05:34:42 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C55C9C0613CF; Mon, 9 Aug 2021 02:34:22 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id e19so2193114pla.10; Mon, 09 Aug 2021 02:34:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LMGJDyl7UhcfZwG/lrk8OVLrJYjfTuTv0zD0UPmM7+o=; b=SQqQMjjNJtk6SKMeeSexM65VwayfQgmINsOAHqkKJo7kzA1/yVXgQDnT8/H/wInPhb dwYT7HJKzbmzjFLykHB3wicVvn63a89l8CHHtM26NGaShcDuvTJFPZxluspYhjmGdNWE O76Wjlfp3KrKA6pA6CK4V+Zko6mbZPp1b8u3ZJZ/psSENk1VHfttgCj77mZeEL27iToZ b/+3oK5gl4a0XMjKO3NkVLFsLGyAx0PqTl1LKehnDbioClJgmJ2nkhBBWGSKPrrFDcoz FB/4IuAXqHTp5madlb8ZI2Ymi9J4/U4KARlKpFFdn4K6GVd9QXAZ/JoqYljC+d9vKBgr RojQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LMGJDyl7UhcfZwG/lrk8OVLrJYjfTuTv0zD0UPmM7+o=; b=cjHRyuIw+3Tn9YNl+A6HregJhceWtWZXMgdBQzbG/WXC8gnsXfXIe14WeFMTUJ8ZHg t3FBtOF3jNNDhcmQgxASMGBnfsh+mqdmMQLHAHjdaymeLUzuN73P14BhyKbAeig5X+uj nkPl4RzOYr9cou9K5trHHpjZ3HoIJzlk0VXegOSLK5PljoZ1Gy4c4YqY/C9duhAn7boy pW8+TPtW4sTNNzU/aA4eTNc1N1LkVGmARKrBYKRKLE5jizFSC9v1+JVtda64ICb56oOQ isjZXNXZEIgNIJaQUw6t2RrqzzKC6ELRWIliy2Db8Dy+s24tv1qwNmJt3QC0JlBgb1H/ XYiQ== X-Gm-Message-State: AOAM533QWYbTf7OaHgHZwJ/6QhdldCp62iyHDveNB/cA+n1If3BAPlXc fqJVxHaYORFlugvwr2Kubms= X-Google-Smtp-Source: ABdhPJyZU6UtCWnNmc+vik8Zko8d4QMuc0ueQP8e8SRyNKnXWN87CtOVEYzgehdkvo5psjMlLMXh+g== X-Received: by 2002:a63:7343:: with SMTP id d3mr87542pgn.169.1628501662437; Mon, 09 Aug 2021 02:34:22 -0700 (PDT) Received: from localhost.localdomain ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id h188sm10839982pfg.45.2021.08.09.02.34.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Aug 2021 02:34:22 -0700 (PDT) From: Like Xu X-Google-Original-From: Like Xu To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Ingo Molnar , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] KVM: x86: Clean up redundant mod_64(x, y) macro definition Date: Mon, 9 Aug 2021 17:34:06 +0800 Message-Id: <20210809093410.59304-2-likexu@tencent.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210809093410.59304-1-likexu@tencent.com> References: <20210809093410.59304-1-likexu@tencent.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Like Xu The mod_64(x, y) macro is only defined and used in the kvm/x86 context. It's safe to move the definition of mod_64(x, y) from x86/{i8254lapic}.c to the generic x86.h without any intended functional change. Signed-off-by: Like Xu --- arch/x86/kvm/i8254.c | 6 ------ arch/x86/kvm/lapic.c | 6 ------ arch/x86/kvm/x86.h | 6 ++++++ 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 5a69cce4d72d..81d2ba064dc3 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -40,12 +40,6 @@ #include "i8254.h" #include "x86.h" -#ifndef CONFIG_X86_64 -#define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) -#else -#define mod_64(x, y) ((x) % (y)) -#endif - #define RW_STATE_LSB 1 #define RW_STATE_MSB 2 #define RW_STATE_WORD0 3 diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 76fb00921203..6b3d8feac1d0 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -42,12 +42,6 @@ #include "cpuid.h" #include "hyperv.h" -#ifndef CONFIG_X86_64 -#define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) -#else -#define mod_64(x, y) ((x) % (y)) -#endif - #define PRId64 "d" #define PRIx64 "llx" #define PRIu64 "u" diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index 44ae10312740..6aac4a901b65 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -8,6 +8,12 @@ #include "kvm_cache_regs.h" #include "kvm_emulate.h" +#ifndef CONFIG_X86_64 +#define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) +#else +#define mod_64(x, y) ((x) % (y)) +#endif + static __always_inline void kvm_guest_enter_irqoff(void) { /* From patchwork Mon Aug 9 09:34:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Like Xu X-Patchwork-Id: 12426037 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 6C963C4338F for ; Mon, 9 Aug 2021 09:34:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51DEB6108D for ; Mon, 9 Aug 2021 09:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234589AbhHIJer (ORCPT ); Mon, 9 Aug 2021 05:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234564AbhHIJeq (ORCPT ); Mon, 9 Aug 2021 05:34:46 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 840EDC0613CF; Mon, 9 Aug 2021 02:34:25 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id gz13-20020a17090b0ecdb0290178c0e0ce8bso662982pjb.1; Mon, 09 Aug 2021 02:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5jB8CoTWK2C4ziZeKzeYIfYXklUI9UOSANjF0ttEBWc=; b=cMfv9a7/zeSchOm6rgA2iBCzcCgPawm058zZmliElUjw5rfCx1RPivisNphQdRG+Uc Q91I1bbBdEBbaTUSdPLC66kCYFSt152lag39+XBxEOFYuVSD5TbTMpYHUJfwLSzHm2q5 PaBFuAmsKFGMOOCtemxvd45P4s8pCl5wmyb/PkbQ/hiYWYkSLbWifhzVtKDE5+CfpM19 ynvXXmkgayhsyHHq//bdNN6uMrYjUX9CdNyhYcDMDgrP1HpH5YElkCsMvmS0amPoX4ok pvB/qymyx0koxABC1I57r04A1+bMsh4SLZ53z6DHtDCxc7/5uBYepYddvFlEkiWKrhC1 K8SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5jB8CoTWK2C4ziZeKzeYIfYXklUI9UOSANjF0ttEBWc=; b=qOF9WdeUzg9F9G6J2Ueq8pfrHdvmwI/ZB0BeGFPsl7IPcI8xhNS/HFEWrdpNI9+yjN cKhf0IKdjtuRSJWbtf9InVN22XWqAKM4kswGKpH56vE8ZFO3FGqavtOLjmR0X9We/p/4 uf3VtE656aULc7dHsPoLhhVFvZTM15ianYQIzep1rsBhx6xflF8gQ/XotkLejUDGvYYN ak8+EKQl9BSLozoDxYTvi0WDOSNNvBcquK9uLd6tGFeelytkz5oeRHGNyfvXPst37FaB VN/vnBw7DHUdD+gcM2cwCvGovpPPesgTc5VrUsAT6DG/0pe3ANaTBjUe1XUZVmIhL3YV AH5Q== X-Gm-Message-State: AOAM532COthiJLqqYKAMUv+Zs9DT+zfBIXoxAVZQdcqf/wFXRUhBp+Rn owIn599YammmLYmCkvMMuf4= X-Google-Smtp-Source: ABdhPJxOHWdPCzmG+3XrWMpK6NGltR81LX3pHqFBvsFSGhlXxJ43yuht5ggjYdMn2UIRFpW757ijjg== X-Received: by 2002:a17:90a:d702:: with SMTP id y2mr3014220pju.127.1628501665087; Mon, 09 Aug 2021 02:34:25 -0700 (PDT) Received: from localhost.localdomain ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id h188sm10839982pfg.45.2021.08.09.02.34.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Aug 2021 02:34:24 -0700 (PDT) From: Like Xu X-Google-Original-From: Like Xu To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Ingo Molnar , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] KVM: x86: Clean up redundant CC macro definition Date: Mon, 9 Aug 2021 17:34:07 +0800 Message-Id: <20210809093410.59304-3-likexu@tencent.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210809093410.59304-1-likexu@tencent.com> References: <20210809093410.59304-1-likexu@tencent.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Like Xu With the exception of drivers/dma/pl330.c, the CC macro is defined and used in {svm, vmx}/nested.c, and the KVM_NESTED_VMENTER_CONSISTENCY_CHECK macro it refers to is defined in x86.h, so it's safe to move it into x86.h without intended functional changes. Signed-off-by: Like Xu --- arch/x86/kvm/svm/nested.c | 2 -- arch/x86/kvm/vmx/nested.c | 2 -- arch/x86/kvm/x86.h | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 5e13357da21e..57c288ba6ef0 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -29,8 +29,6 @@ #include "lapic.h" #include "svm.h" -#define CC KVM_NESTED_VMENTER_CONSISTENCY_CHECK - static void nested_svm_inject_npf_exit(struct kvm_vcpu *vcpu, struct x86_exception *fault) { diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 0d0dd6580cfd..404db7c854d2 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -22,8 +22,6 @@ module_param_named(enable_shadow_vmcs, enable_shadow_vmcs, bool, S_IRUGO); static bool __read_mostly nested_early_check = 0; module_param(nested_early_check, bool, S_IRUGO); -#define CC KVM_NESTED_VMENTER_CONSISTENCY_CHECK - /* * Hyper-V requires all of these, so mark them as supported even though * they are just treated the same as all-context. diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index 6aac4a901b65..b8a024b0f91c 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -67,6 +67,8 @@ static __always_inline void kvm_guest_exit_irqoff(void) failed; \ }) +#define CC KVM_NESTED_VMENTER_CONSISTENCY_CHECK + #define KVM_DEFAULT_PLE_GAP 128 #define KVM_VMX_DEFAULT_PLE_WINDOW 4096 #define KVM_DEFAULT_PLE_WINDOW_GROW 2 From patchwork Mon Aug 9 09:34:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Like Xu X-Patchwork-Id: 12426041 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 957F6C4338F for ; Mon, 9 Aug 2021 09:34:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 775D860F35 for ; Mon, 9 Aug 2021 09:34:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234646AbhHIJex (ORCPT ); Mon, 9 Aug 2021 05:34:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234634AbhHIJev (ORCPT ); Mon, 9 Aug 2021 05:34:51 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F9E6C0613CF; Mon, 9 Aug 2021 02:34:28 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id a8so26909748pjk.4; Mon, 09 Aug 2021 02:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SClIEUrgBmGnLAFcX7ZZcCu89jAx05xmV/2QXqeca2c=; b=LsyWMjctV2SbgGvZf7etUKKoyebOtcEhXQ/cU3VtoMBK0lMmH011y/DVcKSBEp2ypO 87na3pOnAJlIK05je08mBAZFZGpWwlgD1ashhiwTk+qOdbiGK5nYeecgiaJYyWbIhDNK ULwwYUFWQgiqNJL6YgFyslc0kUpuLdyg+goJh22a98iT28qCmu3YzrojTrx7zw85gY2S OPEL0lznH3/qh/r05RpKDc6sn3mP4D/LG05kmPqVaTwDoPy+zzD0cl0Cl4xq5AsKlx8Z PT3lq1ENa/C/6iIA4XJx3JEOoBwPxIRCb+m9wPxJDii1yMl+nvwYoSnQVkdgdj1z79ds g1lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SClIEUrgBmGnLAFcX7ZZcCu89jAx05xmV/2QXqeca2c=; b=OqUxnRm5iUyFjTYPxI/FfeG/SdgsxVsA6yK+e5d7ho9262g1xZo2SKseoaKSHUx4zA Hmp+4D5hH2LpwGsWBKdG3UVslQAMYERGSvJuvhdkYa3CfIUMGahwMsexNJoXvEbCXjfp 7xGkRS7MEADNE1O1wdtmCeoiwlQQofakgVu3/33/sulG+G7Y7hYP7riTUS4L0BGZFHRA EluzEzmRPCwJkx0FNzotyjMkktH+vRITKGyn7NSVh5W1a7Nbvg1EdCEX/481KQjFtmrF whUiDGxkZ+TO+0w0kGnXF2voefev5+xzfig0HvzAN55twOg9iYPN9erMFppLz6ElWV0f yRgg== X-Gm-Message-State: AOAM5302R9Bz4k7u/XjgxGxGGYl/5G4TjDvA30+qgFeLFyrZq5zabtt7 JoJYnceSLWgBZuW6Od39sHR246ursFgNPw== X-Google-Smtp-Source: ABdhPJx3owKMpELajEbku0QfVtOuK2luyB/1Wxh2S9w281C87D1YUJVUF+tLaK7wWI0mPEIoNXofgw== X-Received: by 2002:a17:90a:6782:: with SMTP id o2mr34827680pjj.165.1628501667764; Mon, 09 Aug 2021 02:34:27 -0700 (PDT) Received: from localhost.localdomain ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id h188sm10839982pfg.45.2021.08.09.02.34.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Aug 2021 02:34:27 -0700 (PDT) From: Like Xu X-Google-Original-From: Like Xu To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Ingo Molnar , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] KVM: x86: Clean up redundant ROL16(val, n) macro definition Date: Mon, 9 Aug 2021 17:34:08 +0800 Message-Id: <20210809093410.59304-4-likexu@tencent.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210809093410.59304-1-likexu@tencent.com> References: <20210809093410.59304-1-likexu@tencent.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Like Xu The ROL16(val, n) macro is repeatedly defined in several vmcs-related files, and it has never been used outside the KVM context. Let's move it to vmcs.h without any intended functional changes. Signed-off-by: Like Xu --- arch/x86/kvm/vmx/evmcs.c | 1 - arch/x86/kvm/vmx/evmcs.h | 4 ---- arch/x86/kvm/vmx/vmcs.h | 2 ++ arch/x86/kvm/vmx/vmcs12.c | 1 - arch/x86/kvm/vmx/vmcs12.h | 4 ---- 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c index 896b2a50b4aa..0dab1b7b529f 100644 --- a/arch/x86/kvm/vmx/evmcs.c +++ b/arch/x86/kvm/vmx/evmcs.c @@ -14,7 +14,6 @@ DEFINE_STATIC_KEY_FALSE(enable_evmcs); #if IS_ENABLED(CONFIG_HYPERV) -#define ROL16(val, n) ((u16)(((u16)(val) << (n)) | ((u16)(val) >> (16 - (n))))) #define EVMCS1_OFFSET(x) offsetof(struct hv_enlightened_vmcs, x) #define EVMCS1_FIELD(number, name, clean_field)[ROL16(number, 6)] = \ {EVMCS1_OFFSET(name), clean_field} diff --git a/arch/x86/kvm/vmx/evmcs.h b/arch/x86/kvm/vmx/evmcs.h index 2ec9b46f0d0c..152ab0aa82cf 100644 --- a/arch/x86/kvm/vmx/evmcs.h +++ b/arch/x86/kvm/vmx/evmcs.h @@ -73,8 +73,6 @@ struct evmcs_field { extern const struct evmcs_field vmcs_field_to_evmcs_1[]; extern const unsigned int nr_evmcs_1_fields; -#define ROL16(val, n) ((u16)(((u16)(val) << (n)) | ((u16)(val) >> (16 - (n))))) - static __always_inline int get_evmcs_offset(unsigned long field, u16 *clean_field) { @@ -95,8 +93,6 @@ static __always_inline int get_evmcs_offset(unsigned long field, return evmcs_field->offset; } -#undef ROL16 - static inline void evmcs_write64(unsigned long field, u64 value) { u16 clean_field; diff --git a/arch/x86/kvm/vmx/vmcs.h b/arch/x86/kvm/vmx/vmcs.h index 4b9957e2bf5b..6e5de2e2b0da 100644 --- a/arch/x86/kvm/vmx/vmcs.h +++ b/arch/x86/kvm/vmx/vmcs.h @@ -11,6 +11,8 @@ #include "capabilities.h" +#define ROL16(val, n) ((u16)(((u16)(val) << (n)) | ((u16)(val) >> (16 - (n))))) + struct vmcs_hdr { u32 revision_id:31; u32 shadow_vmcs:1; diff --git a/arch/x86/kvm/vmx/vmcs12.c b/arch/x86/kvm/vmx/vmcs12.c index d9f5d7c56ae3..cab6ba7a5005 100644 --- a/arch/x86/kvm/vmx/vmcs12.c +++ b/arch/x86/kvm/vmx/vmcs12.c @@ -2,7 +2,6 @@ #include "vmcs12.h" -#define ROL16(val, n) ((u16)(((u16)(val) << (n)) | ((u16)(val) >> (16 - (n))))) #define VMCS12_OFFSET(x) offsetof(struct vmcs12, x) #define FIELD(number, name) [ROL16(number, 6)] = VMCS12_OFFSET(name) #define FIELD64(number, name) \ diff --git a/arch/x86/kvm/vmx/vmcs12.h b/arch/x86/kvm/vmx/vmcs12.h index 5e0e1b39f495..2a45f026ee11 100644 --- a/arch/x86/kvm/vmx/vmcs12.h +++ b/arch/x86/kvm/vmx/vmcs12.h @@ -364,8 +364,6 @@ static inline void vmx_check_vmcs12_offsets(void) extern const unsigned short vmcs_field_to_offset_table[]; extern const unsigned int nr_vmcs12_fields; -#define ROL16(val, n) ((u16)(((u16)(val) << (n)) | ((u16)(val) >> (16 - (n))))) - static inline short vmcs_field_to_offset(unsigned long field) { unsigned short offset; @@ -385,8 +383,6 @@ static inline short vmcs_field_to_offset(unsigned long field) return offset; } -#undef ROL16 - static inline u64 vmcs12_read_any(struct vmcs12 *vmcs12, unsigned long field, u16 offset) { From patchwork Mon Aug 9 09:34:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Like Xu X-Patchwork-Id: 12426039 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 B4978C4338F for ; Mon, 9 Aug 2021 09:34:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BD046108D for ; Mon, 9 Aug 2021 09:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234630AbhHIJev (ORCPT ); Mon, 9 Aug 2021 05:34:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234564AbhHIJeu (ORCPT ); Mon, 9 Aug 2021 05:34:50 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCF97C061796; Mon, 9 Aug 2021 02:34:30 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so33546164pjr.1; Mon, 09 Aug 2021 02:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=paMMYKKDNMpKtXFsce6OcCMqHzENmTbIMXLEYEGC9LM=; b=YfmvDMH8vOx5dSG8Iguhx/ExPkvGJl8W2PJzWwEQW/MIoVsUOMmL4izX0nfphOurzh na2Qo3OOnJ3MjgfVaaBkqYZGkvv98IgzooTQfDOR6+hdvzIyjegHOs1y4G6l8DSl5I3n bmXZ+x2zT32FtOtyp3eliwY35QHyzy+Ag3lUrh1nGVU6VzBcyG5GfgdO88hfm4zfJF09 JPi+pS8fokwdf9IQa5HWikZgCf6YjolZ7oswnKOOS98439Mbms6N5yODv+Xo1v0KiG5x IlVoghL9vGtld7yrCXXHouj2M9RF9urgQd6dnnoAKURgU1onxLYmMOAGYyxEh8pG3nxP 2/zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=paMMYKKDNMpKtXFsce6OcCMqHzENmTbIMXLEYEGC9LM=; b=iC5ycX0OiHNE0SnatQHYpB/K7nRsZWIykxJGZGEcE32mMftboggvhLxPtsuF4lwvoI +1gvAahNBY+c7KUbtYJ2bMmNt/9TP8xgvxlBGnxRGjiuZYEdwC9WlD5A/qip/0bYjV9g UC94tl8TtboQ+rFfqd9zCVTluve/B1wl6AQkGFOOaGn3BzCzRWOLdptmMZ0k+bFlvcNM iXOPgMx8hnb6Ks/epoGEPeom7kostNrKZaq8vjnvBUarNSTTIjYk1VyBC/h/+BAew42l DM5QlC60w/fT/qVSqotFiiTuOgenkWfpeujmNswI2cqetA4EobuWssByN+iLoO6nb9nI 31lA== X-Gm-Message-State: AOAM533G5MLjgTnICemiUcrjzhqgzQksxEak5jhBHdbKXwzJbmD1aSJ/ PEECtFFl4RoxfN/EOq14ryI= X-Google-Smtp-Source: ABdhPJymEN9P+1KmLocw1I3tK+cZ/V7imfxvFX/+U6VG93/lGJn536uhRiVpRcCOaE36oGuGcVSvXg== X-Received: by 2002:a17:902:6ac8:b029:12d:632:ffcf with SMTP id i8-20020a1709026ac8b029012d0632ffcfmr8948632plt.28.1628501670386; Mon, 09 Aug 2021 02:34:30 -0700 (PDT) Received: from localhost.localdomain ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id h188sm10839982pfg.45.2021.08.09.02.34.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Aug 2021 02:34:30 -0700 (PDT) From: Like Xu X-Google-Original-From: Like Xu To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Ingo Molnar , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] KVM: x86: Clean up redundant __ex(x) macro definition Date: Mon, 9 Aug 2021 17:34:09 +0800 Message-Id: <20210809093410.59304-5-likexu@tencent.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210809093410.59304-1-likexu@tencent.com> References: <20210809093410.59304-1-likexu@tencent.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Like Xu The __ex(x) macro is repeatedly defined in sev.c, svm.c and vmx_ops.h, and it has never been used outside the KVM/x86 context. Let's move it to kvm_host.h without any intended functional changes. Signed-off-by: Like Xu --- arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/svm/sev.c | 2 -- arch/x86/kvm/svm/svm.c | 2 -- arch/x86/kvm/vmx/vmx_ops.h | 2 -- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 4c567b05edad..7480d31463bc 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1823,6 +1823,8 @@ asmlinkage void kvm_spurious_fault(void); "668: \n\t" \ _ASM_EXTABLE(666b, 667b) +#define __ex(x) __kvm_handle_fault_on_reboot(x) + #define KVM_ARCH_WANT_MMU_NOTIFIER int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v); diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 9f1585f40c85..19cdb73aa623 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -28,8 +28,6 @@ #include "cpuid.h" #include "trace.h" -#define __ex(x) __kvm_handle_fault_on_reboot(x) - #ifndef CONFIG_KVM_AMD_SEV /* * When this config is not defined, SEV feature is not supported and APIs in diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 9d72b1df426e..2b6632d4c76f 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -46,8 +46,6 @@ #include "kvm_onhyperv.h" #include "svm_onhyperv.h" -#define __ex(x) __kvm_handle_fault_on_reboot(x) - MODULE_AUTHOR("Qumranet"); MODULE_LICENSE("GPL"); diff --git a/arch/x86/kvm/vmx/vmx_ops.h b/arch/x86/kvm/vmx/vmx_ops.h index 164b64f65a8f..c0d74b994b56 100644 --- a/arch/x86/kvm/vmx/vmx_ops.h +++ b/arch/x86/kvm/vmx/vmx_ops.h @@ -10,8 +10,6 @@ #include "evmcs.h" #include "vmcs.h" -#define __ex(x) __kvm_handle_fault_on_reboot(x) - asmlinkage void vmread_error(unsigned long field, bool fault); __attribute__((regparm(0))) void vmread_error_trampoline(unsigned long field, bool fault); From patchwork Mon Aug 9 09:34:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Like Xu X-Patchwork-Id: 12426043 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 DDD8AC4338F for ; Mon, 9 Aug 2021 09:34:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1C5B60F35 for ; Mon, 9 Aug 2021 09:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234674AbhHIJe6 (ORCPT ); Mon, 9 Aug 2021 05:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234650AbhHIJex (ORCPT ); Mon, 9 Aug 2021 05:34:53 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80B91C0613D3; Mon, 9 Aug 2021 02:34:33 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id k2so15672547plk.13; Mon, 09 Aug 2021 02:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=biNAy5h7oVY1q9CMKi2TrD2G8iCaEg6EwP+zpkG0x9I=; b=KOFlhkZ8VT9Gg9IfumWNsU68mB6qyhv3ke4WeNu4vQGPDja7D1rSsGobfSJIEz+trR tO10tcI5Hsvj8CxNRUpQLmai/t3R9HPXZ5Hmed/L/L7VveGjC9KkQOocGuCJ2kT9PodI wJdX5yFTlyHJ/2XcQS23jBgqwZPNeHKskN59LNx5u5k+qRP8DlSvjgPrPR6MPqSQhK+b jeUio+sEk/0O7teaVuE4PNUumxMPAsUNNedzbRoTF/xU0ZDvauzppZXLw4npMgEMbNlQ ZxhZeWFhU+fCA4cbtTIW8adOo9zshLEb0xohK0qyccRqe729ErkEWDbBBat+wdIF74sV 2eBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=biNAy5h7oVY1q9CMKi2TrD2G8iCaEg6EwP+zpkG0x9I=; b=Y2Zjz5eF0dec/wfwAww9DYRJozS+ezuT92sFM88W8ijJHKK7yDRUGlTrs15IVuavKH zZeL0o/3DtgJkoHLXQmZwdRJgu8dtrkoDjAKArGy3XqaArJz5lvXK0HDMBNJ8lVsYOcU +YPLDEKiKXuAgOtC+CWUFVkutPk3E8mU326fMZQjc+RLdYQ7ro/VcrCNMVYKzJoDyayU izPkk58vRLBozsxGhWdM4LKqSs9OmOz0QdyHAExzflanYqaXAhFBRqLh4R0DWlCm30CY lrSooBGE6Zdo/5VXXBKu8d3jzGD4Luznqn0MiXV0Xn0ITl20phP+XDETAGEauhi0srOg 1sbA== X-Gm-Message-State: AOAM531iZ8wQwzN7TM3EzI89yLIIPJYgpAY4YOvmpvcgcbZiFpglH0qb 3FJHI+f7jAOQKUWP7bbBwJU= X-Google-Smtp-Source: ABdhPJxKQ+0mIcms3UnGJli7b+FS7AElw6vbE0y7uJR2PIKScPY3i57ziCBYSkdhDkTL5xfz7FhBKA== X-Received: by 2002:a17:903:31c3:b029:ed:6f74:49c7 with SMTP id v3-20020a17090331c3b02900ed6f7449c7mr19366644ple.12.1628501673150; Mon, 09 Aug 2021 02:34:33 -0700 (PDT) Received: from localhost.localdomain ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id h188sm10839982pfg.45.2021.08.09.02.34.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Aug 2021 02:34:32 -0700 (PDT) From: Like Xu X-Google-Original-From: Like Xu To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Ingo Molnar , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] KVM: x86: Clean up redundant pr_fmt(fmt) macro definition for svm Date: Mon, 9 Aug 2021 17:34:10 +0800 Message-Id: <20210809093410.59304-6-likexu@tencent.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210809093410.59304-1-likexu@tencent.com> References: <20210809093410.59304-1-likexu@tencent.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Like Xu The svm specific pr_fmt(fmt) macro is repeatedly defined in svm code and the new one has never been used outside the svm context. Let's move it to svm.h without any intended functional changes. Signed-off-by: Like Xu --- arch/x86/kvm/svm/avic.c | 2 -- arch/x86/kvm/svm/nested.c | 2 -- arch/x86/kvm/svm/svm.c | 2 -- arch/x86/kvm/svm/svm.h | 3 +++ 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c index a8ad78a2faa1..8b055f9ad9fe 100644 --- a/arch/x86/kvm/svm/avic.c +++ b/arch/x86/kvm/svm/avic.c @@ -12,8 +12,6 @@ * Avi Kivity */ -#define pr_fmt(fmt) "SVM: " fmt - #include #include #include diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 57c288ba6ef0..3080776a55a5 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -12,8 +12,6 @@ * Avi Kivity */ -#define pr_fmt(fmt) "SVM: " fmt - #include #include #include diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 2b6632d4c76f..4a3f8ef56daa 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -1,5 +1,3 @@ -#define pr_fmt(fmt) "SVM: " fmt - #include #include "irq.h" diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h index bd0fe94c2920..76d5fe3f00dc 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -15,6 +15,9 @@ #ifndef __SVM_SVM_H #define __SVM_SVM_H +#undef pr_fmt +#define pr_fmt(fmt) "SVM: " fmt + #include #include #include