From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF97EC433F5 for ; Thu, 9 Dec 2021 20:05:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231490AbhLIUJS (ORCPT ); Thu, 9 Dec 2021 15:09:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231439AbhLIUJR (ORCPT ); Thu, 9 Dec 2021 15:09:17 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 430FCC061746 for ; Thu, 9 Dec 2021 12:05:43 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id k2so10700442lji.4 for ; Thu, 09 Dec 2021 12:05:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=vdi+ngDYZ8frSITjIEVRzjOKqqv9jxuC3qoXZDRzY3E=; b=POI/206AdEE7Y8xM46ArhvWFzWMc2DNrU+UafFP+UOclIvQYLxk1wmsBw/yyS/2aJq S5CpimmLVPKLGv1qeaK8y9ZSZWPbUrwWz0U9F23hBFzZMNnqPiSgGl6i4yrjddpeoM+4 pCbv8bG+8PORW01axAIL0xFxcCuYd/SxoZ6D83LMnf0JeYB3FzzmLDoqQYGTBLtxMEcP AqUoKYkz+sQ323/QBMVXkSS+NhUo2aqU24AfJZE57ACd8ve3kXXj62V6znNiezs+Qw1u 72Nkmrzzg3J90EBkRxkscukCm+D95/mVkCa9cL3RnL2xd6tVyz3BvuskJvsUpaKNUpzK u5Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vdi+ngDYZ8frSITjIEVRzjOKqqv9jxuC3qoXZDRzY3E=; b=GHS9hYJM/NL85mboFFm6l7CPI/mPyV7rO4xRPIrM/i60cwEeiGaf5LclrF1YnSQSMy DzCfXoPvU/yls2tvFuj83yfAgV0zzgJCwpp2VGcFt9lyO6ztTmDGRLA+V+LVARe+71y3 L1tOxNgf+dj8SShizl5dMKO8X/qHnmghmAGieRXj1ytto+PJfgwwwfhnzgmK/oiP2CIj FU+Lv2iyNqYI2hVXz1E8Qnlr3Gnp643jZe91iGolwcafDMBZQb/6i84u1qLhUqwg6NT6 koHq/yLnukW/HaXrtPvIixBtTOk/Q76EE1el/kMU935OHiSAvZMnyrdfay4g4nWvVONP mYTQ== X-Gm-Message-State: AOAM532jz3NcH/4NsOHOU63Ks3RCoTXg5KTZ87GOLJ+/jxkKBOGozZPr 3e7RRHc/4B/9jj/xIMe/CFg= X-Google-Smtp-Source: ABdhPJxucGuWwfKQW2OEY9Dp9Wft8deEcKtIdgf1+XzoXquMxrrE4dy0sBiatCkpQLtPu/fTSAEpFw== X-Received: by 2002:a2e:530d:: with SMTP id h13mr8398300ljb.95.1639080341326; Thu, 09 Dec 2021 12:05:41 -0800 (PST) Received: from otyshchenko.router ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id o12sm87371lft.134.2021.12.09.12.05.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Dec 2021 12:05:40 -0800 (PST) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Oleksandr Tyshchenko , Stefano Stabellini , Russell King , Boris Ostrovsky , Juergen Gross , Julien Grall , Bertrand Marquis , Wei Chen , Henry Wang , Kaly Xin , Jiamei Xie Subject: [PATCH V4 0/6] xen: Add support of extended regions (safe ranges) on Arm Date: Thu, 9 Dec 2021 22:05:30 +0200 Message-Id: <1639080336-26573-1-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oleksandr Tyshchenko Hello all. You can find the RFC-V3 patch series at [1],[2] and [3]. The corresponding Xen support (for both Dom0 and DomU) is already committed and is available in mainline Xen since the following commit: 57f87857dc2de452a796d6bad4f476510efd2aba libxl/arm: Add handling of extended regions for DomU The extended region (safe range) is a region of guest physical address space which is unused and could be safely used to create grant/foreign mappings instead of ballooning out real RAM pages to obtain a physical address space for creating these mappings (which simply results in wasting domain memory and shattering super pages in P2M table). The problem is that we cannot follow Linux advise which memory ranges are unused on Arm as there might be some identity mappings in P2M table (stage 2) the guest is not aware of or not all device I/O regions might be known (registered) by the time the guest starts creating grant/foreign mappings. This is why we need some hints from the hypervisor which knows all details in advance to be able to choose extended regions (which won't clash with other resources). The extended regions are chosen at the domain creation time and advertised to it via "reg" property under hypervisor node in the guest device-tree [4]. As region 0 is reserved for grant table space (always present), the indexes for extended regions are 1...N. No device tree bindings update is needed, guest infers the presence of extended regions from the number of regions in "reg" property. Please note the following: - The ACPI case is not covered for now - patch series was created in a way to retain existing behavior on x86 The patch series is based on v5.16-rc3 and also available at [5], it was fully tested on Arm64 and only compile tested on x86. [1] https://lore.kernel.org/all/1627490656-1267-1-git-send-email-olekstysh@gmail.com/ https://lore.kernel.org/all/1627490656-1267-2-git-send-email-olekstysh@gmail.com/ [2] https://lore.kernel.org/all/1635264312-3796-1-git-send-email-olekstysh@gmail.com/ [3] https://lore.kernel.org/all/1637787223-21129-1-git-send-email-olekstysh@gmail.com/ [4] https://xenbits.xen.org/gitweb/?p=xen.git;a=blob_plain;f=docs/misc/arm/device-tree/guest.txt;hb=refs/heads/master [5] https://github.com/otyshchenko1/linux/commits/map_opt_ml7 Oleksandr Tyshchenko (6): xen/unpopulated-alloc: Drop check for virt_addr_valid() in fill_list() arm/xen: Switch to use gnttab_setup_auto_xlat_frames() for DT xen/balloon: Bring alloc(free)_xenballooned_pages helpers back xen/unpopulated-alloc: Add mechanism to use Xen resource arm/xen: Read extended regions from DT and init Xen resource dt-bindings: xen: Clarify "reg" purpose Documentation/devicetree/bindings/arm/xen.txt | 14 +-- arch/arm/xen/enlighten.c | 132 ++++++++++++++++++++++++-- drivers/xen/Kconfig | 2 +- drivers/xen/balloon.c | 20 ++-- drivers/xen/unpopulated-alloc.c | 87 ++++++++++++++++- include/xen/balloon.h | 3 + include/xen/xen.h | 16 ++++ 7 files changed, 245 insertions(+), 29 deletions(-) -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93881C433F5 for ; Thu, 9 Dec 2021 20:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VuqPdOG/CdL8vk9Y9Yz+csPLrdJLHg5p42Ms5wX1RAc=; b=PItLss2ySHkoni ieQ0K8CVlHJEvTV1zeOstmCEwQtg2F4DLIA6ZcmRUm6hT566K7wX4fi2KETOm0NpZa+IzJGkGkj4e Ipl2NKIB5pFbCVG4JxUtYISaoNyz+twZ9lAO+a2mVYWyFVLshqPRRYy/9US6MW/nSprpgqopUkk3u ws650tpvhdB+mkENtCgGihwExysn2GkNVFU4hro1G/qwuyPSkwaxZFb8ybGLqjbXo+2jh62eghM4t WC2XCrdEWQeu9qTWwG9aD7YrLEZfvWcr/8+E5dZDDHCInYErwG/GE7UzsW0wVKGfT1Qg6gg5wMjpc pjfRX6ZgjA8OhshHImyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvPfp-00HQh8-0k; Thu, 09 Dec 2021 20:05:49 +0000 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvPfk-00HQfZ-5X for linux-arm-kernel@lists.infradead.org; Thu, 09 Dec 2021 20:05:45 +0000 Received: by mail-lj1-x22b.google.com with SMTP id 13so10634186ljj.11 for ; Thu, 09 Dec 2021 12:05:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=vdi+ngDYZ8frSITjIEVRzjOKqqv9jxuC3qoXZDRzY3E=; b=POI/206AdEE7Y8xM46ArhvWFzWMc2DNrU+UafFP+UOclIvQYLxk1wmsBw/yyS/2aJq S5CpimmLVPKLGv1qeaK8y9ZSZWPbUrwWz0U9F23hBFzZMNnqPiSgGl6i4yrjddpeoM+4 pCbv8bG+8PORW01axAIL0xFxcCuYd/SxoZ6D83LMnf0JeYB3FzzmLDoqQYGTBLtxMEcP AqUoKYkz+sQ323/QBMVXkSS+NhUo2aqU24AfJZE57ACd8ve3kXXj62V6znNiezs+Qw1u 72Nkmrzzg3J90EBkRxkscukCm+D95/mVkCa9cL3RnL2xd6tVyz3BvuskJvsUpaKNUpzK u5Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vdi+ngDYZ8frSITjIEVRzjOKqqv9jxuC3qoXZDRzY3E=; b=2VqddHZxm/7bMWo4GfLND18bPcIqwxn1tnmb4YzIT9ghOqSZ/T4VAwyyJyV9w8joyx ei2Y0vLVZd8gxBwYmvwxZclIWJpfTrKZJ9uEsgS3kr3Weo7YmdRLitGFqmdHU8MbUIS7 ZPYqyjYbOkktW6d8rkmmtBGDRKsB4JwsFF9d4NpxR5YQpqy/4QPRehd+2h78WU8aWJwf J65iAgKB7aQJuZNhyF3DdJC3a1az49KvJIfqj5k2rKVtd3406Z0v8EpUE/td3r92fuGm 9H5xP06oUXTDVlxMwe+Zrsq2eA64qSOCa8N3f/il59NP/HzJOCdTlYGNi6ZBqoxyKL1p HpvA== X-Gm-Message-State: AOAM531bLMiGIJbLBt54IxjK0ge9bGkYl29Ed1tlHAnPUdEv0mNgdzHa 8SLb515fgkEXSXe0yeTc1J8= X-Google-Smtp-Source: ABdhPJxucGuWwfKQW2OEY9Dp9Wft8deEcKtIdgf1+XzoXquMxrrE4dy0sBiatCkpQLtPu/fTSAEpFw== X-Received: by 2002:a2e:530d:: with SMTP id h13mr8398300ljb.95.1639080341326; Thu, 09 Dec 2021 12:05:41 -0800 (PST) Received: from otyshchenko.router ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id o12sm87371lft.134.2021.12.09.12.05.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Dec 2021 12:05:40 -0800 (PST) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Oleksandr Tyshchenko , Stefano Stabellini , Russell King , Boris Ostrovsky , Juergen Gross , Julien Grall , Bertrand Marquis , Wei Chen , Henry Wang , Kaly Xin , Jiamei Xie Subject: [PATCH V4 0/6] xen: Add support of extended regions (safe ranges) on Arm Date: Thu, 9 Dec 2021 22:05:30 +0200 Message-Id: <1639080336-26573-1-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211209_120544_276887_55511144 X-CRM114-Status: GOOD ( 16.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Oleksandr Tyshchenko Hello all. You can find the RFC-V3 patch series at [1],[2] and [3]. The corresponding Xen support (for both Dom0 and DomU) is already committed and is available in mainline Xen since the following commit: 57f87857dc2de452a796d6bad4f476510efd2aba libxl/arm: Add handling of extended regions for DomU The extended region (safe range) is a region of guest physical address space which is unused and could be safely used to create grant/foreign mappings instead of ballooning out real RAM pages to obtain a physical address space for creating these mappings (which simply results in wasting domain memory and shattering super pages in P2M table). The problem is that we cannot follow Linux advise which memory ranges are unused on Arm as there might be some identity mappings in P2M table (stage 2) the guest is not aware of or not all device I/O regions might be known (registered) by the time the guest starts creating grant/foreign mappings. This is why we need some hints from the hypervisor which knows all details in advance to be able to choose extended regions (which won't clash with other resources). The extended regions are chosen at the domain creation time and advertised to it via "reg" property under hypervisor node in the guest device-tree [4]. As region 0 is reserved for grant table space (always present), the indexes for extended regions are 1...N. No device tree bindings update is needed, guest infers the presence of extended regions from the number of regions in "reg" property. Please note the following: - The ACPI case is not covered for now - patch series was created in a way to retain existing behavior on x86 The patch series is based on v5.16-rc3 and also available at [5], it was fully tested on Arm64 and only compile tested on x86. [1] https://lore.kernel.org/all/1627490656-1267-1-git-send-email-olekstysh@gmail.com/ https://lore.kernel.org/all/1627490656-1267-2-git-send-email-olekstysh@gmail.com/ [2] https://lore.kernel.org/all/1635264312-3796-1-git-send-email-olekstysh@gmail.com/ [3] https://lore.kernel.org/all/1637787223-21129-1-git-send-email-olekstysh@gmail.com/ [4] https://xenbits.xen.org/gitweb/?p=xen.git;a=blob_plain;f=docs/misc/arm/device-tree/guest.txt;hb=refs/heads/master [5] https://github.com/otyshchenko1/linux/commits/map_opt_ml7 Oleksandr Tyshchenko (6): xen/unpopulated-alloc: Drop check for virt_addr_valid() in fill_list() arm/xen: Switch to use gnttab_setup_auto_xlat_frames() for DT xen/balloon: Bring alloc(free)_xenballooned_pages helpers back xen/unpopulated-alloc: Add mechanism to use Xen resource arm/xen: Read extended regions from DT and init Xen resource dt-bindings: xen: Clarify "reg" purpose Documentation/devicetree/bindings/arm/xen.txt | 14 +-- arch/arm/xen/enlighten.c | 132 ++++++++++++++++++++++++-- drivers/xen/Kconfig | 2 +- drivers/xen/balloon.c | 20 ++-- drivers/xen/unpopulated-alloc.c | 87 ++++++++++++++++- include/xen/balloon.h | 3 + include/xen/xen.h | 16 ++++ 7 files changed, 245 insertions(+), 29 deletions(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel