Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2346752pxa; Mon, 3 Aug 2020 13:59:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFVslvOD4gH6qGinOQwilekcoXBnQGavwYmVpy+qwMIDodBBHAZbYtbnkod6DzYloScJBR X-Received: by 2002:a05:6402:60e:: with SMTP id n14mr17541901edv.29.1596488356474; Mon, 03 Aug 2020 13:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596488356; cv=none; d=google.com; s=arc-20160816; b=IXajMQCSKwSyAy0hxdwxpxZ1Xhm8gtIE8gmSXGs9Q3LgHdQJErSU7vDDr0Xllb9ZZo VXPSdefR3wwxjdiAZH5r9DygZQ/ALbRHq9Bjw+v2avIf73Wul8MdV71V4MkMexwzRH5B OxPCV6073cu77W7W+qje1ez82FReh6aa60E3t0AVMle6RaKV9Bz1wOmSfX/FZQVKaf4+ IB0NnTa1wyV1qkTURHIzJxtjiXDpfV+6VUh5uJm0kM7qBeNTkVNWzs46+xs900pXr7la 6It3sCvjK8yeisoN2FDVXgHGULLe3V8SIl6MNq6laTbuxEQbQlivDBg5TadXwF/1v7oI Fptg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=T01zlXdVAdfOQiZawGmFzoRF7DScTQR3FGD2nDiB9KQ=; b=dqmH3NtOZKIS0zYkm3XkWeVU3pODF01B0DV9bzLVktFRnpHPqjCxVGg1snUwt0Bxwm Dq3r7elEZj4W90Znl6kH1e3L2Q5BxmRpA3P3PzPk5SvdEkHvAXpSBP2Oc1Q+jafDkIob SB8O5qNTCQDi576hZIXUeiy3RgBIIRe0pJx0yVILaKZghflaHP9CUh8tEYt1FgZ3hBQv tDULpfVyVfvao8Yko7VCACzmmCE9dlrORQp/BfhJGneez+CXEw+NEHjUV0mHHG9fypo6 4U+osZpJuMEsREDCb3pyHSCK69OyjYpJ2QlIDzNVbb00W3Ra46AwabEqZ40vjyvV0OUt oueg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="N/FM95nk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si11111948edq.412.2020.08.03.13.58.54; Mon, 03 Aug 2020 13:59:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="N/FM95nk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728743AbgHCU6m (ORCPT + 99 others); Mon, 3 Aug 2020 16:58:42 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:45635 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727003AbgHCU6m (ORCPT ); Mon, 3 Aug 2020 16:58:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596488320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=T01zlXdVAdfOQiZawGmFzoRF7DScTQR3FGD2nDiB9KQ=; b=N/FM95nkk3DJdnNZWc0KJfGqAQCFVu5EHFW99jX7Ua7BwRANiJ01qXO9mRhV/h0Ovqq+ud p9w+7dWxhLMT8a7vhH4/79dggf4it5j7XxWbSj8QxLBlNn3YzhnrwLIRdvEoKbzxOSNq+x dTK5NCnGNgSlpE1tl1HatJp5xzWuKY0= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-hLOep-ZNN6SJnvKVeqA9aw-1; Mon, 03 Aug 2020 16:58:38 -0400 X-MC-Unique: hLOep-ZNN6SJnvKVeqA9aw-1 Received: by mail-qv1-f70.google.com with SMTP id v18so21747620qvi.8 for ; Mon, 03 Aug 2020 13:58:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=T01zlXdVAdfOQiZawGmFzoRF7DScTQR3FGD2nDiB9KQ=; b=B70NgZ6bhKwpYkypRk/oJoc/FesDTzgiJh/wHboXpb7YekTfgZ2zJPNX1ZbZ75sIb+ G1rNs9lbkzFGs0G96g2zla9kflP2kQM/uciR2Nn1RYmGe7Gl1TYZdB5URqFZPsLgRQjA x8pnlzor7gSPVtelDLMsNFWfLWILgJVGg4NYKbIlXxZ3ocM8pUYTPDmaptoMmEoPQ4Do 0WPfoF21AyOrJaJBzKom0EiHEM3whaDluF3UwPduUVdh1niI8FFGqFH/8GdoBhKsDp9/ 3TXkUEfmULbVhoPvHnr7pqEncBXdpCbCc57bNm1AF8c1331/YaH6E2DiA2Q42S+rgFx0 35OQ== X-Gm-Message-State: AOAM532f3IRmm6UMyVZRk/5/89Qhp6G62Wx0wVO7n1P3tSA16B9XjHex CfuZI9YdIkQCi3x9wbhJC7q1Q92s+1a8VCBh2y/18BBsdMXEKs4NL3ElKTeCZSNL2eBahRXFe5f Y5Fo2f01rTN04poYLpZWciseT X-Received: by 2002:ac8:7c97:: with SMTP id y23mr18342396qtv.273.1596488317551; Mon, 03 Aug 2020 13:58:37 -0700 (PDT) X-Received: by 2002:ac8:7c97:: with SMTP id y23mr18342383qtv.273.1596488317312; Mon, 03 Aug 2020 13:58:37 -0700 (PDT) Received: from redhat.com (bzq-79-177-102-128.red.bezeqint.net. [79.177.102.128]) by smtp.gmail.com with ESMTPSA id g4sm21056476qtp.89.2020.08.03.13.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 13:58:36 -0700 (PDT) Date: Mon, 3 Aug 2020 16:58:33 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: virtualization@lists.linux-foundation.org, Jason Wang Subject: [PATCH v2 00/24] virtio: config space endian-ness cleanup Message-ID: <20200803205814.540410-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Config space endian-ness is currently a mess: fields are not tagged with the correct endian-ness so it's easy to make mistakes like instanciating config space in native endian-ness. The following patches adding sparse tagging are currently in my tree. Lightly tested. As a follow-up, I plan to add new APIs that handle modern config space in a more efficient way (bypassing the version check). That is still TBD. I also start with a version using gcc extensions, then switch to _Generic. This is helpful for backports to older kernels/older distros: _Generic patch can just be skipped. Michael S. Tsirkin (24): virtio_balloon: fix sparse warning virtio_ring: sparse warning fixup virtio: allow __virtioXX, __leXX in config space virtio_9p: correct tags for config space fields virtio_balloon: correct tags for config space fields virtio_blk: correct tags for config space fields virtio_console: correct tags for config space fields virtio_crypto: correct tags for config space fields virtio_fs: correct tags for config space fields virtio_gpu: correct tags for config space fields virtio_input: correct tags for config space fields virtio_iommu: correct tags for config space fields virtio_mem: correct tags for config space fields virtio_net: correct tags for config space fields virtio_pmem: correct tags for config space fields virtio_scsi: correct tags for config space fields virtio_config: disallow native type fields mlxbf-tmfifo: sparse tags for config access vdpa: make sure set_features in invoked for legacy vhost/vdpa: switch to new helpers virtio_vdpa: legacy features handling vdpa_sim: fix endian-ness of config space virtio_config: cread/write cleanup virtio_config: rewrite using _Generic drivers/platform/mellanox/mlxbf-tmfifo.c | 13 +- drivers/scsi/virtio_scsi.c | 4 +- drivers/vdpa/vdpa.c | 1 + drivers/vdpa/vdpa_sim/vdpa_sim.c | 31 ++++- drivers/vhost/vdpa.c | 8 +- drivers/virtio/virtio_balloon.c | 2 +- drivers/virtio/virtio_vdpa.c | 9 +- include/linux/vdpa.h | 34 +++++ include/linux/virtio_config.h | 159 ++++++++++++++--------- include/linux/virtio_ring.h | 19 ++- include/uapi/linux/virtio_9p.h | 4 +- include/uapi/linux/virtio_balloon.h | 10 +- include/uapi/linux/virtio_blk.h | 26 ++-- include/uapi/linux/virtio_console.h | 8 +- include/uapi/linux/virtio_crypto.h | 26 ++-- include/uapi/linux/virtio_fs.h | 2 +- include/uapi/linux/virtio_gpu.h | 8 +- include/uapi/linux/virtio_input.h | 18 +-- include/uapi/linux/virtio_iommu.h | 12 +- include/uapi/linux/virtio_mem.h | 14 +- include/uapi/linux/virtio_net.h | 8 +- include/uapi/linux/virtio_pmem.h | 4 +- include/uapi/linux/virtio_scsi.h | 20 +-- 23 files changed, 270 insertions(+), 170 deletions(-) -- MST