From patchwork Tue May 13 16:13:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vkamensky X-Patchwork-Id: 30097 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0AEF220446 for ; Tue, 13 May 2014 16:17:29 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id lc6sf1608467vcb.3 for ; Tue, 13 May 2014 09:17:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=Uk2FmF3yREK4DoHsKWDjkORMVgOaMMInjBLn4Fm+flM=; b=L/mDeYnl48oAdS8/4yeg+dTAvtmKx29caeUyBfs3W4RoSwZGg3YMSC0beNJgyrQFLd 3rTPaoaQan8zhiLy0ZPkf6tW6ONk6d7kSJil+nFpmyim51+lSLGVYXVAV3Q7H2M6WnJT 1Kq9kSEA+4L1N6WhsvLZWE8b0Rbw9SNpdzuvnmwLHI3B4wvpompKYp+Vv6Lnwdk/yxTb F7q7HgRYNiGFr7o+2EBwRYSFlH6BEbujFvGhfGh9cqdePINJrKIo70G+CUO77Zc3Fpcq aeB4vP8gFq77asr2sXEGMoXHH1RnQzrYTQRikJX5h3mP1mueduy6bOaSQ74NpeRt7BlU zdeA== X-Gm-Message-State: ALoCoQkXNIUyoncvQY/Fm63/oKYvdnEA+9veWHDVl5crLexDgW207CLpRQtcEhK0fvtO9xPO7p2O X-Received: by 10.58.152.37 with SMTP id uv5mr4831635veb.0.1399997848842; Tue, 13 May 2014 09:17:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.37 with SMTP id g34ls897262qgd.64.gmail; Tue, 13 May 2014 09:17:28 -0700 (PDT) X-Received: by 10.52.124.66 with SMTP id mg2mr955388vdb.50.1399997848608; Tue, 13 May 2014 09:17:28 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id 10si2730639vcu.78.2014.05.13.09.17.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 09:17:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.173 as permitted sender) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id pa12so743180veb.18 for ; Tue, 13 May 2014 09:17:28 -0700 (PDT) X-Received: by 10.220.184.72 with SMTP id cj8mr29806801vcb.10.1399997848496; Tue, 13 May 2014 09:17:28 -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.220.221.72 with SMTP id ib8csp164121vcb; Tue, 13 May 2014 09:17:26 -0700 (PDT) X-Received: by 10.224.165.148 with SMTP id i20mr29901719qay.41.1399997846604; Tue, 13 May 2014 09:17:26 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id f5si2776978qas.33.2014.05.13.09.17.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 May 2014 09:17:26 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WkFN5-0002ug-3F; Tue, 13 May 2014 16:16:03 +0000 Received: from mail-pa0-f50.google.com ([209.85.220.50]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WkFMN-0001TO-Bc for linux-arm-kernel@lists.infradead.org; Tue, 13 May 2014 16:15:19 +0000 Received: by mail-pa0-f50.google.com with SMTP id fb1so456098pad.23 for ; Tue, 13 May 2014 09:14:58 -0700 (PDT) X-Received: by 10.68.133.229 with SMTP id pf5mr6358197pbb.115.1399997698447; Tue, 13 May 2014 09:14:58 -0700 (PDT) Received: from kamensky-w530.hsd1.ca.comcast.net (c-24-6-79-41.hsd1.ca.comcast.net. [24.6.79.41]) by mx.google.com with ESMTPSA id dd5sm28958360pbc.85.2014.05.13.09.14.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 May 2014 09:14:57 -0700 (PDT) From: Victor Kamensky To: kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com, agraf@suse.de Subject: [PATCH v3 05/14] ARM: KVM: vgic mmio should hold data as LE bytes array in BE case Date: Tue, 13 May 2014 09:13:57 -0700 Message-Id: <1399997646-4716-6-git-send-email-victor.kamensky@linaro.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1399997646-4716-1-git-send-email-victor.kamensky@linaro.org> References: <1399997646-4716-1-git-send-email-victor.kamensky@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140513_091519_416974_61E851F1 X-CRM114-Status: GOOD ( 11.58 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.50 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Cc: taras.kondratiuk@linaro.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Victor Kamensky X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: victor.kamensky@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.173 as permitted sender) smtp.mail=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 According to recent clarifications of mmio.data array meaning - the mmio.data array should hold bytes as they would appear in memory. Vgic is little endian device. And in case of BE image kernel side that emulates vgic, holds data in BE form. So we need to byteswap cpu<->le32 vgic registers when we read/write them from mmio.data[]. Change has no effect in LE case because cpu already runs in le32. Signed-off-by: Victor Kamensky Reviewed-by: Christoffer Dall Acked-by: Marc Zyngier --- virt/kvm/arm/vgic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 56ff9be..529c336 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -241,12 +241,12 @@ static void vgic_cpu_irq_clear(struct kvm_vcpu *vcpu, int irq) static u32 mmio_data_read(struct kvm_exit_mmio *mmio, u32 mask) { - return *((u32 *)mmio->data) & mask; + return le32_to_cpu(*((u32 *)mmio->data)) & mask; } static void mmio_data_write(struct kvm_exit_mmio *mmio, u32 mask, u32 value) { - *((u32 *)mmio->data) = value & mask; + *((u32 *)mmio->data) = cpu_to_le32(value) & mask; } /**