From patchwork Wed Oct 25 17:18:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 737871 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp396953wrq; Wed, 25 Oct 2023 10:19:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6i8VNvVT2KnjRQxl09kqKULloX51UpvdMK3Zck4MefCLOQkPgZMy8N2A06tYcshuEQofM X-Received: by 2002:a05:620a:4496:b0:76d:a27c:245 with SMTP id x22-20020a05620a449600b0076da27c0245mr279838qkp.7.1698254364169; Wed, 25 Oct 2023 10:19:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698254364; cv=none; d=google.com; s=arc-20160816; b=e71/3IvrYm02TfJUdY7EivqjSRH/SftPvLZHWSp5B/UnaL7c1odMayI2dcoopVKM4a sfW7eg919/KnTkencDgvAKxFNyn/otf5FG1wozsk6Z+nDAxIKtkXJuZDPdHOB2UkDBgy 6H0jEnz4mZZ2BNWGWaxiBNvE1VjRqmXuQ6aUj7e8rkRHf9+C7OME4Wpr85fhM2XjFxLP WiyuF9gmGB/A7VM0nMYuQXBPeZV6DMPtH8KW0ND6r7plrjm9YYhuzU5w50fgIDf1eOaL hW1KA+UchUPXNpQRLl0ErKFu8XmJ9DoKFUdea/6EIn1oj/kgbSEYHfALpLvNgLfqzAIm rFmQ== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=oziu0b/58XNG4oLsAK1xwSryTw0y+7AfpE+oCSmUvUQ=; fh=Ge5o5bC3oB2u8TqnOG+KdZkqA43ugHLpFajNU7OS/yQ=; b=ISaAQ1b27CDzvb7kaWjg6iWloIcGJS08ouVtpfuFPNIJyFJvvfq51EFzSwc4Ujz3p2 MdsYBfqneQOC4B5afcadFsZv9eu6BENSTUJeEkfCKzbM0K6k1sAgdFtm446BRcK4TQSs iVvHH23C2Qo3NsPHsFnRm8dFU95/Z5eqgnmaS1vVi2UULjQBNkv1/Dcihs5hp4qcB47u zmoscSXYhtmSY9w50fsmPvG3eMB0EapnXM3EOPSkMatgpzvrSehfPYaVyHtAg+IAzaU1 WOT8fUxPkFhGxdVHe99AgErY570PhJgWBqNPV4oA2MTyzn/dh/1fRsMEoEJrxwAHbAyO Xp6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CvkfKz2J; 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 f7-20020a05620a12e700b00767e5d15d79si8749021qkl.34.2023.10.25.10.19.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 10:19:24 -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=CvkfKz2J; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvhWq-0002Xp-Hv; Wed, 25 Oct 2023 13:18:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvhWo-0002XA-Ih for qemu-devel@nongnu.org; Wed, 25 Oct 2023 13:18:46 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvhWn-0001lZ-00 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 13:18:46 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c9e95aa02dso9083155ad.0 for ; Wed, 25 Oct 2023 10:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698254323; x=1698859123; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oziu0b/58XNG4oLsAK1xwSryTw0y+7AfpE+oCSmUvUQ=; b=CvkfKz2JmOudi8iIuel2vY18aMyshjMTHZCVW0/lV1upiHDYf+mTc+yGYdmC5lY1gi pvxI4Sfcjabfahx8sW1eNrAptmwkqdS8yGmpLLacX3OauVN+py16+8RMJZXgdYNrA9fv v7M79dUZYV531RSZolNFlkFMwpOhT5phA4QH66Lj77qxlCHMudfyR003mBS45RXADFA+ iiSjDRAJl9nvbtuIikrvHfo1lkDTah2X/6kgjQB8+CNHNI1AZ3spppXm9CUdU9mT+MC2 B0NFgaJvgd8MQS0cv29YeMVyCaBh24ct3yHuF93655t/4hGQ39uZUGfqFREc2FUiomPR n4OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698254323; x=1698859123; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oziu0b/58XNG4oLsAK1xwSryTw0y+7AfpE+oCSmUvUQ=; b=ID1ksotGAXsG3s214aTssVHOqwpBukC0DL+4YUjfWXuqEnKrItn+GgZ3yFsWcI2qxL rAXzSajnd2Iw0hcA5ayIL0+79Ec7iciYVNNzMygIiBK/REPv6DuVuxDxY38RusbJQz10 XeJ+h2dmql4S1GMwhTEUMSg9WWiQMN3xnibITjy147v06TiCa2qEKs+FQVIZM2TKzvP5 iR6hqeXeyOTJ6Dh+GLhcPQ8Dh4759Y0mEL8qUxRZZIgQBVXceGKBv3s+boch74/RaGJK 7l1Cbf3gL3FQoROFwp0UPcHh8kfZAuI5T+hAtVNNH/Wl6sUQXf7kaMYnDGHaeuZy1ECe ewpA== X-Gm-Message-State: AOJu0Yzj+rXTdWT3HUHJyKGytdUCxZE/107SA/cDynOkRXQun/AW+xcK z0gSnAOJyEHQLgS/x2K9JqgmWQ== X-Received: by 2002:a17:903:2306:b0:1b8:a67f:1c15 with SMTP id d6-20020a170903230600b001b8a67f1c15mr356982plh.25.1698254322668; Wed, 25 Oct 2023 10:18:42 -0700 (PDT) Received: from p14s.cg.shawcable.net ([2604:3d09:148c:c800:60a2:aa5c:7b32:6823]) by smtp.gmail.com with ESMTPSA id y2-20020a17090264c200b001c5fa48b9a0sm9736901pli.33.2023.10.25.10.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 10:18:42 -0700 (PDT) From: Mathieu Poirier To: mst@redhat.com Cc: viresh.kumar@linaro.org, lulu@redhat.com, qemu-devel@nongnu.org Subject: [PATCH] virtio: rng: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX Date: Wed, 25 Oct 2023 11:18:41 -0600 Message-Id: <20231025171841.3379663-1-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=mathieu.poirier@linaro.org; helo=mail-pl1-x629.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 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-bounces+patch=linaro.org@nongnu.org Since the driver doesn't support interrupts, we must return early when index is set to VIRTIO_CONFIG_IRQ_IDX. Basically the same thing Viresh did for "91208dd297f2 virtio: i2c: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX". Fixes: 544f0278afca ("virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX") Signed-off-by: Mathieu Poirier Tested-by: Leo Yan Reviewed-by: Philippe Mathieu-Daudé --- hw/virtio/vhost-user-rng.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c index 201a39e220c5..62142b717f73 100644 --- a/hw/virtio/vhost-user-rng.c +++ b/hw/virtio/vhost-user-rng.c @@ -129,6 +129,14 @@ static void vu_rng_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask) { VHostUserRNG *rng = VHOST_USER_RNG(vdev); + /* + * We don't support interrupts, return early if index is set to + * VIRTIO_CONFIG_IRQ_IDX. + */ + if (idx == VIRTIO_CONFIG_IRQ_IDX) { + return; + } + vhost_virtqueue_mask(&rng->vhost_dev, vdev, idx, mask); } @@ -136,6 +144,14 @@ static bool vu_rng_guest_notifier_pending(VirtIODevice *vdev, int idx) { VHostUserRNG *rng = VHOST_USER_RNG(vdev); + /* + * We don't support interrupts, return early if index is set to + * VIRTIO_CONFIG_IRQ_IDX. + */ + if (idx == VIRTIO_CONFIG_IRQ_IDX) { + return false; + } + return vhost_virtqueue_pending(&rng->vhost_dev, idx); }