From patchwork Mon Jan 19 16:29:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 43324 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9BCFE24116 for ; Mon, 19 Jan 2015 16:32:00 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id w7sf17441167lbi.0 for ; Mon, 19 Jan 2015 08:31:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=R/aJ/KchA+c3FPwTf9gZCgdDARvNY54vIeQWgN+I3Mg=; b=DoVXooIbhxmb6C3i65lk7NO9Fj/Pjxl9vEPuzdIDVhWRYEYxc2EXHYf8kXFCnCXvcV ltDrhSiXs97W7jylPugeatHqXH5pRRUBblhn+ato8hDrQO5o0ogELrcJHyx+bm0yorKf ka332XDu4HYLlAINUVj2/NYkM1BHGo0OTNgluXNcoqiw0SOak3Ki9dpGLndf0bsLKtYF bvLQMmIKxVQb3tydnHjP1CiguAHTOOdyGOwn+QDNznLX2+l+ptzxDVbRinmj3CZ/ZXq2 g28AP9xDOIleEDL1DthBtQsdXNCwX7QU9INEJe7OCiUje4IkTGs3ojb7F2Q8h0YBfBXj abyw== X-Gm-Message-State: ALoCoQkFcHYjzktYN/lRNixQmFhruCwg5zPis3A+4mIn4qIMaH1OWRLobIuXaezymay0y9UvdG5R X-Received: by 10.180.79.133 with SMTP id j5mr1394850wix.0.1421685115782; Mon, 19 Jan 2015 08:31:55 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.65 with SMTP id kw1ls606998lac.70.gmail; Mon, 19 Jan 2015 08:31:55 -0800 (PST) X-Received: by 10.152.3.195 with SMTP id e3mr32755598lae.8.1421685115612; Mon, 19 Jan 2015 08:31:55 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id u1si13787338lau.102.2015.01.19.08.31.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Jan 2015 08:31:55 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id l4so16331962lbv.3 for ; Mon, 19 Jan 2015 08:31:55 -0800 (PST) X-Received: by 10.152.6.132 with SMTP id b4mr33023633laa.59.1421685115303; Mon, 19 Jan 2015 08:31:55 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1144635lbb; Mon, 19 Jan 2015 08:31:54 -0800 (PST) X-Received: by 10.180.83.129 with SMTP id q1mr36715205wiy.8.1421685114373; Mon, 19 Jan 2015 08:31:54 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id uo9si26911248wjc.89.2015.01.19.08.31.53 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 19 Jan 2015 08:31:54 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YDFDA-0006Qi-P1; Mon, 19 Jan 2015 16:29:56 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YDFD9-0006QF-GQ for xen-devel@lists.xenproject.org; Mon, 19 Jan 2015 16:29:55 +0000 Received: from [85.158.143.35] by server-3.bemta-4.messagelabs.com id D1/49-15461-2013DB45; Mon, 19 Jan 2015 16:29:54 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-2.tower-21.messagelabs.com!1421684994!14429939!1 X-Originating-IP: [74.125.82.51] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31141 invoked from network); 19 Jan 2015 16:29:54 -0000 Received: from mail-wg0-f51.google.com (HELO mail-wg0-f51.google.com) (74.125.82.51) by server-2.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 19 Jan 2015 16:29:54 -0000 Received: by mail-wg0-f51.google.com with SMTP id l18so10619192wgh.10 for ; Mon, 19 Jan 2015 08:29:54 -0800 (PST) X-Received: by 10.194.77.97 with SMTP id r1mr4602585wjw.51.1421684991950; Mon, 19 Jan 2015 08:29:51 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id fw6sm14830368wib.1.2015.01.19.08.29.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Jan 2015 08:29:51 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 19 Jan 2015 16:29:10 +0000 Message-Id: <1421684957-29884-4-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421684957-29884-1-git-send-email-julien.grall@linaro.org> References: <1421684957-29884-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH 03/10] xen/arm: vgic-v3: Correctly handle GICD_CTLR X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: As backward GICv2 compatibility is not supported in the VGICv3 driver, the bit ARE_NS should be set at any time. Futhermore, when ARE_NS is set, the guest can only modify EnableGrp1A. At same time take the vgic_lock to write into domain.arch.vgic.ctrl. It was already taken during read. Signed-off-by: Julien Grall --- xen/arch/arm/vgic-v3.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index 406ea93..1aa2f58 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -45,6 +45,12 @@ #define GICV3_GICR_PIDR2 GICV3_GICD_PIDR2 #define GICV3_GICR_PIDR4 GICV3_GICD_PIDR4 +/* + * GICD_CTLR default value: + * - No GICv2 compatibility => ARE = 1 + */ +#define VGICD_CTLR_DEFAULT (GICD_CTLR_ARE_NS) + static struct vcpu *vgic_v3_irouter_to_vcpu(struct vcpu *v, uint64_t irouter) { irouter &= ~(GICD_IROUTER_SPI_MODE_ANY); @@ -834,8 +840,15 @@ static int vgic_v3_distr_mmio_write(struct vcpu *v, mmio_info_t *info) { case GICD_CTLR: if ( dabt.size != DABT_WORD ) goto bad_width; - /* Ignore all but the enable bit */ - v->domain->arch.vgic.ctlr = (*r) & GICD_CTL_ENABLE; + + vgic_lock(v); + /* Only EnableGrp1A can be changed */ + if ( *r & GICD_CTLR_ENABLE_G1A ) + v->domain->arch.vgic.ctlr |= GICD_CTLR_ENABLE_G1A; + else + v->domain->arch.vgic.ctlr &= ~GICD_CTLR_ENABLE_G1A; + vgic_unlock(v); + return 1; case GICD_TYPER: /* RO -- write ignored */ @@ -1092,6 +1105,8 @@ static int vgic_v3_domain_init(struct domain *d) register_mmio_handler(d, &vgic_rdistr_mmio_handler, d->arch.vgic.rbase[i], d->arch.vgic.rbase_size[i]); + d->arch.vgic.ctlr = VGICD_CTLR_DEFAULT; + return 0; }