From patchwork Thu Jun 26 11:42:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 32557 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CA56F2066E for ; Thu, 26 Jun 2014 11:43:11 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id uy5sf18550602obc.9 for ; Thu, 26 Jun 2014 04:43:11 -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=CKoowFVtvRk7Y6QkDGDcYxKuyu52RkDlrjKzq8xL5ik=; b=HTOYDqYLRWGrrKGqoqoIleE1zvTOXq/lS1rnH85fzJWUN4vWtHckjkcO0ZT3r8ww2A 80B0KXYJwWDW8qxJkB/VIIOB4ldmihmvIzMi5DnGAiP1WGnUmgnSVMuL5S7AExI4u44a EZlEJxPcab1COg6jH8JOPjWDOoGsX0VGvm52cx7R7X93P90C2El4Zq7NHREeJbARe+vX J3J3ZcL+r+WAFuWO8WaXvVyQfI5b2SrlFFDu4unrib8WyZ/UcfYo6GyuH9eDXWQcs6Ml aA/75T05+o2Y1ltU9d3YNEjxP1PqFgtfl9K1DEJ0gUGYKxQcjgWsAVg3/s2TJMXxWHJF VIEg== X-Gm-Message-State: ALoCoQlPXE/+00z1Rt5Psa5wAnJIiSiodrjQUv4lVU9UI+mIYEOHJvgqyF9aBP7WUp0NXJwjRzvm X-Received: by 10.182.43.196 with SMTP id y4mr7419194obl.35.1403782991427; Thu, 26 Jun 2014 04:43:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.103.118 with SMTP id x109ls191082qge.74.gmail; Thu, 26 Jun 2014 04:43:11 -0700 (PDT) X-Received: by 10.52.249.41 with SMTP id yr9mr805699vdc.51.1403782991313; Thu, 26 Jun 2014 04:43:11 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id py18si1049038vdb.2.2014.06.26.04.43.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 04:43:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id db11so3447006veb.26 for ; Thu, 26 Jun 2014 04:43:11 -0700 (PDT) X-Received: by 10.52.249.41 with SMTP id yr9mr805687vdc.51.1403782991196; Thu, 26 Jun 2014 04:43:11 -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.221.37.5 with SMTP id tc5csp24009vcb; Thu, 26 Jun 2014 04:43:10 -0700 (PDT) X-Received: by 10.180.20.206 with SMTP id p14mr3807683wie.26.1403782990380; Thu, 26 Jun 2014 04:43:10 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id q1si11833015wiz.56.2014.06.26.04.42.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 26 Jun 2014 04:42:58 -0700 (PDT) Received-SPF: none (google.com: pm215@archaic.org.uk does not designate permitted sender hosts) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1X084k-0005KT-Jp; Thu, 26 Jun 2014 12:42:46 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Peter Crosthwaite Subject: [PATCH v2 1/4] hw/arm/strongarm: Fix handling of GPSR/GPCR reads Date: Thu, 26 Jun 2014 12:42:43 +0100 Message-Id: <1403782966-20457-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1403782966-20457-1-git-send-email-peter.maydell@linaro.org> References: <1403782966-20457-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@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.128.181 as permitted sender) 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: , The StrongARM GPIO GPSR and GPCR registers are write-only, with reads being undefined behaviour. Instead of having GPCR return 31337 and GPSR return the value last written, make both log the guest error and return 0. Signed-off-by: Peter Maydell --- hw/arm/strongarm.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 0da9015..cc2d7f2 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -480,7 +480,6 @@ struct StrongARMGPIOInfo { uint32_t rising; uint32_t falling; uint32_t status; - uint32_t gpsr; uint32_t gafr; uint32_t prev_level; @@ -544,14 +543,14 @@ static uint64_t strongarm_gpio_read(void *opaque, hwaddr offset, return s->dir; case GPSR: /* GPIO Pin-Output Set registers */ - DPRINTF("%s: Read from a write-only register 0x" TARGET_FMT_plx "\n", - __func__, offset); - return s->gpsr; /* Return last written value. */ + qemu_log_mask(LOG_GUEST_ERROR, + "strongarm GPIO: read from write only register GPSR\n"); + return 0; case GPCR: /* GPIO Pin-Output Clear registers */ - DPRINTF("%s: Read from a write-only register 0x" TARGET_FMT_plx "\n", - __func__, offset); - return 31337; /* Specified as unpredictable in the docs. */ + qemu_log_mask(LOG_GUEST_ERROR, + "strongarm GPIO: read from write only register GPCR\n"); + return 0; case GRER: /* GPIO Rising-Edge Detect Enable registers */ return s->rising; @@ -590,7 +589,6 @@ static void strongarm_gpio_write(void *opaque, hwaddr offset, case GPSR: /* GPIO Pin-Output Set registers */ s->olevel |= value; strongarm_gpio_handler_update(s); - s->gpsr = value; break; case GPCR: /* GPIO Pin-Output Clear registers */