From patchwork Mon Sep 19 02:08:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 9338443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 170FC601C2 for ; Mon, 19 Sep 2016 02:13:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01A2A28EAB for ; Mon, 19 Sep 2016 02:13:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA97028EAE; Mon, 19 Sep 2016 02:12:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7276828EAB for ; Mon, 19 Sep 2016 02:12:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blo1W-0004Dj-G2; Mon, 19 Sep 2016 02:09:34 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blo1V-0004D8-IY for xen-devel@lists.xen.org; Mon, 19 Sep 2016 02:09:33 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id 81/D4-01945-BD84FD75; Mon, 19 Sep 2016 02:09:31 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsVyMfTAId1bHvf DDVrm21gs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBl32zYxF/yUqni78zlzA+M50S5GLg4hgQmM Et9+nWQDcVgEXrJI/JvazQziSAj0s0q0P1wH5HAAOTESl2ZodTFyApnVEhM37GYBsYUEVCTmb uphhJg0nUmi594lNpAEm4C0xJ4LSxkhGjQklh69zwpSJCLQzyjx5vBcVpAEs4ClxPkNH9lBbG EBF4l3fZvBmlkEVCVeTnkCtoFXwEFiwtWfrBCD5CSuz5zOBGJzCjhKTGh4yQ5xhYPEgSO/2Sc wCi5gZFjFqFGcWlSWWqRraKqXVJSZnlGSm5iZo2toYKyXm1pcnJiempOYVKyXnJ+7iREYdAxA sINxzXbPQ4ySHExKorw7Su6FC/El5adUZiQWZ8QXleakFh9ilOHgUJLg9XC/Hy4kWJSanlqRl pkDDH+YtAQHj5IIbyxImre4IDG3ODMdInWK0ZJjy+9ra5k4tiy4ASS3Tb23lkmIJS8/L1VKnF ccpEEApCGjNA9uHCxGLzHKSgnzMgIdKMRTkFqUm1mCKv+KUZyDUUmYNwhkCk9mXgnc1ldABzE BHbR61m2Qg0oSEVJSDYznox5aKd6QWrfpfu4uldLc3SU8PW+XNiVOTl0axWa2xGLtl1l8DpVB Bde6erXWhrxbmWraKtDl8eMab0Ys64x2b2WB4Hbdece3aooVFFa98xNVTiwWDWFJ79/uvn9vh Pl1u3rZpp/Tow6bLb+6ht/yXNeNqeIF8Z96t539c7xa4vyfGMHsViWW4oxEQy3mouJEANVuX0 HMAgAA X-Env-Sender: van.freenix@gmail.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1474250969!30489854!1 X-Originating-IP: [209.85.192.194] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13624 invoked from network); 19 Sep 2016 02:09:30 -0000 Received: from mail-pf0-f194.google.com (HELO mail-pf0-f194.google.com) (209.85.192.194) by server-11.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 19 Sep 2016 02:09:30 -0000 Received: by mail-pf0-f194.google.com with SMTP id 21so5042948pfy.1 for ; Sun, 18 Sep 2016 19:09:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EtycVjYePtGBwAlzTPKN2B0go4jK9xeQHusUSEARfi4=; b=hL1Nr6+yrgs7e8r32KwgpyCyoMS3T/iqBmYVtSDD4CrQBxXQcWgLKthhk4rQqjqIyM igkMbQPteJZXttLht3dvOWloFWOGhPHJs8tHM0nJEMLEnqs11NsKnVh58rKLKoXmYm/r VTtMXtqP+E71vhEvFza1AoNiwHe6RiFM4vxl23jzb7kPPyzQIsGtFVjywygpHYLIqRs3 WtK64C61mtlfr1zO+zlFo/xpFs6Ok/Sere0aZwpWnyYcCjlEpeoDErGnIvu86s9inalQ bJB3FHktBUcmQRwBbR46cR570TirKV5QwoBk5yBw/KCKQo7y3jv4LeE6FSSCciUWN29l XAGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EtycVjYePtGBwAlzTPKN2B0go4jK9xeQHusUSEARfi4=; b=l5AcSv4dX9UVj15slmmpB5iDY/gdmeUo99GGZS8vKMoQmkuebkvn+lIs79cEoIgaCr 4OFvLCYnCfWcnv+KwEl1CesYCVmNa2AmJPgh7LwIOFpxRwRlnMjV5yiEgvm6yRj0zz6X zF9asI8AJ7T+g+SLtcqJiw3OkJEH4KIaD/2p3bc7q3AaMRYCtUDQFoN8Lk/kl3m2sb6Q QkMot8gx6KptCmqPM4Fx5mtLsdIVodTeA2mVhNgtUA3vvei6vWl4IslcJDQ7ESPpWAL3 wUkTGd6QkP9tjkXcYqHKiLG40RdaO/f97L0C6DJuvy1/uh9GEKFrAgUrBqEVXkSbK/G0 lLLg== X-Gm-Message-State: AE9vXwN6YJLvP0UBvM0jl7VQzJMD7pPXVZmJzelY8qFbitd2PsSwtPmPPoj4EiQuiY8kTg== X-Received: by 10.98.220.145 with SMTP id c17mr43103902pfl.159.1474250969191; Sun, 18 Sep 2016 19:09:29 -0700 (PDT) Received: from linux-u7w5.ap.freescale.net (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id i68sm66777180pfc.25.2016.09.18.19.09.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Sep 2016 19:09:28 -0700 (PDT) From: van.freenix@gmail.com X-Google-Original-From: peng.fan@nxp.com To: julien.grall@arm.com, sstabellini@kernel.org, jbeulich@suse.com, andrew.cooper3@citrix.com, jgross@suse.com, dario.faggioli@citrix.com Date: Mon, 19 Sep 2016 10:08:55 +0800 Message-Id: <1474250936-27962-5-git-send-email-peng.fan@nxp.com> X-Mailer: git-send-email 2.6.6 In-Reply-To: <1474250936-27962-1-git-send-email-peng.fan@nxp.com> References: <1474250936-27962-1-git-send-email-peng.fan@nxp.com> Cc: Peng Fan , xen-devel@lists.xen.org Subject: [Xen-devel] [RFC 4/5] xen/arm: move vpidr from arch_domain to arch_vcpu X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Peng Fan Move vpidr from arch_domain to arch_vcpu. In order to support Big.Little, Big CPUs and Little CPUs are assigned to different cpupools. when a new domain is to be created with cpupool specificed, the domain is first assigned to cpupool0 and then the domain moved from cpupool0 to the specified cpupool. In domain creation process arch_domain_create, vpidr is initialized with boot_cpu_data.midr.bits. But Big cpupool and Little cpupool have different midr, the guest vcpu midr should use the midr info from cpupool which the domain runs in. Signed-off-by: Peng Fan Cc: Stefano Stabellini Cc: Julien Grall --- xen/arch/arm/domain.c | 9 +++++---- xen/arch/arm/traps.c | 2 +- xen/include/asm-arm/domain.h | 9 ++++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 20bb2ba..934c112 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -150,7 +151,7 @@ static void ctxt_switch_to(struct vcpu *n) p2m_restore_state(n); - WRITE_SYSREG32(n->domain->arch.vpidr, VPIDR_EL2); + WRITE_SYSREG32(n->arch.vpidr, VPIDR_EL2); WRITE_SYSREG(n->arch.vmpidr, VMPIDR_EL2); /* VGIC */ @@ -521,6 +522,9 @@ int vcpu_initialise(struct vcpu *v) v->arch.actlr = READ_SYSREG32(ACTLR_EL1); + /* The virtual ID matches the physical id of the cpu in the cpupool */ + v->arch.vpidr = v->domain->cpupool->info.midr; + processor_vcpu_initialise(v); if ( (rc = vcpu_vgic_init(v)) != 0 ) @@ -562,9 +566,6 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, if ( (d->shared_info = alloc_xenheap_pages(0, 0)) == NULL ) goto fail; - /* Default the virtual ID to match the physical */ - d->arch.vpidr = boot_cpu_data.midr.bits; - clear_page(d->shared_info); share_xen_page_with_guest( virt_to_page(d->shared_info), d, XENSHARE_writable); diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 683bcb2..c0ad97e 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1975,7 +1975,7 @@ static void do_cp14_32(struct cpu_user_regs *regs, const union hsr hsr) * - Variant and Revision bits match MDIR */ val = (1 << 24) | (5 << 16); - val |= ((d->arch.vpidr >> 20) & 0xf) | (d->arch.vpidr & 0xf); + val |= ((d->vcpu[0]->arch.vpidr >> 20) & 0xf) | (d->vcpu[0]->arch.vpidr & 0xf); set_user_reg(regs, regidx, val); break; diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index 9452fcd..b998c6d 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -63,9 +63,6 @@ struct arch_domain RELMEM_done, } relmem; - /* Virtual CPUID */ - uint32_t vpidr; - struct { uint64_t offset; } phys_timer_base; @@ -173,6 +170,12 @@ struct arch_vcpu uint32_t esr; #endif + /* + * Holds the value of the Virtualization Processor ID. + * This is the value returned by Non-secure EL1 reads of MIDR_EL1. + */ + uint32_t vpidr; + uint32_t ifsr; /* 32-bit guests only */ uint32_t afsr0, afsr1;