From patchwork Mon Oct 10 17:28:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 613765 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2124852pvb; Mon, 10 Oct 2022 10:48:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NBT1ZFzjph2PGtiPLoCKRCHvy+dcqNa390tPjB3R9l4UT3BVxwiyUH0c2STJL8or6mNur X-Received: by 2002:a05:6214:27ce:b0:4b1:92c9:611c with SMTP id ge14-20020a05621427ce00b004b192c9611cmr15707417qvb.115.1665424132584; Mon, 10 Oct 2022 10:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665424132; cv=none; d=google.com; s=arc-20160816; b=TEy8Q8zjrUUZ2NwpRE2Ev3Z0fF0jz9klDkNraNHEOS0ZgqB2ph3JU9RVRvLnhx1AMI 6PhT6NDrjdRCLK286kp5p/DsukB8mHTAtR2ffiLT2ANETpw5k72FsZfJpdMKLM0AsKoQ UTS+hKwfQgCyTYdXVj7ta2kCvUo/KgKTMD/+U6uow10wkGvpvYSPcT4QJIclCA3QzIw9 44hMSBMxaooUhCBn7twm9kxOR9E5QqsQz6ji04h1tX/7xUVDih3xN+6F1iUnXIdesW89 6iFlY2hBQuBnebFFqdmEJ9Bl+MnFXq3H2a5TeKQ6vAWLyk0LTmnCHzPNz2qt18O1v17H BQ7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nvGXlozHC+df8Bjp/q5u04uDCnJ0h7GQtmXnBTatQbk=; b=cekT2xIsfOaa+csG1V8nm3PhJq7TLuYUnVI2WNFYTYQD/49GJk8YAx1FClrbkSQ85e 8OZMehAhRG5gHGufL4SbDvErbK0JCFKCT8oDXh7c/e+r26UCodO+LOg3Z8B2b097XI5o RKoHMDvzzwi/UyyG3RIEBId/i3FtqN8LSCNgLkRzz1sPOmZByMTTDx3XBTcWE0cn6zYa gKSmFciFUT4Z0u5x94ZmzaDDzKKaQoNSr+TPmbqWxfAt7B8y4eHlKEwNYgBw5u7OpaC2 Hur6qFAKEVDAyf1NUKXtK6uXc3Nqk8k9Yfn92szDwMN1Y3aft13T2HhiGxQVM6PN8wGN T8gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YDGNasLZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a9-20020ac80009000000b0035ba1e5d423si4797781qtg.627.2022.10.10.10.48.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Oct 2022 10:48:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YDGNasLZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:50378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohwtY-0005X6-3R for patch@linaro.org; Mon, 10 Oct 2022 13:48:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohwaT-0008CO-Eb for qemu-devel@nongnu.org; Mon, 10 Oct 2022 13:29:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohwaP-0006SB-AE for qemu-devel@nongnu.org; Mon, 10 Oct 2022 13:29:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665422944; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nvGXlozHC+df8Bjp/q5u04uDCnJ0h7GQtmXnBTatQbk=; b=YDGNasLZjUH9sRfUCqUmv19Q4HdV6p/JJauseK6kW2FbRb6MdexVKMB/shYLgwwlfAWgKx a/xVTOkCvxOMcaBLHX9zI0bQvNZ7K2giz7gYGlZaGbt6YMFY/xuR/RV1KcufKO4x8v26u3 Md0YYKWd1qsDDIA7FG0GYixVCeO0ofw= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-408-YvHTMqN6M6uINC-rPaBPAA-1; Mon, 10 Oct 2022 13:29:03 -0400 X-MC-Unique: YvHTMqN6M6uINC-rPaBPAA-1 Received: by mail-wr1-f70.google.com with SMTP id u20-20020adfc654000000b0022cc05e9119so2950737wrg.16 for ; Mon, 10 Oct 2022 10:29:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nvGXlozHC+df8Bjp/q5u04uDCnJ0h7GQtmXnBTatQbk=; b=4zQQY6SEWKgB2Nkf1tDLSnqOSmu0LfAQlbKJ+RxEC5egKetR/u7CjjCODNsk/5mh+J Wzuvz9MlDgETrC2SWYVsigv3jP5StD9IBsuDrONJMMdxlNUEVcQaPjNxFVYsQkFWXjOj lD8IQK78ZoxtvxHHgZUfGXvVKut5TJb9yVBjWju2DadpM/sizn3uEzB2T5WogwvgAOya jXaQUY1Dei15RsOFgMBmFYfhsuZULCrnXHJLQQwnqItfSQzSguVsi6R/++qcP3Z8I4L7 14Iv7Xjl39EBbNKBz8o6L9DA65xHNRIX4GoQ/P/TvKYPTc7GNqpJQYsqYD06GCVnSm61 PlLA== X-Gm-Message-State: ACrzQf0IENGjv19yLH7XKve0NVZ83GhIlksZ0pWxN2RTJQpAO4ycfoq0 AjH8NIIei8xnazTEJydz5hJXt83rQ/w0slV9VOXi1xklrDE6F1uMjvaXki4bBxt5AAlKXK+oJ4T p280Sau/aizjBzMrGlfsCUc/LdgIrqtGfOR+w6I8U09VuBwGPr76EbaxVi0EG X-Received: by 2002:a05:6000:1885:b0:22e:7851:b257 with SMTP id a5-20020a056000188500b0022e7851b257mr12127296wri.418.1665422942159; Mon, 10 Oct 2022 10:29:02 -0700 (PDT) X-Received: by 2002:a05:6000:1885:b0:22e:7851:b257 with SMTP id a5-20020a056000188500b0022e7851b257mr12127279wri.418.1665422941861; Mon, 10 Oct 2022 10:29:01 -0700 (PDT) Received: from redhat.com ([2.55.183.131]) by smtp.gmail.com with ESMTPSA id u9-20020a5d4349000000b0022cdb687bf9sm12062396wrr.0.2022.10.10.10.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 10:29:01 -0700 (PDT) Date: Mon, 10 Oct 2022 13:28:57 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= , Jason Wang Subject: [PULL 05/55] hw/virtio: log potentially buggy guest drivers Message-ID: <20221010172813.204597-6-mst@redhat.com> References: <20221010172813.204597-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221010172813.204597-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée If the guest driver attempts to use the UNUSED(30) bit it is potentially buggy as 6.3 Legacy Interface: Reserved Feature Bits states it "SHOULD NOT be negotiated". For now just log this guest error. Signed-off-by: Alex Bennée Acked-by: Jason Wang Message-Id: <20220802095010.3330793-9-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 5d607aeaa0..97a6307c0f 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2980,6 +2980,13 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val) if (vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) { return -EINVAL; } + + if (val & (1ull << VIRTIO_F_BAD_FEATURE)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: guest driver for %s has enabled UNUSED(30) feature bit!\n", + __func__, vdev->name); + } + ret = virtio_set_features_nocheck(vdev, val); if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { /* VIRTIO_RING_F_EVENT_IDX changes the size of the caches. */