From patchwork Thu Jan 23 23:46: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: 313773 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 11E8C2C00A2 for ; Fri, 24 Jan 2014 10:46:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751979AbaAWXql (ORCPT ); Thu, 23 Jan 2014 18:46:41 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:43103 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751492AbaAWXqk (ORCPT ); Thu, 23 Jan 2014 18:46:40 -0500 Received: by mail-pa0-f42.google.com with SMTP id kl14so2501724pab.15 for ; Thu, 23 Jan 2014 15:46:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kbR1amgx6eUjKM3MySCzu/doy0U8a8Zt+wbagcIJ8Yg=; b=YbX6U7vJNtktWQ/Oign78iCc9iTuR/fXLi3i/3UjXz/sXS24rdDPCI84hpJR46LJ7W fmSZpYqBgl4uhEAsvswIMqzhMGizA/AnlUQPMSh3WnbJxr0PePvsMejwFHRBWrtBkJc+ B84PQoXxJ15Ahmq2Il6ddVYjtG1mkcu1BTevGPKfha+xDOmr43s41PTMcTYH6DAjEyuK qpG3sbKGFaygzNX5i282m7krysGrrbXxlp8F7p0aekeL+o0OxhuF1dj+k5Nlck4YBQKe ZojvMmLj551S/ykpWRmsxoEAcZmQTds5ooeZfCzHhE1cOYEeJ+IxgKrM13ceLBCpeO1g 7NyQ== X-Gm-Message-State: ALoCoQl8W1iNj6UUyA0WkK7eFErjYSR5kIA83FmjanMJjfnl8ttzU0GdGRVmeIOhuqbKQM83digq X-Received: by 10.66.179.143 with SMTP id dg15mr11089637pac.52.1390520800456; Thu, 23 Jan 2014 15:46:40 -0800 (PST) Received: from localhost.localdomain (mobile-166-137-184-253.mycingular.net. [166.137.184.253]) by mx.google.com with ESMTPSA id os1sm67237961pac.20.2014.01.23.15.46.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 15:46:39 -0800 (PST) From: Christoffer Dall To: kvm@vger.kernel.org Cc: kvmarm@lists.cs.columbia.edu, kvm-ppc@vger.kernel.org, Christoffer Dall , Marc Zyngier , Peter Maydell , Alexander Graf Subject: [RFC PATCH] KVM: Specify byte order for KVM_EXIT_MMIO Date: Thu, 23 Jan 2014 15:46:06 -0800 Message-Id: <1390520766-5275-1-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.5.2 Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org 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 --- 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..fb7c7e4 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 kernel 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