From patchwork Tue Jan 31 18:10:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 50991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp53352wrn; Tue, 31 Jan 2023 10:12:47 -0800 (PST) X-Google-Smtp-Source: AK7set+lDlXGcxDGYh5Js0VEFK59HjyeUbMEDQBMzxUTtcyzRFw+JQmPGXUTiZ9UK0EbKPLCVgvV X-Received: by 2002:a05:6a00:1651:b0:593:e59c:3d2e with SMTP id m17-20020a056a00165100b00593e59c3d2emr3817931pfc.16.1675188766800; Tue, 31 Jan 2023 10:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675188766; cv=none; d=google.com; s=arc-20160816; b=cFlJQwGeQBmjG44OOag8ImsqGBtYNzqUKvE1w0VUkQbWFpHrOYHKq08oSq0jTAWnJT X9dJ1QmP672QkgpVFNTKsLV6ZLvs2ydiikfnIFcJZM4sS9ZbFofsD92JhivlFglxCaLh 01ahQhiETzNccnw2ZmPkYU3NrshLICQFmkttcuHyi92DeXovQe0AEug9QunDwqoZXpJU WO5awnSC2XgNYAkqSMi41By4U2sMLoaPOAxQmZq+GkrKiy+mHKSa9NXCtcE7eQJsJIsJ zXtIt3uhqM8cibDUIKp2cv7wQbPyQhZU6Xc6iZn4uJnsCy4B084eDBwgS4e3maqmbEc4 Dpew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=fDi0m5SyE7+dA+NV6/8hnqsdAW8zJoIlpf8Mpr+lH/Q=; b=BAFTsBk68XFosFr5RBNkc/Xex6qdm5/p3eiuRXyy128wjKfKpmQiUKY//BCQJgj7Gx 3o/sovYaLSqLr+MQYbB668Gm+vSzZo7PENUGlOxLnPeUW42kCiDsi9yChkH6zeqJLBfe 6iuEvy2MqnEfEa21iTmEAI1ityBOdTVyBNSz0Wy4ACHj+5i0golJADkzIdw7RNqgraPO WwHY+Q3GiiHs70BDojJuThmPZPKPj4RdNgZR1hgYx5opQddtMfVkqcR7X3+epMSCH/B6 3o22mDiODUfGauc+GQAdB2OjHk41p9DCo+m/nIdfp87eAKpE3bISfr7CHQr+V3r2TJ6l KFiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=UPBLZHxW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d72-20020a621d4b000000b00593d7e0f42dsi5085309pfd.297.2023.01.31.10.12.34; Tue, 31 Jan 2023 10:12:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=UPBLZHxW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231646AbjAaSKT (ORCPT + 99 others); Tue, 31 Jan 2023 13:10:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231444AbjAaSKS (ORCPT ); Tue, 31 Jan 2023 13:10:18 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 760B91B54D; Tue, 31 Jan 2023 10:10:17 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 39E6C20DDD0A; Tue, 31 Jan 2023 10:10:17 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 39E6C20DDD0A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675188617; bh=fDi0m5SyE7+dA+NV6/8hnqsdAW8zJoIlpf8Mpr+lH/Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UPBLZHxWLk7ouTZD5X0Tij6sHjQBGOIIr+j+Yv9SvBYNjMKXO1kvLu1EYvHBVILtt 3Zzx2jJ+4L0lSTwGbcl6VBajfKCG/6B/bdrhEqTX77YK3jFC7gMzC5oGHqaNUuvgXD GioSWwXxPDTWB7fjNuvfHXrbI+df2ar4QjON42l8= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com Subject: [PATCH v2 1/6] drivers/clocksource/hyper-v: non ACPI support in hyperv clock Date: Tue, 31 Jan 2023 10:10:04 -0800 Message-Id: <1675188609-20913-2-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> References: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756562736326488260?= X-GMAIL-MSGID: =?utf-8?q?1756562736326488260?= Add a placeholder function for the hv_setup_stimer0_irq API to accommodate systems without ACPI support. Since this function is not utilized on x86/x64 systems and non-ACPI support is only intended for x86/x64 systems, a placeholder function is sufficient for now and can be improved upon if necessary in the future This change will make it easier to add device tree support for VMBus in subsequent commits. Signed-off-by: Saurabh Sengar --- drivers/clocksource/hyperv_timer.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index c0cef92b12b8..f32948c8a96f 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -49,7 +49,7 @@ static bool direct_mode_enabled; static int stimer0_irq = -1; static int stimer0_message_sint; -static DEFINE_PER_CPU(long, stimer0_evt); +static __maybe_unused DEFINE_PER_CPU(long, stimer0_evt); /* * Common code for stimer0 interrupts coming via Direct Mode or @@ -68,7 +68,7 @@ EXPORT_SYMBOL_GPL(hv_stimer0_isr); * stimer0 interrupt handler for architectures that support * per-cpu interrupts, which also implies Direct Mode. */ -static irqreturn_t hv_stimer0_percpu_isr(int irq, void *dev_id) +static irqreturn_t __maybe_unused hv_stimer0_percpu_isr(int irq, void *dev_id) { hv_stimer0_isr(); return IRQ_HANDLED; @@ -196,6 +196,7 @@ void __weak hv_remove_stimer0_handler(void) { }; +#ifdef CONFIG_ACPI /* Called only on architectures with per-cpu IRQs (i.e., not x86/x64) */ static int hv_setup_stimer0_irq(void) { @@ -230,6 +231,16 @@ static void hv_remove_stimer0_irq(void) stimer0_irq = -1; } } +#else +static int hv_setup_stimer0_irq(void) +{ + return 0; +} + +static void hv_remove_stimer0_irq(void) +{ +} +#endif /* hv_stimer_alloc - Global initialization of the clockevent and stimer0 */ int hv_stimer_alloc(bool have_percpu_irqs) From patchwork Tue Jan 31 18:10:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 50992 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp53395wrn; Tue, 31 Jan 2023 10:12:53 -0800 (PST) X-Google-Smtp-Source: AK7set9sO/zW3hp5pNtZTcoUGutbOejeaXI9/Akkeq7MV7tNhEtDuiIzUuVkgey3H00XXYWy7+YQ X-Received: by 2002:a05:6a00:1f0d:b0:593:b470:aeda with SMTP id be13-20020a056a001f0d00b00593b470aedamr8197516pfb.29.1675188773220; Tue, 31 Jan 2023 10:12:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675188773; cv=none; d=google.com; s=arc-20160816; b=MNfpyRejU1ujyM5grP6hFYmeDOPwLLAlE57DjyhoJEJWSqZdGQ/wo08kiFo5RXADlX bS8fZ3Ip+B6nkWIbLb1x9WDcpSAF3RjaboxwHU7bsC2TFbQ+pRvrC53kLYt/TCibNB6h 2m4lZzzSqR+JVWotUCyHyga4MCTVm1KIqP3NmhunrdF2LU45gJijRJCyHPqeuFdDEJkV 0gTrfxS7/N/VhWJTm/T/IDASySgjJOixL/9G36+GjRG/3JQwAiH317DBZnzehuUgqhya ztZPy81JgY0Sumg49geKubaPiaRlr9jT1FXQwRucYzUgDwp8NyFieLTny38yvureo1XR XSBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=N4m8eTBLEQ3pQvSAw3zhPyK5+Dh9KUtxaoiQbxVw8Hk=; b=z9L0WjMpBCTbm5+wyquVKlqnepnyL3eiN+UAhFpiNFTn06gr6abhi9bMopJQjclw/3 m3VLg52R1vb9knLuycbVs9inVAZRCpqLd50w1D7UlZWwxlGFKFYcBOEnMev7rjyRrH+u rSz79UOrk3ZzrD+unUpvMO5bAuQ1I2BzzXqWZEzC5qlQTL8ga8M9e13I9YcOox2Cb29z lgjbzRITSIFOGBL2ijwuY76C38i2s61LzRg7iAyUOKR/JntU7MWH6Pk3+43fZnmqSjr7 DZJHlp2tb2DAB+u51LvvpTh+8aqmcvqBgYba5P9YUCYPLAEbL4lMQACIeNexxTRJtqrj /xAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=MT5Cs0TO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j190-20020a6255c7000000b0058dea7e1e7dsi16416241pfb.188.2023.01.31.10.12.40; Tue, 31 Jan 2023 10:12:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=MT5Cs0TO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbjAaSKY (ORCPT + 99 others); Tue, 31 Jan 2023 13:10:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbjAaSKS (ORCPT ); Tue, 31 Jan 2023 13:10:18 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9E1A22194B; Tue, 31 Jan 2023 10:10:17 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 5266E20DE342; Tue, 31 Jan 2023 10:10:17 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5266E20DE342 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675188617; bh=N4m8eTBLEQ3pQvSAw3zhPyK5+Dh9KUtxaoiQbxVw8Hk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MT5Cs0TOL4U5Somh7wlFDgMXQo/WPD/1uSvXW2bYjP1tJMKkjlYNw6aKwOax73Ve9 SKZaPFcZ4/X4RvKDoYR7YwNr53l7EECCKeWS6WpLgyGztTN8j2uMZsn4bAhv5Zgu9j i9OJ5KoN6YcjH21ntwF2uINlxCtovlXTl6lwErDY= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com Subject: [PATCH v2 2/6] Drivers: hv: allow non ACPI compilation for hv_is_hibernation_supported Date: Tue, 31 Jan 2023 10:10:05 -0800 Message-Id: <1675188609-20913-3-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> References: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756562743168832050?= X-GMAIL-MSGID: =?utf-8?q?1756562743168832050?= acpi_sleep_state_supported API is only define for CONFIG_ACPI flag and thus it can't be used for non-ACPI builds. Initaly there won't be hibernate support for non ACPI builds. This change will help adding device tree support in subsequent commits. Signed-off-by: Saurabh Sengar --- drivers/hv/hv_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index 52a6f89ccdbd..370ec20d1993 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -234,7 +234,11 @@ EXPORT_SYMBOL_GPL(hv_setup_dma_ops); bool hv_is_hibernation_supported(void) { +#ifdef CONFIG_ACPI return !hv_root_partition && acpi_sleep_state_supported(ACPI_STATE_S4); +#else + return false; +#endif } EXPORT_SYMBOL_GPL(hv_is_hibernation_supported); From patchwork Tue Jan 31 18:10:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 50993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp53925wrn; Tue, 31 Jan 2023 10:13:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXvt7o4qYfnmQYQlFEwe0mW5ciAljihmA3HzW2dmOGzeHzs64oWG0i3SZashBXf+ZADf36Qp X-Received: by 2002:a05:6a20:d704:b0:b8:499d:7c9b with SMTP id iz4-20020a056a20d70400b000b8499d7c9bmr56418808pzb.51.1675188826910; Tue, 31 Jan 2023 10:13:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675188826; cv=none; d=google.com; s=arc-20160816; b=VzQCzsTXxDKCSBz1ZGyBasZU4qbcA8A31iWdiwgQVmjCCNAbXI8/ArgnJFBK5gFSJN vBrX5dSf/992FUAHo2AbHf0623eP6VcqdcftzdpzjJtUiddXJwWWODOL/t4YkFl5BlqS art/w3LcjneryTWp1j5icoyBtsUAUQ0rAuujXoJ9bAofvaIuvjCRPgV6r81vfMwh0k27 ENLDaMAfgrC5rsusIyi/I+rZ1Gr9h56G6p8YNYiIv3edZef227Two/b9GIMFt/C3Ekgw EP6CltjgbzphvONACezHtlsmcugpOxEeqtV9cdkr3IN3bbZbZEZb8omiCEsDa2nxWhh4 xM7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=ANW5SmReljM/ZqznaSaYgwM0EI1m+kZRgs2ecj5BRas=; b=K0n7zQ8CYFHGE9ZehpLLEse0vB/5GYJvhyZEaELU9QBFzV9h6nzBKAQJbDs7XRnbtZ 4ivNXZ0J6x9DdY4tKWkoBv8Dpiaif26dtcaZy7Ow+QDyow6pYMQzvyWEAbKbM8ItPXqE G9pt27kGe/dIj5Sape3LAkrOuSm7r+6thPs4fxKtDtngY3aMY3dlrSfMYbEs2/7VGyEo hVuk39fUSYP42pYy9jC08iByFqMwJapAZ7TEVJ16SbSj/UHJSI56CB28r1wsKTcY/Rku 1PKY2zNQwYXDXfSI//XrunPRZQN1E3dLfkUri17RJH++NQZER3sy4s3CgMBDshoGxwHC DTZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=rj3ua2kL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a637b0e000000b004e2da688d22si12681961pgc.162.2023.01.31.10.13.34; Tue, 31 Jan 2023 10:13:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=rj3ua2kL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbjAaSK0 (ORCPT + 99 others); Tue, 31 Jan 2023 13:10:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230013AbjAaSKT (ORCPT ); Tue, 31 Jan 2023 13:10:19 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A523525E09; Tue, 31 Jan 2023 10:10:17 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 6AA1120DE346; Tue, 31 Jan 2023 10:10:17 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6AA1120DE346 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675188617; bh=ANW5SmReljM/ZqznaSaYgwM0EI1m+kZRgs2ecj5BRas=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rj3ua2kL83Z0agsaWPMMpmsz1F8WNVCqvekG8Bacm/FGsJJREglCeP792UZTDVAZN SgCEyziKFYAK/PpxYS0Zmj3uZKzQOX6MP5doiPPbvOiGZXS/ldV1KVAMoR340iH0eC QGhIwMbXB9rjwYA/E3Zd72ASp/2QcJ1bN/TaCSvw= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com Subject: [PATCH v2 3/6] Drivers: hv: vmbus: Convert acpi_device to platform_device Date: Tue, 31 Jan 2023 10:10:06 -0800 Message-Id: <1675188609-20913-4-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> References: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756562799109966630?= X-GMAIL-MSGID: =?utf-8?q?1756562799109966630?= Use more generic platform device instead of acpi device. Also rename the function vmbus_acpi_remove to more generic name vmbus_mmio_remove. Signed-off-by: Saurabh Sengar --- drivers/hv/vmbus_drv.c | 78 +++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index d24dd65b33d4..49030e756b9f 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,7 @@ struct vmbus_dynid { struct hv_vmbus_device_id id; }; -static struct acpi_device *hv_acpi_dev; +static struct platform_device *hv_dev; static int hyperv_cpuhp_online; @@ -143,7 +144,7 @@ static DEFINE_MUTEX(hyperv_mmio_lock); static int vmbus_exists(void) { - if (hv_acpi_dev == NULL) + if (hv_dev == NULL) return -ENODEV; return 0; @@ -932,7 +933,7 @@ static int vmbus_dma_configure(struct device *child_device) * On x86/x64 coherence is assumed and these calls have no effect. */ hv_setup_dma_ops(child_device, - device_get_dma_attr(&hv_acpi_dev->dev) == DEV_DMA_COHERENT); + device_get_dma_attr(&hv_dev->dev) == DEV_DMA_COHERENT); return 0; } @@ -2090,7 +2091,7 @@ int vmbus_device_register(struct hv_device *child_device_obj) &child_device_obj->channel->offermsg.offer.if_instance); child_device_obj->device.bus = &hv_bus; - child_device_obj->device.parent = &hv_acpi_dev->dev; + child_device_obj->device.parent = &hv_dev->dev; child_device_obj->device.release = vmbus_device_release; child_device_obj->device.dma_parms = &child_device_obj->dma_parms; @@ -2262,7 +2263,7 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx) return AE_OK; } -static void vmbus_acpi_remove(struct acpi_device *device) +static void vmbus_mmio_remove(void) { struct resource *cur_res; struct resource *next_res; @@ -2441,13 +2442,15 @@ void vmbus_free_mmio(resource_size_t start, resource_size_t size) } EXPORT_SYMBOL_GPL(vmbus_free_mmio); -static int vmbus_acpi_add(struct acpi_device *device) +static int vmbus_acpi_add(struct platform_device *pdev) { acpi_status result; int ret_val = -ENODEV; - struct acpi_device *ancestor; + struct platform_device *ancestor; + struct acpi_device *adev = to_acpi_device(&pdev->dev); - hv_acpi_dev = device; + hv_dev = pdev; + adev->fwnode.dev = &pdev->dev; /* * Older versions of Hyper-V for ARM64 fail to include the _CCA @@ -2456,15 +2459,16 @@ static int vmbus_acpi_add(struct acpi_device *device) * up the ACPI device to behave as if _CCA is present and indicates * hardware coherence. */ - ACPI_COMPANION_SET(&device->dev, device); + ACPI_COMPANION_SET(&pdev->dev, ACPI_COMPANION(&pdev->dev)); if (IS_ENABLED(CONFIG_ACPI_CCA_REQUIRED) && - device_get_dma_attr(&device->dev) == DEV_DMA_NOT_SUPPORTED) { + device_get_dma_attr(&pdev->dev) == DEV_DMA_NOT_SUPPORTED) { + struct acpi_device *adev_node = ACPI_COMPANION(&pdev->dev); pr_info("No ACPI _CCA found; assuming coherent device I/O\n"); - device->flags.cca_seen = true; - device->flags.coherent_dma = true; + adev_node->flags.cca_seen = true; + adev_node->flags.coherent_dma = true; } - result = acpi_walk_resources(device->handle, METHOD_NAME__CRS, + result = acpi_walk_resources(ACPI_HANDLE(&pdev->dev), METHOD_NAME__CRS, vmbus_walk_resources, NULL); if (ACPI_FAILURE(result)) @@ -2473,9 +2477,9 @@ static int vmbus_acpi_add(struct acpi_device *device) * Some ancestor of the vmbus acpi device (Gen1 or Gen2 * firmware) is the VMOD that has the mmio ranges. Get that. */ - for (ancestor = acpi_dev_parent(device); ancestor; - ancestor = acpi_dev_parent(ancestor)) { - result = acpi_walk_resources(ancestor->handle, METHOD_NAME__CRS, + for (ancestor = to_platform_device(pdev->dev.parent); ancestor; + ancestor = to_platform_device(ancestor->dev.parent)) { + result = acpi_walk_resources(ACPI_HANDLE(&ancestor->dev), METHOD_NAME__CRS, vmbus_walk_resources, NULL); if (ACPI_FAILURE(result)) @@ -2489,10 +2493,21 @@ static int vmbus_acpi_add(struct acpi_device *device) acpi_walk_err: if (ret_val) - vmbus_acpi_remove(device); + vmbus_mmio_remove(); return ret_val; } +static int vmbus_platform_driver_probe(struct platform_device *pdev) +{ + return vmbus_acpi_add(pdev); +} + +static int vmbus_platform_driver_remove(struct platform_device *pdev) +{ + vmbus_mmio_remove(); + return 0; +} + #ifdef CONFIG_PM_SLEEP static int vmbus_bus_suspend(struct device *dev) { @@ -2658,15 +2673,15 @@ static const struct dev_pm_ops vmbus_bus_pm = { .restore_noirq = vmbus_bus_resume }; -static struct acpi_driver vmbus_acpi_driver = { - .name = "vmbus", - .ids = vmbus_acpi_device_ids, - .ops = { - .add = vmbus_acpi_add, - .remove = vmbus_acpi_remove, - }, - .drv.pm = &vmbus_bus_pm, - .drv.probe_type = PROBE_FORCE_SYNCHRONOUS, +static struct platform_driver vmbus_platform_driver = { + .probe = vmbus_platform_driver_probe, + .remove = vmbus_platform_driver_remove, + .driver = { + .name = "vmbus", + .acpi_match_table = ACPI_PTR(vmbus_acpi_device_ids), + .pm = &vmbus_bus_pm, + .probe_type = PROBE_FORCE_SYNCHRONOUS, + } }; static void hv_kexec_handler(void) @@ -2750,12 +2765,11 @@ static int __init hv_acpi_init(void) /* * Get ACPI resources first. */ - ret = acpi_bus_register_driver(&vmbus_acpi_driver); - + ret = platform_driver_register(&vmbus_platform_driver); if (ret) return ret; - if (!hv_acpi_dev) { + if (!hv_dev) { ret = -ENODEV; goto cleanup; } @@ -2785,8 +2799,8 @@ static int __init hv_acpi_init(void) return 0; cleanup: - acpi_bus_unregister_driver(&vmbus_acpi_driver); - hv_acpi_dev = NULL; + platform_driver_unregister(&vmbus_platform_driver); + hv_dev = NULL; return ret; } @@ -2839,7 +2853,7 @@ static void __exit vmbus_exit(void) cpuhp_remove_state(hyperv_cpuhp_online); hv_synic_free(); - acpi_bus_unregister_driver(&vmbus_acpi_driver); + platform_driver_unregister(&vmbus_platform_driver); } From patchwork Tue Jan 31 18:10:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 50995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp53994wrn; Tue, 31 Jan 2023 10:13:55 -0800 (PST) X-Google-Smtp-Source: AK7set/DI1DfoCYq6Ee4wktLmqrhuftAi/726Q7YAPw01/l0eYVsRTWCLB7yyDQaeBXoGNe0dyUg X-Received: by 2002:a17:90a:1988:b0:22c:6b5b:8509 with SMTP id 8-20020a17090a198800b0022c6b5b8509mr13927353pji.16.1675188835297; Tue, 31 Jan 2023 10:13:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675188835; cv=none; d=google.com; s=arc-20160816; b=KmXk6HiMHdXVfo1i7ggeRNSJSb+Jd69clyDPrOHVOb/0su04Cs6n1RfCDhxCFfsBCO 7MqFpQP18ox5fnBkttIu2VYifqWvntiaqWWKCw4mzHOdVMcPNpC37HR/Wf0bMX9zVMVg d6XLrSHNxkYwSpc6mstBQYZXViFnhnVmstoas5rt4Z5nqsgEKyyzYyTMsam3YTDEGvQr XugicBWJnwv3z6cHr6E8RQY6UvNZSvx6ZZUf9WF4BWK315yS1gbai3S8ilX0UHzrljpl s//tchSogNXana3MZUcZXXid3N3Ebg3pluG1dWDfZhvPTRHmNZqRtdvpZ2qbhpkCyZKy fCZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=Bo1Cw+VywhyDQcgWGZuK7oyHRAyzlfuMCm8VaFb4YAM=; b=CVETbLwPIkaQDJhBH2GDRVyWnvw1vbMx7qvHo5lNZ8+E15E5GW758I+ieBG9CGF0xT dxNVrd+/sTQBYG8e6Hiz0O9VcxedtBIAFBx7TZCwxPNxhMQI+CP+cvmnefg/gYg0Qdvo l1yFyLU6yTKM2hTivXF6gKEWsoAQbCeAhij6Lu6mlbraqJf0LS9nDj5amPYJ9xATeTyK 6lLAZgCX/wC7Y/ZEqa3sw+t1LfxOUIwGxNw/thwoPXTCqsT8oP15SUb/yCQq3DK6ibmD z+ruMPJ1/zThCXCaRZOJ259UqouR2xuWr7IMU/FqOy+Kx+pm4eLEiOPFqh+I9KVZWtjz zUzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=pg9+FQh7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu7-20020a17090b1b0700b0022bbabee51esi16125443pjb.57.2023.01.31.10.13.41; Tue, 31 Jan 2023 10:13:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=pg9+FQh7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbjAaSKf (ORCPT + 99 others); Tue, 31 Jan 2023 13:10:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231648AbjAaSKT (ORCPT ); Tue, 31 Jan 2023 13:10:19 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C90FA25E27; Tue, 31 Jan 2023 10:10:17 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 82A9F20DE349; Tue, 31 Jan 2023 10:10:17 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 82A9F20DE349 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675188617; bh=Bo1Cw+VywhyDQcgWGZuK7oyHRAyzlfuMCm8VaFb4YAM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pg9+FQh770ejizrOiZ/X53MWdAvo2ADyCRyNiHS2YoLW1kSxbRI9Dd5fgzAPndBsh HoGzsaePEIpbTHoV+2gPjAd1hvHPaKa3UJs3E1e9D2b6ZfSKAg/+m0rx0gVexLpi5V pDZnBqn+CeZisrcIV2Uzk8Knv0Jg4iDYJsqu5E28= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com Subject: [PATCH v2 4/6] dt-bindings: hypervisor: Rename virtio to hypervisor Date: Tue, 31 Jan 2023 10:10:07 -0800 Message-Id: <1675188609-20913-5-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> References: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756562808159739707?= X-GMAIL-MSGID: =?utf-8?q?1756562808159739707?= Rename virtio folder to more generic hypervisor, so that this can accommodate more devices of similar type. Signed-off-by: Saurabh Sengar --- .../devicetree/bindings/{virtio => hypervisor}/mmio.yaml | 2 +- .../devicetree/bindings/{virtio => hypervisor}/pci-iommu.yaml | 2 +- .../bindings/{virtio => hypervisor}/virtio-device.yaml | 2 +- MAINTAINERS | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename Documentation/devicetree/bindings/{virtio => hypervisor}/mmio.yaml (95%) rename Documentation/devicetree/bindings/{virtio => hypervisor}/pci-iommu.yaml (98%) rename Documentation/devicetree/bindings/{virtio => hypervisor}/virtio-device.yaml (93%) diff --git a/Documentation/devicetree/bindings/virtio/mmio.yaml b/Documentation/devicetree/bindings/hypervisor/mmio.yaml similarity index 95% rename from Documentation/devicetree/bindings/virtio/mmio.yaml rename to Documentation/devicetree/bindings/hypervisor/mmio.yaml index 0aa8433f0a5e..8492c9b4fec9 100644 --- a/Documentation/devicetree/bindings/virtio/mmio.yaml +++ b/Documentation/devicetree/bindings/hypervisor/mmio.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/virtio/mmio.yaml# +$id: http://devicetree.org/schemas/hypervisor/mmio.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: virtio memory mapped devices diff --git a/Documentation/devicetree/bindings/virtio/pci-iommu.yaml b/Documentation/devicetree/bindings/hypervisor/pci-iommu.yaml similarity index 98% rename from Documentation/devicetree/bindings/virtio/pci-iommu.yaml rename to Documentation/devicetree/bindings/hypervisor/pci-iommu.yaml index 972a785a42de..52de535fd4ef 100644 --- a/Documentation/devicetree/bindings/virtio/pci-iommu.yaml +++ b/Documentation/devicetree/bindings/hypervisor/pci-iommu.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/virtio/pci-iommu.yaml# +$id: http://devicetree.org/schemas/hypervisor/pci-iommu.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: virtio-iommu device using the virtio-pci transport diff --git a/Documentation/devicetree/bindings/virtio/virtio-device.yaml b/Documentation/devicetree/bindings/hypervisor/virtio-device.yaml similarity index 93% rename from Documentation/devicetree/bindings/virtio/virtio-device.yaml rename to Documentation/devicetree/bindings/hypervisor/virtio-device.yaml index 8c6919ba9497..7b8d93b06237 100644 --- a/Documentation/devicetree/bindings/virtio/virtio-device.yaml +++ b/Documentation/devicetree/bindings/hypervisor/virtio-device.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/virtio/virtio-device.yaml# +$id: http://devicetree.org/schemas/hypervisor/virtio-device.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: Virtio device diff --git a/MAINTAINERS b/MAINTAINERS index 263d37a129b1..9bc5b88b723a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21967,7 +21967,7 @@ L: virtualization@lists.linux-foundation.org S: Maintained F: Documentation/ABI/testing/sysfs-bus-vdpa F: Documentation/ABI/testing/sysfs-class-vduse -F: Documentation/devicetree/bindings/virtio/ +F: Documentation/devicetree/bindings/hypervisor/ F: Documentation/driver-api/virtio/ F: drivers/block/virtio_blk.c F: drivers/crypto/virtio/ From patchwork Tue Jan 31 18:10:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 50996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp54023wrn; Tue, 31 Jan 2023 10:13:57 -0800 (PST) X-Google-Smtp-Source: AK7set9gDhF6P+UoWvuq6jlsr8o5SJtQP43CPxt495A4J6hXpHfO9voEFXIrKGBl6w8ZFmSchgd3 X-Received: by 2002:a17:902:e809:b0:196:7a94:41ac with SMTP id u9-20020a170902e80900b001967a9441acmr12230888plg.66.1675188837165; Tue, 31 Jan 2023 10:13:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675188837; cv=none; d=google.com; s=arc-20160816; b=f4wcN7fe31ud1zL6BGUEQDhOOIRL4NMgRT1mVvS14IwM4RdWicIoNduiJYH0U/y5iI AiR2vjtYN5KRpjklDClMkf0QYQS/AqItfSad9McMn4kzxyj1cd2WBvZqbvaIkoj2Vwpt jeHcIC5+MiUBF0IF2lGLNzZchOu9QC3qW10n33hbtjQKQ+Tl4wzkrODddK5Qt1QIrBui yAa0YQhbJhYe+iscVH5n4S3xMJM1GloSieo2F5IP3Jw9/JjcRNAKcmta1CeAlpVR+8q4 jhJgihMKswSiUs6Gbk3rQl7oOpofp42mUGlrG/I93TqvLjP6sfbAIif88d2T4r/AYRn+ Z8KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=aolDgf0ZKmA1dIvXP/OLbXrz+i5/r4RkpCnFJWskn6w=; b=GOZBNQg09+tk6exD59FW0N43kE1lCuHE8dEZ+APXVjTtWhhuxwGX8TtK02x9X3GSOe Y4Tu6S6FX9CEU3tWK79ulRKzBZ3kH7QNSU4d2cTthE9OmHok3EqMTOCPkEtQo/ONfh2W WvXx18c2y/ykkaLi5jvzEJrSgR2/Kex2jRev9X32WvhkTwqZ5Xog/ncCqPx1OG8lQm8S WXiiiJ7sVYipi7D+6NwmclbaSqIwULjSh7JUfrfi0wqjGSm4uetvB9B3Rldc6CMgPI++ /g0O/DscpAnaJiCvg31FUr6TbvMEglHO15lYAmuZp86M5lV5EoW5pxMI0JChomovhOhQ bN6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=XhFYOZ5z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f6-20020a170902ce8600b00189239e6a29si18451380plg.95.2023.01.31.10.13.44; Tue, 31 Jan 2023 10:13:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=XhFYOZ5z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230321AbjAaSKc (ORCPT + 99 others); Tue, 31 Jan 2023 13:10:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231644AbjAaSKT (ORCPT ); Tue, 31 Jan 2023 13:10:19 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 47BBF2884D; Tue, 31 Jan 2023 10:10:18 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 9A96520DFDBF; Tue, 31 Jan 2023 10:10:17 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9A96520DFDBF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675188617; bh=aolDgf0ZKmA1dIvXP/OLbXrz+i5/r4RkpCnFJWskn6w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XhFYOZ5zsW06gmNDjCX8xlCrymk2F9BhPsEXvR9/xI2wHtfEIBQr1s3Bs3F3GJg6e vohocTceW2F4c2LX+iYT0AOi9q7dEutF/VcR4tV3wLpkAFX4noleRLV+9F0+goj98u QPBIkVVVrqWCpKTp7PovS5nSvRe43RO4V2jJl7o4= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com Subject: [PATCH v2 5/6] dt-bindings: hypervisor: Add dt-bindings for VMBus Date: Tue, 31 Jan 2023 10:10:08 -0800 Message-Id: <1675188609-20913-6-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> References: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756562810232493035?= X-GMAIL-MSGID: =?utf-8?q?1756562810232493035?= Add dt-bindings for Hyper-V VMBus Signed-off-by: Saurabh Sengar --- .../bindings/hypervisor/msft,vmbus.yaml | 50 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 1 + 3 files changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/hypervisor/msft,vmbus.yaml diff --git a/Documentation/devicetree/bindings/hypervisor/msft,vmbus.yaml b/Documentation/devicetree/bindings/hypervisor/msft,vmbus.yaml new file mode 100644 index 000000000000..8f50d6097c48 --- /dev/null +++ b/Documentation/devicetree/bindings/hypervisor/msft,vmbus.yaml @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hypervisor/msft,vmbus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microsoft Hyper-V VMBus device tree bindings + +maintainers: + - Saurabh Sengar + +description: + VMBus is a software bus that implement the protocols for communication + between the root or host OS and guest OSs (virtual machines). + +properties: + compatible: + const: msft,vmbus + + ranges: true + + '#address-cells': + const: 2 + + '#size-cells': + const: 1 + +required: + - compatible + - ranges + - '#address-cells' + - '#size-cells' + +additionalProperties: false + +examples: + - | + / { + compatible = "foo"; + model = "foo"; + #address-cells = <0x02>; + #size-cells = <0x02>; + + vmbus@ff0000000 { + #address-cells = <0x02>; + #size-cells = <0x01>; + compatible = "msft,vmbus"; + ranges = <0x00 0x00 0x0f 0xf0000000 0x10000000>; + }; + }; diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index 1f7a519a936f..ab74ea97535f 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -876,6 +876,8 @@ patternProperties: deprecated: true "^mscc,.*": description: Microsemi Corporation + "^msft,.*": + description: Microsoft Corporation "^msi,.*": description: Micro-Star International Co. Ltd. "^mstar,.*": diff --git a/MAINTAINERS b/MAINTAINERS index 9bc5b88b723a..c749782b0cff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9496,6 +9496,7 @@ S: Supported T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git F: Documentation/ABI/stable/sysfs-bus-vmbus F: Documentation/ABI/testing/debugfs-hyperv +F: Documentation/devicetree/bindings/hypervisor/msft,vmbus.yaml F: Documentation/virt/hyperv F: Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst F: arch/arm64/hyperv From patchwork Tue Jan 31 18:10:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 50994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp53995wrn; Tue, 31 Jan 2023 10:13:55 -0800 (PST) X-Google-Smtp-Source: AK7set8F9L5swmMu0pmjMC8zu8V4PgB7gT2OShLquc25I6QA3LTXmqyB4ipfStYunbIZeM2Hwxal X-Received: by 2002:a17:90b:1d88:b0:22c:5da7:9a9e with SMTP id pf8-20020a17090b1d8800b0022c5da79a9emr15877211pjb.42.1675188835402; Tue, 31 Jan 2023 10:13:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675188835; cv=none; d=google.com; s=arc-20160816; b=BgaY9yk4rfw7oa66IrHU0C2ezqNX/vvR+vH9DqpOg9S5DwisPqqivazVlGaORFoE3a bzDiOYTbbzOB8n7i/2iPtOVr0VvrtLF0xiXaktfGhTY5igY5+fG8RuEhRimNTJJg2EvU 5xxsz36mSCaZHF1tkgu7HvBZIAIUaY0sn4uO51eEg4iwh1G351V4xr3TrU3GHzjMU5mn op8B6i68J8sXXMW8VZBtnaa6oz3fAfbhJadXneRuVsZ7bqRD6X/jrc7NwKucC8aLOqvj YCzEUMy6Ql9/JzPODe2mLI1L/F+VpXnLMi6boUhWJiEQdcRw2yPCpmeC2xLZgj/EFqOQ ZvWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=2Oq3rLHSInRpCaH6L9jH9KNuBdNY6d/bl/THZjFDmv0=; b=j1mB18aHix2Y6RvPEjIQa89GzowZdiJIJiGuCi7vp6BOKL6HZNSUPfoJPzevS9h6wc bgT0hoTW0leeNpYLeGtbfwTgvYGlO0Qfs03sqmAZ+T/HLwuQFfKC05ca3nHL1H6H7Pg5 00Z7q5UoOFyHO7ugW2zzmL6fnVYHtdeHg0vIZ1nsABGHBpHhj8EdtWXnqlvYTIn4og+T CXLNRlKrAEnXbU4jOhMM62t77kV6gdpG+D2kOLI8h6tDAq2Xo4JmRcIl9ylvuSNlFb7U ixnKL2887Vhn6uizCDKvProQNZPN7t7lyd9MwVxw5P75BCizkr8ldvrss9cgjGz/ImzO Fr+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=N9NFWF+F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f2-20020a17090ab94200b0022c8ba1bd77si8918891pjw.174.2023.01.31.10.13.43; Tue, 31 Jan 2023 10:13:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=N9NFWF+F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbjAaSK3 (ORCPT + 99 others); Tue, 31 Jan 2023 13:10:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbjAaSKT (ORCPT ); Tue, 31 Jan 2023 13:10:19 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4BFFF28865; Tue, 31 Jan 2023 10:10:18 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id B2F6B20DFE14; Tue, 31 Jan 2023 10:10:17 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B2F6B20DFE14 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675188617; bh=2Oq3rLHSInRpCaH6L9jH9KNuBdNY6d/bl/THZjFDmv0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=N9NFWF+FtHhqTmI33iFD7aDObg0jR3F88cvzGrZRh0vJsPIB+Dp3fERD0gCMq8gRy axOPqo2AgV4txx3gSALFHG/JeE3fC1yq+V4C2mZJR/LW1x+RzdlcjBXjBrx1szlEPp sIyOdGBEaFLYJTfYfC66wgS27ZEqqPeNMR7bAzPY= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com Subject: [PATCH v2 6/6] Driver: VMBus: Add device tree support Date: Tue, 31 Jan 2023 10:10:09 -0800 Message-Id: <1675188609-20913-7-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> References: <1675188609-20913-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756562808715751344?= X-GMAIL-MSGID: =?utf-8?q?1756562808715751344?= Update the driver to support device tree boot as well along with ACPI. At present the device tree parsing only provides the mmio region info and is not the exact copy of ACPI parsing. This is sufficient to cater all the current device tree usecases for VMBus. Signed-off-by: Saurabh Sengar --- drivers/hv/vmbus_drv.c | 75 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 49030e756b9f..1741f1348f9f 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -2152,7 +2152,7 @@ void vmbus_device_unregister(struct hv_device *device_obj) device_unregister(&device_obj->device); } - +#ifdef CONFIG_ACPI /* * VMBUS is an acpi enumerated device. Get the information we * need from DSDT. @@ -2262,6 +2262,7 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx) return AE_OK; } +#endif static void vmbus_mmio_remove(void) { @@ -2282,7 +2283,7 @@ static void vmbus_mmio_remove(void) } } -static void vmbus_reserve_fb(void) +static void __maybe_unused vmbus_reserve_fb(void) { resource_size_t start = 0, size; struct pci_dev *pdev; @@ -2442,6 +2443,7 @@ void vmbus_free_mmio(resource_size_t start, resource_size_t size) } EXPORT_SYMBOL_GPL(vmbus_free_mmio); +#ifdef CONFIG_ACPI static int vmbus_acpi_add(struct platform_device *pdev) { acpi_status result; @@ -2496,10 +2498,68 @@ static int vmbus_acpi_add(struct platform_device *pdev) vmbus_mmio_remove(); return ret_val; } +#else + +static int vmbus_device_add(struct platform_device *pdev) +{ + struct resource **cur_res = &hyperv_mmio; + struct device_node *np; + u32 *ranges, len; + u64 start; + int nr_ranges, child_cells = 2, cur_cell = 0, ret = 0; + + hv_dev = pdev; + np = pdev->dev.of_node; + + nr_ranges = device_property_count_u32(&pdev->dev, "ranges"); + if (nr_ranges < 0) + return nr_ranges; + ranges = kcalloc(nr_ranges, sizeof(u32), GFP_KERNEL); + if (!ranges) + return -ENOMEM; + + if (device_property_read_u32_array(&pdev->dev, "ranges", ranges, nr_ranges)) { + ret = -EINVAL; + goto free_ranges; + } + + while (cur_cell < nr_ranges) { + struct resource *res; + + /* The first u64 in the ranges description isn't used currently. */ + cur_cell = cur_cell + child_cells; + start = ranges[cur_cell++]; + start = (start << 32) | ranges[cur_cell++]; + len = ranges[cur_cell++]; + + res = kzalloc(sizeof(*res), GFP_ATOMIC); + if (!res) { + ret = -ENOMEM; + goto free_ranges; + } + + res->name = "hyperv mmio"; + res->flags = IORESOURCE_MEM | IORESOURCE_MEM_64; + res->start = start; + res->end = start + len; + + *cur_res = res; + cur_res = &res->sibling; + } + +free_ranges: + kfree(ranges); + return ret; +} +#endif static int vmbus_platform_driver_probe(struct platform_device *pdev) { +#ifdef CONFIG_ACPI return vmbus_acpi_add(pdev); +#else + return vmbus_device_add(pdev); +#endif } static int vmbus_platform_driver_remove(struct platform_device *pdev) @@ -2645,6 +2705,16 @@ static int vmbus_bus_resume(struct device *dev) #define vmbus_bus_resume NULL #endif /* CONFIG_PM_SLEEP */ +static const struct of_device_id vmbus_of_match[] = { + { + .compatible = "msft,vmbus", + }, + { + /* sentinel */ + }, +}; +MODULE_DEVICE_TABLE(of, vmbus_of_match); + static const struct acpi_device_id vmbus_acpi_device_ids[] = { {"VMBUS", 0}, {"VMBus", 0}, @@ -2679,6 +2749,7 @@ static struct platform_driver vmbus_platform_driver = { .driver = { .name = "vmbus", .acpi_match_table = ACPI_PTR(vmbus_acpi_device_ids), + .of_match_table = of_match_ptr(vmbus_of_match), .pm = &vmbus_bus_pm, .probe_type = PROBE_FORCE_SYNCHRONOUS, }