From patchwork Tue Aug 2 09:49:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 594851 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp4201411maz; Tue, 2 Aug 2022 03:03:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1suHz+JZiCz4AuWRa2rXEMl6/wvUYF7ROQOTk4rzZNCXhDACRgelr1IeEm3Vc/MOc3byw0O X-Received: by 2002:a37:ad12:0:b0:6b8:62a6:c876 with SMTP id f18-20020a37ad12000000b006b862a6c876mr13817038qkm.718.1659434581979; Tue, 02 Aug 2022 03:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659434581; cv=none; d=google.com; s=arc-20160816; b=IB78y0trnNepND5XK3KsLzyDefWto8ykL374mu5JGUiFmiPsh/6BxHFhrRnThlz5Xw H10NzcIM1RDGqaNnkLEK8/P4bz148sXN5ZGRH266z1hIe426avjZ7qaNX8SdDP3TRYhV KXqIl4J/iphAkIjxR4j2ewW89H5X485vL1RtBfmCZHdOH1PFyPqqUd9cG3loZEqdyWEa Dzn0ONlhvpiiRaYO5CNVXsOXlWgGzR1VdPx1CU6x8Nq1lZTLbJRin9AxtDi1EONLKVgq y2cSM7iya89qsubDOKbTOWCenKVCmcjxAMuOp8CVIakfK4rKhEq1riq1E2LXDMFTpVMj 8pGQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FCj/56VzmS3/60OSoLTpgej5xNapP0emctIC1iwkYIU=; b=eQk40QroxszPKTDIQCFY80Spn+f3dIl637Qlc81+0/paA4RK4rzHoJ7AVaJW0eutaI gzN9wZbK9ML20km0kMuyNgZ8hiXL3bMjye2xEX9L6Dj8tOkonpXdARpsUI0mVnaQgW3N OuujAnQPudJdnKNgHT1qOQWMfToqHmGsXz3wyT9t7ARCoHzgOdAzxIPOTxGIcSvCmzjR HH3TxORFcC13AGznX54rhZkMESTrA7b4B5lGiVMKbPciMvb+ZKTOXc3uTBABu16rfYgG 7jKn9gk1fJHmZzen9Sh1Gh4xoRbEN30SAvwr94S6zKwC6NCyNHa/c2nfzt5BURmhQEab OCqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bFxJ3qwO; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e15-20020a0562141d0f00b0047355815894si9017103qvd.229.2022.08.02.03.03.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Aug 2022 03:03:01 -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=@linaro.org header.s=google header.b=bFxJ3qwO; 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=linaro.org Received: from localhost ([::1]:42220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIojt-0004RH-Gv for patch@linaro.org; Tue, 02 Aug 2022 06:03:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIoXq-0001Rr-2i for qemu-devel@nongnu.org; Tue, 02 Aug 2022 05:50:34 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:34761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIoXn-0002W3-Jw for qemu-devel@nongnu.org; Tue, 02 Aug 2022 05:50:33 -0400 Received: by mail-wr1-x433.google.com with SMTP id j1so8785053wrw.1 for ; Tue, 02 Aug 2022 02:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=FCj/56VzmS3/60OSoLTpgej5xNapP0emctIC1iwkYIU=; b=bFxJ3qwOb707nKyR4nNIQLKNKeQQR1+viFQR0dAVqlfiZY6ZGPAvUXTUppLVzqt1uE M1xsMXqeIEk7gLT8layS+87an46D+Ipx+oA3lgvDSDzixyYyrnw4hokeDA25e8ZpyJni XvU9PhJZR1ZopZpumVLwwD2/fjdskEoZFEoghBeaioEQupisUytFnj6FPtJsx2KV2Lm7 CBOKTlpGGVJd5sbbSGPFQJWbwzZmVxFI6mkmKWw9uUA4ijPPhMk9wKTjyinnzsqEpa0S FnsU5BzbkWUqDV1TJu1PBxUJmVa+dAFzAI9yPqcmLwhqopys2YfsBtjXDLAXa1h3VZSf b/nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=FCj/56VzmS3/60OSoLTpgej5xNapP0emctIC1iwkYIU=; b=Xgy4rCn6Q5KT2aTCjuG6PtxYIX/zp/q0FyO+ARBwkN72qXx0JytzL1ibJXXZnJPJqt jn0o6z2EGKqlwN0kS62I1q3UhkE2KdK8/2lgFpbOpkpv4/lrcxzzx9lNfOI4bC03TfWI +RGl9eZBM+wVBL1ZFuw0aqvLfX1iK8gdmWK6KpTCB6/NyWmf/3QASe+z93pFodHtzve8 7tgn0bK3JouT89XKzUx68m+Lzw2FgqZUNSGjE95l6Vcvb3IFXY3j80Q9GzssiPC70xd4 Jl7hR+zvEUVZlx7BxjWJhj6gkOOFJxpzyNkq+dbEyAw47w/x+P9tF7BktVxp1Hl08FtQ ez3g== X-Gm-Message-State: ACgBeo0lV7+1NNoYk29ye/ZrXpbfo4DdbIJ+i9rqwZOeXJmTZJNRtU5h 65uzRvTfCx4h2ywWPXrt6mG0Uw== X-Received: by 2002:adf:e10a:0:b0:21e:47f4:6a51 with SMTP id t10-20020adfe10a000000b0021e47f46a51mr12948639wrz.276.1659433830316; Tue, 02 Aug 2022 02:50:30 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id j3-20020a5d6043000000b0021efc75914esm14785094wrt.79.2022.08.02.02.50.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 02:50:18 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4FEB01FFC0; Tue, 2 Aug 2022 10:50:11 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Jason Wang Subject: [PATCH v4 08/22] hw/virtio: log potentially buggy guest drivers Date: Tue, 2 Aug 2022 10:49:56 +0100 Message-Id: <20220802095010.3330793-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220802095010.3330793-1-alex.bennee@linaro.org> References: <20220802095010.3330793-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x433.google.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, 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, T_SCC_BODY_TEXT_LINE=-0.01 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" 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 --- 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. */