From patchwork Mon Jul 1 10:15:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hang.yuan@linux.intel.com X-Patchwork-Id: 11025467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 89C501398 for ; Mon, 1 Jul 2019 10:26:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D45A283A6 for ; Mon, 1 Jul 2019 10:26:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7193D28641; Mon, 1 Jul 2019 10:26:22 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07369283A6 for ; Mon, 1 Jul 2019 10:26:21 +0000 (UTC) Received: from localhost ([::1]:56864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhtVt-0001cK-0v for patchwork-qemu-devel@patchwork.kernel.org; Mon, 01 Jul 2019 06:26:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33195) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhtV2-0000sz-Ct for qemu-devel@nongnu.org; Mon, 01 Jul 2019 06:25:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hhtV1-0006Ow-AM for qemu-devel@nongnu.org; Mon, 01 Jul 2019 06:25:28 -0400 Received: from mga04.intel.com ([192.55.52.120]:65182) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hhtUx-0006JA-LQ for qemu-devel@nongnu.org; Mon, 01 Jul 2019 06:25:25 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jul 2019 03:25:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,439,1557212400"; d="scan'208";a="184222137" Received: from henry-optiplex-7050.bj.intel.com ([10.238.156.132]) by fmsmga001.fm.intel.com with ESMTP; 01 Jul 2019 03:25:16 -0700 From: hang.yuan@linux.intel.com To: qemu-devel@nongnu.org Date: Mon, 1 Jul 2019 18:15:29 +0800 Message-Id: <1561976129-31086-1-git-send-email-hang.yuan@linux.intel.com> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.120 Subject: [Qemu-devel] [PATCH v2] target/i386: HAX: Enable ROM/ROM device memory region support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hang Yuan Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Hang Yuan Add ROM and ROM device memory region support in HAX. Their memory region is read only and write access will generate EPT violation. The violation will be handled in the HAX kernel with the following patch. https://github.com/intel/haxm/commit/33ceea09a1655fca12c47f1e112b1d269357ff28 v2: fix coding style problems Signed-off-by: Hang Yuan --- target/i386/hax-mem.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/target/i386/hax-mem.c b/target/i386/hax-mem.c index 6bb5a24917..a8bfd37977 100644 --- a/target/i386/hax-mem.c +++ b/target/i386/hax-mem.c @@ -175,13 +175,10 @@ static void hax_process_section(MemoryRegionSection *section, uint8_t flags) uint64_t host_va; uint32_t max_mapping_size; - /* We only care about RAM and ROM regions */ - if (!memory_region_is_ram(mr)) { - if (memory_region_is_romd(mr)) { - /* HAXM kernel module does not support ROMD yet */ - warn_report("Ignoring ROMD region 0x%016" PRIx64 "->0x%016" PRIx64, - start_pa, start_pa + size); - } + /* We only care about RAM/ROM regions and ROM device */ + if (memory_region_is_rom(mr) || (memory_region_is_romd(mr))) { + flags |= HAX_RAM_INFO_ROM; + } else if (!memory_region_is_ram(mr)) { return; }