Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1105235ybv; Fri, 7 Feb 2020 14:37:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyEOAbByYChF0vb6ZgYz/kKoyKGV9IF/vYxhm6ZCOwFyMRF+7PxqfkrRlQ31dWBlG8JGCd9 X-Received: by 2002:a9d:3b09:: with SMTP id z9mr1281753otb.195.1581115073795; Fri, 07 Feb 2020 14:37:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581115073; cv=none; d=google.com; s=arc-20160816; b=EvXXkp66OQDRV1QJTfAPZ7G3ZVZSz7tSS1boHFPZN4tiiyevOqUIgAqNkuMn5pBL1N csO2/sdh6CiUaXT/+Q2Jo3nvmF4K6JDqAfz7EWbdLlqY2EJGv2+H10QRYf3bTVKkNvRi jtjeJpHbl1z/ySgWztfBWKQtCAYSVZZ8p6CcatXCWvL50553zDuweYRmw0hzeghi50lf E38/dpYfxMWWlF64AzMrqB4X8z7N77yvtNgfOcBeDkHSwCYtVReN1vejB6hkibK6iMkk rbImQMOVKuJ31C6E24YGrUhX05WiRNVUjYUz0euFc0K7s8Vcs53ViAd1uWZF+tuin99x x7ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rPutAweyqqYRiz9KxYGz1dd9ij66mBcCSHiTuUd/XC8=; b=TfBuk56U9eYboezLUAzOUqYaBUKveu+P2tL99lHWx+wUqOQmtz9URHeqpvkDzuXRJi 0IaENPBPmi7qujpT8bx6nsH1kjO8+tg4LwJAkQbjT1WOwub1liw8wPQCbS4Zh0m0xbsH CrPD1BD1l5d5u5tET+M1mxYhBQhso6DqV2i/T6+3+3YmKTIiJ8/xIa8QoolAxzBPOjCR 6Vc/sPSH6eYqfSV03qJKIHCSq1/QxXmQjbj7tZCsOZ+EPbR2kI2SW+ewLzwmTWHjMpOH n2c5Fhlpqw0EyIo7uWuqJRDrKjP0VGOE0XJf47oQy0/NHwUNdenlyICIuyp6KVmLbsby qv6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ks60V9C7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a143si4485228oii.179.2020.02.07.14.37.42; Fri, 07 Feb 2020 14:37:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ks60V9C7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727517AbgBGWfd (ORCPT + 99 others); Fri, 7 Feb 2020 17:35:33 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:41021 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727068AbgBGWfb (ORCPT ); Fri, 7 Feb 2020 17:35:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581114930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rPutAweyqqYRiz9KxYGz1dd9ij66mBcCSHiTuUd/XC8=; b=Ks60V9C7YfpZmlEbttL3ixrSkZS+hsUdOOGP7GiguAhQwpPxp3WVgu+VPR2BPj4JAN0m4x URg87Y+Obrs1bvy6WPiFjgoLrX5Fa5i9D0rJU4E5/Nl5lIRSX727eoZXTEwhL71J1hjusg rZVVwjzrOhlOUbMaEwha8IRpJZBHcx4= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-302-J0iwef4ENVye5PXgleMW9A-1; Fri, 07 Feb 2020 17:35:28 -0500 X-MC-Unique: J0iwef4ENVye5PXgleMW9A-1 Received: by mail-qt1-f198.google.com with SMTP id y3so529623qti.15 for ; Fri, 07 Feb 2020 14:35:28 -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=rPutAweyqqYRiz9KxYGz1dd9ij66mBcCSHiTuUd/XC8=; b=JNA18GvxcNIB9NDqehfTI5Cp3NhD5hOTjbfV/Le4g9F+r0ySoe4GuHW5e3ztg4l9NL /kki7nQjAf/3jbHfteKD1NPCd26v3LefSRjvksONI/3f7EUqmna3o01cbmbLLtOR9qaF TNMQ4laSmX/ZUO25XlDaVOoIwi5g9hk3jFvlGQ6qTS8aDGzc3FVNHlnk0Yic8o3SZNZz kjZinY3kv2k12vlBOe0Q9pTLOlKjVjzW0HI44aVjrciXXmW4WFvJnjjPdAjdQzc7bYy7 p2Edn1TzGTysNX1TFA56UfPs0OemmlQTRB0szyuNJXRC8J1UAFGY1mwlfKVqepbehjgR LSww== X-Gm-Message-State: APjAAAWuqeViCgaBRL3UXhVsJRLv8ZG/r9bELSfuvAFDk+IuPa0ztarV SEevpFWZsFaHkjYSec/M/22G70mWzXJ0BiWI1VAyGNPO671BAEuucY/JT4G+KCmDzE8lKrATR91 12G16zI2FqqiAu8LSqrd8rFF8 X-Received: by 2002:a05:620a:ce5:: with SMTP id c5mr1099008qkj.49.1581114927308; Fri, 07 Feb 2020 14:35:27 -0800 (PST) X-Received: by 2002:a05:620a:ce5:: with SMTP id c5mr1098986qkj.49.1581114927069; Fri, 07 Feb 2020 14:35:27 -0800 (PST) Received: from xz-x1.redhat.com ([2607:9880:19c8:32::2]) by smtp.gmail.com with ESMTPSA id u12sm2178736qtj.84.2020.02.07.14.35.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 14:35:26 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Sean Christopherson , Paolo Bonzini , linux-mips@vger.kernel.org, peterx@redhat.com, Vitaly Kuznetsov Subject: [PATCH RFC 2/4] KVM: MIPS: Drop flush_shadow_memslot() callback Date: Fri, 7 Feb 2020 17:35:18 -0500 Message-Id: <20200207223520.735523-3-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200207223520.735523-1-peterx@redhat.com> References: <20200207223520.735523-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The MIPS flush_shadow_memslot() callback is always calling the flush_shadow_all() implementation no matter for trap-emul or VZ. Delete it and call flush_shadow_all() instead. This patch prepares for a further replacement of letting MIPS to use the common kvm_flush_remote_tlbs() call in all places. No functional change expected. Signed-off-by: Peter Xu --- arch/mips/include/asm/kvm_host.h | 7 ------- arch/mips/kvm/mips.c | 8 ++++---- arch/mips/kvm/trap_emul.c | 7 ------- arch/mips/kvm/vz.c | 7 ------- 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h index 41204a49cf95..e95faffb23d8 100644 --- a/arch/mips/include/asm/kvm_host.h +++ b/arch/mips/include/asm/kvm_host.h @@ -786,13 +786,6 @@ struct kvm_mips_callbacks { void (*vcpu_uninit)(struct kvm_vcpu *vcpu); int (*vcpu_setup)(struct kvm_vcpu *vcpu); void (*flush_shadow_all)(struct kvm *kvm); - /* - * Must take care of flushing any cached GPA PTEs (e.g. guest entries in - * VZ root TLB, or T&E GVA page tables and corresponding root TLB - * mappings). - */ - void (*flush_shadow_memslot)(struct kvm *kvm, - const struct kvm_memory_slot *slot); gpa_t (*gva_to_gpa)(gva_t gva); void (*queue_timer_int)(struct kvm_vcpu *vcpu); void (*dequeue_timer_int)(struct kvm_vcpu *vcpu); diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index 2606f3f02b54..1d5e7ffda746 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c @@ -216,7 +216,7 @@ void kvm_arch_flush_shadow_memslot(struct kvm *kvm, kvm_mips_flush_gpa_pt(kvm, slot->base_gfn, slot->base_gfn + slot->npages - 1); /* Let implementation do the rest */ - kvm_mips_callbacks->flush_shadow_memslot(kvm, slot); + kvm_mips_callbacks->flush_shadow_all(kvm); spin_unlock(&kvm->mmu_lock); } @@ -258,7 +258,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, new->base_gfn + new->npages - 1); /* Let implementation do the rest */ if (needs_flush) - kvm_mips_callbacks->flush_shadow_memslot(kvm, new); + kvm_mips_callbacks->flush_shadow_all(kvm); spin_unlock(&kvm->mmu_lock); } } @@ -1003,7 +1003,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log) memslot = id_to_memslot(slots, log->slot); /* Let implementation handle TLB/GVA invalidation */ - kvm_mips_callbacks->flush_shadow_memslot(kvm, memslot); + kvm_mips_callbacks->flush_shadow_all(kvm); } mutex_unlock(&kvm->slots_lock); @@ -1026,7 +1026,7 @@ int kvm_vm_ioctl_clear_dirty_log(struct kvm *kvm, struct kvm_clear_dirty_log *lo memslot = id_to_memslot(slots, log->slot); /* Let implementation handle TLB/GVA invalidation */ - kvm_mips_callbacks->flush_shadow_memslot(kvm, memslot); + kvm_mips_callbacks->flush_shadow_all(kvm); } mutex_unlock(&kvm->slots_lock); diff --git a/arch/mips/kvm/trap_emul.c b/arch/mips/kvm/trap_emul.c index 5a11e83dffe6..2ecb430ea0f1 100644 --- a/arch/mips/kvm/trap_emul.c +++ b/arch/mips/kvm/trap_emul.c @@ -703,12 +703,6 @@ static void kvm_trap_emul_flush_shadow_all(struct kvm *kvm) kvm_flush_remote_tlbs(kvm); } -static void kvm_trap_emul_flush_shadow_memslot(struct kvm *kvm, - const struct kvm_memory_slot *slot) -{ - kvm_trap_emul_flush_shadow_all(kvm); -} - static u64 kvm_trap_emul_get_one_regs[] = { KVM_REG_MIPS_CP0_INDEX, KVM_REG_MIPS_CP0_ENTRYLO0, @@ -1292,7 +1286,6 @@ static struct kvm_mips_callbacks kvm_trap_emul_callbacks = { .vcpu_uninit = kvm_trap_emul_vcpu_uninit, .vcpu_setup = kvm_trap_emul_vcpu_setup, .flush_shadow_all = kvm_trap_emul_flush_shadow_all, - .flush_shadow_memslot = kvm_trap_emul_flush_shadow_memslot, .gva_to_gpa = kvm_trap_emul_gva_to_gpa_cb, .queue_timer_int = kvm_mips_queue_timer_int_cb, .dequeue_timer_int = kvm_mips_dequeue_timer_int_cb, diff --git a/arch/mips/kvm/vz.c b/arch/mips/kvm/vz.c index dde20887a70d..814bd1564a79 100644 --- a/arch/mips/kvm/vz.c +++ b/arch/mips/kvm/vz.c @@ -3123,12 +3123,6 @@ static void kvm_vz_flush_shadow_all(struct kvm *kvm) } } -static void kvm_vz_flush_shadow_memslot(struct kvm *kvm, - const struct kvm_memory_slot *slot) -{ - kvm_vz_flush_shadow_all(kvm); -} - static void kvm_vz_vcpu_reenter(struct kvm_run *run, struct kvm_vcpu *vcpu) { int cpu = smp_processor_id(); @@ -3185,7 +3179,6 @@ static struct kvm_mips_callbacks kvm_vz_callbacks = { .vcpu_uninit = kvm_vz_vcpu_uninit, .vcpu_setup = kvm_vz_vcpu_setup, .flush_shadow_all = kvm_vz_flush_shadow_all, - .flush_shadow_memslot = kvm_vz_flush_shadow_memslot, .gva_to_gpa = kvm_vz_gva_to_gpa_cb, .queue_timer_int = kvm_vz_queue_timer_int_cb, .dequeue_timer_int = kvm_vz_dequeue_timer_int_cb, -- 2.24.1