From nobody Mon Nov 25 06:20:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=@amazon.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=amazon.com ARC-Seal: i=1; a=rsa-sha256; t=1715598742; cv=none; d=zohomail.com; s=zohoarc; b=GkInlteMhitwseMpmkTK+VsVPJZNSYLXh4LFUhfjbGURMgknkVR25GwV9/rOHNPpkF1tQvi1MoFrtGRKjdi84zP+8hlU2Ptcw+++BE2rlZIx/WHuJEoimOgZE/viJ+bmmsl9KL7X1t008O+dlv3aYlKi5UMMZl5xCD1N0tiNYCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715598742; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TyQ1NOFs+JBNhEZ9nul6mULL97GoHUzPHp2fRNIcmm8=; b=IGszH7YyFJ1gxw6xmt09F9ryxtkWyl7UaOH8eIHu8jiKGnSYAxifE+rNc4hLfa2LJv41taadXsC8X2CHnydbT5mTQTsKvOf4SW358Y4Hjt3A05tzd1soanuTW/1TRuwg7c9iR+Euh57/aAAgMGy8I7cHKH/pGDlSeAygQmZMO58= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@amazon.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715598742055635.5287378727827; Mon, 13 May 2024 04:12:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.720813.1123798 (Exim 4.92) (envelope-from ) id 1s6Tb5-0005PR-VX; Mon, 13 May 2024 11:11:59 +0000 Received: by outflank-mailman (output) from mailman id 720813.1123798; Mon, 13 May 2024 11:11:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s6Tb5-0005MO-P5; Mon, 13 May 2024 11:11:59 +0000 Received: by outflank-mailman (input) for mailman id 720813; Mon, 13 May 2024 11:11:58 +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 1s6Tb4-00036L-J7 for xen-devel@lists.xenproject.org; Mon, 13 May 2024 11:11:58 +0000 Received: from smtp-fw-80008.amazon.com (smtp-fw-80008.amazon.com [99.78.197.219]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9c2d2cf0-1119-11ef-b4bb-af5377834399; Mon, 13 May 2024 13:11:56 +0200 (CEST) Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO smtpout.prod.us-east-1.prod.farcaster.email.amazon.dev) ([10.25.36.214]) by smtp-border-fw-80008.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 11:11:46 +0000 Received: from EX19MTAUEC002.ant.amazon.com [10.0.44.209:61768] by smtpin.naws.us-east-1.prod.farcaster.email.amazon.dev [10.0.82.155:2525] with esmtp (Farcaster) id c198cc80-af3a-4fc8-8dd3-4517e4aca5e4; Mon, 13 May 2024 11:11:46 +0000 (UTC) Received: from EX19D008UEC003.ant.amazon.com (10.252.135.194) by EX19MTAUEC002.ant.amazon.com (10.252.135.253) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Mon, 13 May 2024 11:11:39 +0000 Received: from EX19MTAUWB001.ant.amazon.com (10.250.64.248) by EX19D008UEC003.ant.amazon.com (10.252.135.194) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Mon, 13 May 2024 11:11:38 +0000 Received: from dev-dsk-eliasely-1a-fd74790f.eu-west-1.amazon.com (10.253.91.118) by mail-relay.amazon.com (10.250.64.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28 via Frontend Transport; Mon, 13 May 2024 11:11:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 9c2d2cf0-1119-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1715598716; x=1747134716; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TyQ1NOFs+JBNhEZ9nul6mULL97GoHUzPHp2fRNIcmm8=; b=G530L5nXYBuZsVfLoljrP8cOdAU7gMGf+W6vXAqf2ZvK8ZR6v92qoqjO yNaI5Q+nZzrtXjlThjlL+f+YojqFpGSCd/C2tJMdj48iZ/jouE25usPbP RHNQL66uA3eCifkHmnwvxo2++Jadt1JspDx7QEUIDm5VWZ8Gs80rCgYxx g=; X-IronPort-AV: E=Sophos;i="6.08,158,1712620800"; d="scan'208";a="88736833" X-Farcaster-Flow-ID: c198cc80-af3a-4fc8-8dd3-4517e4aca5e4 From: Elias El Yandouzi To: CC: , , , Hongyan Xia , Wei Wang , Julien Grall , Elias El Yandouzi Subject: [PATCH V3 05/19] x86/mapcache: Initialise the mapcache for the idle domain Date: Mon, 13 May 2024 11:11:03 +0000 Message-ID: <20240513111117.68828-6-eliasely@amazon.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240513111117.68828-1-eliasely@amazon.com> References: <20240513111117.68828-1-eliasely@amazon.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @amazon.com) X-ZM-MESSAGEID: 1715598743956100001 Content-Type: text/plain; charset="utf-8" From: Hongyan Xia In order to use the mapcache in the idle domain, we also have to populate its page tables in the PERDOMAIN region, and we need to move mapcache_domain_init() earlier in arch_domain_create(). Note, commit 'x86: lift mapcache variable to the arch level' has initialised the mapcache for HVM domains. With this patch, PV, HVM, idle domains now all initialise the mapcache. Signed-off-by: Wei Wang Signed-off-by: Hongyan Xia Signed-off-by: Julien Grall Signed-off-by: Elias El Yandouzi ---- Changes in V2: * Free resources if mapcache initialisation fails * Remove `is_idle_domain()` check from `create_perdomain_mappings= ()` diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 507d704f16..3303bdb53e 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -758,9 +758,16 @@ int arch_domain_create(struct domain *d, =20 spin_lock_init(&d->arch.e820_lock); =20 + if ( (rc =3D mapcache_domain_init(d)) !=3D 0) + { + free_perdomain_mappings(d); + return rc; + } + /* Minimal initialisation for the idle domain. */ if ( unlikely(is_idle_domain(d)) ) { + struct page_info *pg =3D d->arch.perdomain_l3_pg; static const struct arch_csw idle_csw =3D { .from =3D paravirt_ctxt_switch_from, .to =3D paravirt_ctxt_switch_to, @@ -771,6 +778,9 @@ int arch_domain_create(struct domain *d, =20 d->arch.cpu_policy =3D ZERO_BLOCK_PTR; /* Catch stray misuses. */ =20 + idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)] =3D + l4e_from_page(pg, __PAGE_HYPERVISOR_RW); + return 0; } =20 @@ -851,8 +861,6 @@ int arch_domain_create(struct domain *d, =20 psr_domain_init(d); =20 - mapcache_domain_init(d); - if ( is_hvm_domain(d) ) { if ( (rc =3D hvm_domain_initialise(d, config)) !=3D 0 ) --=20 2.40.1