From patchwork Sat Feb 17 18:03:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 202657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp443847dyc; Sat, 17 Feb 2024 10:05:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWjHz7a1PbZwRJ1uekmqPXXLv4l6Ko+juumv+Ne2lFDiN+H8qq3nzJKiNZYumcz9dORfdAhSNIuSc7KgLex9CJS6KRaWw== X-Google-Smtp-Source: AGHT+IFGG/FBuQpICvaRxb1BDz7rOJ/PAU9IkBRbkM4uC95DH1bJySPTEUXyMvCUsVxHSdBtHpUb X-Received: by 2002:a92:b74d:0:b0:365:1eda:df6e with SMTP id c13-20020a92b74d000000b003651edadf6emr1594884ilm.26.1708193122146; Sat, 17 Feb 2024 10:05:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193122; cv=pass; d=google.com; s=arc-20160816; b=pl/LppV3T64qwDURWmaTBvXGg5cL1RnmI9Yjj0cTNFrbqKgFfDlZCei0/fLZzE+TzG I/Due8HojV0NipcDr1huc0C6j1B8OSL6ssMN8lacNSOKucXnwrmLYi/j4GOKu5yDA9lw DA1zPEnK5ov6HW4zXjNjHdSPp3e0berqEhKd08YHm3jZYLrJV0/weVGanNyCYZMa7rsU okYVnv1Osdk5L74D6Ri3tFxjFfIw5fl/2jJ5Hr9bQw+bEc1vhzgIUOBSXV0EU9siM3nO VJitB/WiYOTGgFfd6BDBBPLA3CSSZYi3V4HN9a+bDt9jUJDUMEGzuQRSH23jZ5d7Z8Uo FTcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=IJXczuiy25vcEMZMajrYQPcvnxC/NI9o3yOT9PmVG/A=; fh=/g2YaKiPj+3FPE7qve5VOLtb1iRxoth7NZi+8r+O0Q0=; b=kM4baxANHX8EF7qElHRHMACtlawFvQeEY2SFvLkOqDD45vRt2+Sgzq00s8pthmDmxy 1xn/39PBgiwt15QWv6uo4q7qeyV3bJ7qmH6q0OXeCDINURwd5wOAm8PRKO85ETYor2H4 TKYEvoNonCXpMQJU6foYqClq7oAykDf8FrPNs8PK09+5Dic+G2Iqk+G87rxORp5pGoMi 5zlURe16igSLgRd+AwnjP5+68vRKAqztk/yAltNW2aH0nyM6yHKjH5Vi9R0n8fWJ89c+ b31bfJ+YKGxbfcYuaMToX5f33WgI41++DbhN7VG0GOB37ex9iwdjaHQg0mDvG79tiWh5 B/7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="JESdnY/x"; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-69993-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69993-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q23-20020a637517000000b005d8b884ae31si1791953pgc.568.2024.02.17.10.05.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:05:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69993-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="JESdnY/x"; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-69993-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69993-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 178562816C9 for ; Sat, 17 Feb 2024 18:05:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B07467E768; Sat, 17 Feb 2024 18:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="JESdnY/x" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA8437E0E3; Sat, 17 Feb 2024 18:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193075; cv=none; b=Lqige/dc7Oved9c5g4WQDkYS9uKMok9kXv6AsALw1kInAe4PESPEcD5+0VSs4N53urmmfGwWwpIPLgHeZ8H6xQicEOWhfE0RnBKDLQT87t2emq87PzedJmbIaUUzFXLTktU5OihGOdWOsOzgL1bflCGC1vHqdZaCEdC1bFa8tG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193075; c=relaxed/simple; bh=aQYHlXV7kN6BYqhUEYWn7DqoPucn2DTrXeCBMweMa6A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=MvA0/eBiSKMb2IXykgaFxjAsslPJrOGB2G7lpzyGCLo6jlItprTOF2rKT9HQmrs5NlNnt7w7HGxkQCCx/bb9P+gdRgH4B7kaboc9yxoXYgqzXD5oF2lj7+/TNXcCHGjfhYfzvafQJuwgktfwmXNfcBvGFi1IzJB9A26NSjWxvR4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=JESdnY/x; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 9CBEC207FD2F; Sat, 17 Feb 2024 10:04:27 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9CBEC207FD2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1708193067; bh=IJXczuiy25vcEMZMajrYQPcvnxC/NI9o3yOT9PmVG/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JESdnY/xusHyCYTZjvMI+irpL1MF8p4TXWKvlq5nMVj8KBuOJYjRCF2iZ8cnLHKWb G9ZH6wuypj9BmnmEL2fd2VDS44CUb76vZ4UMxXrXD4OaBdVEmB9JSATudM18ywWD1/ ybR6i3Dq8B4SmWMeZc/5Iu8Tiwv8GAgIQul1pBDM= From: Saurabh Sengar To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, gregkh@linuxfoundation.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ssengar@microsoft.com Subject: [PATCH 3/6] uio_hv_generic: Enable interrupt for low speed VMBus devices Date: Sat, 17 Feb 2024 10:03:37 -0800 Message-Id: <1708193020-14740-4-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708193020-14740-1-git-send-email-ssengar@linux.microsoft.com> References: <1708193020-14740-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791170310922337142 X-GMAIL-MSGID: 1791170310922337142 Hyper-V is adding some "specialty" synthetic devices. Instead of writing new kernel-level VMBus drivers for these devices, the devices will be presented to user space via this existing Hyper-V generic UIO driver, so that a user space driver can handle the device. Since these new synthetic devices are low speed devices, they don't support monitor bits and we must use vmbus_setevent() to enable interrupts from the host. Signed-off-by: Saurabh Sengar --- drivers/uio/uio_hv_generic.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index 4bda6b52e49e..289611c7dfd7 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -84,6 +84,9 @@ hv_uio_irqcontrol(struct uio_info *info, s32 irq_state) dev->channel->inbound.ring_buffer->interrupt_mask = !irq_state; virt_mb(); + if (!dev->channel->offermsg.monitor_allocated && irq_state) + vmbus_setevent(dev->channel); + return 0; } @@ -240,12 +243,6 @@ hv_uio_probe(struct hv_device *dev, int ret; size_t ring_size = hv_dev_ring_size(channel); - /* Communicating with host has to be via shared memory not hypercall */ - if (!channel->offermsg.monitor_allocated) { - dev_err(&dev->device, "vmbus channel requires hypercall\n"); - return -ENOTSUPP; - } - if (!ring_size) ring_size = HV_RING_SIZE * PAGE_SIZE;