From patchwork Tue Oct 26 16:05:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 12585095 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 903D0C433F5 for ; Tue, 26 Oct 2021 16:09:55 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6532D6108D for ; Tue, 26 Oct 2021 16:09:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6532D6108D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=/BMXSudTtNY5fYS8tCoylDBwSDrZn/6WX7AiWlBs3w0=; b=yQ43AEZ6Oh57aS zJtXpj8Z5NnQu9CKcx+wu698rBN+Jr6CX9NME+L61A28vyg6YMkjFWVP1kl/hY3+b2J+w+I1/JnxD iPO6LnzPZS4i+8jAOg9VMpC0gPaS+SR5bWhGtZUKHhwxdzc4kd2ZfvF4Udu+nOzemLAzOFaCYwmhp tjoR4ChJehQAcVonI/VFBz1zLQxwtf8uubjzkqxSvQ38Z6FBxxxQdZO2j4BKX4dUasq7zgrfaHuWI 7W/SS1m0jkhVw4aRfDSzCUNno6zKaRhNJ8qH2q948lqTa3jaFhVc5YIYMHEz3h3Px297mIn6/P4uo YnvO3boY2FOODIwqqLOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfOzi-002LMO-IL; Tue, 26 Oct 2021 16:08:10 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfOzZ-002LJP-EL for linux-arm-kernel@lists.infradead.org; Tue, 26 Oct 2021 16:08:04 +0000 Received: by mail-ed1-x535.google.com with SMTP id z20so16167873edc.13 for ; Tue, 26 Oct 2021 09:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=bAVBWRDZRgubnRSuBYCl4clj0aVWREQm4G5cX+KG1p4=; b=IRDZVkn1hy6HTn6NCAY05VCjxdq5sZSzZ/zhkxVxmJgo79/McEOL3/iJ/d1r//8JgI 35NahJ8ril6M+lshDWp+3AU6poeOYlGjmAXVxV0JB2UQL7Ghwxjz0h0vXbMxSRi3nhiv xwxv03QLNDivyn9pXc3PkfJSCC6JURlI+0JbfKbO1J8bMFt2GGA5kOsgNU/HTwVxY80e 9OfKFDdZSXoFBP4DwuPaGMAnk0jS7qW24jrn7NgJDPscT59nn5Lffb/EvmJKmH2fJObN kWg+uYQvl2aryBOblgagD4nMXooTtyuPn5IHQ4xv843vNj1zyR3C10vYR4P6CImPG352 f1Tg== 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=bAVBWRDZRgubnRSuBYCl4clj0aVWREQm4G5cX+KG1p4=; b=uV4OGVxu8DuB2bkxTnYpgZOSaFLA9Al7SBGCRlhwfrmTLsQhP9V5/a9ZBHew6NAlC9 q7zhg2srU7lY9ruhJzMCgMCj5QW4dzeeGm4JzhUyXXm0/40sAzu9YXRZ5sYmF6VDjXfO OyoZFkug0DVOV9C0m/RY8m4PIzdzUNAQkYu3Tzx1BQg7SuDHIpjTwv4ROwSMOEaTOEUO zV46qtxvOlX1vsoisveSrzaEpDvA/ti7Y4isa1p9TU+kQ9Z5/qcghrg+jGkRp090QeBK EKwqJDk3EJrlDrRRBKtcl7ZGgiecUQ/9viVXG7i+wD8z5SxjDFk9q7atNqi1YB6UPdTL GAyw== X-Gm-Message-State: AOAM530oX24P7KM0kYci3MyosPsfugeoxMUnJKHDLCZN+5I+Ija/o+3P K/ayauy+Q2ifaKkN4LGTrVw= X-Google-Smtp-Source: ABdhPJxtMgA2kyKQC10zrMOP8KtcHqswMqEj2qKkSjTogokVg/wr2Px2E1gCaIw0gu0zlXxwCQNP+g== X-Received: by 2002:a17:907:76cc:: with SMTP id kf12mr18527547ejc.228.1635264319752; Tue, 26 Oct 2021 09:05:19 -0700 (PDT) Received: from otyshchenko.router ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id eu9sm4025195ejc.14.2021.10.26.09.05.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Oct 2021 09:05:19 -0700 (PDT) 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 Subject: [PATCH V2 0/4] xen: Add support of extended regions (safe ranges) on Arm Date: Tue, 26 Oct 2021 19:05:08 +0300 Message-Id: <1635264312-3796-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-20211026_090801_557927_04F9FDB8 X-CRM114-Status: GOOD ( 17.97 ) 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Oleksandr Tyshchenko You can find the RFC patch series at [1]. 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 [2]. 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.15-rc7 and also available at [3], 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://xenbits.xen.org/gitweb/?p=xen.git;a=blob_plain;f=docs/misc/arm/device-tree/guest.txt;hb=refs/heads/master [3] https://github.com/otyshchenko1/linux/commits/map_opt_ml5 Oleksandr Tyshchenko (4): 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/unpopulated-alloc: Add mechanism to use Xen resource arm/xen: Read extended regions from DT and init Xen resource arch/arm/xen/enlighten.c | 144 ++++++++++++++++++++++++++++++++++++++-- drivers/xen/Kconfig | 2 +- drivers/xen/unpopulated-alloc.c | 90 +++++++++++++++++++++++-- include/xen/xen.h | 2 + 4 files changed, 226 insertions(+), 12 deletions(-)