From patchwork Thu Jan 29 18:25:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 43965 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 8212424128 for ; Thu, 29 Jan 2015 18:28:22 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id b6sf23092362lbj.0 for ; Thu, 29 Jan 2015 10:28:21 -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=mfS6Q4lxDfuXNPZaoWHEmSGY8Tpv56VkjNBeWN9lZcM=; b=S8YCwA+vLVv4iWRkiHd0f2sOSzPpBMp5LbX9QF2HZWkacwbniQN/+EAmg4OkMt68+Y h64FfCShkk5Unu+lhajW5TErxTbIKAiSWfF6JELtoMEszjade7F+CpIAReB8h+vrCKrh 1J7T0q/N64Spaax3dNlDkU+cTqt4KRnULr7rDPxGJEhRum6A9q1SdxYV6uXGq/1++3Lq Wg0CQLRjy8cM6M4IQ6xFGTb4bzQRWA2msdu3K+vefdTHq253Mb6mCJ2jd1ef37jiNvxV mwDEWOPHpkNcqIAbPdf/oCtyRUm835Zg085ZfKYj1kUYkBT4T/df4qDH9Z17Ug1D+338 g/dA== X-Gm-Message-State: ALoCoQmqzsN7ljCVTRTun+8LSS1SaJg1TuUezWzTpNsVIQQCt/MS/usXrysCDHvFhyU/Ad/jptZJ X-Received: by 10.152.43.166 with SMTP id x6mr303944lal.3.1422556101195; Thu, 29 Jan 2015 10:28:21 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.229 with SMTP id v5ls257630lav.55.gmail; Thu, 29 Jan 2015 10:28:20 -0800 (PST) X-Received: by 10.112.217.68 with SMTP id ow4mr2403072lbc.97.1422556100968; Thu, 29 Jan 2015 10:28:20 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id jt16si8231792lab.9.2015.01.29.10.28.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 10:28:20 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id 10so31241053lbg.6 for ; Thu, 29 Jan 2015 10:28:20 -0800 (PST) X-Received: by 10.152.8.1 with SMTP id n1mr2425250laa.47.1422556100835; Thu, 29 Jan 2015 10:28:20 -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.35.133 with SMTP id h5csp34262lbj; Thu, 29 Jan 2015 10:28:18 -0800 (PST) X-Received: by 10.180.82.10 with SMTP id e10mr3772018wiy.18.1422556096112; Thu, 29 Jan 2015 10:28:16 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id s7si4636634wiw.66.2015.01.29.10.28.14 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Jan 2015 10:28:16 -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 1YGtne-0004bJ-Ro; Thu, 29 Jan 2015 18:26:42 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YGtne-0004b1-3h for xen-devel@lists.xenproject.org; Thu, 29 Jan 2015 18:26:42 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id CB/28-03185-16B7AC45; Thu, 29 Jan 2015 18:26:41 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-10.tower-31.messagelabs.com!1422556000!23324747!1 X-Originating-IP: [74.125.82.49] 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 6593 invoked from network); 29 Jan 2015 18:26:40 -0000 Received: from mail-wg0-f49.google.com (HELO mail-wg0-f49.google.com) (74.125.82.49) by server-10.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 29 Jan 2015 18:26:40 -0000 Received: by mail-wg0-f49.google.com with SMTP id k14so23869747wgh.8 for ; Thu, 29 Jan 2015 10:26:40 -0800 (PST) X-Received: by 10.194.63.206 with SMTP id i14mr3532113wjs.107.1422556000556; Thu, 29 Jan 2015 10:26:40 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id x18sm3518503wia.12.2015.01.29.10.26.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 10:26:39 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 29 Jan 2015 18:25:38 +0000 Message-Id: <1422555950-31821-4-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1422555950-31821-1-git-send-email-julien.grall@linaro.org> References: <1422555950-31821-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Vijaya.Kumar@caviumnetworks.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v2 03/15] 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.175 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 is RAO/WI. Furthermore, 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 --- Changes in v2: - Clearly explain that ARE_NS is RAO/WI rather than imply the guest should set it. - Typoes --- 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 e0a7d5b..9115199 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); @@ -838,8 +844,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 */ @@ -1100,6 +1113,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; }