Received: by 10.223.185.116 with SMTP id b49csp6721070wrg; Wed, 28 Feb 2018 14:24:22 -0800 (PST) X-Google-Smtp-Source: AH8x227BsQ14IfL1B6XKERLL+0EHu++aon0o29GfGpFAxQwJKLGWLFZH4bvAGtUgr0TTmyQaNhfX X-Received: by 2002:a17:902:42a3:: with SMTP id h32-v6mr19962735pld.231.1519856662548; Wed, 28 Feb 2018 14:24:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519856662; cv=none; d=google.com; s=arc-20160816; b=GVNQwKI9WvmE5KrvT8+zRbtl8zGvkX7TO3q7mG1J9Rnrpz2d735GEUCCIbvtRV9l8d BxO4GgMhZN/W87FPC/zFqz18hFx2+/6nSG5E1beYA3J7Z32Pxoa5Rp4wkBM/E0neCdKt ivlcf37u4YTS4vxu/pAHYuqVPhoMRWbpNfc4WEeFUju47MyDCLiOyeMqC4GgGj9ks03y 699FZKOtWgIc8gf2u9g/spqCMJXCbLFEPgZlRaV0vbtugC3SS1BC6A4gyA1HMK5XZI0s mApzUyLq7W6+z+HebCvgJ865ItNfDTxrnlWpnmb6mNHHDK+HUFAn9m+cN9XcVts6Ia7F PIOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=D0mXfgj3a8/dMKAjSGGNgqeNsfjJk9+n2QTOgg6DSo0=; b=mC7ftmxTJUEzl6t/IBRthTzDNc3SkQdg1pgyjXyt/5v/x0xWeJTGViQd3I0DE/PFD2 FKk0ZVU/44m23QOHNNdO1t9yv4bvgVS8gdiIb++U7ejKrlyYtAwREHJG7xOTg0wHo/EX UfgSNTWnIk06NOanUXHyPrgphykyQMakeLfX2fzrDEdXCMsEyRa4O06hBs4Aw8p/Ib0f KB2kzPT49ntk9Lfwhgzs2AxKlqLA1tQQNCjgVQHq2gF9fDjJO4QSNDGUAO9o0bcAqjG6 +SXm7EkQvYiRMQqYNrGXafZKILhfXB8NpCCjQvyLr7Glo8i02mIfWpHaFPJEWG3SCHHA joGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Luvg0Zku; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si1562092pgp.41.2018.02.28.14.24.07; Wed, 28 Feb 2018 14:24:22 -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=@gmail.com header.s=20161025 header.b=Luvg0Zku; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935335AbeB1WX1 (ORCPT + 99 others); Wed, 28 Feb 2018 17:23:27 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:34438 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935151AbeB1WXZ (ORCPT ); Wed, 28 Feb 2018 17:23:25 -0500 Received: by mail-pl0-f67.google.com with SMTP id u13-v6so2397767plq.1; Wed, 28 Feb 2018 14:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=D0mXfgj3a8/dMKAjSGGNgqeNsfjJk9+n2QTOgg6DSo0=; b=Luvg0Zku3cCoLG5ApZd+om2wJqmnIxuaqAUrxLv0xPKClif5/QWjrgwWM2olPu9obx pez6aaMuo8FkwcOzMYMm334iiBe/P1L3CTaMjVSX4vOJOFmnkru7YZ0L11FJGVuBjIrl mAY6/9oOivVWjwl+Erp/s0wZrsSlgyDRhMgaykkTpOCClVXNwS5PZckurKlSsvKPxnLk QKRlfMQk0oS8VbO0r6BKgf2L8tXc0oO3pTyGX8iFbaTllDqj+z3axhTwgP+H3siwdkAT CuW2zoEYO/Ty+42Qb/azmAQrgtENdroJRN5J+BWXlEOFacTk3xNuGTF1BSdXM2aKXXRb Xglw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=D0mXfgj3a8/dMKAjSGGNgqeNsfjJk9+n2QTOgg6DSo0=; b=EDzGjSGwtosy5GcjqKPU2rfdqpMZDfkl7H9E57uSIi0VmFZbHretQDDZ5/60c9OPyQ lzHQiN8zECUvYEl0D2V4H+tfqV2EuaaZbbUObvEZ35OrGirKxMUZMkUw7K732vJHMliD pyoMx3IZhLfLoVZmCVIQEi/1Cj71llXfEvf9XfWfly0EIXp3tRhVOooRVHd1xvv/cSym zjLdE8mwASbxCnb+ev2A9eXzFxtI/4G4IhQIAfYjlAwkUmtlcmonZGoMawZ8Q/gBJvBu SmifQ/E6K5C7bh818yvu3PHefYHkQervhPrhiql9nXtM11c9Bg2sZQ7wnbDab1YawKhE HgyQ== X-Gm-Message-State: APf1xPB7CNCFlZa/NXm9qC/w9XoYf3kvcGC6Lhw1hfj36cWtS6pIh5I4 quxgBJ5qLmKLf830EqdrYLIXGw== X-Received: by 2002:a17:902:780c:: with SMTP id p12-v6mr9803161pll.161.1519856604219; Wed, 28 Feb 2018 14:23:24 -0800 (PST) Received: from gmail.com ([2605:e000:1117:c19a:2e0:1bff:fe70:ea]) by smtp.gmail.com with ESMTPSA id 12sm4950911pfr.147.2018.02.28.14.23.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 14:23:22 -0800 (PST) Date: Wed, 28 Feb 2018 12:23:20 -1000 From: Joey Pabalinas To: kvm@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] x86/kvm/mmu: const-ify struct kvm_memory_slot pointers Message-ID: <20180228222320.23xpoldpmhcp26vi@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zma6suokuyszoxu2" Content-Disposition: inline User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --zma6suokuyszoxu2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Remove `(struct kvm_memory_slot *)` cast of the `const struct kvm_memory_slot *memslot` parameter and const-ify all references to that pointer down the function call chain. Signed-off-by: Joey Pabalinas 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index f551962ac29488431b..e6b32de4d7426fecb3 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1235,7 +1235,7 @@ static void pte_list_remove(u64 *spte, struct kvm_rma= p_head *rmap_head) } =20 static struct kvm_rmap_head *__gfn_to_rmap(gfn_t gfn, int level, - struct kvm_memory_slot *slot) + const struct kvm_memory_slot *slot) { unsigned long idx; =20 @@ -1678,7 +1678,7 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, struct = kvm_rmap_head *rmap_head, =20 struct slot_rmap_walk_iterator { /* input fields. */ - struct kvm_memory_slot *slot; + const struct kvm_memory_slot *slot; gfn_t start_gfn; gfn_t end_gfn; int start_level; @@ -1705,7 +1705,7 @@ rmap_walk_init_level(struct slot_rmap_walk_iterator *= iterator, int level) =20 static void slot_rmap_walk_init(struct slot_rmap_walk_iterator *iterator, - struct kvm_memory_slot *slot, int start_level, + const struct kvm_memory_slot *slot, int start_level, int end_level, gfn_t start_gfn, gfn_t end_gfn) { iterator->slot =3D slot; @@ -5081,7 +5081,7 @@ typedef bool (*slot_level_handler) (struct kvm *kvm, = struct kvm_rmap_head *rmap_ =20 /* The caller should hold mmu-lock before calling this function. */ static __always_inline bool -slot_handle_level_range(struct kvm *kvm, struct kvm_memory_slot *memslot, +slot_handle_level_range(struct kvm *kvm, const struct kvm_memory_slot *mem= slot, slot_level_handler fn, int start_level, int end_level, gfn_t start_gfn, gfn_t end_gfn, bool lock_flush_tlb) { @@ -5111,7 +5111,7 @@ slot_handle_level_range(struct kvm *kvm, struct kvm_m= emory_slot *memslot, } =20 static __always_inline bool -slot_handle_level(struct kvm *kvm, struct kvm_memory_slot *memslot, +slot_handle_level(struct kvm *kvm, const struct kvm_memory_slot *memslot, slot_level_handler fn, int start_level, int end_level, bool lock_flush_tlb) { @@ -5138,7 +5138,7 @@ slot_handle_large_level(struct kvm *kvm, struct kvm_m= emory_slot *memslot, } =20 static __always_inline bool -slot_handle_leaf(struct kvm *kvm, struct kvm_memory_slot *memslot, +slot_handle_leaf(struct kvm *kvm, const struct kvm_memory_slot *memslot, slot_level_handler fn, bool lock_flush_tlb) { return slot_handle_level(kvm, memslot, fn, PT_PAGE_TABLE_LEVEL, @@ -5245,10 +5245,8 @@ static bool kvm_mmu_zap_collapsible_spte(struct kvm = *kvm, void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm, const struct kvm_memory_slot *memslot) { - /* FIXME: const-ify all uses of struct kvm_memory_slot. */ spin_lock(&kvm->mmu_lock); - slot_handle_leaf(kvm, (struct kvm_memory_slot *)memslot, - kvm_mmu_zap_collapsible_spte, true); + slot_handle_leaf(kvm, memslot, kvm_mmu_zap_collapsible_spte, true); spin_unlock(&kvm->mmu_lock); } =20 --=20 2.16.2 --zma6suokuyszoxu2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKlZXrihdNOcUPZTNruvLfWhyVBkFAlqXK9gACgkQruvLfWhy VBk2ZRAAvpfTkox2wnkOyI+Ig4AlNy9i9OuEvgwa8uLxeGlNK6U7zVClogon0ivD xiowUOQW32GEohAXKWsECgsAgA1RPkW+gKoIlpxBLFQKXdZN244UseXH2gqM6PDt W9kTOBR4gdtogo7/cwOHeyBUI1kvMy5rjmlg9ItJTUu02dBTJ84TLZkulnagARol 4Z9VBngc1odXQVbVxxnYa2dyM0EicVhWnyVZhL81de3rLCkuKGDxxpcgzgkG6zQU UTrN1BpI1Rxuy8yokk9lux20udjycgK82VN6nruViVas1KtDz7rwfcH5aBE00B6y uf0wEqCEHZmNmONWOFgc7P/U2yvN0joYkHuXIvByCFhVtxRrPATLQ2/VFJI4kCUC NcM9i+4Xh73baS0Zs/DMRHfWoOSe6t0r7InFRa8CJYIRvli9384jWB4ZOl+RsgeQ VWn8/ytO7sKY+33mEoCsSXzzU22wLQhKpXHlXV31qi/RM3QWf+xLXFssqfsAbQg4 4C0PcMAcSTLUv2Ii9p3FGKg1HlNtzX38c8zdRPAa+UW+HuQ2lTs5YTIJPx/VjWed 1J0RZf81VLHcQpFFgIQ4sBD5KlDktqmWIPgd0mR0m8hvQmCYJjUM7YkkRWyIeKYe CTx/hVaz8DnrcGrUuGVSp2hb4d8FisN/0EgomohPTmkpqzyLG+k= =p/nH -----END PGP SIGNATURE----- --zma6suokuyszoxu2--