From patchwork Tue Dec 9 11:26:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 42044 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 ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 665CE244AC for ; Tue, 9 Dec 2014 11:39:24 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf609015wib.6 for ; Tue, 09 Dec 2014 03:39:23 -0800 (PST) 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 :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=V/RqYgHxuTroiXFbuBxwx4FpbtJPQJ1O58FIu60a6dw=; b=F7wHAF2uqCthRJthFUUmDAU+S3LgJ22yZ3eNthBfO2TosbTS7WNsYAw650dM7fFYmp k9H4rwNcU2S+t+Bo0M9N6m3bpI4FvaX7y3n5OY+jqiiWZ0GH9tK6ZZXoSFxY49Gvqeu9 h6qfB79d/a3i/pFQmxuh+hEQsy76A4sdpxJytw+THbchruCZ6O3WgebJZbe1u/li6h+p 3lWX6pD+Iu+dQ9p74p6BDKlvV+Z2SIHec1m4PKCiKTfRLxVJKFyIC8hBIjZErpHfOMl7 8PlkD4Y7R41KZHp3UaWXTBYsNLrGgRRdjzb8+YVnyL080LbqT54yRUwXv8G2WY9TsN5j 0tDQ== X-Gm-Message-State: ALoCoQnEZoOyjpT+JmaRBpaAGQLSBaWOfGvJEql+Dm4GMGQje23KC3DcHbJN+x2WTcxyWVa0fZ69 X-Received: by 10.194.178.163 with SMTP id cz3mr7202846wjc.1.1418125163700; Tue, 09 Dec 2014 03:39:23 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.169 with SMTP id l9ls25255lal.101.gmail; Tue, 09 Dec 2014 03:39:23 -0800 (PST) X-Received: by 10.112.136.38 with SMTP id px6mr10434086lbb.88.1418125163409; Tue, 09 Dec 2014 03:39:23 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id s8si986940lae.135.2014.12.09.03.39.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Dec 2014 03:39:23 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id hv19so347183lab.0 for ; Tue, 09 Dec 2014 03:39:23 -0800 (PST) X-Received: by 10.152.3.67 with SMTP id a3mr21356961laa.56.1418125163262; Tue, 09 Dec 2014 03:39:23 -0800 (PST) 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.184.201 with SMTP id ew9csp739390lbc; Tue, 9 Dec 2014 03:39:22 -0800 (PST) X-Received: by 10.70.127.233 with SMTP id nj9mr29147415pdb.137.1418125161443; Tue, 09 Dec 2014 03:39:21 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id s5si1396807pdg.142.2014.12.09.03.39.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Dec 2014 03:39:21 -0800 (PST) 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 1XyJ4v-0004wK-M8; Tue, 09 Dec 2014 11:35:41 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XyIvS-00055p-B4 for linux-arm-kernel@bombadil.infradead.org; Tue, 09 Dec 2014 11:25:54 +0000 Received: from mail-lb0-f172.google.com ([209.85.217.172]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XyIvQ-0003xu-ON for linux-arm-kernel@lists.infradead.org; Tue, 09 Dec 2014 11:25:53 +0000 Received: by mail-lb0-f172.google.com with SMTP id u10so302873lbd.31 for ; Tue, 09 Dec 2014 03:25:30 -0800 (PST) X-Received: by 10.112.142.7 with SMTP id rs7mr21246855lbb.83.1418124330337; Tue, 09 Dec 2014 03:25:30 -0800 (PST) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id w3sm279709law.36.2014.12.09.03.25.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Dec 2014 03:25:29 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , kvm@vger.kernel.org Subject: [GIT PULL 7/9] arm/arm64: KVM: avoid unnecessary guest register mangling on MMIO read Date: Tue, 9 Dec 2014 12:26:06 +0100 Message-Id: <1418124368-28418-8-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty In-Reply-To: <1418124368-28418-1-git-send-email-christoffer.dall@linaro.org> References: <1418124368-28418-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141209_062552_936576_CAA5177E X-CRM114-Status: GOOD ( 11.05 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.172 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.217.172 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Marc Zyngier , Andre Przywara , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.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.215.41 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: Andre Przywara Currently we mangle the endianness of the guest's register even on an MMIO _read_, where it is completely useless, because we will not use the value of that register. Rework the io_mem_abort() function to clearly separate between reads and writes and only do the endianness mangling on MMIO writes. Signed-off-by: Andre Przywara Signed-off-by: Marc Zyngier --- arch/arm/kvm/mmio.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c index 4cb5a93..5d3bfc0 100644 --- a/arch/arm/kvm/mmio.c +++ b/arch/arm/kvm/mmio.c @@ -187,15 +187,18 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, } rt = vcpu->arch.mmio_decode.rt; - data = vcpu_data_guest_to_host(vcpu, *vcpu_reg(vcpu, rt), mmio.len); - trace_kvm_mmio((mmio.is_write) ? KVM_TRACE_MMIO_WRITE : - KVM_TRACE_MMIO_READ_UNSATISFIED, - mmio.len, fault_ipa, - (mmio.is_write) ? data : 0); + if (mmio.is_write) { + data = vcpu_data_guest_to_host(vcpu, *vcpu_reg(vcpu, rt), + mmio.len); - if (mmio.is_write) + trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, mmio.len, + fault_ipa, data); mmio_write_buf(mmio.data, mmio.len, data); + } else { + trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, mmio.len, + fault_ipa, 0); + } if (vgic_handle_mmio(vcpu, run, &mmio)) return 1;