From patchwork Mon Apr 17 06:02:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1769447 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=E0d7av+M; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q0Ggy4nZMz1yb4 for ; Mon, 17 Apr 2023 16:03:25 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1poHwY-0007uQ-0M; Mon, 17 Apr 2023 02:02:26 -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 1poHwV-0007tp-TH for qemu-devel@nongnu.org; Mon, 17 Apr 2023 02:02:23 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1poHwQ-00043W-Ny for qemu-devel@nongnu.org; Mon, 17 Apr 2023 02:02:23 -0400 Received: by mail-pj1-x1030.google.com with SMTP id z11-20020a17090abd8b00b0024721c47ceaso11098083pjr.3 for ; Sun, 16 Apr 2023 23:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681711332; x=1684303332; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=syA8DPA0vYxtc4caZ7sv7vitLcN6zFkYLX0pkX40gIk=; b=E0d7av+MZOt/I7sZCAjcObhSnXJ/Uau+mtf7Zgdq6sV0w9cwfDgVh4fifB/+nJ/PLp yOv9D/CAysBvWnE/SujxhGp++XyT6T+pJ9piDeIZJ+vbBBaPac3pIQT1YyZvY4wnrraS kOTQCF7iG1jTPlxaB69oeAF9NdmvofKkCiiVEsbpBv3K5IDYcbE/bYe1EqirMJX1aHYS 0WKB2bnaOMK7uzZZOiZlsQT24dTimI0VGeBExITHYY9NnKg/PcJMhVA/zSGZQBx/IxsX VJA6+rjTYjMqt3esAEwJlvGpt3GzW8hF5Qu6PAYOvhc+28armrpyWU1ye8wA++wVxE03 biZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681711332; x=1684303332; 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=syA8DPA0vYxtc4caZ7sv7vitLcN6zFkYLX0pkX40gIk=; b=IMCxQ811+vTM/M9FvszA2L6mttPg+3ylswJ5kYoG4yeesK/bmqEAhrBC2N3y29tkpE JOhG/Zwv/CxwMwEtgxNTD6uu/Tp0WNGMZZhR9GNUcxTE0PPecrZRhLr9woZK4f4pmqWV vQR6FxavuWbYuANsuAV9P2Lg+upKiLBXUMN8MyjHwqs6do6MNRRcPoYEXNXCPB3ZKpV0 0cCrLr4ZCD/f3uBXjvc5vpJj6ffAyXC8UaSste+/EPVPyQwgaoNOq2wwvxip37X5EIWI fhBytO3oYL3KEMnGBSgWatOObJaENRmRoHeHZa4ALtcSpKsUWHBnDO9gngBARDAWkfAy VvIQ== X-Gm-Message-State: AAQBX9d3lhqgyFwVau1laealXGOTf0Nc+t5YsZjS0LvO9IP+S9QOlIhe BiSsZJ2P+PZogK8jxL0eIjPAvxJENaggEbhRojs= X-Google-Smtp-Source: AKy350ZLbhFnsFxyGVQ2vlyAm3PWfnejfAuVUQwreY+zRMjiFHG2B1ZbXvo1PzVga9xRMHSriB5d3w== X-Received: by 2002:a05:6a20:3953:b0:ef:fd71:304e with SMTP id r19-20020a056a20395300b000effd71304emr1655410pzg.11.1681711332076; Sun, 16 Apr 2023 23:02:12 -0700 (PDT) Received: from localhost ([122.172.85.8]) by smtp.gmail.com with ESMTPSA id b33-20020a630c21000000b004fbd91d9716sm6056079pgl.15.2023.04.16.23.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Apr 2023 23:02:11 -0700 (PDT) From: Viresh Kumar To: qemu-devel@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , "Michael S. Tsirkin" Cc: Viresh Kumar , Vincent Guittot , stratos-dev@op-lists.linaro.org Subject: [PATCH] virtio: i2c: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX Date: Mon, 17 Apr 2023 11:32:04 +0530 Message-Id: <89d47285e882a99a0513411edcc96aa575512f13.1681710993.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=viresh.kumar@linaro.org; helo=mail-pj1-x1030.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Since the driver doesn't support interrupts, we must return early when index is set to VIRTIO_CONFIG_IRQ_IDX. Fixes: 544f0278afca ("virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX") Signed-off-by: Viresh Kumar --- hw/virtio/vhost-user-i2c.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c index 60eaf0d95be0..45100a24953c 100644 --- a/hw/virtio/vhost-user-i2c.c +++ b/hw/virtio/vhost-user-i2c.c @@ -128,6 +128,16 @@ static void vu_i2c_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask) { VHostUserI2C *i2c = VHOST_USER_I2C(vdev); + /* + * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1 + * as the Marco of configure interrupt's IDX, If this driver does not + * support, the function will return + */ + + if (idx == VIRTIO_CONFIG_IRQ_IDX) { + return; + } + vhost_virtqueue_mask(&i2c->vhost_dev, vdev, idx, mask); } @@ -135,6 +145,16 @@ static bool vu_i2c_guest_notifier_pending(VirtIODevice *vdev, int idx) { VHostUserI2C *i2c = VHOST_USER_I2C(vdev); + /* + * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1 + * as the Marco of configure interrupt's IDX, If this driver does not + * support, the function will return + */ + + if (idx == VIRTIO_CONFIG_IRQ_IDX) { + return false; + } + return vhost_virtqueue_pending(&i2c->vhost_dev, idx); }