From patchwork Thu Sep 26 09:46:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xia, Hongyan" X-Patchwork-Id: 11162169 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEC5813BD for ; Thu, 26 Sep 2019 09:51:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id AAEE92053B for ; Thu, 26 Sep 2019 09:51:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="Gjkv1i/+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAEE92053B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=none 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.89) (envelope-from ) id 1iDQPd-0007x7-Lt; Thu, 26 Sep 2019 09:50:13 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDQPa-0007qF-Sx for xen-devel@lists.xenproject.org; Thu, 26 Sep 2019 09:50:10 +0000 X-Inumbo-ID: e716710a-e042-11e9-964c-12813bfff9fa Received: from smtp-fw-2101.amazon.com (unknown [72.21.196.25]) by localhost (Halon) with ESMTPS id e716710a-e042-11e9-964c-12813bfff9fa; Thu, 26 Sep 2019 09:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1569491356; x=1601027356; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=USV90sFuRrX8EANWvawhUHi+KMNPnW4terwRZ7si4HI=; b=Gjkv1i/+5PmE1knZTajvVtAwQtc4VUyLgoxNqQxWg5pFZYXgkZNoaxLz NBulUidE41eCZevH7Xe9nUiDS/01ynao0Lqb+RPYxeqmM/IaQM1sBUEgs xwtbsNe57ThXtuHR177cX/AaNPomso9FvoqdcE2Drbgw/ettH5SCQBBbN 8=; X-IronPort-AV: E=Sophos;i="5.64,551,1559520000"; d="scan'208";a="753354334" Received: from iad6-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1a-807d4a99.us-east-1.amazon.com) ([10.124.125.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 26 Sep 2019 09:49:15 +0000 Received: from EX13MTAUWA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1a-807d4a99.us-east-1.amazon.com (Postfix) with ESMTPS id B57ACA2AC9; Thu, 26 Sep 2019 09:49:13 +0000 (UTC) Received: from EX13D27UWA003.ant.amazon.com (10.43.160.56) by EX13MTAUWA001.ant.amazon.com (10.43.160.118) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 09:48:53 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13D27UWA003.ant.amazon.com (10.43.160.56) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 09:48:53 +0000 Received: from u9d785c4ba99158.ant.amazon.com (10.125.106.58) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 26 Sep 2019 09:48:51 +0000 From: To: Date: Thu, 26 Sep 2019 10:46:24 +0100 Message-ID: <4e79e54d7052964e8ddbd7fde381b4198eb992b0.1569489002.git.hongyax@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [RFC PATCH 61/84] x86: lift domain mapcache to arch_domain X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_?= =?utf-8?q?Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Wei Liu It is going to be needed by HVM as well, because we want even HVM domain to have a per-domain mapcache. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/domain.c | 4 ++-- xen/arch/x86/domain_page.c | 10 ++++------ xen/include/asm-x86/domain.h | 6 +++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 75e89b81bf..083b413a70 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -617,6 +617,8 @@ int arch_domain_create(struct domain *d, psr_domain_init(d); + mapcache_domain_init(d); + if ( is_hvm_domain(d) ) { if ( (rc = hvm_domain_initialise(d)) != 0 ) @@ -624,8 +626,6 @@ int arch_domain_create(struct domain *d, } else if ( is_pv_domain(d) ) { - mapcache_domain_init(d); - if ( (rc = pv_domain_initialise(d)) != 0 ) goto fail; } diff --git a/xen/arch/x86/domain_page.c b/xen/arch/x86/domain_page.c index bece9d8cd0..9a1cc5bb40 100644 --- a/xen/arch/x86/domain_page.c +++ b/xen/arch/x86/domain_page.c @@ -94,7 +94,7 @@ void *map_domain_page(mfn_t mfn) return ret; } - dcache = &v->domain->arch.pv.mapcache; + dcache = &v->domain->arch.mapcache; vcache = &v->arch.pv.mapcache; if ( !dcache->inuse ) { @@ -210,7 +210,7 @@ void unmap_domain_page(const void *ptr) v = mapcache_current_vcpu(); ASSERT(v && is_pv_vcpu(v)); - dcache = &v->domain->arch.pv.mapcache; + dcache = &v->domain->arch.mapcache; ASSERT(dcache->inuse); idx = PFN_DOWN(va - MAPCACHE_VIRT_START); @@ -254,11 +254,9 @@ void unmap_domain_page(const void *ptr) int mapcache_domain_init(struct domain *d) { - struct mapcache_domain *dcache = &d->arch.pv.mapcache; + struct mapcache_domain *dcache = &d->arch.mapcache; unsigned int bitmap_pages; - ASSERT(is_pv_domain(d)); - #ifdef NDEBUG if ( !mem_hotplug && max_page <= PFN_DOWN(__pa(HYPERVISOR_VIRT_END - 1)) ) return 0; @@ -282,7 +280,7 @@ int mapcache_domain_init(struct domain *d) int mapcache_vcpu_init(struct vcpu *v) { struct domain *d = v->domain; - struct mapcache_domain *dcache = &d->arch.pv.mapcache; + struct mapcache_domain *dcache = &d->arch.mapcache; unsigned long i; unsigned int ents = d->max_vcpus * MAPCACHE_VCPU_ENTRIES; unsigned int nr = PFN_UP(BITS_TO_LONGS(ents) * sizeof(long)); diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 7cebfa4fb9..2c7b4df34c 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -260,9 +260,6 @@ struct pv_domain /* Mitigate L1TF with shadow/crashing? */ bool check_l1tf; - /* map_domain_page() mapping cache. */ - struct mapcache_domain mapcache; - struct cpuidmasks *cpuidmasks; }; @@ -295,6 +292,9 @@ struct arch_domain uint32_t pci_cf8; uint8_t cmos_idx; + /* map_domain_page() mapping cache. */ + struct mapcache_domain mapcache; + union { struct pv_domain pv; struct hvm_domain hvm;