From patchwork Thu Jul 4 15:01:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 18262 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f198.google.com (mail-gg0-f198.google.com [209.85.161.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 88BB825A60 for ; Thu, 4 Jul 2013 15:01:14 +0000 (UTC) Received: by mail-gg0-f198.google.com with SMTP id p4sf1545943ggn.1 for ; Thu, 04 Jul 2013 08:01:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=iufKfeqH55b/QI/TzG3XukT7pIEa7+7HBrVQwG4Lerc=; b=HD3/uIDcm4kZpZ3E1HPO8VZCTHoNpj5NGdPzCADacWcVqBnbR+LezcHttoWvWuH5Ay ann3Yf8y7TC1t9K0EM32g8FrsxVz6CWWDguL2edTZ7FkkmRw3gTOpLz5hUTgPjT+rG6W o1JE92ObWDWs3x0X/DbF12nCb/FdVmS/ev8s6xoUe5AIG8KLzdDbRex6oJg2+WEhutXf DxBVSHfDYtGW4J4rLYMEFcY6v41sCRMDfLDQpYrK0V8pjRyOjzd2pZQsNwwKnk6ZjXmK KvUkDJH9lohGi9Y0AiOW0tQ8clyV828ClAmqZeSxuJ0Nkvkx/84JeYZjxuCWEvN64w7L 7sCg== X-Received: by 10.59.4.137 with SMTP id ce9mr1063316ved.28.1372950073612; Thu, 04 Jul 2013 08:01:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.73.37 with SMTP id i5ls753517qev.54.gmail; Thu, 04 Jul 2013 08:01:13 -0700 (PDT) X-Received: by 10.58.197.5 with SMTP id iq5mr3412638vec.30.1372950073467; Thu, 04 Jul 2013 08:01:13 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id k4si987356vdi.80.2013.07.04.08.01.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Jul 2013 08:01:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id cz10so1067457veb.8 for ; Thu, 04 Jul 2013 08:01:13 -0700 (PDT) X-Received: by 10.221.31.130 with SMTP id sg2mr3238378vcb.86.1372950073318; Thu, 04 Jul 2013 08:01:13 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.149.77 with SMTP id s13csp14973vcv; Thu, 4 Jul 2013 08:01:12 -0700 (PDT) X-Received: by 10.14.176.199 with SMTP id b47mr7115511eem.117.1372950071758; Thu, 04 Jul 2013 08:01:11 -0700 (PDT) Received: from mail-ea0-f176.google.com (mail-ea0-f176.google.com [209.85.215.176]) by mx.google.com with ESMTPS id x6si2815205eew.227.2013.07.04.08.01.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Jul 2013 08:01:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.176 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.176; Received: by mail-ea0-f176.google.com with SMTP id z15so844576ead.7 for ; Thu, 04 Jul 2013 08:01:10 -0700 (PDT) X-Received: by 10.15.32.194 with SMTP id a42mr7388157eev.43.1372950070545; Thu, 04 Jul 2013 08:01:10 -0700 (PDT) Received: from belegaer.uk.xensource.com. (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id n45sm5705815eew.1.2013.07.04.08.01.09 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Jul 2013 08:01:09 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: ian.campbell@citrix.com, Stefano.Stabellini@eu.citrix.com, patches@linaro.org, tim@xen.org, Julien Grall Subject: [PATCH] xen/arm: Trap the ACTLR register Date: Thu, 4 Jul 2013 16:01:06 +0100 Message-Id: <1372950066-14379-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQltWiNBA7xcJk95GbVk1/CmWiHA2pYWdN9qbgubN2z2zDjxcEWQx40+/CTx3asL4XhMGrke X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Cortex-A15 ACTLR is used to set the SMP bit. If the guest has the control on this register, it can disable SMP support and so TLB broadcast. Implement the access to ACTRL as read-only register with SMP bit set to one if the guest has multiple VCPUs. Signed-off-by: Julien Grall --- xen/arch/arm/domain.c | 9 +++++++-- xen/arch/arm/traps.c | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index f465ab7..6937abf 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "vtimer.h" @@ -61,7 +62,6 @@ static void ctxt_switch_from(struct vcpu *p) p->arch.csselr = READ_SYSREG(CSSELR_EL1); /* Control Registers */ - p->arch.actlr = READ_SYSREG(ACTLR_EL1); p->arch.sctlr = READ_SYSREG(SCTLR_EL1); p->arch.cpacr = READ_SYSREG(CPACR_EL1); @@ -182,7 +182,6 @@ static void ctxt_switch_to(struct vcpu *n) isb(); /* Control Registers */ - WRITE_SYSREG(n->arch.actlr, ACTLR_EL1); WRITE_SYSREG(n->arch.sctlr, SCTLR_EL1); WRITE_SYSREG(n->arch.cpacr, CPACR_EL1); @@ -452,6 +451,12 @@ int vcpu_initialise(struct vcpu *v) return rc; v->arch.sctlr = SCTLR_BASE; + v->arch.actlr = READ_SYSREG32(ACTLR_EL1); + /* XXX: Handle other than CA15 cpus */ + if ( v->domain->max_vcpus > 1 ) + v->arch.actlr |= ACTLR_CA15_SMP; + else + v->arch.actlr &= ~ACTLR_CA15_SMP; if ( (rc = vcpu_vgic_init(v)) != 0 ) return rc; diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 398d209..bbd60aa 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -62,7 +62,8 @@ void __cpuinit init_traps(void) WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2); /* Setup hypervisor traps */ - WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI|HCR_TSC, HCR_EL2); + WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI|HCR_TSC| + HCR_TAC, HCR_EL2); isb(); } @@ -836,6 +837,7 @@ static void do_cp15_32(struct cpu_user_regs *regs, { struct hsr_cp32 cp32 = hsr.cp32; uint32_t *r = (uint32_t*)select_user_reg(regs, cp32.reg); + struct vcpu *v = current; if ( !cp32.ccvalid ) { dprintk(XENLOG_ERR, "cp_15(32): need to handle invalid condition codes\n"); @@ -889,6 +891,10 @@ static void do_cp15_32(struct cpu_user_regs *regs, domain_crash_synchronous(); } break; + case HSR_CPREG32(ACTLR): + if ( cp32.read ) + *r = v->arch.actlr; + break; default: printk("%s p15, %d, r%d, cr%d, cr%d, %d @ 0x%"PRIregister"\n", cp32.read ? "mrc" : "mcr",