From patchwork Fri Oct 18 02:30:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 21105 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B3318246F1 for ; Fri, 18 Oct 2013 02:30:12 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id wm4sf7684378obc.8 for ; Thu, 17 Oct 2013 19:30:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=7S/gB+VwZXeXlGsoTGi//CTFZWoSORaVWaWQ+uJipBo=; b=emrtSJIUhTOcS9R/pmdQIQTqyK39EhNPxyzZn89u/kEzlQ8MTssFoJWpQkExRpHdJm SWt05LSpSgeTd9J12/NYC34kIJI/m9BBn6rV2vxDa4RzKnh7toCxlHKWAMKZwNJxfwkS sD4FEVYVGDc4yyfbn/+g+s9G4fEDjWx8aoBgWa65aBxOigUu4Jp7HUypmwClv06/9UAM 6dsCl91n4qtzWJtvKwvOarwAVLA7b9CUpVgo4ois03q4NBIdHVj+A2seBk11p0MI0xHY v+RDD7sTwPNaRBZkvVZryIH39xJGJfQPepIxX/lXezODVKoP8U86p3Cxrf0vooMRLL8n LGSQ== X-Received: by 10.43.151.16 with SMTP id kq16mr218998icc.22.1382063411648; Thu, 17 Oct 2013 19:30:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.128.229 with SMTP id nr5ls1190868qeb.94.gmail; Thu, 17 Oct 2013 19:30:11 -0700 (PDT) X-Received: by 10.52.173.165 with SMTP id bl5mr212620vdc.18.1382063411464; Thu, 17 Oct 2013 19:30:11 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id pb4si7686980vec.150.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Oct 2013 19:30:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.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.128.178; Received: by mail-ve0-f178.google.com with SMTP id jy13so1661764veb.23 for ; Thu, 17 Oct 2013 19:30:11 -0700 (PDT) X-Gm-Message-State: ALoCoQm7Efw22Q1AEt2XGrSJpFSI9Xnnx+KnXydF9ZDsiAXHUT3Y2Pm5oymV36kHfikGe+3NhIk2 X-Received: by 10.58.39.97 with SMTP id o1mr218557vek.15.1382063411337; Thu, 17 Oct 2013 19:30: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.220.174.196 with SMTP id u4csp1625vcz; Thu, 17 Oct 2013 19:30:10 -0700 (PDT) X-Received: by 10.66.66.76 with SMTP id d12mr1073925pat.162.1382063410041; Thu, 17 Oct 2013 19:30:10 -0700 (PDT) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by mx.google.com with ESMTPS id it5si940670pbc.215.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Oct 2013 19:30:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.44 is neither permitted nor denied by best guess record for domain of roy.franz@linaro.org) client-ip=209.85.160.44; Received: by mail-pb0-f44.google.com with SMTP id xa7so3164863pbc.31 for ; Thu, 17 Oct 2013 19:30:09 -0700 (PDT) X-Received: by 10.68.130.1 with SMTP id oa1mr578174pbb.35.1382063409267; Thu, 17 Oct 2013 19:30:09 -0700 (PDT) Received: from rfranz-i7.local (c-98-244-40-86.hsd1.ca.comcast.net. [98.244.40.86]) by mx.google.com with ESMTPSA id ta10sm369443pab.5.2013.10.17.19.30.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Oct 2013 19:30:08 -0700 (PDT) From: Roy Franz To: qemu-devel@nongnu.org, kwolf@redhat.com, stefanha@redhat.com Cc: patches@linaro.org, Roy Franz Subject: [PATCH] block: mask NOR flash buffered write length Date: Thu, 17 Oct 2013 19:30:02 -0700 Message-Id: <1382063402-30359-1-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.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: , For buffered writes, mask the length with the maximum supported length. This is required for block writes to work on the ARM vexpress platform, where the flash interface is 32 bits wide. For buffered writes to the 2 16 bit flashes on the interface, the length is repeated in each 16 bit word, and without this mask the two lengths are interpreted as a single 32 bit value that is very large. Signed-off-by: Roy Franz --- hw/block/pflash_cfi01.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 018a967..a364cca 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -378,6 +378,7 @@ static void pflash_write(pflash_t *pfl, hwaddr offset, break; case 0xe8: + value &= pfl->writeblock_size - 1; DPRINTF("%s: block write of %x bytes\n", __func__, value); pfl->counter = value; pfl->wcycle++;