From patchwork Fri Jan 24 23:39:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 23692 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CA5D520307 for ; Fri, 24 Jan 2014 23:39:45 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id m10sf6573352vbh.0 for ; Fri, 24 Jan 2014 15:39:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=riXQvsA5MZdi5BZxlyKa1tqZXq28hdG6fKh3kATPWgQ=; b=H/NoPeAxJXWv/1CB7LiaJc5q6+eP64neItEmqoeDQQ0jGbNachOWD2Wfl6nIF45K76 XYWR3i0GRGnLpnDQNEBsE/vDZm87Vfanafyd3DN9joSzEi8CQAlqj9ju6j0GhQI4A+XY CiBNuBz16VgPgKwjp8GTIbOP77iFezL8yGJugG/uRwv01c45nLSortMnuYRSz+3N7Cye Cr9hPwEtUtlWyRSD0cj+8Rm1aHxw5X/F7prYSj1D/1dsT23WSFI+bAmueRzwQANDMoDB mki5Zx+p5iMU39xYdYMhS6KOmBRbnodKVfFxOJo/jbGc/t40RD5+6kPr7pKCfEK6bKQ6 VZKA== X-Gm-Message-State: ALoCoQnDNgtzyA3xIgEfDlA4ZJYa4+GORFlg8G772TAxd4ew9OKJqrH9p6xZe7VcekH5+6EZI5vB X-Received: by 10.236.128.243 with SMTP id f79mr5116429yhi.27.1390606784342; Fri, 24 Jan 2014 15:39:44 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.38 with SMTP id n35ls50283qga.68.gmail; Fri, 24 Jan 2014 15:39:44 -0800 (PST) X-Received: by 10.220.64.134 with SMTP id e6mr5277325vci.2.1390606784221; Fri, 24 Jan 2014 15:39:44 -0800 (PST) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id kn3si1322782veb.16.2014.01.24.15.39.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 15:39:44 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.41 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.41; Received: by mail-vb0-f41.google.com with SMTP id g10so2258578vbg.0 for ; Fri, 24 Jan 2014 15:39:44 -0800 (PST) X-Received: by 10.58.86.230 with SMTP id s6mr9088134vez.16.1390606784064; Fri, 24 Jan 2014 15:39:44 -0800 (PST) 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 u4csp14299vcz; Fri, 24 Jan 2014 15:39:43 -0800 (PST) X-Received: by 10.66.226.46 with SMTP id rp14mr16881792pac.133.1390606782866; Fri, 24 Jan 2014 15:39:42 -0800 (PST) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx.google.com with ESMTPS id va10si2747141pbc.158.2014.01.24.15.39.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 15:39:42 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.46 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.220.46; Received: by mail-pa0-f46.google.com with SMTP id rd3so3839636pab.33 for ; Fri, 24 Jan 2014 15:39:42 -0800 (PST) X-Received: by 10.66.119.136 with SMTP id ku8mr16791316pab.121.1390606782306; Fri, 24 Jan 2014 15:39:42 -0800 (PST) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id id1sm6904963pbc.11.2014.01.24.15.39.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 15:39:41 -0800 (PST) From: Christoffer Dall To: kvm@vger.kernel.org Cc: kvm-ppc@vger.kernel.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall , Marc Zyngier , Peter Maydell , Alexander Graf Subject: [PATCH v2] KVM: Specify byte order for KVM_EXIT_MMIO Date: Fri, 24 Jan 2014 15:39:42 -0800 Message-Id: <1390606782-14724-1-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.5.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.41 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: , The KVM API documentation is not clear about the semantics of the data field on the mmio struct on the kvm_run struct. This has become problematic when supporting ARM guests on big-endian host systems with guests of both endianness types, because it is unclear how the data should be exported to user space. This should not break with existing implementations as all supported existing implementations of known user space applications (QEMU and kvmtools for virtio) only support default endianness of the architectures on the host side. Cc: Marc Zyngier Cc: Peter Maydell Cc: Alexander Graf Signed-off-by: Christoffer Dall --- Changes [v1 - v2]: - s/host kernel should/host user space should/ Documentation/virtual/kvm/api.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 366bf4b..6dbd68c 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2565,6 +2565,11 @@ executed a memory-mapped I/O instruction which could not be satisfied by kvm. The 'data' member contains the written data if 'is_write' is true, and should be filled by application code otherwise. +The 'data' member byte order is host kernel native endianness, regardless of +the endianness of the guest, and represents the the value as it would go on the +bus in real hardware. The host user space should always be able to do: + val = *(( *)mmio.data). + NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_DCR, KVM_EXIT_PAPR and KVM_EXIT_EPR the corresponding operations are complete (and guest state is consistent) only after userspace