Received: by 10.223.176.5 with SMTP id f5csp2844450wra; Mon, 5 Feb 2018 10:49:45 -0800 (PST) X-Google-Smtp-Source: AH8x224PJz9yRcdlVwFrBc1WB4yTRa4j6kk2+el7N1WvEZhvbwP1tGZuMr5wXqHlyLWhfDyYwfnP X-Received: by 10.98.72.206 with SMTP id q75mr5706376pfi.219.1517856585855; Mon, 05 Feb 2018 10:49:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517856585; cv=none; d=google.com; s=arc-20160816; b=GdiWRighixANv530DZyu67buiOe59/gwT9uYnTAAyvhqLlH86EyOLaRSR6TLsag1MK IdjqMfkzVZ94x2g8OIuTZk7npxu2YAuoFcu0lubpH7WHkMQQWDVZ89ZcInD1IiCQsc1G 7uUqIHyu3/bbU//20itNIGYUfX/u4DTOoH2mzPnOemNe5OxaMHd2WPpf2elpbVWdzIBz IbS2dPttRcZzrZT6+wJQxtaFB00RDLKfXOPjPdEr+5EYwuaf4FhLbj2Uiy89mkMWEVZL ATP5EaOQZ/RQ0hU1f/gjtMcVOoW2ytVwvToWj/3/ueYjoZ7STsKKpjvcEte3SMeilEBw yHhQ== 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 :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=mC3oWe6AQDaHo6fF7EYaJsQoPw96QNIZFmkzkDN9bXw=; b=NiSZFbqP59RxCsbYbjuyFeLqI8BgEPI/92dx3iEu5SPcFc0DT/FYSg6FX6tiNLKdUh W2f156g6cfueHVOR6qNasZTl26ChlCbFTxe78FCjDxJjbXNB59e0IooNfUWvublCs4dZ 6EMMNzd7a6NZtN7bsL/oANh5KhWIK42qhF6cA6vxEg3dM07KRZWg8+OtO5sYC72B6QXj X/Ddht1bm866hnMYSewpc9LcySYQitrvh8pyoqHxLkCUU9PRnx1G7VEdBhDwiv6vsR4d Ya2grRzFHDeO2YWHo3qOodYaBxwZL+6S1vWCoyHPkOdS8JvI6KWGyPikusKA9xaC2hEr R5GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=PI6QXb3/; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3-v6si5386704plo.99.2018.02.05.10.49.31; Mon, 05 Feb 2018 10:49:45 -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=@amazon.de header.s=amazon201209 header.b=PI6QXb3/; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753558AbeBEStM (ORCPT + 99 others); Mon, 5 Feb 2018 13:49:12 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:14366 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753979AbeBESsz (ORCPT ); Mon, 5 Feb 2018 13:48:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1517856534; x=1549392534; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=mC3oWe6AQDaHo6fF7EYaJsQoPw96QNIZFmkzkDN9bXw=; b=PI6QXb3/RL725xuq/VKL7A40oE6xUwQIqSrWt2p31mgSTKqs1APsI25J PONL/0c4ZaHKIlsLtbx+qvAQdaDqVnJUOvxrol6ZRhCX0dJXedWtGEfOI HSNlvXL76s06gB1fBRMblOcqcrkQ4dJg0yHU6RQp1M4GWGFcd3vNBLVW9 A=; X-IronPort-AV: E=Sophos;i="5.46,465,1511827200"; d="scan'208";a="718190591" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2a-c5104f52.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2018 18:48:03 +0000 Received: from u54e1ad5160425a4b64ea.ant.amazon.com (pdx2-ws-svc-lb17-vlan2.amazon.com [10.247.140.66]) by email-inbound-relay-2a-c5104f52.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w15IlnTL101939 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Feb 2018 18:47:50 GMT Received: from u54e1ad5160425a4b64ea.ant.amazon.com (localhost [127.0.0.1]) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w15IlmdE003135; Mon, 5 Feb 2018 19:47:48 +0100 Received: (from karahmed@localhost) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Submit) id w15Illn4003133; Mon, 5 Feb 2018 19:47:47 +0100 From: KarimAllah Ahmed To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: KarimAllah Ahmed , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [RFC 00/12] KVM/X86: Introduce a new guest mapping API Date: Mon, 5 Feb 2018 19:47:19 +0100 Message-Id: <1517856451-2932-1-git-send-email-karahmed@amazon.de> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Guest memory can either be directly managed by the kernel (i.e. have a "struct page") or they can simply live outside kernel control (i.e. do not have a "struct page"). KVM mostly support these two modes, except in a few places where the code seems to assume that guest memory must have a "struct page". This patchset introduces a new mapping function to map guest memory into host kernel memory. Ideally I should also get rid of all guest mapping functions that end up converting a guest address to a page, but I decided to get feedback on this first and see if this is an acceptable API. Most of the offending code paths that has been updated are in the nested code base. Mostly because I stumbled upon this code while looking at the nested MSR bitmap handling for the IBRS patches. There are also offending code paths in SVM code, but I will do that once the interface is accepted. KarimAllah Ahmed (12): KVM: Introduce helper functions to map/unmap guest memory KVM/VMX: Use the new host mapping API for apic_access_page KVM/VMX: Use the new host mapping API for virtual_apic_page KVM/VMX: Use the new host mapping API for pi_desc_page KVM/VMX: Use the new host mapping API for mapping nested vmptr KVM/VMX: Use the new host mapping API for handle_vmptrld KVM/VMX: Use the new host mapping API for mapping L12 MSR bitmap KVM/VMX: Use the new host mapping API for mapping nested PML KVM/VMX: Use the new host mapping API for cmpxchg_emulated KVM/VMX: Use the new host mapping API for synic_clear_sint_msg_pending KVM/VMX: Use the new host mapping API for synic_deliver_msg KVM/VMX: Remove kvm_vcpu_gpa_to_page as it is now unused arch/x86/kvm/hyperv.c | 24 +++---- arch/x86/kvm/vmx.c | 159 ++++++++++++++++++++--------------------------- arch/x86/kvm/x86.c | 12 ++-- include/linux/kvm_host.h | 18 +++++- virt/kvm/kvm_main.c | 62 ++++++++++++++++++ 5 files changed, 161 insertions(+), 114 deletions(-) Cc: Paolo Bonzini Cc: Radim Krčmář Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org -- 2.7.4