Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3765355ybb; Mon, 6 Apr 2020 15:27:46 -0700 (PDT) X-Google-Smtp-Source: APiQypLUDIm0fIiMym8cd20bK5vy0+gca5yaQlivTClnppEsulVU1xCPSNr1N7d+LTGh7hpf6wdK X-Received: by 2002:aca:3dd7:: with SMTP id k206mr1249672oia.87.1586212066121; Mon, 06 Apr 2020 15:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586212066; cv=none; d=google.com; s=arc-20160816; b=T0LlUWsuXsDBxusV3aXzxiFfaNAyzqPunVvWUBXhBgSphJ5Lt0gJkry5PYzeMOBv1c Gw5a6ewUBbtpdkdetW6odt7gBaooHicLV4nSnIA9F4tkhV1ar7d7lEHjv2CijprYzAIs wUM8gwROkGw2khq6zNSigFB6FX79MGZJqNXEOoTn0/ktNiKoVg0tuUw2a54VNFjaBF9g sYrDtTKF7kT03gf3Xp0PW5sjy9yCi+Su+F30saG/NxXg8r7LmOHBI1uUAubxjjPFPgsI ftpc6Gco4nsm2ev+Sbzy1T0svPZhkIT1Qb0rjbEggOXSFndbEMhdcGWLY4XgEMJnhMOA s34g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=qWI++drUheRLgJRLP25chFJvpGmbc+MWUzzhPso8aKg=; b=B3t3ZJO5iFNcb3a9z8AbcucZf1Yu7wJun3+9dz+yfV/VSMLYbpLUBM/HLBrvp8jP2D 2Gb0cp+yVLVlir+/+l28qZon1eVuHY9d9wqCNd1c+jEYhEaPhwVjO3l1ofYA8N3cVQlq i1SoNI9mDIYt/fc6bDENv/3EgpvSlwNJNsahFjxVeG5sjSrZmMZfTCXfwsu43TDnarK3 1g8GcijVYKXPIZfwDdagrJ2miXDDdEp2Lx1UbzEKjXajbzaSYzZCmCXdXjhMEqyMWc91 VgzEKeqYr6+cJRmRLcSH/kmoMAv0bPMTsLd3bxUcfPOF+erX9b+w3AS/k6xHje8xhDya YaMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z4VIHn8t; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e193si7309194oib.276.2020.04.06.15.27.34; Mon, 06 Apr 2020 15:27:46 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=Z4VIHn8t; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726513AbgDFW0s (ORCPT + 99 others); Mon, 6 Apr 2020 18:26:48 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:33862 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726477AbgDFW0q (ORCPT ); Mon, 6 Apr 2020 18:26:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586212005; 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: in-reply-to:in-reply-to:references:references; bh=qWI++drUheRLgJRLP25chFJvpGmbc+MWUzzhPso8aKg=; b=Z4VIHn8tCLGJ2XVkPFFmOY5ktk2t9BBHzw6QN0WKQXnlDx+Ytam344d7zxwL39w8DT4f/S cF73FA4VRnplLvE6f2Xy+ebqANjGAcO2MRxf8i+Y5gMoi8aHOiWFP0c3xzugulNlBc6HR0 Rthng8fEdv+vxpmwGnvDAvaYxB4BYIw= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-441-yGl7crbFOniGuGorniovxw-1; Mon, 06 Apr 2020 18:26:39 -0400 X-MC-Unique: yGl7crbFOniGuGorniovxw-1 Received: by mail-wr1-f70.google.com with SMTP id k11so639014wrm.19 for ; Mon, 06 Apr 2020 15:26:39 -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:references :mime-version:content-disposition:in-reply-to; bh=qWI++drUheRLgJRLP25chFJvpGmbc+MWUzzhPso8aKg=; b=eRGkNIuJgK5KtsnR0nd+vw3sNGlyDCNxrGVrQYheBWDgRmoSnn8q54Q4EqV1Q2p550 D/QtLCat2Q5TPRrXBwOSVgKMNOjiPEJyY54RO2NrknH26/sXnleSj6le2KKFvAKh1xmK 6qs4JpGu1IlrYFejtafVNq9cnC0+G/ufpPbZlXfHl9lYCRCAkLRdfcAWoqyGe3+4/jN3 v5bubwOQY6BJEXBg+cxIYPEcf/ni7XnS8mEF9Fq1e0ExdKZWZOu/NbBqJAYEh9w9OiF3 AKzo2c42Clctsp+3SsTKYfvC+ayN95z9aIfdQx6h5N2lttcWKBkYVdwg2NahFX9XvXdT NB9g== X-Gm-Message-State: AGi0PuZQuT8zEE9jbC7ea51ItvPXiP1gwV0eUgYpndD+fMkwp/rlCzfC 2EHRB0B+ti4slb8yFtVVUuK3MhfLXOWK0ObFJd+z0ej6iqe8VS9/r6wr7Zbmv4Y+G7FHh1ITgYz f0O92TIxooyhl6n4KW+TCjJ8S X-Received: by 2002:a5d:6204:: with SMTP id y4mr1590912wru.410.1586211998045; Mon, 06 Apr 2020 15:26:38 -0700 (PDT) X-Received: by 2002:a5d:6204:: with SMTP id y4mr1590896wru.410.1586211997853; Mon, 06 Apr 2020 15:26:37 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id f3sm1304116wmj.24.2020.04.06.15.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 15:26:37 -0700 (PDT) Date: Mon, 6 Apr 2020 18:26:36 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: Matej Genci , Jason Wang , virtualization@lists.linux-foundation.org Subject: [PATCH v6 04/12] virtio: add VIRTIO_RING_NO_LEGACY Message-ID: <20200406222507.281867-5-mst@redhat.com> References: <20200406222507.281867-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200406222507.281867-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matej Genci Add macro to disable legacy vring functions. Signed-off-by: Matej Genci Link: https://lore.kernel.org/r/20190911124942.243713-1-matej.genci@nutanix.com Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci_modern.c | 1 + include/uapi/linux/virtio_ring.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index 7abcc50838b8..db93cedd262f 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -16,6 +16,7 @@ #include #define VIRTIO_PCI_NO_LEGACY +#define VIRTIO_RING_NO_LEGACY #include "virtio_pci_common.h" /* diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h index 559f42e73315..9223c3a5c46a 100644 --- a/include/uapi/linux/virtio_ring.h +++ b/include/uapi/linux/virtio_ring.h @@ -135,6 +135,8 @@ struct vring { #define VRING_USED_ALIGN_SIZE 4 #define VRING_DESC_ALIGN_SIZE 16 +#ifndef VIRTIO_RING_NO_LEGACY + /* The standard layout for the ring is a continuous chunk of memory which looks * like this. We assume num is a power of 2. * @@ -181,6 +183,8 @@ static inline unsigned vring_size(unsigned int num, unsigned long align) + sizeof(__virtio16) * 3 + sizeof(struct vring_used_elem) * num; } +#endif /* VIRTIO_RING_NO_LEGACY */ + /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ /* Assuming a given event_idx value from the other side, if * we have just incremented index from old to new_idx, -- MST