From patchwork Thu Jun 12 16:30:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vkamensky X-Patchwork-Id: 31839 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 846C220AE6 for ; Thu, 12 Jun 2014 16:33:03 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id hy10sf3298640vcb.1 for ; Thu, 12 Jun 2014 09:33:03 -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=rtas1g64V4RXxIp1ilzVs2DerDD/lcaZZtyH7K2rvkU=; b=CfD4NaMzihroeSy0JR7oaOFoYHkPTSw5b8eNmvXu/5ACQmNzMo5RVHRvKTO+stMp0b L1+wRQQznDmi1MN2UeBdZin4CKIvtcUbT/l5EPvgqOI1cPsZmO70xbOHgipMGLSthcE3 1lqiJ4JEXHocLDhmQlm6Np5gVPL1EEv3Oesl4eYkYXmsWT8neZQRa8lDLcrjpF3f9A4I 2q6Fhp0m/NN9smdz/ptFOFB1m6ugwtjdL3vYiGdy/iRV6D8MHBkLHXEcqA+uldTNY7l4 XPb3xH9WN7D3MY90h2snJSUDvc9YCQYj/uXBsJ/dIl84ZBYjx6s+jLFU7HYJi3xOShXB j/5Q== X-Gm-Message-State: ALoCoQnr/Jv6HIBwm7P3LzYy7eeigVgZssMqVcSnsMRwU6cM8UKI0m8DxeLMgsLzyFGmFqftBH3P X-Received: by 10.236.150.114 with SMTP id y78mr594700yhj.7.1402590783350; Thu, 12 Jun 2014 09:33:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.26.183 with SMTP id 52ls3094062qgv.15.gmail; Thu, 12 Jun 2014 09:33:03 -0700 (PDT) X-Received: by 10.53.8.162 with SMTP id dl2mr8777136vdd.24.1402590783127; Thu, 12 Jun 2014 09:33:03 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id uw7si480487vec.24.2014.06.12.09.33.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Jun 2014 09:33:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jz11so2086176veb.17 for ; Thu, 12 Jun 2014 09:33:03 -0700 (PDT) X-Received: by 10.52.94.47 with SMTP id cz15mr8900108vdb.0.1402590783044; Thu, 12 Jun 2014 09:33:03 -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.221.54.6 with SMTP id vs6csp416967vcb; Thu, 12 Jun 2014 09:33:02 -0700 (PDT) X-Received: by 10.229.79.2 with SMTP id n2mr62074518qck.11.1402590782610; Thu, 12 Jun 2014 09:33:02 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id j91si34747894qgf.81.2014.06.12.09.33.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jun 2014 09:33:02 -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 1Wv7uq-0008B4-NQ; Thu, 12 Jun 2014 16:31:52 +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 1Wv7tz-0007sE-Ni for linux-arm-kernel@lists.infradead.org; Thu, 12 Jun 2014 16:31:03 +0000 Received: by mail-pa0-f50.google.com with SMTP id fb1so1188835pad.9 for ; Thu, 12 Jun 2014 09:30:38 -0700 (PDT) X-Received: by 10.68.221.42 with SMTP id qb10mr13975225pbc.65.1402590638913; Thu, 12 Jun 2014 09:30:38 -0700 (PDT) Received: from kamensky-w530.cisco.com (128-107-239-235.cisco.com. [128.107.239.235]) by mx.google.com with ESMTPSA id nh8sm81278030pbc.25.2014.06.12.09.30.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jun 2014 09:30:38 -0700 (PDT) From: Victor Kamensky To: kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com, agraf@suse.de Subject: [PATCH v4 05/14] ARM: KVM: vgic mmio should hold data as LE bytes array in BE case Date: Thu, 12 Jun 2014 09:30:04 -0700 Message-Id: <1402590613-3341-6-git-send-email-victor.kamensky@linaro.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1402590613-3341-1-git-send-email-victor.kamensky@linaro.org> References: <1402590613-3341-1-git-send-email-victor.kamensky@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140612_093059_814063_D67E7A7A X-CRM114-Status: GOOD ( 11.65 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.50 listed in wl.mailspike.net] -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 -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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.18-1 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.172 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; } /**