From patchwork Wed Dec 4 19:07:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11273471 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39C5A6C1 for ; Wed, 4 Dec 2019 19:07:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 16F7320803 for ; Wed, 4 Dec 2019 19:07:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Drq/KvQj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729014AbfLDTHs (ORCPT ); Wed, 4 Dec 2019 14:07:48 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:26415 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728883AbfLDTHd (ORCPT ); Wed, 4 Dec 2019 14:07:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575486452; h=from:from:reply-to:subject:subject: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=14g8RaA5piWvH+2ustd/wNI5q+TQc8KxgzZhf+/2kiM=; b=Drq/KvQjAtk1pnoHS+iAq/3ejzViWgOUFx3BUGf0nepk5U7Zyx/TxJeTyKasdlr+OMl/SV EYy5ScqWWULOM94Rw2UGMmb8URPnHGttqtnrCyWXvLcSKqIMKp4PBk0/l22nMyoDtIiZjt QVGAVI6SsrKt9pr2INgk1YStm9XR0Bc= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-144-45E4NY4nPH-NSSanuVtM-w-1; Wed, 04 Dec 2019 14:07:30 -0500 Received: by mail-qt1-f200.google.com with SMTP id t20so641098qtr.3 for ; Wed, 04 Dec 2019 11:07:30 -0800 (PST) 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=dMSAhkBc+XDUp7X0JKW/OfiFquvplAZgCqXULfdRF2I=; b=oX1IB/mnlR0C9mOeFhRAP9L6zIRWDeqNO2L2pmAuqYnwev87agkhZHjrW+ppob+vGP AkgGvlC++kfin1lB7SPFV9iqv6EJIuePs7MzaI7JXLBvpXOSTOW752/JYaOecpmpae6x t7iWd+8k5e5EiJfUKtmyRgbacS4UPryFjUBZSYlJplyuhDBnNywpt7x6pSog68n5C7WP vvSB5A4uklArGWe5RhaZfu0rVQHynO2My0Fj8+ew9UBtrrwfiFSOd8oFiNUmk3SVze4Y e4UCVsCGOT0nJb2E+3bd7o3r5XCQxP/hANIz7JfsOQNGvDs0GlliPWfROp0w/e2N1jF/ crHA== X-Gm-Message-State: APjAAAXpRugS0q6UjYIO7UjuQH0WNwm7hQ7wrA9rgp+u8X+Z6i3Ln6bD cCh8xpKGWLTgs2jnXB1X2+TOYtm9k1k7haqlhA0Ge8YRVKMCbg4w4j+Ne1mU4hBoOJdodtrt17n VU2G07n3OQ6/O X-Received: by 2002:a37:62c4:: with SMTP id w187mr4623785qkb.121.1575486449611; Wed, 04 Dec 2019 11:07:29 -0800 (PST) X-Google-Smtp-Source: APXvYqx342LHgJ8Z4Al1qN577PBjCuf9DkQOJEwuuV8mZT8Sv3S0edfBKQdU7LsMR1sARS/2KXJbvQ== X-Received: by 2002:a37:62c4:: with SMTP id w187mr4623754qkb.121.1575486449366; Wed, 04 Dec 2019 11:07:29 -0800 (PST) Received: from xz-x1.yyz.redhat.com ([104.156.64.74]) by smtp.gmail.com with ESMTPSA id y18sm4072126qtn.11.2019.12.04.11.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2019 11:07:28 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Nitesh Narayan Lal , Paolo Bonzini , Sean Christopherson , peterx@redhat.com, Vitaly Kuznetsov Subject: [PATCH v5 4/6] KVM: X86: Drop KVM_APIC_SHORT_MASK and KVM_APIC_DEST_MASK Date: Wed, 4 Dec 2019 14:07:19 -0500 Message-Id: <20191204190721.29480-5-peterx@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191204190721.29480-1-peterx@redhat.com> References: <20191204190721.29480-1-peterx@redhat.com> MIME-Version: 1.0 X-MC-Unique: 45E4NY4nPH-NSSanuVtM-w-1 X-Mimecast-Spam-Score: 0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We have both APIC_SHORT_MASK and KVM_APIC_SHORT_MASK defined for the shorthand mask. Similarly, we have both APIC_DEST_MASK and KVM_APIC_DEST_MASK defined for the destination mode mask. Drop the KVM_APIC_* macros and replace the only user of them to use the APIC_DEST_* macros instead. At the meantime, move APIC_SHORT_MASK and APIC_DEST_MASK from lapic.c to lapic.h. Reviewed-by: Vitaly Kuznetsov Signed-off-by: Peter Xu --- arch/x86/kvm/lapic.c | 3 --- arch/x86/kvm/lapic.h | 5 +++-- arch/x86/kvm/svm.c | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 1eabe58bb6d5..805c18178bbf 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -56,9 +56,6 @@ #define APIC_VERSION (0x14UL | ((KVM_APIC_LVT_NUM - 1) << 16)) #define LAPIC_MMIO_LENGTH (1 << 12) /* followed define is not in apicdef.h */ -#define APIC_SHORT_MASK 0xc0000 -#define APIC_DEST_NOSHORT 0x0 -#define APIC_DEST_MASK 0x800 #define MAX_APIC_VECTOR 256 #define APIC_VECTORS_PER_REG 32 diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h index 0b9bbadd1f3c..5a9f29ed9a4b 100644 --- a/arch/x86/kvm/lapic.h +++ b/arch/x86/kvm/lapic.h @@ -10,8 +10,9 @@ #define KVM_APIC_SIPI 1 #define KVM_APIC_LVT_NUM 6 -#define KVM_APIC_SHORT_MASK 0xc0000 -#define KVM_APIC_DEST_MASK 0x800 +#define APIC_SHORT_MASK 0xc0000 +#define APIC_DEST_NOSHORT 0x0 +#define APIC_DEST_MASK 0x800 #define APIC_BUS_CYCLE_NS 1 #define APIC_BUS_FREQUENCY (1000000000ULL / APIC_BUS_CYCLE_NS) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 362e874297e4..65a27a7e9cb1 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -4519,9 +4519,9 @@ static int avic_incomplete_ipi_interception(struct vcpu_svm *svm) */ kvm_for_each_vcpu(i, vcpu, kvm) { bool m = kvm_apic_match_dest(vcpu, apic, - icrl & KVM_APIC_SHORT_MASK, + icrl & APIC_SHORT_MASK, GET_APIC_DEST_FIELD(icrh), - icrl & KVM_APIC_DEST_MASK); + icrl & APIC_DEST_MASK); if (m && !avic_vcpu_is_running(vcpu)) kvm_vcpu_wake_up(vcpu);