From patchwork Thu Nov 11 14:13:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Peng X-Patchwork-Id: 12614897 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7EAFC433F5 for ; Thu, 11 Nov 2021 14:17:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7653C60EDF for ; Thu, 11 Nov 2021 14:17:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7653C60EDF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 162CD6B0071; Thu, 11 Nov 2021 09:17:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EAFB6B0082; Thu, 11 Nov 2021 09:17:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECD1D6B008A; Thu, 11 Nov 2021 09:17:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id D9BF86B0071 for ; Thu, 11 Nov 2021 09:17:50 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9330018527CDA for ; Thu, 11 Nov 2021 14:17:50 +0000 (UTC) X-FDA: 78796852932.19.BA279AE Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by imf22.hostedemail.com (Postfix) with ESMTP id 024F51926 for ; Thu, 11 Nov 2021 14:17:49 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10164"; a="296353357" X-IronPort-AV: E=Sophos;i="5.87,226,1631602800"; d="scan'208";a="296353357" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2021 06:16:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,226,1631602800"; d="scan'208";a="492556158" Received: from chaop.bj.intel.com ([10.240.192.101]) by orsmga007.jf.intel.com with ESMTP; 11 Nov 2021 06:16:29 -0800 From: Chao Peng To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, qemu-devel@nongnu.org Cc: Paolo Bonzini , Jonathan Corbet , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Yu Zhang , Chao Peng , "Kirill A . Shutemov" , luto@kernel.org, john.ji@intel.com, susie.li@intel.com, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com Subject: [RFC PATCH 10/13] softmmu/physmem: Add private memory address space Date: Thu, 11 Nov 2021 22:13:49 +0800 Message-Id: <20211111141352.26311-11-chao.p.peng@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211111141352.26311-1-chao.p.peng@linux.intel.com> References: <20211111141352.26311-1-chao.p.peng@linux.intel.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 024F51926 X-Stat-Signature: 5g3fmpztbwprj8k1cfkfikhm8cewt76t Authentication-Results: imf22.hostedemail.com; dkim=none; spf=none (imf22.hostedemail.com: domain of chao.p.peng@linux.intel.com has no SPF policy when checking 134.134.136.100) smtp.mailfrom=chao.p.peng@linux.intel.com; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none) X-HE-Tag: 1636640269-459680 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Signed-off-by: Chao Peng --- include/exec/address-spaces.h | 2 ++ softmmu/physmem.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/exec/address-spaces.h b/include/exec/address-spaces.h index db8bfa9a92..b3f45001c0 100644 --- a/include/exec/address-spaces.h +++ b/include/exec/address-spaces.h @@ -27,6 +27,7 @@ * until a proper bus interface is available. */ MemoryRegion *get_system_memory(void); +MemoryRegion *get_system_private_memory(void); /* Get the root I/O port region. This interface should only be used * temporarily until a proper bus interface is available. @@ -34,6 +35,7 @@ MemoryRegion *get_system_memory(void); MemoryRegion *get_system_io(void); extern AddressSpace address_space_memory; +extern AddressSpace address_space_private_memory; extern AddressSpace address_space_io; #endif diff --git a/softmmu/physmem.c b/softmmu/physmem.c index f4d6eeaa17..a2d339fd88 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -85,10 +85,13 @@ RAMList ram_list = { .blocks = QLIST_HEAD_INITIALIZER(ram_list.blocks) }; static MemoryRegion *system_memory; +static MemoryRegion *system_private_memory; static MemoryRegion *system_io; AddressSpace address_space_io; AddressSpace address_space_memory; +AddressSpace address_space_private_memory; + static MemoryRegion io_mem_unassigned; @@ -2669,6 +2672,11 @@ static void memory_map_init(void) memory_region_init(system_memory, NULL, "system", UINT64_MAX); address_space_init(&address_space_memory, system_memory, "memory"); + system_private_memory = g_malloc(sizeof(*system_private_memory)); + + memory_region_init(system_private_memory, NULL, "system-private", UINT64_MAX); + address_space_init(&address_space_private_memory, system_private_memory, "private-memory"); + system_io = g_malloc(sizeof(*system_io)); memory_region_init_io(system_io, NULL, &unassigned_io_ops, NULL, "io", 65536); @@ -2680,6 +2688,11 @@ MemoryRegion *get_system_memory(void) return system_memory; } +MemoryRegion *get_system_private_memory(void) +{ + return system_private_memory; +} + MemoryRegion *get_system_io(void) { return system_io;