From patchwork Thu Sep 26 21:03:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 20652 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CF55F23A4E for ; Thu, 26 Sep 2013 21:03:46 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id j7sf1718798qaq.3 for ; Thu, 26 Sep 2013 14:03:46 -0700 (PDT) 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=ROoaB7I/erzJj/8u0lRAvc4BT33VMzVMKCslZXckcNQ=; b=eZ3W+nWoyWFa+S6/UwYT0L+9Jk9yDIkknwJ0yZX60a/cWJAMyt4pISLQEG3/hcmwKz f//WoyBkHvloG9Ep7vaE11pGBApUGQRaz/A2J5v5X17AYehhujQPN4TXITt9OymmVS5d 6rHuSKGUwfGHWPc+mxLYxeGSCLQkPixNMBa5QBsv1J1cQsnGLAxiRUrqg+fD6c+HjG4r QtL2Y9MBGr+A9FEz7jj8TlyaLCFApqkJ+WpYV2+L3pHSSSS9Y8sTsaYWI8NlQRqg1dCO NhZx7Lj3l1USUui2ZyZeSqv+OqqmYclaGAIKJkyWSRuiUrsVZuQcvloNZZj9v8qqvE+1 aExQ== X-Gm-Message-State: ALoCoQlu5BW6oC42wBYVG90dN395TG5DEJD7ajWD+upgDthes/+VmJZ/XPE4lAoYUi6Fb5jxZcMS X-Received: by 10.58.49.34 with SMTP id r2mr296975ven.31.1380229426634; Thu, 26 Sep 2013 14:03:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.164 with SMTP id ll4ls1126188qeb.17.gmail; Thu, 26 Sep 2013 14:03:46 -0700 (PDT) X-Received: by 10.52.103.35 with SMTP id ft3mr2125738vdb.5.1380229426509; Thu, 26 Sep 2013 14:03:46 -0700 (PDT) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id d14si896212veh.39.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 14:03:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.41 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.41; Received: by mail-vb0-f41.google.com with SMTP id g17so1270301vbg.14 for ; Thu, 26 Sep 2013 14:03:16 -0700 (PDT) X-Received: by 10.52.119.139 with SMTP id ku11mr66489vdb.42.1380229396394; Thu, 26 Sep 2013 14:03:16 -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.174.196 with SMTP id u4csp388817vcz; Thu, 26 Sep 2013 14:03:15 -0700 (PDT) X-Received: by 10.68.91.3 with SMTP id ca3mr3537906pbb.20.1380229395535; Thu, 26 Sep 2013 14:03:15 -0700 (PDT) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by mx.google.com with ESMTPS id lm10si4917881pab.266.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 14:03:15 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.169 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.192.169; Received: by mail-pd0-f169.google.com with SMTP id r10so1686393pdi.0 for ; Thu, 26 Sep 2013 14:03:15 -0700 (PDT) X-Received: by 10.68.255.229 with SMTP id at5mr3446741pbd.130.1380229395124; Thu, 26 Sep 2013 14:03:15 -0700 (PDT) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id 7sm7385572paf.22.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 14:03:14 -0700 (PDT) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall Subject: [RFC PATCH v2 4/6] arm_gic: Support setting/getting binary point reg Date: Thu, 26 Sep 2013 14:03:04 -0700 Message-Id: <1380229386-24166-5-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1380229386-24166-1-git-send-email-christoffer.dall@linaro.org> References: <1380229386-24166-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.212.41 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. Signed-off-by: Christoffer Dall Changelog [v2]: - Renamed binary_point to bpr and abpr - Added GICC_ABPR read-as-write logic for TCG --- hw/intc/arm_gic.c | 10 +++++++--- hw/intc/arm_gic_common.c | 6 ++++-- hw/intc/gic_internal.h | 7 +++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index 6470d37..d1ddac1 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -578,8 +578,7 @@ 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 */ value = gic_acknowledge_irq(s, cpu); value |= (GIC_SGI_SRC(value, cpu) & 0x7) << 10; @@ -588,6 +587,8 @@ static uint32_t gic_cpu_read(GICState *s, int cpu, int offset) 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); @@ -606,10 +607,13 @@ 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 */ + 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 0657e8b..5449d77 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, NCPU), VMSTATE_UINT16_ARRAY(running_priority, GICState, NCPU), VMSTATE_UINT16_ARRAY(current_pending, GICState, NCPU), + VMSTATE_UINT8_ARRAY(bpr, GICState, NCPU), + VMSTATE_UINT8_ARRAY(abpr, GICState, NCPU), VMSTATE_END_OF_LIST() } }; diff --git a/hw/intc/gic_internal.h b/hw/intc/gic_internal.h index 5b53242..758b85a 100644 --- a/hw/intc/gic_internal.h +++ b/hw/intc/gic_internal.h @@ -92,6 +92,13 @@ typedef struct GICState { uint16_t running_priority[NCPU]; uint16_t current_pending[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[NCPU]; + uint8_t abpr[NCPU]; + uint32_t num_cpu; MemoryRegion iomem; /* Distributor */