From patchwork Sun Feb 2 23:17:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 24018 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ACEE520341 for ; Sun, 2 Feb 2014 23:17:32 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id e14sf25319605iej.0 for ; Sun, 02 Feb 2014 15:17:31 -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=S5rjV1EZwucuhl52qyCkq3xLcG4jcWgjM99ZOyg3DoU=; b=HEfC2OzMzUkQo/kOVMyuBphepR22UoE6tOE/XRZXqP7l6fMTEhpDUGIb7HRdin/5P2 ABH0Zm7jAXq/VL6a8M5ibhefLW4FCKcuP7LBb9HvOxuL9gq2OzQY8L/ZzGVs6mBo8rmT 8kJms5HYoAB2I7RHOpU8OT5jvmIa5G8WTu4W4rGmRFbtql6bK3MWECUKblu6ed4i66ta jYP7eCAvHfC8oqNuA/WgTzgQj7bnZAQEZQQwsPrjJf7GkfuufSjYFJjWhcJOcd0LNUMz JNJsOrm6W1d2GC6GCRhJwCXWzztdavTPy/waozEIfCs4Fqfsb+6J621cYfqUYuort/JM g22Q== X-Gm-Message-State: ALoCoQmDuUCM9aKXyC2HQsxMnpxvLCrdGb3AaRbXzYmQ1Mbi5PAnzU1fNHxV1XfmG3Fvbtt4kFm8 X-Received: by 10.50.12.68 with SMTP id w4mr4386535igb.0.1391383051938; Sun, 02 Feb 2014 15:17:31 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.137 with SMTP id x9ls1827262qgx.53.gmail; Sun, 02 Feb 2014 15:17:31 -0800 (PST) X-Received: by 10.221.26.10 with SMTP id rk10mr26418978vcb.0.1391383051844; Sun, 02 Feb 2014 15:17:31 -0800 (PST) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id eo4si6218226vdb.147.2014.02.02.15.17.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Feb 2014 15:17:31 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.181 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.181; Received: by mail-vc0-f181.google.com with SMTP id ie18so4238699vcb.40 for ; Sun, 02 Feb 2014 15:17:31 -0800 (PST) X-Received: by 10.58.90.202 with SMTP id by10mr25155541veb.6.1391383051752; Sun, 02 Feb 2014 15:17:31 -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.220.174.196 with SMTP id u4csp117658vcz; Sun, 2 Feb 2014 15:17:31 -0800 (PST) X-Received: by 10.66.65.134 with SMTP id x6mr33384890pas.12.1391383050782; Sun, 02 Feb 2014 15:17:30 -0800 (PST) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by mx.google.com with ESMTPS id x3si18327479pbk.353.2014.02.02.15.17.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Feb 2014 15:17:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.175 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.192.175; Received: by mail-pd0-f175.google.com with SMTP id w10so6162259pde.6 for ; Sun, 02 Feb 2014 15:17:30 -0800 (PST) X-Received: by 10.68.7.66 with SMTP id h2mr33619251pba.91.1391383050395; Sun, 02 Feb 2014 15:17:30 -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 qq5sm49777615pbb.24.2014.02.02.15.17.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Feb 2014 15:17:29 -0800 (PST) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall Subject: [PATCH v6 3/6] arm_gic: Support setting/getting binary point reg Date: Sun, 2 Feb 2014 15:17:21 -0800 Message-Id: <1391383044-596-4-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1391383044-596-1-git-send-email-christoffer.dall@linaro.org> References: <1391383044-596-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.181 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 6550292..5413a24 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -669,14 +669,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); @@ -695,10 +696,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 92de7f8..d2d8ce1 100644 --- a/hw/intc/arm_gic_common.c +++ b/hw/intc/arm_gic_common.c @@ -58,8 +58,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[]) { @@ -76,6 +76,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 5dd826d..0f0644b 100644 --- a/include/hw/intc/arm_gic_common.h +++ b/include/hw/intc/arm_gic_common.h @@ -68,6 +68,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 */