From patchwork Sat Dec 21 06:09:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 22703 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 02CE620822 for ; Sat, 21 Dec 2013 06:10:12 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wm4sf13780203obc.7 for ; Fri, 20 Dec 2013 22:10:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=ZKWVBTmCRMEZTYs2/lex55Ve1eY+l2NOR3rmRHrcCM4=; b=RIQUzkDb2QnBHzVAIpN5/zUBJNmzEe4+OajlGDMSH4SKLhZKbz9HAgneiTnIFTeagQ 3a7eifmpeXcxbehkWhOiYXTePgz6jX6+TwK8idW0G3IGGoauiZNbKFdp/vwH5JSLSb5v WNQUNqzmN/UsNThD+JZSHWf599g6T+QmTh9Jp+qZgUPkFZHWFOqrFIGLLWF3GK2Hf7B/ UP2FgnUpj1pv+Bw+P/wd7XtwBDqMti5jZqzwBGU754C2q+u5vFo2NdOPt4P6UVd7bj5J DO6CUGOKNpx6/K+qwmdMevjZQt2Ru8K11yzffcni5o2XvooqNQ22RFupgqAmBzyv0iU7 7xfA== X-Gm-Message-State: ALoCoQk2FTElFDodq38kGUWzFcVXMI5NbtqG0e4LuCjk+4JNsHQuBHCHK0x5KH6VxLbteyXW7Y/x X-Received: by 10.182.219.226 with SMTP id pr2mr5211635obc.44.1387606212149; Fri, 20 Dec 2013 22:10:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.2.41 with SMTP id 9ls994108qer.99.gmail; Fri, 20 Dec 2013 22:10:12 -0800 (PST) X-Received: by 10.58.187.81 with SMTP id fq17mr7816535vec.14.1387606212058; Fri, 20 Dec 2013 22:10:12 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id n17si2303482vcq.135.2013.12.20.22.10.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Dec 2013 22:10:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id lh4so1956169vcb.9 for ; Fri, 20 Dec 2013 22:10:12 -0800 (PST) X-Received: by 10.58.255.195 with SMTP id as3mr81944ved.50.1387606211895; Fri, 20 Dec 2013 22:10:11 -0800 (PST) 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.59.13.131 with SMTP id ey3csp109311ved; Fri, 20 Dec 2013 22:10:11 -0800 (PST) X-Received: by 10.68.129.99 with SMTP id nv3mr13283485pbb.40.1387606210883; Fri, 20 Dec 2013 22:10:10 -0800 (PST) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by mx.google.com with ESMTPS id sj5si7055556pab.226.2013.12.20.22.10.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Dec 2013 22:10:10 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.44 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.160.44; Received: by mail-pb0-f44.google.com with SMTP id rq2so3490761pbb.3 for ; Fri, 20 Dec 2013 22:10:10 -0800 (PST) X-Received: by 10.68.196.69 with SMTP id ik5mr13276124pbc.132.1387606210485; Fri, 20 Dec 2013 22:10:10 -0800 (PST) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id ae5sm24345852pac.18.2013.12.20.22.10.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Dec 2013 22:10:09 -0800 (PST) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall Subject: [RFC PATCH v4 5/8] arm_gic: Support setting/getting binary point reg Date: Fri, 20 Dec 2013 22:09:36 -0800 Message-Id: <1387606179-22709-6-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.5 In-Reply-To: <1387606179-22709-1-git-send-email-christoffer.dall@linaro.org> References: <1387606179-22709-1-git-send-email-christoffer.dall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.178 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: , Add a binary_point field to the gic emulation structure and support setting/getting this register now when we have it. We don't actually support interrupt grouping yet, oh well. Reviewed-by: Peter Maydell Signed-off-by: Christoffer Dall --- Changes [v2 -> v3]: - Treat writes for GIC prior to v2 as RAZ/WI. Changes [v1 -> v2]: - Renamed binary_point to bpr and abpr - Added GICC_ABPR read-as-write logic for TCG hw/intc/arm_gic.c | 12 +++++++++--- hw/intc/arm_gic_common.c | 6 ++++-- include/hw/intc/arm_gic_common.h | 7 +++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index d0ccb2a..7ea869a 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -640,14 +640,15 @@ static uint32_t gic_cpu_read(GICState *s, int cpu, int offset) case 0x04: /* Priority mask */ return s->priority_mask[cpu]; case 0x08: /* Binary Point */ - /* ??? Not implemented. */ - return 0; + return s->bpr[cpu]; case 0x0c: /* Acknowledge */ return gic_acknowledge_irq(s, cpu); case 0x14: /* Running Priority */ return s->running_priority[cpu]; case 0x18: /* Highest Pending Interrupt */ return s->current_pending[cpu]; + case 0x1c: /* Aliased Binary Point */ + return s->abpr[cpu]; default: qemu_log_mask(LOG_GUEST_ERROR, "gic_cpu_read: Bad offset %x\n", (int)offset); @@ -666,10 +667,15 @@ static void gic_cpu_write(GICState *s, int cpu, int offset, uint32_t value) s->priority_mask[cpu] = (value & 0xff); break; case 0x08: /* Binary Point */ - /* ??? Not implemented. */ + s->bpr[cpu] = (value & 0x7); break; case 0x10: /* End Of Interrupt */ return gic_complete_irq(s, cpu, value & 0x3ff); + case 0x1c: /* Aliased Binary Point */ + if (s->revision >= 2) { + s->abpr[cpu] = (value & 0x7); + } + break; default: qemu_log_mask(LOG_GUEST_ERROR, "gic_cpu_write: Bad offset %x\n", (int)offset); diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c index 4647f0d..ca12f06 100644 --- a/hw/intc/arm_gic_common.c +++ b/hw/intc/arm_gic_common.c @@ -59,8 +59,8 @@ static const VMStateDescription vmstate_gic_irq_state = { static const VMStateDescription vmstate_gic = { .name = "arm_gic", - .version_id = 5, - .minimum_version_id = 5, + .version_id = 6, + .minimum_version_id = 6, .pre_save = gic_pre_save, .post_load = gic_post_load, .fields = (VMStateField[]) { @@ -77,6 +77,8 @@ static const VMStateDescription vmstate_gic = { VMSTATE_UINT16_ARRAY(running_irq, GICState, GIC_NCPU), VMSTATE_UINT16_ARRAY(running_priority, GICState, GIC_NCPU), VMSTATE_UINT16_ARRAY(current_pending, GICState, GIC_NCPU), + VMSTATE_UINT8_ARRAY(bpr, GICState, GIC_NCPU), + VMSTATE_UINT8_ARRAY(abpr, GICState, GIC_NCPU), VMSTATE_END_OF_LIST() } }; diff --git a/include/hw/intc/arm_gic_common.h b/include/hw/intc/arm_gic_common.h index 59a005e..f37bf69 100644 --- a/include/hw/intc/arm_gic_common.h +++ b/include/hw/intc/arm_gic_common.h @@ -69,6 +69,13 @@ typedef struct GICState { uint16_t running_priority[GIC_NCPU]; uint16_t current_pending[GIC_NCPU]; + /* We present the GICv2 without security extensions to a guest and + * therefore the guest can configure the GICC_CTLR to configure group 1 + * binary point in the abpr. + */ + uint8_t bpr[GIC_NCPU]; + uint8_t abpr[GIC_NCPU]; + uint32_t num_cpu; MemoryRegion iomem; /* Distributor */