From patchwork Wed Feb 21 14:02:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 129073 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp662759ljc; Wed, 21 Feb 2018 06:06:07 -0800 (PST) X-Google-Smtp-Source: AH8x227qiythZEFZ4ngvmNW1oy/FADmQMDvGOVKCx2UrVKhuqZDtP2mTpyyzKW7PEVR3ahs6qCM/ X-Received: by 10.31.140.5 with SMTP id o5mr2429504vkd.157.1519221967789; Wed, 21 Feb 2018 06:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519221967; cv=none; d=google.com; s=arc-20160816; b=LMAYFE/bfkUYRoTXA0xFSZGrYgDdFifZrEMg7ndBICC5YcAjdlFgubSymLTHKnlxzQ vHn7YdxZH25IDGmV7nk3Mqw14i5oNeoduNSCFd3k41Ofz/sa45nQ1CdV4afiEO875nnO 6SlxIqj88thBwn93UFSrQ3FIgiH+OmTxoTM3y3Sc8a6OSZoR49d8GRTXmT9MbE2GbqbC L7Xqcb6Hb6EtPnK/tavwVFxQhXbl5U9b+DMDsl60HsAIja37zGgGs2oPfWtZjtakdu2T onwje9j7Yjk8d3XsZ0dzw4eeC4UctCEcv9RC4rTzs4l3yyaWIut2TLQXfRJdM9Ydq/Gl HM1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:message-id:date:to:from :arc-authentication-results; bh=aPqkt931GC8up7qFrJsu3vZ/PPOAKbwMWoST+b+blSU=; b=eJEMfg/mfbSKWMI8BYQts7Qy4tAMgb+hCdoq3iIxfBbvnICi0B3/S+Il4zvthOJ8OW vtKHxiM2E2rgYujksOkLGhXdDiVUeHuyXyVR5vYG1bjxQIt5x1E+v5oeTenpn3IJnkI2 ukmCVOynxsdrlMGownmwl88u15ghXiWsUnHOa5KAktfupqs2qLx/CIAAsqOUUJU92Pe1 JCYTBnk3Wi14YvKy41ECcE23FeNthyQJbprqA8O2z0+A9n0e798pqpfDsouAlfMZ2vqJ hHzyoJelDq6Aau4V6qV3b/aOOez8tIx4nIvBmaALIa41w4j4DrqcUZzZaOxFUKusY22u +DMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n30si3135763uae.380.2018.02.21.06.06.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 06:06:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoUzR-0004OS-NT; Wed, 21 Feb 2018 14:03:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoUzQ-0004Nt-9P for xen-devel@lists.xen.org; Wed, 21 Feb 2018 14:03:20 +0000 X-Inumbo-ID: 2e36d587-1710-11e8-b9b1-635ca7ef6cff Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id 2e36d587-1710-11e8-b9b1-635ca7ef6cff; Wed, 21 Feb 2018 14:04:49 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AFB761435; Wed, 21 Feb 2018 06:03:12 -0800 (PST) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 719363F318; Wed, 21 Feb 2018 06:03:09 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 21 Feb 2018 14:02:43 +0000 Message-Id: <20180221140259.29360-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Cc: Kevin Tian , Stefano Stabellini , Wei Liu , Jun Nakajima , Razvan Cojocaru , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Paul Durrant , Tamas K Lengyel , Jan Beulich , Shane Wang , Suravee Suthikulpanit , Boris Ostrovsky , Gang Wei Subject: [Xen-devel] [PATCH v4 00/16] xen: Convert page_to_mfn and mfn_to_page to use typesafe MFN X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Hi all, This series is a rework of "xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN" sent a couple of months ago (see [1]). In this new approach, the macros __page_to_mfn and __mfn_to_page are completely dropped. To avoid the last patch (#16) to be a huge patch some files are converted to use typesafe upfront. I have tried my best to push _mfn/mfn_x as down as possible in the callers. Some of them was not feasible without major rework, so I left them aside for now. Contribution to switch Xen code base to MFN typesafe are more than welcomed. Note that changes have only been build test it on x86 so far. Cheers, [1] https://lists.xen.org/archives/html/xen-devel/2017-11/msg00027.html Cc: Andrew Cooper Cc: Boris Ostrovsky Cc: Gang Wei Cc: George Dunlap Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Jun Nakajima Cc: Kevin Tian Cc: Konrad Rzeszutek Wilk Cc: Paul Durrant Cc: Razvan Cojocaru Cc: Shane Wang Cc: Stefano Stabellini Cc: Suravee Suthikulpanit Cc: Tamas K Lengyel Cc: Tim Deegan Cc: Wei Liu Julien Grall (16): xen/tmem: Convert the file common/tmem_xen.c to use typesafe MFN xen/arm: setup: use maddr_to_mfn rather than _mfn(paddr_to_pfn(...)) xen/arm: mm: Use gaddr_to_gfn rather than _gfn(paddr_to_pfn(...)) xen/arm: mm: Remove unused M2P code xen/arm: mm: Remove unused relinquish_shared_pages xen/x86: Remove unused override of page_to_mfn/mfn_to_page xen/x86: mm: Switch x86/mm.c to use typesafe for virt_to_mfn xen/mm: Drop the parameter mfn from populate_pt_range xen/pdx: Introduce helper to convert MFN <-> PDX xen/mm: Switch map_pages_to_xen to use MFN typesafe xen/mm: Switch page_alloc.c to typesafe MFN xen/mm: Switch common/memory.c to use typesafe MFN xen/grant: Switch {create, replace}_grant_p2m_mapping to typesafe MFN xen/grant: Switch common/grant_table.c to use typesafe MFN xen/x86: Switch mfn_to_page in x86_64/mm.c to use typesafe MFN xen: Convert page_to_mfn and mfn_to_page to use typesafe MFN xen/arch/arm/domain_build.c | 2 - xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mem_access.c | 2 +- xen/arch/arm/mm.c | 33 ++++---- xen/arch/arm/p2m.c | 10 +-- xen/arch/arm/setup.c | 4 +- xen/arch/x86/cpu/vpmu.c | 4 +- xen/arch/x86/domain.c | 21 ++--- xen/arch/x86/domain_page.c | 6 +- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/dom0_build.c | 6 +- xen/arch/x86/hvm/emulate.c | 6 +- xen/arch/x86/hvm/grant_table.c | 14 ++-- xen/arch/x86/hvm/hvm.c | 12 +-- xen/arch/x86/hvm/ioreq.c | 4 +- xen/arch/x86/hvm/stdvga.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 4 +- xen/arch/x86/hvm/viridian.c | 6 +- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 10 +-- xen/arch/x86/hvm/vmx/vvmx.c | 6 +- xen/arch/x86/mm.c | 70 ++++++++--------- xen/arch/x86/mm/guest_walk.c | 6 +- xen/arch/x86/mm/hap/guest_walk.c | 2 +- xen/arch/x86/mm/hap/hap.c | 6 -- xen/arch/x86/mm/hap/nested_ept.c | 2 +- xen/arch/x86/mm/hap/nested_hap.c | 3 - xen/arch/x86/mm/mem_sharing.c | 5 -- xen/arch/x86/mm/p2m-ept.c | 8 +- xen/arch/x86/mm/p2m-pod.c | 6 -- xen/arch/x86/mm/p2m-pt.c | 6 -- xen/arch/x86/mm/p2m.c | 6 -- xen/arch/x86/mm/paging.c | 6 -- xen/arch/x86/mm/shadow/private.h | 16 +--- xen/arch/x86/numa.c | 2 +- xen/arch/x86/physdev.c | 2 +- xen/arch/x86/pv/callback.c | 6 -- xen/arch/x86/pv/descriptor-tables.c | 6 -- xen/arch/x86/pv/dom0_build.c | 14 ++-- xen/arch/x86/pv/domain.c | 6 -- xen/arch/x86/pv/emul-gate-op.c | 6 -- xen/arch/x86/pv/emul-priv-op.c | 10 --- xen/arch/x86/pv/grant_table.c | 16 ++-- xen/arch/x86/pv/iret.c | 6 -- xen/arch/x86/pv/mm.c | 6 -- xen/arch/x86/pv/ro-page-fault.c | 6 -- xen/arch/x86/pv/shim.c | 4 +- xen/arch/x86/pv/traps.c | 6 -- xen/arch/x86/setup.c | 14 ++-- xen/arch/x86/smpboot.c | 8 +- xen/arch/x86/tboot.c | 15 ++-- xen/arch/x86/traps.c | 4 +- xen/arch/x86/x86_64/mm.c | 67 ++++++++-------- xen/arch/x86/x86_64/mmconfig_64.c | 4 +- xen/common/domain.c | 4 +- xen/common/efi/boot.c | 2 +- xen/common/grant_table.c | 131 +++++++++++++++++--------------- xen/common/kimage.c | 6 -- xen/common/memory.c | 66 +++++++++------- xen/common/page_alloc.c | 58 +++++++------- xen/common/tmem.c | 2 +- xen/common/tmem_xen.c | 26 ++++--- xen/common/trace.c | 4 +- xen/common/vmap.c | 10 +-- xen/common/xenoprof.c | 2 - xen/drivers/acpi/apei/erst.c | 2 +- xen/drivers/acpi/apei/hest.c | 2 +- xen/drivers/passthrough/amd/iommu_map.c | 12 +-- xen/drivers/passthrough/iommu.c | 2 +- xen/drivers/passthrough/vtd/dmar.c | 2 +- xen/drivers/passthrough/x86/iommu.c | 2 +- xen/include/asm-arm/grant_table.h | 11 ++- xen/include/asm-arm/mm.h | 45 +++-------- xen/include/asm-arm/numa.h | 8 +- xen/include/asm-arm/p2m.h | 4 +- xen/include/asm-x86/grant_table.h | 6 +- xen/include/asm-x86/hvm/grant_table.h | 8 +- xen/include/asm-x86/mm.h | 12 +-- xen/include/asm-x86/p2m.h | 2 +- xen/include/asm-x86/page.h | 32 ++++---- xen/include/asm-x86/pv/grant_table.h | 8 +- xen/include/xen/domain_page.h | 8 +- xen/include/xen/mm.h | 10 +-- xen/include/xen/pdx.h | 3 + xen/include/xen/tmem_xen.h | 2 +- 85 files changed, 429 insertions(+), 571 deletions(-)