From patchwork Sun Jan 1 16:37:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexander Gordeev X-Patchwork-Id: 9492913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 03B8160416 for ; Sun, 1 Jan 2017 16:37:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E25891FF35 for ; Sun, 1 Jan 2017 16:37:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5268223B2; Sun, 1 Jan 2017 16:37:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A2D61FF35 for ; Sun, 1 Jan 2017 16:37:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932322AbdAAQhm (ORCPT ); Sun, 1 Jan 2017 11:37:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49684 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932315AbdAAQhk (ORCPT ); Sun, 1 Jan 2017 11:37:40 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F7988050A for ; Sun, 1 Jan 2017 16:37:41 +0000 (UTC) Received: from dhcp-27-118.brq.redhat.com (dhcp-27-122.brq.redhat.com [10.34.27.122]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v01GbZLM019089; Sun, 1 Jan 2017 11:37:40 -0500 From: Alexander Gordeev To: kvm@vger.kernel.org Cc: Alexander Gordeev , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [kvm-unit-tests RFC PATCH 04/10] x86: Remove virt_to_phys_cr3() interface Date: Sun, 1 Jan 2017 17:37:26 +0100 Message-Id: <1483288652-18983-5-git-send-email-agordeev@redhat.com> In-Reply-To: <1483288652-18983-1-git-send-email-agordeev@redhat.com> References: <1483288652-18983-1-git-send-email-agordeev@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 01 Jan 2017 16:37:41 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Public interface virt_to_phys_cr3() is only used in asyncpf test and does not make much sense for the rest of the code. This update turns it local to asyncpf only. Cc: Radim Krčmář Signed-off-by: Alexander Gordeev --- lib/x86/vm.c | 5 ----- lib/x86/vm.h | 1 - x86/asyncpf.c | 5 +++++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/x86/vm.c b/lib/x86/vm.c index 72f6b380bb79..c1448d7a2766 100644 --- a/lib/x86/vm.c +++ b/lib/x86/vm.c @@ -178,11 +178,6 @@ void *vmalloc(unsigned long size) return mem; } -uint64_t virt_to_phys_cr3(void *mem) -{ - return (*get_pte(phys_to_virt(read_cr3()), mem) & PT_ADDR_MASK) + ((ulong)mem & (PAGE_SIZE - 1)); -} - void vfree(void *mem) { unsigned long size = ((unsigned long *)mem)[-1]; diff --git a/lib/x86/vm.h b/lib/x86/vm.h index 2418311b25f5..427da661cf69 100644 --- a/lib/x86/vm.h +++ b/lib/x86/vm.h @@ -12,7 +12,6 @@ void vfree(void *mem); void *vmap(unsigned long long phys, unsigned long size); void *alloc_vpage(void); void *alloc_vpages(ulong nr); -uint64_t virt_to_phys_cr3(void *mem); unsigned long *get_pte(unsigned long *cr3, void *virt); unsigned long *install_pte(unsigned long *cr3, diff --git a/x86/asyncpf.c b/x86/asyncpf.c index 3b1bcb007ded..2f857a2a07ab 100644 --- a/x86/asyncpf.c +++ b/x86/asyncpf.c @@ -45,6 +45,11 @@ static inline uint32_t get_apf_reason(void) return r; } +static uint64_t virt_to_phys_cr3(void *mem) +{ + return (*get_pte(phys_to_virt(read_cr3()), mem) & PT_ADDR_MASK) + ((ulong)mem & (PAGE_SIZE - 1)); +} + static void pf_isr(struct ex_regs *r) { void* virt = (void*)((ulong)(buf+i) & ~(PAGE_SIZE-1));