From patchwork Fri Oct 16 13:58:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 55111 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 404BC22EAC for ; Fri, 16 Oct 2015 14:01:56 +0000 (UTC) Received: by wibzt1 with SMTP id zt1sf2958499wib.0 for ; Fri, 16 Oct 2015 07:01:55 -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:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=p74NOdbAMyqI8+4Viakjw/a/gsk0rRanuP+Ih0rWmhc=; b=jgKizSfFPseIPF5kTYmpluZkYuWC3s/Kg1IEC/dht/5oFSKA7aN3XwvIFFENHIHeB/ M+1vNBt/yy87y0Eu9iFvREPnwsFIYFAB+PhqefIMUHVKwEQygcoB3Ms1jdL9MD3Xitga vmt3JtHeA7ZSsaDZ1e5Iaumb3YE3uhrLZV/DMI4AC0yaStLyJhfHBKOsZ0yao1Z+ZweE NK4MZVM4pIgzF/64BKy5cae3z6XjBtyAABTBjw5cNJFEYuUU7Swg3sKwpEtXgWquGr1E tRGcNRTZGPFSnZv0cTSGT3kNLSwaxOZl8r/7aeU1dhoL/6GY2VDGivH69h9qutV5ZJwg XrHA== X-Gm-Message-State: ALoCoQm4fX/cALVjEnKd98HAs96lPEuuIYXcImiEWx04TKSSBZlLpHeM6lAzS+mFURKYdBIa9yrj X-Received: by 10.112.173.170 with SMTP id bl10mr646282lbc.7.1445004115555; Fri, 16 Oct 2015 07:01:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.162.139 with SMTP id l133ls50655lfe.46.gmail; Fri, 16 Oct 2015 07:01:55 -0700 (PDT) X-Received: by 10.25.170.11 with SMTP id t11mr1818085lfe.20.1445004115419; Fri, 16 Oct 2015 07:01:55 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id b65si12996236lfb.158.2015.10.16.07.01.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Oct 2015 07:01:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbpp2 with SMTP id pp2so72813210lbb.0 for ; Fri, 16 Oct 2015 07:01:55 -0700 (PDT) X-Received: by 10.112.199.137 with SMTP id jk9mr8416540lbc.86.1445004115240; Fri, 16 Oct 2015 07:01:55 -0700 (PDT) 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.59.35 with SMTP id w3csp1309450lbq; Fri, 16 Oct 2015 07:01:54 -0700 (PDT) X-Received: by 10.55.203.4 with SMTP id d4mr18915211qkj.47.1445004109192; Fri, 16 Oct 2015 07:01:49 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b51si18022425qgf.68.2015.10.16.07.01.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 16 Oct 2015 07:01:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:53851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn5Zq-0006kq-GB for patch@linaro.org; Fri, 16 Oct 2015 10:01:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn5WO-00020g-9U for qemu-devel@nongnu.org; Fri, 16 Oct 2015 09:58:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zn5WM-0000lb-P9 for qemu-devel@nongnu.org; Fri, 16 Oct 2015 09:58:11 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:35158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn5WM-0000ht-Hh for qemu-devel@nongnu.org; Fri, 16 Oct 2015 09:58:10 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Zn5WJ-0003mZ-TT for qemu-devel@nongnu.org; Fri, 16 Oct 2015 14:58:07 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 16 Oct 2015 14:58:02 +0100 Message-Id: <1445003887-14475-9-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1445003887-14475-1-git-send-email-peter.maydell@linaro.org> References: <1445003887-14475-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 08/13] misc: zynq_slcr: Fix MMIO writes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.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.217.176 as permitted sender) smtp.mailfrom=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 From: Peter Crosthwaite The /4 for offset calculation in MMIO writes was happening twice giving wrong write offsets. Fix. While touching the code, change the if-else to be a short returning if and convert the debug message to a GUEST_ERROR, which is more accurate for this condition. Cc: qemu-stable@nongnu.org Cc: Guenter Roeck Signed-off-by: Peter Crosthwaite Reviewed-by: Alistair Francis Signed-off-by: Peter Maydell --- hw/misc/zynq_slcr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c index 964f253..3d78708 100644 --- a/hw/misc/zynq_slcr.c +++ b/hw/misc/zynq_slcr.c @@ -393,12 +393,12 @@ static void zynq_slcr_write(void *opaque, hwaddr offset, return; } - if (!s->regs[LOCKSTA]) { - s->regs[offset / 4] = val; - } else { - DB_PRINT("SCLR registers are locked. Unlock them first\n"); + if (s->regs[LOCKSTA]) { + qemu_log_mask(LOG_GUEST_ERROR, + "SCLR registers are locked. Unlock them first\n"); return; } + s->regs[offset] = val; switch (offset) { case PSS_RST_CTRL: