From patchwork Mon Aug 4 08:46:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 34798 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0E51B20F2E for ; Mon, 4 Aug 2014 08:56:19 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf43596627pde.7 for ; Mon, 04 Aug 2014 01:56:19 -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=xP+cvnKDbv42LaRIytyfpYSHxvV4hOi5lagOOqpEDNU=; b=fe21BUe7P43hOhlAz+J9nMXGotEf7YnV68HZYYNYHIfNDJybzRHEICS5SoX91bcDyZ Jz03zhwVebZuaezDZtMtES+ZY7BZj7tT2TiGgeUbHuwfOYpLpikxy/i7C7iISgesIYV1 fpbBNrhuKn6sVADjsjBSH9McRI8/3tm2gX5GRq3oLew8TTZvvhwcytrW35nJs0ZC1Q/9 vf7XCGKGaneqMntbRuqtTss/1z+8nKzT0qnD6UwaStbxXXLVVQFNgmpVNME0+uBp370/ FT5sOAJCtJcjlKXDiBukJi+Q3ch37y/+Kxn/Y6H3X8tu80UKPwwLoaNlKydiwadVNZB/ th5A== X-Gm-Message-State: ALoCoQkAx3x/fHrbXFg6vmuWFCDqIie7xd0ATcVC9AZn6/SK1VEgbnlsbVnHU7+QJ6MLwY2yFvGn X-Received: by 10.66.216.161 with SMTP id or1mr8774495pac.38.1407142579076; Mon, 04 Aug 2014 01:56:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.227 with SMTP id s90ls2066591qga.95.gmail; Mon, 04 Aug 2014 01:56:18 -0700 (PDT) X-Received: by 10.52.61.99 with SMTP id o3mr18524341vdr.46.1407142578896; Mon, 04 Aug 2014 01:56:18 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id x5si11551758vcy.51.2014.08.04.01.56.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 01:56:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so10509281vcb.10 for ; Mon, 04 Aug 2014 01:56:18 -0700 (PDT) X-Received: by 10.52.248.146 with SMTP id ym18mr18624905vdc.8.1407142578788; Mon, 04 Aug 2014 01:56:18 -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.37.5 with SMTP id tc5csp288536vcb; Mon, 4 Aug 2014 01:56:18 -0700 (PDT) X-Received: by 10.66.156.42 with SMTP id wb10mr535839pab.155.1407142577870; Mon, 04 Aug 2014 01:56:17 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id dt8si3354704pac.102.2014.08.04.01.56.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Aug 2014 01:56:17 -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 1XEE2b-0006Ul-Ue; Mon, 04 Aug 2014 08:54:49 +0000 Received: from mail-la0-f51.google.com ([209.85.215.51]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEDwT-00022h-Ns for linux-arm-kernel@lists.infradead.org; Mon, 04 Aug 2014 08:48:30 +0000 Received: by mail-la0-f51.google.com with SMTP id pn19so5154494lab.10 for ; Mon, 04 Aug 2014 01:48:09 -0700 (PDT) X-Received: by 10.153.5.44 with SMTP id cj12mr22592942lad.36.1407142089289; Mon, 04 Aug 2014 01:48:09 -0700 (PDT) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id px1sm26731207lbb.46.2014.08.04.01.48.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Aug 2014 01:48:08 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , Gleb Natapov Subject: [GIT PULL 31/51] ARM: KVM: vgic mmio should hold data as LE bytes array in BE case Date: Mon, 4 Aug 2014 10:46:48 +0200 Message-Id: <1407142028-31105-32-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1407142028-31105-1-git-send-email-christoffer.dall@linaro.org> References: <1407142028-31105-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140804_014829_979961_AF0DBECD X-CRM114-Status: GOOD ( 12.23 ) 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.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.51 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.215.51 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Marc Zyngier , Victor Kamensky , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org 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: christoffer.dall@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.220.179 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 From: Victor Kamensky 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 Signed-off-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 795ab48..b0edc8c 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -238,12 +238,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; } /**