Received: by 10.223.176.5 with SMTP id f5csp213181wra; Tue, 6 Feb 2018 20:49:34 -0800 (PST) X-Google-Smtp-Source: AH8x226mvSMIO+rHXNbmhA/+0jBg9x8IvwIUKTnXlba575ckZ8QSi8v8ZuCphXC40SPOk4XJuBGJ X-Received: by 10.99.151.2 with SMTP id n2mr3689232pge.87.1517978974428; Tue, 06 Feb 2018 20:49:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517978974; cv=none; d=google.com; s=arc-20160816; b=LXW508wMvarfU81+Hqe+vjnyADrkf+hTeTYmidYbPimRJ0RewD+lUCjHT9OBBRg/+J Rg7B2o7N6+YSfAc9Ma+VmHAt2LyfwmxDR9Mp3SMqPZ4ulh6jiOxCXSigF9iM7GJlhdPC DHdvTKPPvO1rvuv5rwp+AwuL/vi1XBaP+x7qKkIJM71MvmrkvF4Iv20TwpQ4DWA+vXuD EUrusEBV8dDJKvfp3lVyI/Cf8h47KV4Hcv/grkKxg53imwbDvbhfCytk07LiHNJniDdy aUp8JxO8AQuzsPjKIUy9ZjIF5xbZhFbPdZqfaPqHbTprj8wq9/bCAZAPpenFA5oeXAe+ 3CHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=ge2q2VCjgGX2PTWCHdBoPUQPKxMZADhLIP2Z4mp6M1c=; b=LGdYbdF+tuFwXkosKXH+qnIkrDiZZn+8yWuFYdVcSH4tRemv8c3cQcncOI8+Mhqw3v NNIoUJpyxKfpzfbu/vERQWrssYM+7ZMSmsh+GRC/3EmrEGdsrwfKQVigTuUCT/LPPooO 1su6VoC4dQ3RFNgWPmzBPXC+14IP8Ayev5mFpZ9idDYhXUQ1Ym5UH4wz8Nz7QbgIzINA FnqhkjW6FNEYw+f3+N5Fw7S2yinuIcNlnhKPGwZlV7ppRykL1rZ9WuHVIO0HystsLqRK TlkeJK7AD6xC3nD8O3E8GldPh5QiJ6+xh48lgoAhslim08GO8VbU3XMtAuhZ3UFlxcCD /gPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ozlabs-ru.20150623.gappssmtp.com header.s=20150623 header.b=UEy5BDg2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8si426994pgn.769.2018.02.06.20.49.20; Tue, 06 Feb 2018 20:49:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ozlabs-ru.20150623.gappssmtp.com header.s=20150623 header.b=UEy5BDg2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753390AbeBGEse (ORCPT + 99 others); Tue, 6 Feb 2018 23:48:34 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:46471 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752848AbeBGEsc (ORCPT ); Tue, 6 Feb 2018 23:48:32 -0500 Received: by mail-pf0-f193.google.com with SMTP id z79so1669430pff.13 for ; Tue, 06 Feb 2018 20:48:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ozlabs-ru.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ge2q2VCjgGX2PTWCHdBoPUQPKxMZADhLIP2Z4mp6M1c=; b=UEy5BDg2HFcKevCTGfqIVpB0huKpLCffNQ4cCqkQVId+l1+bp7yx2eA6xMEc4GzDss eo5GB1DXCkYXokvDv2EBs9R2pGia6b+63l3taB/Ljz4AN3jTGSALyXo2fWB8dThep5rp fup9JSvR9d1AKg+IeO0vvndVq0/HYj275/nxDDkC0pBacy7BmYmg0Uy8z9u+NtVXhUje pDVP1fbV+g8RrpGqbQK8YPlAwMlICmxKJQnTCusja9CODuvQYIb0FsOCNPqlJ0EptO7f eLlix9iNnq3zumBifTh/WfpxjcTIdwBOj7o4LhwHLVAaumt9SuPCGwJRfBtg+0aPf6W0 D04A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ge2q2VCjgGX2PTWCHdBoPUQPKxMZADhLIP2Z4mp6M1c=; b=p/wFE1W1sc5JH5Q/bRZNlh+h/keNtcvQx9t3l2ojlUn1yWLeFUl6iIILfTct9L6fcl B05mGSdpyzOiJHlWIKuzezoUEv4wJqD09bWew2FpkAwIYUyJcyiwJsMj2b3z1u485d97 av/eOWx1BGOI3cgKQxh/NTlnm2Vz/QsRzEUgkb1WNPEWiuyoPotsPKpUQze/b8N9eJqv gqffVlsbohPWKycFajFdwq1KLfHJfrQ/glaLx8FLYNUZEyGcLIg/mht/lo96Ghyjg0E2 ZoK6C5fu/8dk+5I2k7zrZecDOFQzPDapgi/U3/wjH7i/T4SjsPdzi+j7/xJakn+ln7Cu oZUw== X-Gm-Message-State: APf1xPCOpEYT67XC4BtRtmwlhi43rgeLQzBbDrh1ST0YB/oc1IWFCf9P ahb2miY0hWXXB7aRvyoiMzOKgA== X-Received: by 10.101.101.143 with SMTP id u15mr2005276pgv.265.1517978912128; Tue, 06 Feb 2018 20:48:32 -0800 (PST) Received: from [10.61.2.175] ([122.99.82.10]) by smtp.googlemail.com with ESMTPSA id g2sm979478pgq.43.2018.02.06.20.48.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Feb 2018 20:48:31 -0800 (PST) Subject: Re: [RFC PATCH] vfio/pci: Add ioeventfd support To: Alex Williamson Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org References: <20180207000731.32764.95992.stgit@gimli.home> <20180206212538.50ef0e13@w520.home> From: Alexey Kardashevskiy Message-ID: <6014d60c-9bdb-4dc0-7cd7-9299005d9c5a@ozlabs.ru> Date: Wed, 7 Feb 2018 15:48:26 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180206212538.50ef0e13@w520.home> Content-Type: text/plain; charset=utf-8 Content-Language: en-AU Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/02/18 15:25, Alex Williamson wrote: > On Wed, 7 Feb 2018 15:09:22 +1100 > Alexey Kardashevskiy wrote: >> On 07/02/18 11:08, Alex Williamson wrote: >>> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h >>> index e3301dbd27d4..07966a5f0832 100644 >>> --- a/include/uapi/linux/vfio.h >>> +++ b/include/uapi/linux/vfio.h >>> @@ -503,6 +503,30 @@ struct vfio_pci_hot_reset { >>> >>> #define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13) >>> >>> +/** >>> + * VFIO_DEVICE_IOEVENTFD - _IOW(VFIO_TYPE, VFIO_BASE + 14, >>> + * struct vfio_device_ioeventfd) >>> + * >>> + * Perform a write to the device at the specified device fd offset, with >>> + * the specified data and width when the provided eventfd is triggered. >>> + * >>> + * Return: 0 on success, -errno on failure. >>> + */ >>> +struct vfio_device_ioeventfd { >>> + __u32 argsz; >>> + __u32 flags; >>> +#define VFIO_DEVICE_IOEVENTFD_8 (1 << 0) /* 1-byte write */ >>> +#define VFIO_DEVICE_IOEVENTFD_16 (1 << 1) /* 2-byte write */ >>> +#define VFIO_DEVICE_IOEVENTFD_32 (1 << 2) /* 4-byte write */ >>> +#define VFIO_DEVICE_IOEVENTFD_64 (1 << 3) /* 8-byte write */ >>> +#define VFIO_DEVICE_IOEVENTFD_SIZE_MASK (0xf) >>> + __u64 offset; /* device fd offset of write */ >>> + __u64 data; /* data to be written */ >>> + __s32 fd; /* -1 for de-assignment */ >>> +}; >>> + >>> +#define VFIO_DEVICE_IOEVENTFD _IO(VFIO_TYPE, VFIO_BASE + 14) >> >> >> Is this a first ioctl with endianness fixed to little-endian? I'd suggest >> to comment on that as things like vfio_info_cap_header do use the host >> endianness. > > Look at our current read and write interface, we call leXX_to_cpu > before calling iowriteXX there and I think a user would logically > expect to use the same data format here as they would there. If the data is "char data[8]" (i.e. bytestream), then it can be expected to be device/bus endian (i.e. PCI == little endian), but if it is u64 - then I am not so sure really, and this made me look around. It could be "__le64 data" too. > Also note > that iowriteXX does a cpu_to_leXX, so are we really defining the > interface as little-endian or are we just trying to make ourselves > endian neutral and counter that implicit conversion? Thanks, Defining it LE is fine, I just find it a bit confusing when vfio_info_cap_header is host endian but vfio_device_ioeventfd is not. -- Alexey