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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 7010FC05027 for ; Mon, 23 Jan 2023 15:48:44 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.483029.748968 (Exim 4.92) (envelope-from ) id 1pJz3a-00021S-B2; Mon, 23 Jan 2023 15:48:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 483029.748968; Mon, 23 Jan 2023 15:48:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pJz3a-00021I-7R; Mon, 23 Jan 2023 15:48:26 +0000 Received: by outflank-mailman (input) for mailman id 483029; Mon, 23 Jan 2023 15:48:25 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pJz3Z-0000MU-4j for xen-devel@lists.xenproject.org; Mon, 23 Jan 2023 15:48:25 +0000 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [2a00:1450:4864:20::633]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 58f113cd-9b35-11ed-b8d1-410ff93cb8f0; Mon, 23 Jan 2023 16:48:14 +0100 (CET) Received: by mail-ej1-x633.google.com with SMTP id bk15so31563831ejb.9 for ; Mon, 23 Jan 2023 07:48:23 -0800 (PST) Received: from carlo-ubuntu.mo54.unimo.it (nonato.mo54.unimo.it. [155.185.85.8]) by smtp.gmail.com with ESMTPSA id r2-20020a17090609c200b007bd28b50305sm22170978eje.200.2023.01.23.07.48.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 07:48:22 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 58f113cd-9b35-11ed-b8d1-410ff93cb8f0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=minervasys-tech.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0a2gbQNKwUWS/d4kzoidztA9Ce3spqkJtPMisplTAE0=; b=ng7prlLTd1cYH/dTXfkdmn4gkmQlV/868ZF4otjJNBPRm3fFBORoHT1RSyPy74qFS2 IT5XZDYlUuDbODtrCs5RyEFQR59k8Zn/ZZ9Q52okjlpqGbKO2Fe76mu0RPbJsJmXwVRo W492ws8E19D/TaAeynVqDdwLd3UKd/gDFGZzVoYDLWFtFyF+j7zbQcNRp+yP6XWkbR0l ELmMKAfdFC2y/NOw7JNjyWINTFw0nINpN8zW/W4KkbtKJ6IjLeBRJ2VYuQHqEY6ri+ei p9M50WfgxYHT6Hiahy2qhDgVnL0ofdhY7gUrnnWLcF7KkftIJf58zPOsfgw6tRq+ViOr 3uHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0a2gbQNKwUWS/d4kzoidztA9Ce3spqkJtPMisplTAE0=; b=WTnGzDIGYawTiQY0n26BRfPlL5UtZ12+IIc4r74pJKmslnX2jPzPTxOXqfIGtdmbrc tF6Wh23HxmnCwAOd/z5Vkukwlrq6tRDGy1hYcKODVC9nekdIr51qSPlAgyrZe8M2M2N5 L7d8KP6Du/b9+c/4Nays0484vnaQrDxf2Xc12Os2djk1IBehbdlWKkdJO+kaP3u4Sl2X BtYp+pHKwS777KjNIzEFu98WWzPMHyd4HnvCu6SeDQDA0S5QM+5L8aD6AU/3wAjnoeYn dZDymlgEg1nvsr1Bbgv1taHvXscfiRu8tBJuM3dmd2lp+yi7qflB9Fopvu+9Jv2HEsrx 5Tbg== X-Gm-Message-State: AFqh2kr7oJQVUarya8iiNjK2sPQolnvZete0NDbrVBBVUKCTsAnvR0VI oxJUERJzo6PrT6dIBcqvjqtOqKukk/wArNLz X-Google-Smtp-Source: AMrXdXsUAXRa82fcSelfp1n7YAbygkKkkD3DjYj1duZB5/jYaAvQ4PBJQUzuH8foqelDXFscp14mfw== X-Received: by 2002:a17:907:cbc5:b0:7ad:9455:d57d with SMTP id vk5-20020a170907cbc500b007ad9455d57dmr28301982ejc.74.1674488902800; Mon, 23 Jan 2023 07:48:22 -0800 (PST) From: Carlo Nonato To: xen-devel@lists.xenproject.org Cc: Carlo Nonato , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Marco Solieri Subject: [PATCH v4 08/11] xen/arm: use colored allocator for p2m page tables Date: Mon, 23 Jan 2023 16:47:32 +0100 Message-Id: <20230123154735.74832-9-carlo.nonato@minervasys.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230123154735.74832-1-carlo.nonato@minervasys.tech> References: <20230123154735.74832-1-carlo.nonato@minervasys.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cache colored domains can benefit from having p2m page tables allocated with the same coloring schema so that isolation can be achieved also for those kind of memory accesses. In order to do that, the domain struct is passed to the allocator and the MEMF_no_owner flag is used. Signed-off-by: Carlo Nonato Signed-off-by: Marco Solieri --- v4: - fixed p2m page allocation using MEMF_no_owner memflag --- xen/arch/arm/p2m.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 948f199d84..f9faeb61af 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,10 @@ static struct page_info *p2m_alloc_page(struct domain *d) */ if ( is_hardware_domain(d) ) { - pg = alloc_domheap_page(NULL, 0); + if ( is_domain_llc_colored(d) ) + pg = alloc_domheap_page(d, MEMF_no_owner); + else + pg = alloc_domheap_page(NULL, 0); if ( pg == NULL ) printk(XENLOG_G_ERR "Failed to allocate P2M pages for hwdom.\n"); } @@ -105,7 +109,10 @@ int p2m_set_allocation(struct domain *d, unsigned long pages, bool *preempted) if ( d->arch.paging.p2m_total_pages < pages ) { /* Need to allocate more memory from domheap */ - pg = alloc_domheap_page(NULL, 0); + if ( is_domain_llc_colored(d) ) + pg = alloc_domheap_page(d, MEMF_no_owner); + else + pg = alloc_domheap_page(NULL, 0); if ( pg == NULL ) { printk(XENLOG_ERR "Failed to allocate P2M pages.\n"); -- 2.34.1